diff --git a/LionasFoodAndDrinkReminder/Lang/de.lua b/LionasFoodAndDrinkReminder/Lang/de.lua index f7edc3d..f8bcdde 100755 --- a/LionasFoodAndDrinkReminder/Lang/de.lua +++ b/LionasFoodAndDrinkReminder/Lang/de.lua @@ -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") diff --git a/LionasFoodAndDrinkReminder/Lang/en.lua b/LionasFoodAndDrinkReminder/Lang/en.lua index e555a6d..c9e90d5 100755 --- a/LionasFoodAndDrinkReminder/Lang/en.lua +++ b/LionasFoodAndDrinkReminder/Lang/en.lua @@ -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") - diff --git a/LionasFoodAndDrinkReminder/Lang/jp.lua b/LionasFoodAndDrinkReminder/Lang/jp.lua index 32dce21..d77427e 100755 --- a/LionasFoodAndDrinkReminder/Lang/jp.lua +++ b/LionasFoodAndDrinkReminder/Lang/jp.lua @@ -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", "通知の切り替え") - diff --git a/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.lua b/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.lua index 05a38e0..9e6d8a6 100755 --- a/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.lua +++ b/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.lua @@ -11,9 +11,11 @@ LioFADR = { default = { enable = true, -- アドオン有効無効 notifyThresholdMins = 3, -- 通知する閾値(分) - onlyNotifyInDungeon = false, -- ダンジョンにいる時だけ通知する + notifyInDungeon = true, -- ダンジョンにいる時に通知する isInDungeon = false, -- 現在ダンジョンにいるかどうか enableToChat = true, -- チャット欄に通知する + notifyByZoneChanging = true, -- ゾーン変更時に通知する + isZoneChanged = false, -- ゾーン変更したかどうか }, } @@ -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 @@ -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, } ) @@ -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() @@ -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) @@ -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) @@ -462,6 +479,16 @@ function toggleEnable() end +-- zone changed +function LioFADR:onZoneChanged() + +--d("onZoneChanged()") + + LioFADR.savedVariables.isZoneChanged = true + +end + + -- player activated local function onPlayerActivated() @@ -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 diff --git a/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.txt b/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.txt index 5c4e8a9..ddc858d 100755 --- a/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.txt +++ b/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminder.txt @@ -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 diff --git a/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminderMenu.lua b/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminderMenu.lua index 6f76b85..d5b0ffa 100755 --- a/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminderMenu.lua +++ b/LionasFoodAndDrinkReminder/LionasFoodAndDrinkReminderMenu.lua @@ -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") @@ -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, }, @@ -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] = @@ -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)