Skip to content

Commit

Permalink
add night elf speed to config
Browse files Browse the repository at this point in the history
+50% night elf racial bonus
  • Loading branch information
sogladev committed Sep 19, 2024
1 parent 4a85296 commit 8419bc8
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
21 changes: 19 additions & 2 deletions conf/ghost_speed.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,31 @@
# Description: Custom BasePoints for 8326 Ghost EFFECT_1 SPELL_AURA_MOD_INCREASE_SPEED
# Default: 200 - Fast
# 50 - Blizzard Default
# 75 - Blizzard Default for Night Elves (+50% racial bonus)
# 500 - Zoom
#
# GhostSpeed.SpeedSwim
# Description: Custom BasePoints for 8326 Ghost EFFECT_2 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
# Default: 200 - Fast
# 50 - Blizzard Default
# 75 - Blizzard Default for Night Elves (+50% racial bonus)
# 500 - Zoom
#
# GhostSpeed.SpeedNightElf
# Description: Custom BasePoints for Night Elf 20584 Ghost EFFECT_1 SPELL_AURA_MOD_INCREASE_SPEED
# Default: 300 - Fast (200 + 50% racial bonus)
# 50 - Blizzard Default
# 75 - Blizzard Default for Night Elves (+50% racial bonus)
# 500 - Zoom
#
# GhostSpeed.SpeedSwimNightElf
# Description: Custom BasePoints for Night Elf 20584 Ghost EFFECT_2 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
# Default: 300 - Fast (200 + 50% racial bonus)
# 50 - Blizzard Default
# 75 - Blizzard Default for Night Elves (+50% racial bonus)
# 500 - Zoom

GhostSpeed.Speed = 200
GhostSpeed.SpeedSwim = 200
GhostSpeed.Speed = 200
GhostSpeed.SpeedSwim = 200
GhostSpeed.SpeedNightElf = 300
GhostSpeed.SpeedSwimNightElf = 300
4 changes: 3 additions & 1 deletion data/sql/db-world/base/ghost_speed.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- modify ghost speed
DELETE FROM `spell_script_names` WHERE `spell_id` = 8326;
DELETE FROM `spell_script_names` WHERE `spell_id` = 8326 AND `ScriptName` = 'spell_ghost_speed_aura';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (8326, 'spell_ghost_speed_aura');
DELETE FROM `spell_script_names` WHERE `spell_id` = 20584 AND `ScriptName` = 'spell_ghost_speed_night_elf_aura';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (20584, 'spell_ghost_speed_night_elf_aura');
3 changes: 2 additions & 1 deletion optional/undo_ghost_speed.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id` = 8326;
DELETE FROM `spell_script_names` WHERE `spell_id` = 8326 AND `ScriptName` = 'spell_ghost_speed_aura';
DELETE FROM `spell_script_names` WHERE `spell_id` = 20584 AND `ScriptName` = 'spell_ghost_speed_night_elf_aura';
25 changes: 25 additions & 0 deletions src/mod_ghost_speed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class world_ghost_speed : public WorldScript
{
sGhostSpeed->speed = sConfigMgr->GetOption<int32>("GhostSpeed.Speed", 200);
sGhostSpeed->speedSwim = sConfigMgr->GetOption<int32>("GhostSpeed.SpeedSwim", 200);
sGhostSpeed->speedNightElf = sConfigMgr->GetOption<int32>("GhostSpeed.SpeedNightElf", 300);
sGhostSpeed->speedSwimNightElf = sConfigMgr->GetOption<int32>("GhostSpeed.SpeedSwimNightElf", 300);
}
};

Expand All @@ -49,8 +51,31 @@ class spell_ghost_speed_aura : public AuraScript
}
};

// 20584 Ghost - Night Elf
class spell_ghost_speed_night_elf_aura : public AuraScript
{
PrepareAuraScript(spell_ghost_speed_night_elf_aura);

void CalculateAmountSpeed(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
amount = sGhostSpeed->speedNightElf;
}

void CalculateAmountSwimSpeed(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
amount = sGhostSpeed->speedSwimNightElf;
}

void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ghost_speed_night_elf_aura::CalculateAmountSpeed, EFFECT_1, SPELL_AURA_MOD_INCREASE_SPEED);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ghost_speed_night_elf_aura::CalculateAmountSwimSpeed, EFFECT_2, SPELL_AURA_MOD_INCREASE_SWIM_SPEED);
}
};

void AddSC_ghost_speed_spell_script()
{
new world_ghost_speed();
RegisterSpellScript(spell_ghost_speed_aura);
RegisterSpellScript(spell_ghost_speed_night_elf_aura);
}
2 changes: 2 additions & 0 deletions src/mod_ghost_speed.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class GhostSpeed

int32 speed;
int32 speedSwim;
int32 speedNightElf;
int32 speedSwimNightElf;
};

#define sGhostSpeed GhostSpeed::instance()
Expand Down

0 comments on commit 8419bc8

Please sign in to comment.