Add actual module code.

Adds announcement part and scripts the damage for Rocket Barrage.
This commit is contained in:
benjymansy123
2022-08-02 12:17:22 -04:00
parent 411eb5d01a
commit b66cca02ea
4 changed files with 68 additions and 1 deletions

View File

@@ -1 +0,0 @@

View File

@@ -0,0 +1,6 @@
[worldserver]
# Enable the module announcing its presence.
# Default: true
Announce.enable=true

56
src/Worgoblin.cpp Normal file
View File

@@ -0,0 +1,56 @@
#include "worgoblin_loader.h"
#include "Chat.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "Config.h"
class announce : public PlayerScript {
public:
announce() : PlayerScript("announce") { }
void OnLogin(Player* player) override
{
if (sConfigMgr->GetOption<bool>("Announce.enable", true))
{
ChatHandler(player->GetSession()).SendSysMessage("This server is running the Worgoblin module."); // Hell yea
}
}
};
class rocket_barrage : public SpellScriptLoader //ID=69041
{
public:
rocket_barrage() : SpellScriptLoader("spell_rocket_barrage") { }
class rocket_barrage_script : public SpellScript
{
PrepareSpellScript(rocket_barrage_script);
void HandleDamage(SpellEffIndex effIndex)
{
Unit* caster = GetCaster();
int32 basePoints = 0 + caster->getLevel() * 2;
basePoints += caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()) * 0.429; //BM=0.429 here, don't ask me how.
basePoints += caster->GetTotalAttackPowerValue(caster->getClass() != CLASS_HUNTER ? BASE_ATTACK : RANGED_ATTACK) * 0.25; // 0.25=BonusCoefficient, hardcoding it here
SetEffectValue(basePoints);
}
void Register() override
{
OnEffectLaunchTarget += SpellEffectFn(rocket_barrage_script::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
{
return new rocket_barrage_script;
}
};
void Add_Worgoblin()
{
new announce();
new rocket_barrage();
}

6
src/worgoblin_loader.h Normal file
View File

@@ -0,0 +1,6 @@
void Add_Worgoblin();
void Addmod_worgoblinScripts()
{
Add_Worgoblin();
}