From f7193ad5203ba80c84a120a9f7d18f66ba8b46a5 Mon Sep 17 00:00:00 2001 From: Nikolai Zimmermann Date: Sun, 28 May 2017 15:53:07 +0200 Subject: [PATCH] Added Script to check Lua Abilites and Items (#919) Added `.lua` to all "ScriptFile" Keys Fixed AbilitySpecial Numbering of Charger's Charge and Shroud 1 Fixed Item Turret and Spell Totem not not crash parseKV cause of an empty value FIxed Satanic Core looking for a non existing Special Value "radius" Removed leftover variables in trumps_fists.lua Removed unused variable in reactive_reflex.lua Removed leftover pull staff file Removed not working write-version.js --- .../beastmaster_call_of_the_wild.txt | 2 +- .../beastmaster_call_of_the_wild_boar.txt | 2 +- .../abilities/charger/boss_charger_charge.txt | 8 +- .../abilities/enigma_demonic_conversion.txt | 2 +- .../npc/abilities/furion_force_of_nature.txt | 2 +- .../shadow_shaman_mass_serpent_ward.txt | 2 +- .../npc/items/item_infinite_bottle.txt | 2 +- game/scripts/npc/items/item_martyrs_mail.txt | 2 +- .../scripts/npc/items/item_martyrs_mail_2.txt | 2 +- game/scripts/npc/items/item_pull_staff.txt | 84 -------- game/scripts/npc/items/item_satanic_core.txt | 2 +- .../scripts/npc/items/item_satanic_core_2.txt | 2 +- .../scripts/npc/items/item_satanic_core_3.txt | 2 +- .../scripts/npc/items/item_shivas_cuirass.txt | 2 +- .../npc/items/item_shivas_cuirass_2.txt | 2 +- game/scripts/npc/items/item_shroud.txt | 9 +- game/scripts/npc/items/item_shroud_2.txt | 2 +- game/scripts/npc/items/item_spell_totem.txt | 4 +- game/scripts/npc/items/item_trumps_fists.txt | 2 +- .../scripts/npc/items/item_trumps_fists_2.txt | 2 +- game/scripts/npc/items/item_turret.txt | 4 +- .../items/reflex/reactive_reflect.lua | 1 - game/scripts/vscripts/items/satanic_core.lua | 4 +- game/scripts/vscripts/items/shroud.lua | 46 ++--- game/scripts/vscripts/items/trumps_fists.lua | 12 -- scripts/check-lua-kv.js | 194 ++++++++++++++++++ scripts/write-version.js | 13 -- 27 files changed, 248 insertions(+), 163 deletions(-) delete mode 100644 game/scripts/npc/items/item_pull_staff.txt create mode 100644 scripts/check-lua-kv.js delete mode 100644 scripts/write-version.js diff --git a/game/scripts/npc/abilities/beastmaster_call_of_the_wild.txt b/game/scripts/npc/abilities/beastmaster_call_of_the_wild.txt index 40b3858026..0a05a37b98 100644 --- a/game/scripts/npc/abilities/beastmaster_call_of_the_wild.txt +++ b/game/scripts/npc/abilities/beastmaster_call_of_the_wild.txt @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "5169" // unique ID number for this ability. Do not change this once established or it will invalidate collected stats. "BaseClass" "ability_lua" - "ScriptFile" "abilities/oaa_call_of_the_wild_hawk" + "ScriptFile" "abilities/oaa_call_of_the_wild_hawk.lua" "AbilityTextureName" "beastmaster_call_of_the_wild" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_NO_TARGET" "MaxLevel" "6" diff --git a/game/scripts/npc/abilities/beastmaster_call_of_the_wild_boar.txt b/game/scripts/npc/abilities/beastmaster_call_of_the_wild_boar.txt index 9ad66ad253..22143a49af 100644 --- a/game/scripts/npc/abilities/beastmaster_call_of_the_wild_boar.txt +++ b/game/scripts/npc/abilities/beastmaster_call_of_the_wild_boar.txt @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "5580" // unique ID number for this ability. Do not change this once established or it will invalidate collected stats. "BaseClass" "ability_lua" - "ScriptFile" "abilities/oaa_call_of_the_wild_boar" + "ScriptFile" "abilities/oaa_call_of_the_wild_boar.lua" "AbilityTextureName" "beastmaster_call_of_the_wild_boar" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_NO_TARGET" "MaxLevel" "6" diff --git a/game/scripts/npc/abilities/charger/boss_charger_charge.txt b/game/scripts/npc/abilities/charger/boss_charger_charge.txt index 3ea05f5986..36c5a1ad26 100644 --- a/game/scripts/npc/abilities/charger/boss_charger_charge.txt +++ b/game/scripts/npc/abilities/charger/boss_charger_charge.txt @@ -71,22 +71,22 @@ //---------------------------------- // Glacing blow, when the charger strikes a hero indirectly and pushes them away //---------------------------------- - "09" + "10" { "var_type" "FIELD_FLOAT" "glacing_damage" "75 100 150" } - "10" + "11" { "var_type" "FIELD_FLOAT" "glacing_slow" "10 30 50" } - "11" + "12" { "var_type" "FIELD_FLOAT" "glacing_duration" "1 2 3" } - "12" + "13" { "var_type" "FIELD_FLOAT" "glacing_knockback" "200 250 300" diff --git a/game/scripts/npc/abilities/enigma_demonic_conversion.txt b/game/scripts/npc/abilities/enigma_demonic_conversion.txt index e0dd4edc0d..6c56010f77 100644 --- a/game/scripts/npc/abilities/enigma_demonic_conversion.txt +++ b/game/scripts/npc/abilities/enigma_demonic_conversion.txt @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "5147" // unique ID number for this ability. Do not change this once established or it will invalidate collected stats. "BaseClass" "ability_lua" - "ScriptFile" "abilities/oaa_demonic_conversion" + "ScriptFile" "abilities/oaa_demonic_conversion.lua" "AbilityTextureName" "enigma_demonic_conversion" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK" "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_BOTH" diff --git a/game/scripts/npc/abilities/furion_force_of_nature.txt b/game/scripts/npc/abilities/furion_force_of_nature.txt index 40d19c7a75..ce94299b94 100644 --- a/game/scripts/npc/abilities/furion_force_of_nature.txt +++ b/game/scripts/npc/abilities/furion_force_of_nature.txt @@ -11,7 +11,7 @@ "ID" "5247" // unique ID number for this ability. Do not change this once established or it will invalidate collected stats. "BaseClass" "ability_lua" "AbilityTextureName" "furion_force_of_nature" - "ScriptFile" "abilities/oaa_force_of_nature" + "ScriptFile" "abilities/oaa_force_of_nature.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_AOE" // Stats diff --git a/game/scripts/npc/abilities/shadow_shaman_mass_serpent_ward.txt b/game/scripts/npc/abilities/shadow_shaman_mass_serpent_ward.txt index dbdc5cb73a..9a846ed85d 100644 --- a/game/scripts/npc/abilities/shadow_shaman_mass_serpent_ward.txt +++ b/game/scripts/npc/abilities/shadow_shaman_mass_serpent_ward.txt @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "5081" // unique ID number for this ability. Do not change this once established or it will invalidate collected stats. "BaseClass" "ability_lua" - "ScriptFile" "abilities/oaa_shadow_shaman_mass_serpent_ward" + "ScriptFile" "abilities/oaa_shadow_shaman_mass_serpent_ward.lua" "AbilityTextureName" "shadow_shaman_mass_serpent_ward" "AbilityType" "DOTA_ABILITY_TYPE_ULTIMATE" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_POINT" diff --git a/game/scripts/npc/items/item_infinite_bottle.txt b/game/scripts/npc/items/item_infinite_bottle.txt index 1572745a89..08d62fce70 100644 --- a/game/scripts/npc/items/item_infinite_bottle.txt +++ b/game/scripts/npc/items/item_infinite_bottle.txt @@ -14,7 +14,7 @@ "ID" "41" "BaseClass" "item_lua" "AbilityTextureName" "item_bottle" - "ScriptFile" "items/bottle" + "ScriptFile" "items/bottle.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET" diff --git a/game/scripts/npc/items/item_martyrs_mail.txt b/game/scripts/npc/items/item_martyrs_mail.txt index 0641e1efaa..06c4de13a8 100644 --- a/game/scripts/npc/items/item_martyrs_mail.txt +++ b/game/scripts/npc/items/item_martyrs_mail.txt @@ -42,7 +42,7 @@ "BaseClass" "item_lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET" "AbilityTextureName" "custom/martyrs_mail" - "ScriptFile" "items/martyrs_mail" + "ScriptFile" "items/martyrs_mail.lua" // Stats //------------------------------------------------------------------------------------------------------------- diff --git a/game/scripts/npc/items/item_martyrs_mail_2.txt b/game/scripts/npc/items/item_martyrs_mail_2.txt index 1e2ed8c647..a4fc32777c 100644 --- a/game/scripts/npc/items/item_martyrs_mail_2.txt +++ b/game/scripts/npc/items/item_martyrs_mail_2.txt @@ -41,7 +41,7 @@ "BaseClass" "item_lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET" "AbilityTextureName" "custom/martyrs_mail_2" - "ScriptFile" "items/martyrs_mail" + "ScriptFile" "items/martyrs_mail.lua" // Stats //------------------------------------------------------------------------------------------------------------- diff --git a/game/scripts/npc/items/item_pull_staff.txt b/game/scripts/npc/items/item_pull_staff.txt deleted file mode 100644 index 623f4e8395..0000000000 --- a/game/scripts/npc/items/item_pull_staff.txt +++ /dev/null @@ -1,84 +0,0 @@ -"DOTAItems" -{ - //================================================================================================================= - // Recipe: pull Staff - //================================================================================================================= - "item_recipe_pull_staff" - { - // General - //------------------------------------------------------------------------------------------------------------- - "ID" "3340" // unique ID number for this item. Do not change this once established or it will invalidate collected stats. - "BaseClass" "item_datadriven" - "Model" "models/props_gameplay/recipe.mdl" - "AbilityTextureName" "item_recipe" - - // Item Info - //------------------------------------------------------------------------------------------------------------- - "ItemCost" "2400" - "ItemShopTags" "" - - // Recipe - //------------------------------------------------------------------------------------------------------------- - "ItemRecipe" "1" - "ItemResult" "item_pull_staff" - "ItemRequirements" - { - "01" "item_hurricane_pike;item_upgrade_core" - "02" "item_hurricane_pike;item_upgrade_core_2" - "03" "item_hurricane_pike;item_upgrade_core_3" - "04" "item_hurricane_pike;item_upgrade_core_4" - } - } - - //================================================================================================================= - // pull Staff - //================================================================================================================= - "item_pull_staff" - { - // General - //------------------------------------------------------------------------------------------------------------- - "ID" "3341" // unique ID number for this item. Do not change this once established or it will invalidate collected stats. - "BaseClass" "item_hurricane_pike" - "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK" - "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_BOTH | DOTA_UNIT_TARGET_TEAM_CUSTOM" - "AbilityUnitTargetType" "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC | DOTA_UNIT_TARGET_CUSTOM" - "FightRecapLevel" "1" - "AbilityTextureName" "item_hurricane_pike" - // Stats - //------------------------------------------------------------------------------------------------------------- - "AbilityCastRange" "800" - "AbilityCastPoint" "0.0" - "AbilityCooldown" "20.0" - "AbilitySharedCooldown" "pull" - - // Item Info - //------------------------------------------------------------------------------------------------------------- - "AbilityManaCost" "25" - "ItemCost" "7000" - "ItemShopTags" "int;damage;attack_speed;hard_to_tag" - "ItemQuality" "rare" - "ItemAliases" "ps;pull staff" - "ItemDeclarations" "DECLARE_PURCHASES_TO_TEAMMATES | DECLARE_PURCHASES_TO_SPECTATORS" - - // Special - //------------------------------------------------------------------------------------------------------------- - "AbilitySpecial" - { - "01" - { - "var_type" "FIELD_INTEGER" - "bonus_intellect" "10" - } - "02" - { - "var_type" "FIELD_INTEGER" - "bonus_health_regen" "6" - } - "03" - { - "var_type" "FIELD_INTEGER" - "pull_length" "600" - } - } - } -} diff --git a/game/scripts/npc/items/item_satanic_core.txt b/game/scripts/npc/items/item_satanic_core.txt index b92345373f..52ff138f09 100644 --- a/game/scripts/npc/items/item_satanic_core.txt +++ b/game/scripts/npc/items/item_satanic_core.txt @@ -35,7 +35,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3221" // unique ID "BaseClass" "item_lua" - "ScriptFile" "items/satanic_core" + "ScriptFile" "items/satanic_core.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET" "FightRecapLevel" "2" "AbilityTextureName" "custom/satanic_core_1" diff --git a/game/scripts/npc/items/item_satanic_core_2.txt b/game/scripts/npc/items/item_satanic_core_2.txt index 4be7da7f5e..20cd1a41db 100644 --- a/game/scripts/npc/items/item_satanic_core_2.txt +++ b/game/scripts/npc/items/item_satanic_core_2.txt @@ -23,7 +23,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3222" // unique ID "BaseClass" "item_lua" - "ScriptFile" "items/satanic_core" + "ScriptFile" "items/satanic_core.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET" "FightRecapLevel" "2" "AbilityTextureName" "custom/satanic_core_2" diff --git a/game/scripts/npc/items/item_satanic_core_3.txt b/game/scripts/npc/items/item_satanic_core_3.txt index 0eb2c61c0e..5a8076a2bc 100644 --- a/game/scripts/npc/items/item_satanic_core_3.txt +++ b/game/scripts/npc/items/item_satanic_core_3.txt @@ -23,7 +23,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3223" // unique ID "BaseClass" "item_lua" - "ScriptFile" "items/satanic_core" + "ScriptFile" "items/satanic_core.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET" "FightRecapLevel" "2" "AbilityTextureName" "custom/satanic_core_3" diff --git a/game/scripts/npc/items/item_shivas_cuirass.txt b/game/scripts/npc/items/item_shivas_cuirass.txt index 384219eb18..b5ba51e309 100644 --- a/game/scripts/npc/items/item_shivas_cuirass.txt +++ b/game/scripts/npc/items/item_shivas_cuirass.txt @@ -40,7 +40,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3226" // unique ID number for this item. Do not change this once established or it will invalidate collected stats. "BaseClass" "item_lua" - "ScriptFile" "items/shivas_cuirass" + "ScriptFile" "items/shivas_cuirass.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL" "FightRecapLevel" "1" "AbilityTextureName" "custom/shivas_cuirass" diff --git a/game/scripts/npc/items/item_shivas_cuirass_2.txt b/game/scripts/npc/items/item_shivas_cuirass_2.txt index 5e21508bd4..a7473448ce 100644 --- a/game/scripts/npc/items/item_shivas_cuirass_2.txt +++ b/game/scripts/npc/items/item_shivas_cuirass_2.txt @@ -30,7 +30,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3227" // unique ID number for this item. Do not change this once established or it will invalidate collected stats. "BaseClass" "item_lua" - "ScriptFile" "items/shivas_cuirass" + "ScriptFile" "items/shivas_cuirass.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL" "FightRecapLevel" "1" "AbilityTextureName" "custom/shivas_cuirass_2" diff --git a/game/scripts/npc/items/item_shroud.txt b/game/scripts/npc/items/item_shroud.txt index 5ecf637d62..1aabe001c3 100644 --- a/game/scripts/npc/items/item_shroud.txt +++ b/game/scripts/npc/items/item_shroud.txt @@ -42,7 +42,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3234" // unique ID number for this item. Do not change this once established or it will invalidate collected stats. "BaseClass" "item_lua" - "ScriptFile" "items/shroud" + "ScriptFile" "items/shroud.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL | DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT" "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_FRIENDLY" "AbilityUnitTargetType" "DOTA_UNIT_TARGET_HERO" @@ -80,17 +80,17 @@ "bonus_attack_speed" "25 28" } // Glimmer Cape Parameters - "02" + "03" { "var_type" "FIELD_INTEGER" "bonus_magical_armor" "15 20" } - "03" + "04" { "var_type" "FIELD_FLOAT" "duration" "4.0" } - "04" + "05" { "var_type" "FIELD_INTEGER" "extra_spell_damage_percent" "0" // Zero Spell Amp from Ghost Scepter @@ -112,5 +112,4 @@ } } } - } diff --git a/game/scripts/npc/items/item_shroud_2.txt b/game/scripts/npc/items/item_shroud_2.txt index 360157e3fc..621ebfd13a 100644 --- a/game/scripts/npc/items/item_shroud_2.txt +++ b/game/scripts/npc/items/item_shroud_2.txt @@ -33,7 +33,7 @@ //------------------------------------------------------------------------------------------------------------- "ID" "3235" // unique ID number for this item. Do not change this once established or it will invalidate collected stats. "BaseClass" "item_lua" - "ScriptFile" "items/shroud" + "ScriptFile" "items/shroud.lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL | DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT" "AbilityUnitTargetTeam" "DOTA_UNIT_TARGET_TEAM_FRIENDLY" "AbilityUnitTargetType" "DOTA_UNIT_TARGET_HERO" diff --git a/game/scripts/npc/items/item_spell_totem.txt b/game/scripts/npc/items/item_spell_totem.txt index c0f8e9d138..00f97cf990 100644 --- a/game/scripts/npc/items/item_spell_totem.txt +++ b/game/scripts/npc/items/item_spell_totem.txt @@ -65,7 +65,9 @@ "modifier_item_spell_totem_summon" { "OnSpellStart" - {} + { + "SpawnUnit" "" + } } } diff --git a/game/scripts/npc/items/item_trumps_fists.txt b/game/scripts/npc/items/item_trumps_fists.txt index 3d726f379b..f5412901da 100644 --- a/game/scripts/npc/items/item_trumps_fists.txt +++ b/game/scripts/npc/items/item_trumps_fists.txt @@ -42,7 +42,7 @@ "BaseClass" "item_lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE" "AbilityTextureName" "custom/trumps_fists" - "ScriptFile" "items/trumps_fists" + "ScriptFile" "items/trumps_fists.lua" // Stats //------------------------------------------------------------------------------------------------------------- diff --git a/game/scripts/npc/items/item_trumps_fists_2.txt b/game/scripts/npc/items/item_trumps_fists_2.txt index 5720fbb0bb..777bd809a0 100644 --- a/game/scripts/npc/items/item_trumps_fists_2.txt +++ b/game/scripts/npc/items/item_trumps_fists_2.txt @@ -32,7 +32,7 @@ "BaseClass" "item_lua" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE" "AbilityTextureName" "custom/trumps_fists_2" - "ScriptFile" "items/trumps_fists" + "ScriptFile" "items/trumps_fists.lua" // Stats //------------------------------------------------------------------------------------------------------------- "MaxUpgradeLevel" "2" diff --git a/game/scripts/npc/items/item_turret.txt b/game/scripts/npc/items/item_turret.txt index f8dc1b2d1f..9028fd2935 100644 --- a/game/scripts/npc/items/item_turret.txt +++ b/game/scripts/npc/items/item_turret.txt @@ -65,7 +65,9 @@ "modifier_item_turret_summon" { "OnSpellStart" - {} + { + "SpawnUnit" "" + } } } diff --git a/game/scripts/vscripts/items/reflex/reactive_reflect.lua b/game/scripts/vscripts/items/reflex/reactive_reflect.lua index ca929bcec4..e0a44a0799 100644 --- a/game/scripts/vscripts/items/reflex/reactive_reflect.lua +++ b/game/scripts/vscripts/items/reflex/reactive_reflect.lua @@ -26,7 +26,6 @@ function item_reactive_3a:OnSpellStart() return false end - local maxCharges = self:GetSpecialValueFor( "max_charges" ) local caster = self:GetCaster() local duration = self:GetSpecialValueFor( "duration" ) diff --git a/game/scripts/vscripts/items/satanic_core.lua b/game/scripts/vscripts/items/satanic_core.lua index d2cd8a0f37..f5e291eb62 100644 --- a/game/scripts/vscripts/items/satanic_core.lua +++ b/game/scripts/vscripts/items/satanic_core.lua @@ -36,13 +36,11 @@ end function modifier_item_satanic_core:OnCreated() self.lifesteal_percent = self:GetAbility():GetSpecialValueFor( "lifesteal_percent" ) self.unholy_lifesteal_percent = self:GetAbility():GetSpecialValueFor( "unholy_lifesteal_percent" ) - self.aura_radius = self:GetAbility():GetSpecialValueFor( "radius" ) end function modifier_item_satanic_core:OnRefresh() self.lifesteal_percent = self:GetAbility():GetSpecialValueFor( "lifesteal_percent" ) self.unholy_lifesteal_percent = self:GetAbility():GetSpecialValueFor( "unholy_lifesteal_percent" ) - self.aura_radius = self:GetAbility():GetSpecialValueFor( "radius" ) end function modifier_item_satanic_core:IsAura() @@ -66,7 +64,7 @@ function modifier_item_satanic_core:GetAuraSearchFlags() end function modifier_item_satanic_core:GetAuraRadius() - return self.aura_radius + return 0 end function modifier_item_satanic_core:IsPurgable() diff --git a/game/scripts/vscripts/items/shroud.lua b/game/scripts/vscripts/items/shroud.lua index fabf98836b..448c54e612 100644 --- a/game/scripts/vscripts/items/shroud.lua +++ b/game/scripts/vscripts/items/shroud.lua @@ -7,16 +7,16 @@ LinkLuaModifier( "modifier_item_shroud_passive", "items/shroud.lua", LUA_MODIFIE item_shroud = class({}) function item_shroud:GetIntrinsicModifierName() - return "modifier_item_shroud_passive" + return "modifier_item_shroud_passive" end function item_shroud:OnSpellStart() - local hTarget = self:GetCursorTarget() - local shroud_duration = self:GetSpecialValueFor( "duration" ) + local hTarget = self:GetCursorTarget() + local shroud_duration = self:GetSpecialValueFor( "duration" ) - EmitSoundOn( "Item.GlimmerCape.Activate", hTarget ) - hTarget:AddNewModifier( hTarget, self, "modifier_ghost_state", { duration = shroud_duration } ) - hTarget:AddNewModifier( hTarget, self, "modifier_item_glimmer_cape_fade", { duration = shroud_duration } ) + EmitSoundOn( "Item.GlimmerCape.Activate", hTarget ) + hTarget:AddNewModifier( hTarget, self, "modifier_ghost_state", { duration = shroud_duration } ) + hTarget:AddNewModifier( hTarget, self, "modifier_item_glimmer_cape_fade", { duration = shroud_duration } ) end -------------------------------------------------------------------------------- @@ -28,7 +28,7 @@ item_shroud_2 = item_shroud --luacheck: ignore item_shroud_2 modifier_item_shroud_passive = class({}) function modifier_item_shroud_passive:IsHidden() - return true + return true end function modifier_item_shroud_passive:IsPurgable() @@ -36,40 +36,40 @@ function modifier_item_shroud_passive:IsPurgable() end function modifier_item_shroud_passive:OnCreated() - self.bonus_all_stats = self:GetAbility():GetSpecialValueFor( "bonus_all_stats" ) - self.bonus_attack_speed = self:GetAbility():GetSpecialValueFor( "bonus_attack_speed" ) - self.bonus_magical_armor = self:GetAbility():GetSpecialValueFor( "bonus_magical_armor" ) + self.bonus_all_stats = self:GetAbility():GetSpecialValueFor( "bonus_all_stats" ) + self.bonus_attack_speed = self:GetAbility():GetSpecialValueFor( "bonus_attack_speed" ) + self.bonus_magical_armor = self:GetAbility():GetSpecialValueFor( "bonus_magical_armor" ) end function modifier_item_shroud_passive:DeclareFunctions() - local funcs = { - MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, - MODIFIER_PROPERTY_STATS_AGILITY_BONUS, - MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, - MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, - MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS, - } - return funcs + local funcs = { + MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, + MODIFIER_PROPERTY_STATS_AGILITY_BONUS, + MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, + MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, + MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS, + } + return funcs end function modifier_item_shroud_passive:GetModifierBonusStats_Strength() - return self.bonus_all_stats + return self.bonus_all_stats end function modifier_item_shroud_passive:GetModifierBonusStats_Agility() - return self.bonus_all_stats + return self.bonus_all_stats end function modifier_item_shroud_passive:GetModifierBonusStats_Intellect() - return self.bonus_all_stats + return self.bonus_all_stats end function modifier_item_shroud_passive:GetModifierAttackSpeedBonus_Constant() - return self.bonus_attack_speed + return self.bonus_attack_speed end function modifier_item_shroud_passive:GetModifierMagicalResistanceBonus() - return self.bonus_magical_armor + return self.bonus_magical_armor end -------------------------------------------------------------------------------- diff --git a/game/scripts/vscripts/items/trumps_fists.lua b/game/scripts/vscripts/items/trumps_fists.lua index 612e4d17e3..6c2f1382da 100644 --- a/game/scripts/vscripts/items/trumps_fists.lua +++ b/game/scripts/vscripts/items/trumps_fists.lua @@ -34,18 +34,6 @@ function modifier_item_trumps_fists_passive:OnCreated() self.bonus_mana = self:GetAbility():GetSpecialValueFor( "bonus_mana" ) self.heal_prevent_duration = self:GetAbility():GetSpecialValueFor( "heal_prevent_duration" ) - - self.corruption_duration = self:GetAbility():GetSpecialValueFor( "corruption_duration" ) - - if IsServer() then - if self:GetParent():GetAttackCapability() == DOTA_UNIT_CAP_MELEE_ATTACK then - self.cold_duration = self:GetAbility():GetSpecialValueFor( "cold_duration_melee" ) - elseif self:GetParent():GetAttackCapability() == DOTA_UNIT_CAP_RANGED_ATTACK then - self.cold_duration = self:GetAbility():GetSpecialValueFor( "cold_duration_ranged" ) - else - self.cold_duration = 0 - end - end end function modifier_item_trumps_fists_passive:DeclareFunctions() diff --git a/scripts/check-lua-kv.js b/scripts/check-lua-kv.js new file mode 100644 index 0000000000..3bedcdf9b4 --- /dev/null +++ b/scripts/check-lua-kv.js @@ -0,0 +1,194 @@ +const parseKV = require('parse-kv'); +const chalk = require('chalk'); +const path = require('path'); +const fs = require('fs'); +const readline = require('readline'); + +var walk = (directoryName, action) => { + fs.readdir(directoryName, (err, files) => { + if (err) { + console.error(chalk.red(err)); + return; + } + files.forEach((file) => { + var fullPath = path.join(directoryName, file); + fs.stat(fullPath, (err, f) => { + if (err) { + console.error(chalk.red(err)); + return; + } + if (f.isDirectory()) { + walk(fullPath, action); + } else { + action(fullPath); + } + }); + }); + }); +}; + +function checkLuaItemFile (path) { + // console.log(chalk.blue('Checking "' + path + '".')); + var data = parseKV(fs.readFileSync(path)).DOTAItems; + for (var item in data) { + if (item === 'values') { + continue; + } + + if (data[item].values.BaseClass === undefined) { + console.error(chalk.yellow('WARN') + ' Missing Key: "' + chalk.bold('BaseClass') + '"\n in Item "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + continue; + } + + if (data[item].values.BaseClass !== 'item_lua') { + continue; + } + + if (data[item].values.BaseClass === undefined) { + console.error(chalk.red('ERR') + ' Missing Key: "' + chalk.bold('ScriptFile') + '"\n in Item "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + continue; + } + + if (data[item].AbilitySpecial === undefined) { + console.error(chalk.yellow('WARN') + ' Missing Key: "' + chalk.bold('SpecialValues') + '"\n in Item "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + } + + var ScriptFilePath = 'game/scripts/vscripts/' + data[item].values.ScriptFile; + + fs.stat(ScriptFilePath, (err, stat) => { + if (err === null) { + // console.log(chalk.blue('-> Checking "' + ScriptFilePath + '".')); + + var lineReader = readline.createInterface({ + input: fs.createReadStream(ScriptFilePath) + }); + + var lineNumber = 0; + lineReader.on('line', (line) => { + lineNumber++; + var SpecialValueRegex = new RegExp(/GetSpecialValueFor\(\s*"[^"]+"\s*\)/); + var SpecialValueMatches = line.match(SpecialValueRegex); + + if (SpecialValueMatches) { + var start = SpecialValueMatches[0].indexOf('"') + 1; + var SpecialValueKey = SpecialValueMatches[0].slice(start, SpecialValueMatches[0].indexOf('"', start)); + + if (data[item].AbilitySpecial === undefined) { + console.error(chalk.red('ERR') + ' Trying to access Value ' + chalk.bold(SpecialValueKey) + ' of non existing Key: "' + chalk.bold('SpecialValues') + '"\n from ScriptFile "' + chalk.bold(ScriptFilePath) + '"\n in Item "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + } + + var foundSpecialValue = false; + for (var AbilitySpecialKey in data[item].AbilitySpecial) { + if (AbilitySpecialKey === 'values') { + continue; + } + if (data[item].AbilitySpecial.hasOwnProperty(AbilitySpecialKey)) { + for (var AbilitySpecialName in data[item].AbilitySpecial[AbilitySpecialKey].values) { + if (AbilitySpecialName === SpecialValueKey) { + foundSpecialValue = true; + } + } + } + } + + if (!foundSpecialValue) { + console.error(chalk.red('ERR') + ' Trying to access non exiting Value "' + chalk.bold(SpecialValueKey) + '" of Key: "' + chalk.bold('SpecialValues') + '"\n from line ' + chalk.bold(lineNumber) + ' in ScriptFile "' + chalk.bold(ScriptFilePath) + '"\n in Item "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + // console.error(chalk.red('ERR ScriptFile in path "' + ScriptFilePath + '" is trying to get the SpecialValue "' + SpecialValueKey + '" from the item "' + item + '" in path "' + path + '" but that Key does not exist.')); + } + } + }); + + lineReader.on('close', () => {}); + } else if (err.code === 'ENOENT') { + console.error(chalk.red('ERR') + ' Key "' + chalk.bold('ScriptFile') + '" is pointing to a non exising file: "' + chalk.bold(ScriptFilePath) + '"\n in Item "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + } else { + console.error(chalk.red('ERR the "ScriptFile" Key of item "' + item + '" in path "' + path + '" is raising error ' + err.code + '\n')); + } + }); + } +} + +function checkLuaAbilityFile (path) { + // console.log(chalk.blue('Checking "' + path + '".')); + var data = parseKV(fs.readFileSync(path)).DOTAAbilities; + for (var item in data) { + if (item === 'values') { + continue; + } + + if (data[item].values.BaseClass === undefined) { + console.error(chalk.yellow('WARN') + ' Missing Key: "' + chalk.bold('BaseClass') + '"\n in Ability "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + continue; + } + + if (data[item].values.BaseClass !== 'ability_lua') { + continue; + } + + if (data[item].values.BaseClass === undefined) { + console.error(chalk.red('ERR') + ' Missing Key: "' + chalk.bold('ScriptFile') + '"\n in Ability "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + continue; + } + + if (data[item].AbilitySpecial === undefined) { + console.error(chalk.yellow('WARN') + ' Missing Key: "' + chalk.bold('SpecialValues') + '"\n in Ability "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + } + + var ScriptFilePath = 'game/scripts/vscripts/' + data[item].values.ScriptFile; + + fs.stat(ScriptFilePath, (err, stat) => { + if (err === null) { + // console.log(chalk.blue('-> Checking "' + ScriptFilePath + '".')); + + var lineReader = readline.createInterface({ + input: fs.createReadStream(ScriptFilePath) + }); + + var lineNumber = 0; + lineReader.on('line', (line) => { + lineNumber++; + var SpecialValueRegex = new RegExp(/GetSpecialValueFor\(\s*"[^"]+"\s*\)/); + var SpecialValueMatches = line.match(SpecialValueRegex); + + if (SpecialValueMatches) { + var start = SpecialValueMatches[0].indexOf('"') + 1; + var SpecialValueKey = SpecialValueMatches[0].slice(start, SpecialValueMatches[0].indexOf('"', start)); + + if (data[item].AbilitySpecial === undefined) { + console.error(chalk.red('ERR') + ' Trying to access Value ' + chalk.bold(SpecialValueKey) + ' of non existing Key: "' + chalk.bold('SpecialValues') + '"\n from ScriptFile "' + chalk.bold(ScriptFilePath) + '"\n in Ability "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + } + + var foundSpecialValue = false; + for (var AbilitySpecialKey in data[item].AbilitySpecial) { + if (AbilitySpecialKey === 'values') { + continue; + } + if (data[item].AbilitySpecial.hasOwnProperty(AbilitySpecialKey)) { + for (var AbilitySpecialName in data[item].AbilitySpecial[AbilitySpecialKey].values) { + if (AbilitySpecialName === SpecialValueKey) { + foundSpecialValue = true; + } + } + } + } + + if (!foundSpecialValue) { + console.error(chalk.red('ERR') + ' Trying to access non exiting Value "' + chalk.bold(SpecialValueKey) + '" of Key: "' + chalk.bold('SpecialValues') + '"\n from line ' + chalk.bold(lineNumber) + ' in ScriptFile "' + chalk.bold(ScriptFilePath) + '"\n in Ability "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + // console.error(chalk.red('ERR ScriptFile in path "' + ScriptFilePath + '" is trying to get the SpecialValue "' + SpecialValueKey + '" from the item "' + item + '" in path "' + path + '" but that Key does not exist.')); + } + } + }); + + lineReader.on('close', () => {}); + } else if (err.code === 'ENOENT') { + console.error(chalk.red('ERR') + ' Key "' + chalk.bold('ScriptFile') + '" is pointing to a non exising file: "' + chalk.bold(ScriptFilePath) + '"\n in Ability "' + chalk.bold(item) + '"\n in Path "' + chalk.bold(path) + '"\n'); + } else { + console.error(chalk.red('ERR the "ScriptFile" Key of Ability "' + item + '" in path "' + path + '" is raising error ' + err.code + '\n')); + } + }); + } +} +(() => { + walk('game/scripts/npc/items', checkLuaItemFile); + walk('game/scripts/npc/abilities', checkLuaAbilityFile); +})(); diff --git a/scripts/write-version.js b/scripts/write-version.js deleted file mode 100644 index 57a125b35a..0000000000 --- a/scripts/write-version.js +++ /dev/null @@ -1,13 +0,0 @@ -const fs = require('fs'); -var pjson = require('./package.json'); - -const addonGameMode = './game/scripts/vscripts/addon_game_mode.lua'; - -fs.readFile(addonGameMode, (err, data) => { - if (err) return console.log(err); - var result = data.replace(/GAME_VERSION = "\d+.\d+.\d+"/g, 'GAME_VERSION = "' + pjson.version + '"'); - - fs.writeFile(addonGameMode, result, 'utf8', function (err) { - if (err) return console.log(err); - }); -});