From 415b97cd0fd2ed7cb10e3d7b4bc32c223e096efd Mon Sep 17 00:00:00 2001 From: Shane Parker Date: Thu, 19 May 2022 04:21:08 -0400 Subject: [PATCH] For unknown reasons the vast majority of the files were uncommitted last time --- campaign/4e/char_power.xml | 4 ++-- campaign/4e/scripts/char_power.lua | 9 +++++++-- campaign/5e/record_power.xml | 4 ++-- campaign/5e/scripts/record_power.lua | 15 ++++++++++----- graphics/graphics_icons.xml | 4 ++++ scripts/data_library_tmt.lua | 4 ++-- scripts/data_trigger.lua | 6 +++--- scripts/manager_action_attack_4e_tmt.lua | 4 ++-- scripts/manager_action_attack_5e_tmt.lua | 4 ++-- scripts/manager_action_damage_4e_tmt.lua | 6 +++--- scripts/manager_action_damage_5e_tmt.lua | 7 +++---- scripts/manager_actions_tmt.lua | 15 +++++++++------ scripts/manager_campaigndata_tmt.lua | 4 ++-- scripts/manager_char_4e_tmt.lua | 6 +++--- scripts/manager_char_5e_tmt.lua | 6 +++--- scripts/manager_chat_tmt.lua | 4 ++-- scripts/manager_desktop_tmt.lua | 4 ++-- scripts/manager_effect_tmt.lua | 4 ++-- scripts/manager_trigger.lua | 13 ++++++------- strings/strings.xml | 4 ++++ .../scripts/masterindextriggeritem_window.lua | 10 +++++----- triggers/scripts/parameterlist.lua | 4 ++-- triggers/scripts/tooltipcombobox.lua | 4 ++-- triggers/scripts/trigger.lua | 4 ++-- triggers/scripts/trigger_content.lua | 10 +++++----- triggers/scripts/triggeraction.lua | 8 ++++---- triggers/scripts/triggercondition.lua | 8 ++++---- triggers/scripts/triggerevent.lua | 6 +++--- triggers/scripts/triggerparameter.lua | 4 ++-- triggers/template_triggers.xml | 4 ++++ triggers/triggers.xml | 4 ++++ 31 files changed, 110 insertions(+), 83 deletions(-) diff --git a/campaign/4e/char_power.xml b/campaign/4e/char_power.xml index 72a8c04..bf59fba 100644 --- a/campaign/4e/char_power.xml +++ b/campaign/4e/char_power.xml @@ -1,6 +1,6 @@ - diff --git a/campaign/4e/scripts/char_power.lua b/campaign/4e/scripts/char_power.lua index 15cd281..808c9d1 100644 --- a/campaign/4e/scripts/char_power.lua +++ b/campaign/4e/scripts/char_power.lua @@ -1,3 +1,8 @@ +-- +-- Please see the license.txt file included with this distribution for +-- attribution and copyright information. +-- + local fActivatePowerOriginal; function onInit() fActivatePowerOriginal = super.activatePower; @@ -32,8 +37,8 @@ function activatePower() rSource = rActor, rPower = rPower }; - + TriggerManager.fireEvent( - CharPowerTMT_4E.rPowerUsedEvent.sName, + CharPowerTMT_4E.rPowerUsedEvent.sName, rEventData); end \ No newline at end of file diff --git a/campaign/5e/record_power.xml b/campaign/5e/record_power.xml index 0d19a57..6cc2382 100644 --- a/campaign/5e/record_power.xml +++ b/campaign/5e/record_power.xml @@ -1,6 +1,6 @@ - diff --git a/campaign/5e/scripts/record_power.lua b/campaign/5e/scripts/record_power.lua index 8a6c9c1..487bc02 100644 --- a/campaign/5e/scripts/record_power.lua +++ b/campaign/5e/scripts/record_power.lua @@ -1,3 +1,8 @@ +-- +-- Please see the license.txt file included with this distribution for +-- attribution and copyright information. +-- + local fUsePowerOriginal; function onInit() @@ -11,7 +16,7 @@ end function usePower(bShowFull) fUsePowerOriginal(bShowFull); - + local node = getDatabaseNode(); local charnode = node.getChild("..."); @@ -26,8 +31,8 @@ function usePower(bShowFull) local sGroup = DB.getValue(node, "group", ""); local sRange = DB.getValue(node, "range", ""); - local rPower = { - sName = sName, + local rPower = { + sName = sName, nLevel = nLevel, sSchool = sSchool, sCastingTime = sCastingTime, @@ -40,8 +45,8 @@ function usePower(bShowFull) rSource = rActor, rPower = rPower }; - + TriggerManager.fireEvent( - CharDamageTMT_5E.rPowerUsedEvent.sName, + CharDamageTMT_5E.rPowerUsedEvent.sName, rEventData); end \ No newline at end of file diff --git a/graphics/graphics_icons.xml b/graphics/graphics_icons.xml index f2d4774..1f72df7 100644 --- a/graphics/graphics_icons.xml +++ b/graphics/graphics_icons.xml @@ -1,4 +1,8 @@ + diff --git a/scripts/data_library_tmt.lua b/scripts/data_library_tmt.lua index 7b60131..19a4d60 100644 --- a/scripts/data_library_tmt.lua +++ b/scripts/data_library_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/data_trigger.lua b/scripts/data_trigger.lua index ccc3251..55d07ae 100644 --- a/scripts/data_trigger.lua +++ b/scripts/data_trigger.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- @@ -54,7 +54,7 @@ function initializeConditions() fCondition = isTarget, aRequiredParameters = {"rTarget"} }; - + -- TODO flesh out before re-enabling -- TriggerManager.defineCondition(rIsSourceCondition); -- TriggerManager.defineCondition(rIsTargetCondition); diff --git a/scripts/manager_action_attack_4e_tmt.lua b/scripts/manager_action_attack_4e_tmt.lua index 68ca7d3..870d65b 100644 --- a/scripts/manager_action_attack_4e_tmt.lua +++ b/scripts/manager_action_attack_4e_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/manager_action_attack_5e_tmt.lua b/scripts/manager_action_attack_5e_tmt.lua index ff72e3c..488db73 100644 --- a/scripts/manager_action_attack_5e_tmt.lua +++ b/scripts/manager_action_attack_5e_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/manager_action_damage_4e_tmt.lua b/scripts/manager_action_damage_4e_tmt.lua index a4e5a22..14720a3 100644 --- a/scripts/manager_action_damage_4e_tmt.lua +++ b/scripts/manager_action_damage_4e_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- @@ -71,6 +71,6 @@ function applyHpToCombatant(rTriggerData, rEventData) end table.insert(rAction.clauses, rHealClause); - + ActionHeal.performRoll(nil, rActor, rAction) end \ No newline at end of file diff --git a/scripts/manager_action_damage_5e_tmt.lua b/scripts/manager_action_damage_5e_tmt.lua index 0a8781a..36105ea 100644 --- a/scripts/manager_action_damage_5e_tmt.lua +++ b/scripts/manager_action_damage_5e_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- @@ -226,7 +226,6 @@ end function applyDamage(rSource, rTarget, bSecret, sDamage, nTotal) rActiveSource = rSource; rActiveTarget = rTarget; - initialHitPoints = getCurrentHitPoints(rTarget); bPrepareForBeforeDamageEvent = true; applyDamageOriginal(rSource, rTarget, bSecret, sDamage, nTotal); end @@ -319,7 +318,7 @@ function getWounds(rActor, sType, nodeActor) return 0; end - local nTotal, nWounds; + local nWounds; if sType == "pc" then nWounds = DB.getValue(nodeActor, "hp.wounds", 0); else diff --git a/scripts/manager_actions_tmt.lua b/scripts/manager_actions_tmt.lua index fc66a60..cd7f918 100644 --- a/scripts/manager_actions_tmt.lua +++ b/scripts/manager_actions_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- @@ -19,7 +19,7 @@ local resolveActionOriginal; function onInit() resolveActionOriginal = ActionsManager.resolveAction; ActionsManager.resolveAction = resolveAction; - + TriggerManager.defineEvent(rDiceRolledEvent); initializeConditions(); @@ -93,7 +93,7 @@ function initializeConditions() fCheckVisibility = checkAdvantageInclusionVisibility, }); end - + TriggerManager.defineCondition(rRollIsTypeCondition); TriggerManager.defineCondition(rRollValueCondition); end @@ -189,7 +189,7 @@ function rollIsValue(rTriggerData, rEventData) if not rTriggerData.bIncludeModifiers then nTotal = nTotal - rEventData.rRoll.nMod; end - + bResult = TriggerData.resolveComparison(nTotal, rTriggerData.nCompareAgainst, rTriggerData.sComparison); end @@ -201,7 +201,7 @@ function rerollDice(rTriggerData, rEventData) end function replaceDice(rTriggerData, rEventData) - changeDice(rTriggerData, rEventData, "REPLACE", function(sDieType) return rTriggerData.sReplacement; end) + changeDice(rTriggerData, rEventData, "REPLACE", function() return rTriggerData.sReplacement; end) end function changeDice(rTriggerData, rEventData, sDisplay, fGetResult) @@ -241,7 +241,10 @@ function changeDice(rTriggerData, rEventData, sDisplay, fGetResult) local rDie = rEventData.rRoll.aDice[nIndex]; rEventData.rRoll.sDesc = rEventData.rRoll.sDesc .. " [" .. sDisplay .. " " .. rDie.result .. "]"; rDie.result = fGetResult(rDie.type); + rDie.value = rDie.result; end + + rEventData.rRoll.aDice.total = Utility.getDiceTotal(rEventData.rRoll.aDice); end function checkModifierInclusionVisibility(rConditionData) diff --git a/scripts/manager_campaigndata_tmt.lua b/scripts/manager_campaigndata_tmt.lua index 58d5cce..3d1c99c 100644 --- a/scripts/manager_campaigndata_tmt.lua +++ b/scripts/manager_campaigndata_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/manager_char_4e_tmt.lua b/scripts/manager_char_4e_tmt.lua index ca997c6..6ddf1a0 100644 --- a/scripts/manager_char_4e_tmt.lua +++ b/scripts/manager_char_4e_tmt.lua @@ -1,12 +1,12 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- rPowerContainsDataCondition = nil; rPowerUsedEvent = { sName = "power_used_event", - aParameters = { + aParameters = { "rSource", "rPower" }; diff --git a/scripts/manager_char_5e_tmt.lua b/scripts/manager_char_5e_tmt.lua index 3654682..acf8d2a 100644 --- a/scripts/manager_char_5e_tmt.lua +++ b/scripts/manager_char_5e_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- @@ -8,7 +8,7 @@ rPowerContainsDataCondition = nil; rPowerUsedEvent = { sName = "power_used_event", - aParameters = { + aParameters = { "rSource", "rPower" }; diff --git a/scripts/manager_chat_tmt.lua b/scripts/manager_chat_tmt.lua index 330a7ce..a846046 100644 --- a/scripts/manager_chat_tmt.lua +++ b/scripts/manager_chat_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/manager_desktop_tmt.lua b/scripts/manager_desktop_tmt.lua index 5409740..9872cfb 100644 --- a/scripts/manager_desktop_tmt.lua +++ b/scripts/manager_desktop_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/manager_effect_tmt.lua b/scripts/manager_effect_tmt.lua index 940f449..7142a7d 100644 --- a/scripts/manager_effect_tmt.lua +++ b/scripts/manager_effect_tmt.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- diff --git a/scripts/manager_trigger.lua b/scripts/manager_trigger.lua index d837f68..070f7c7 100644 --- a/scripts/manager_trigger.lua +++ b/scripts/manager_trigger.lua @@ -1,5 +1,5 @@ --- --- Please see the license.txt file included with this distribution for +-- +-- Please see the license.txt file included with this distribution for -- attribution and copyright information. -- @@ -32,7 +32,7 @@ function onActiveTriggerUpdated(nodeParent, bListchanged) end function onActiveTriggerDeleted(nodeToBeDeleted) - unregisterTrigger(nodeTrigger); + unregisterTrigger(nodeToBeDeleted); end function defineEvent(rEvent) @@ -88,7 +88,7 @@ function getConditionDefinitions() end function getConditionDefinitionsForEvent(vEvent) - return getConditionDefinitionsForCommonEventParameters(getParametersForEvent(vEvent)); + return getConditionDefinitionsForEventParameters(getParametersForEvent(vEvent)); end function getConditionDefinitionsForEventParameters(aEventParameters) @@ -140,7 +140,7 @@ function hasRequiredParameters(aRequiredParameters, aEventParameters) end end return bHasRequirements; -end +end function registerTrigger(nodeTrigger) local rTrigger = loadTriggerFromNode(nodeTrigger); @@ -161,7 +161,7 @@ function unregisterTrigger(nodeTrigger) if not rTrigger then return; end - + for sEventName,_ in pairs(rTrigger.tEventLists) do local tEventTriggers = tRegisteredEventTriggers[sEventName]; if tEventTriggers then @@ -206,7 +206,6 @@ function loadTriggerEventFromNode(nodeEvent) end function loadTriggerConditionFromNode(nodeCondition) - -- TODO invertibility local rCondition = { sName = DB.getValue(nodeCondition, "conditionname", ""); rData = loadParametersFromNode(nodeCondition), diff --git a/strings/strings.xml b/strings/strings.xml index 4094467..da98e86 100644 --- a/strings/strings.xml +++ b/strings/strings.xml @@ -1,4 +1,8 @@ + diff --git a/triggers/scripts/masterindextriggeritem_window.lua b/triggers/scripts/masterindextriggeritem_window.lua index 599e73c..79c5d15 100644 --- a/triggers/scripts/masterindextriggeritem_window.lua +++ b/triggers/scripts/masterindextriggeritem_window.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- @@ -20,16 +20,16 @@ function setRecordType(sNewRecordType) if m_sRecordType == sNewRecordType then return; end - + m_sRecordType = sNewRecordType - + local sRecordDisplayClass = LibraryData.getRecordDisplayClass(m_sRecordType, m_vNode); local sPath = ""; if m_vNode then sPath = m_vNode.getPath(); end link.setValue(sRecordDisplayClass, sPath); - + local sEmptyNameText = LibraryData.getEmptyNameText(m_sRecordType); name.setEmptyText(sEmptyNameText); end diff --git a/triggers/scripts/parameterlist.lua b/triggers/scripts/parameterlist.lua index 632f50a..5530381 100644 --- a/triggers/scripts/parameterlist.lua +++ b/triggers/scripts/parameterlist.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- diff --git a/triggers/scripts/tooltipcombobox.lua b/triggers/scripts/tooltipcombobox.lua index d090b8a..7273273 100644 --- a/triggers/scripts/tooltipcombobox.lua +++ b/triggers/scripts/tooltipcombobox.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- diff --git a/triggers/scripts/trigger.lua b/triggers/scripts/trigger.lua index 05a817f..cfb9d06 100644 --- a/triggers/scripts/trigger.lua +++ b/triggers/scripts/trigger.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- diff --git a/triggers/scripts/trigger_content.lua b/triggers/scripts/trigger_content.lua index 15af0b8..1aee05b 100644 --- a/triggers/scripts/trigger_content.lua +++ b/triggers/scripts/trigger_content.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- @@ -54,14 +54,14 @@ function onEventChanged() return; end - aEvents = getEvents(); + local aEvents = getEvents(); for _,winAction in ipairs(actions.getWindows()) do winAction.updateEvents(aEvents); end end function getEvents() - aEvents = {}; + local aEvents = {}; for _,winEvent in ipairs(events.getWindows()) do table.insert(aEvents, winEvent.getEventName()); end @@ -69,6 +69,6 @@ function getEvents() end function onActionAdded(winAction) - aEvents = getEvents(); + local aEvents = getEvents(); winAction.updateEvents(aEvents); end \ No newline at end of file diff --git a/triggers/scripts/triggeraction.lua b/triggers/scripts/triggeraction.lua index 6d90f57..a7e87d1 100644 --- a/triggers/scripts/triggeraction.lua +++ b/triggers/scripts/triggeraction.lua @@ -1,8 +1,8 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- -local rActionData = {}; +local bUpdatingName = false; local aEventParameters; function onInit() @@ -34,7 +34,7 @@ function onActionNameChanged(nodeActionName) setActionName(nodeActionName.getValue(), true); end -function onActionNameSelected(sSelection) +function onActionNameSelected() bUpdatingName = true; DB.deleteChild(getDatabaseNode(), "parameters"); -- combobox defaults to display value, not data value diff --git a/triggers/scripts/triggercondition.lua b/triggers/scripts/triggercondition.lua index f8b1acb..b0758f6 100644 --- a/triggers/scripts/triggercondition.lua +++ b/triggers/scripts/triggercondition.lua @@ -1,9 +1,9 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- -local rConditionData = {}; +local bUpdatingName = false; local aEventParameters; function onInit() @@ -36,7 +36,7 @@ function onConditionNameChanged(nodeConditionName) setConditionName(nodeConditionName.getValue(), true); end -function onConditionNameSelected(sSelection) +function onConditionNameSelected() bUpdatingName = true; -- combobox defaults to display value, not data value DB.setValue(getDatabaseNode(), "conditionname", "string", conditionname.getSelectedValue()); diff --git a/triggers/scripts/triggerevent.lua b/triggers/scripts/triggerevent.lua index 7234bb8..c10fcf5 100644 --- a/triggers/scripts/triggerevent.lua +++ b/triggers/scripts/triggerevent.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- @@ -80,7 +80,7 @@ function setEventName(sEventName) windowlist.window.onEventChanged(); end -function onEventNameSelected(sSelection) +function onEventNameSelected() bUpdatingName = true; -- combobox defaults to display value, not data value DB.setValue(getDatabaseNode(), "eventname", "string", getEventName()); diff --git a/triggers/scripts/triggerparameter.lua b/triggers/scripts/triggerparameter.lua index 6b323b9..cc47ebc 100644 --- a/triggers/scripts/triggerparameter.lua +++ b/triggers/scripts/triggerparameter.lua @@ -1,5 +1,5 @@ --- --- Please see the license.html file included with this distribution for +-- +-- Please see the license.html file included with this distribution for -- attribution and copyright information. -- diff --git a/triggers/template_triggers.xml b/triggers/template_triggers.xml index 65067e4..da3f53b 100644 --- a/triggers/template_triggers.xml +++ b/triggers/template_triggers.xml @@ -1,4 +1,8 @@ +