Skip to content

Commit

Permalink
Merge pull request #12 from Lionas/develop
Browse files Browse the repository at this point in the history
v0.4.0リリース
  • Loading branch information
Lionas authored Aug 16, 2016
2 parents 4d4094f + 6db3507 commit d4b70bc
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 35 deletions.
6 changes: 4 additions & 2 deletions LionasFoodAndDrinkReminder/Lang/de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ ZO_CreateStringId("LIO_FADR_ENABLE_TITLE", "Aktiviere Meldungen")
ZO_CreateStringId("LIO_FADR_ENABLE_TOOLTIP", "Wenn du über den Zustand deiner Mahlzeit informiert werde möchtest, aktiviere diese Einstellung.")
ZO_CreateStringId("LIO_FADR_NOTIFY_THRESHOLD_TITLE", "Schwelle für Erinnerung in [min]")
ZO_CreateStringId("LIO_FADR_NOTIFY_THRESHOLD_TOOLTIP", "Du wirst über den Zustand der Mahlzeit infomiert, sobald dieser Wert unterschritten wird.")
ZO_CreateStringId("LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TITLE", "Meldungen nur innerhalb Verlies")
ZO_CreateStringId("LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TOOLTIP", "Wenn du nur über den Zustand der Mahlzeit in einem Verlies informiert werden möchtest, aktiviere diese Einstellung.")
ZO_CreateStringId("LIO_FADR_NOTIFY_IN_DUNGEON_TITLE", "Meldungen innerhalb Verlies")
ZO_CreateStringId("LIO_FADR_NOTIFY_IN_DUNGEON_TOOLTIP", "Wenn du über den Zustand der Mahlzeit in einem Verlies informiert werden möchtest, aktiviere diese Einstellung.")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TITLE", "Geben Sie zum Chat bekannt")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TOOLTIP", "Wenn Sie ermöglichen, um über den Staat der Mahlzeit bekannt zu geben, um zu plaudern, überprüfen Sie es bitte.")
ZO_CreateStringId("LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TITLE", "Eine Nachricht von Zone zu ändern")
ZO_CreateStringId("LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TOOLTIP", "Wenn Sie darüber informiert, von dem Zustand der Mahlzeit durch Zonenwechselzu aktivieren, überprüfen Sie bitte heraus.")

-- keybinds
ZO_CreateStringId("SI_BINDING_NAME_LIO_FADR_ACTIVATE", "Aktiviere/Deaktiviere Meldung")
11 changes: 6 additions & 5 deletions LionasFoodAndDrinkReminder/Lang/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ ZO_CreateStringId("LIO_FADR_SHOULD_EAT_DRINK", "There is no effect of the meal!"
-- menus
ZO_CreateStringId("LIO_FADR_DESCRIPTION", "The add-on it notify of the state of the meal.")
ZO_CreateStringId("LIO_FADR_ENABLE_TITLE", "Enable notification")
ZO_CreateStringId("LIO_FADR_ENABLE_TOOLTIP", "If you enable notifying of the state of the meal, please check it.")
ZO_CreateStringId("LIO_FADR_ENABLE_TOOLTIP", "If you enable notifying of the state of the meal, please check out.")
ZO_CreateStringId("LIO_FADR_NOTIFY_THRESHOLD_TITLE", "Threshold of Notify[min(s)]")
ZO_CreateStringId("LIO_FADR_NOTIFY_THRESHOLD_TOOLTIP", "Notify the state of meal if it'll be below this time.")
ZO_CreateStringId("LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TITLE", "Notify only in dungeon")
ZO_CreateStringId("LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TOOLTIP", "Notify the state of the meal only in dungeon, please check it.")
ZO_CreateStringId("LIO_FADR_NOTIFY_IN_DUNGEON_TITLE", "Notify in dungeon")
ZO_CreateStringId("LIO_FADR_NOTIFY_IN_DUNGEON_TOOLTIP", "If you enable notifying of the state of the meal in dungeon, please check out.")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TITLE", "Notify to chat")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TOOLTIP", "If you enable notifying of the state of the meal to chat, please check it.")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TOOLTIP", "If you enable notifying of the state of the meal to chat, please check out.")
ZO_CreateStringId("LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TITLE", "Notify by zone changing")
ZO_CreateStringId("LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TOOLTIP", "If you enable notifying of the state of the meal by zone changing, please check out.")

-- keybinds
ZO_CreateStringId("SI_BINDING_NAME_LIO_FADR_ACTIVATE", "Enable/Disable Notify")

7 changes: 4 additions & 3 deletions LionasFoodAndDrinkReminder/Lang/jp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ ZO_CreateStringId("LIO_FADR_ENABLE_TITLE", "通知を有効にする")
ZO_CreateStringId("LIO_FADR_ENABLE_TOOLTIP", "食事の状態を通知する場合はチェックしてください")
ZO_CreateStringId("LIO_FADR_NOTIFY_THRESHOLD_TITLE", "通知タイミング[分]")
ZO_CreateStringId("LIO_FADR_NOTIFY_THRESHOLD_TOOLTIP", "残り時間がこの時間未満になったら通知します")
ZO_CreateStringId("LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TITLE", "ダンジョンにいる時のみ通知する")
ZO_CreateStringId("LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TOOLTIP", "ダンジョンにいる時のみ、食事の状態を通知する場合はチェックしてください")
ZO_CreateStringId("LIO_FADR_NOTIFY_IN_DUNGEON_TITLE", "ダンジョンで通知する")
ZO_CreateStringId("LIO_FADR_NOTIFY_IN_DUNGEON_TOOLTIP", "ダンジョンで食事の状態を通知する場合はチェックしてください")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TITLE", "チャット欄に通知する")
ZO_CreateStringId("LIO_FADR_ENABLE_NOTIFY_TO_CHAT_TOOLTIP", "チャット欄に食事の状態を通知する場合はチェックしてください")
ZO_CreateStringId("LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TITLE", "ゾーン移動時に通知する")
ZO_CreateStringId("LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TOOLTIP", "ゾーン移動した(旅の祠・特定のエリアへ入った、または、出た)時に食事の状態を通知する場合はチェックしてください")

-- keybinds
ZO_CreateStringId("SI_BINDING_NAME_LIO_FADR_ACTIVATE", "通知の切り替え")

52 changes: 40 additions & 12 deletions LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ LioFADR = {
default = {
enable = true, -- アドオン有効無効
notifyThresholdMins = 3, -- 通知する閾値(分)
onlyNotifyInDungeon = false, -- ダンジョンにいる時だけ通知する
notifyInDungeon = true, -- ダンジョンにいる時に通知する
isInDungeon = false, -- 現在ダンジョンにいるかどうか
enableToChat = true, -- チャット欄に通知する
notifyByZoneChanging = true, -- ゾーン変更時に通知する
isZoneChanged = false, -- ゾーン変更したかどうか
},
}

Expand All @@ -23,8 +25,9 @@ local ADD_ON_LOADED_REGISTER_NAME = LioFADR.name .. "_OnLoad"
local PLAYER_ACTIVATED_REGISTER_NAME = LioFADR.name .. "_Player_Activate"
local PLAYER_DEACTIVATED_REGISTER_NAME = LioFADR.name .. "_Player_DeActivate"
local UPDATE_INTERVAL_REGISTER_NAME = LioFADR.name .. "_Update"
local ZONE_CHANGED_REGISTER_NAME = LioFADR.name .. "_ZoneChanged"
local SAVED_PREFS_NAME = LioFADR.name .. "_SavedPrefs"
local SAVED_PREFS_VERSION = 1
local SAVED_PREFS_VERSION = 2

local UPDATE_INTERVAL_MSEC = 1000
local HOUR_PER_SECS = 3600
Expand Down Expand Up @@ -124,9 +127,11 @@ local function initializePrefs()
{
enable = LioFADR.default.enable,
notifyThresholdMins = LioFADR.default.notifyThresholdMins,
onlyNotifyInDungeon = LioFADR.default.onlyNotifyInDungeon,
notifyInDungeon = LioFADR.default.notifyInDungeon,
isInDungeon = LioFADR.default.isInDungeon,
enableToChat = LioFADR.default.enableToChat,
notifyByZoneChanging = LioFADR.default.notifyByZoneChanging,
isZoneChanged = LioFADR.default.isZoneChanged,
}
)

Expand Down Expand Up @@ -400,18 +405,33 @@ end
-- Cyclic check
local function onUpdate()

--d("onUpdate()"..GetGameTimeMilliseconds())

-- ダンジョンを出入りしたら初回表示を有効にする
if(IsUnitInDungeon(PLAYER_TAG) and (not LioFADR.savedVariables.isInDungeon)) then
clearTable(LioFADR.notifyFirst)
LioFADR.savedVariables.isInDungeon = true

clearTable(LioFADR.notifyFirst)
LioFADR.savedVariables.isInDungeon = true

elseif((not IsUnitInDungeon(PLAYER_TAG)) and (LioFADR.savedVariables.isInDungeon)) then
clearTable(LioFADR.notifyFirst)
LioFADR.savedVariables.isInDungeon = false

clearTable(LioFADR.notifyFirst)
LioFADR.savedVariables.isInDungeon = false
end

-- ゾーンを移動したら初回表示を有効にする
if(LioFADR.savedVariables.notifyByZoneChanging and LioFADR.savedVariables.isZoneChanged) then

--d("onUpdate()--- zonechange")

clearTable(LioFADR.notifyFirst)
LioFADR.savedVariables.isZoneChanged = false

end

if((LioFADR.savedVariables.onlyNotifyInDungeon and IsUnitInDungeon(PLAYER_TAG)) or
(not LioFADR.savedVariables.onlyNotifyInDungeon)) then
if((LioFADR.savedVariables.notifyInDungeon and LioFADR.savedVariables.isInDungeon) or -- ダンジョンで通知するが有効でダンジョン内にいる時
(not LioFADR.savedVariables.isInDungeon) -- ダンジョン内にいない時
) then

scanBuffs()

Expand All @@ -423,7 +443,6 @@ end
-- 通知を有効にする
function LioFADR:setEnable()

-- regist handler
outputChat(GetString(LIO_FADR_ENABLE))
EVENT_MANAGER:RegisterForUpdate(UPDATE_INTERVAL_REGISTER_NAME, UPDATE_INTERVAL_MSEC, onUpdate)

Expand All @@ -433,14 +452,12 @@ end
-- 通知を無効にする
function LioFADR:setDisableWithoutUnregister()

-- unregist handler
outputChat(GetString(LIO_FADR_DISABLE))

end

function LioFADR:setDisable()

-- unregist handler
LioFADR.setDisableWithoutUnregister()
EVENT_MANAGER:UnregisterForUpdate(UPDATE_INTERVAL_REGISTER_NAME)

Expand All @@ -462,6 +479,16 @@ function toggleEnable()
end


-- zone changed
function LioFADR:onZoneChanged()

--d("onZoneChanged()")

LioFADR.savedVariables.isZoneChanged = true

end


-- player activated
local function onPlayerActivated()

Expand Down Expand Up @@ -493,6 +520,7 @@ local function onLoad(event, addon)

-- regist & unregist handler
EVENT_MANAGER:RegisterForEvent(PLAYER_ACTIVATED_REGISTER_NAME, EVENT_PLAYER_ACTIVATED, onPlayerActivated)
EVENT_MANAGER:RegisterForEvent(ZONE_CHANGED_REGISTER_NAME, EVENT_ZONE_CHANGED, LioFADR.onZoneChanged)
EVENT_MANAGER:UnregisterForEvent(ADD_ON_LOADED_REGISTER_NAME, EVENT_ADD_ON_LOADED)

end
Expand Down
4 changes: 2 additions & 2 deletions LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

## Title: Lionas's Food and Drink Reminder v0.3.0
## Title: Lionas's Food and Drink Reminder v0.4.0
## APIVersion: 100016
## Version: 0.3.0
## Version: 0.4.0
## Author: Lionas
## Description: Notify for food and drink when you entered in dungeon and expired.
## OptionalDependsOn: LibStub LibAddonMenu-2.0
Expand Down
36 changes: 25 additions & 11 deletions LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminderMenu.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Lionas's Food & Drink Reminder
-- Author: Lionas
local PanelTitle = "Lionas's Food and Drink Reminder"
local Version = "0.3.0"
local Version = "0.4.0"
local Author = "Lionas"

local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")
Expand Down Expand Up @@ -37,11 +37,10 @@ function LioFADRMenu.LoadLAM2Panel()
setFunc =
function(value)
LioFADR.savedVariables.enable = value

if(value) then
LioFADR.setEnable()
else
LioFADR.setDisable()
if(value) then
LioFADR.setEnable()
else
LioFADR.setDisable()
end
end,
},
Expand All @@ -66,17 +65,17 @@ function LioFADRMenu.LoadLAM2Panel()
[4] =
{
type = "checkbox",
name = GetString(LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TITLE),
tooltip = GetString(LIO_FADR_NOTIFY_ONLY_IN_DUNGEON_TOOLTIP),
default = LioFADR.savedVariables.onlyNotifyInDungeon,
name = GetString(LIO_FADR_NOTIFY_IN_DUNGEON_TITLE),
tooltip = GetString(LIO_FADR_NOTIFY_IN_DUNGEON_TOOLTIP),
default = LioFADR.savedVariables.notifyInDungeon,
getFunc =
function()
return LioFADR.savedVariables.onlyNotifyInDungeon
return LioFADR.savedVariables.notifyInDungeon
end,
setFunc =
function(value)
LioFADR.clearTable(LioFADR.notifyFirst)
LioFADR.savedVariables.onlyNotifyInDungeon = value
LioFADR.savedVariables.notifyInDungeon = value
end,
},
[5] =
Expand All @@ -94,6 +93,21 @@ function LioFADRMenu.LoadLAM2Panel()
LioFADR.savedVariables.enableToChat = value
end,
},
[6] =
{
type = "checkbox",
name = GetString(LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TITLE),
tooltip = GetString(LIO_FADR_NOTIFY_BY_ZONE_CHANGING_TOOLTIP),
default = LioFADR.savedVariables.notifyByZoneChanging,
getFunc =
function()
return LioFADR.savedVariables.notifyByZoneChanging
end,
setFunc =
function(value)
LioFADR.savedVariables.notifyByZoneChanging = value
end,
},
}

LAM2:RegisterAddonPanel(PanelTitle.."LAM2Options", PanelData)
Expand Down

0 comments on commit d4b70bc

Please sign in to comment.