mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 19:10:25 +00:00
[Quest API] Convert Spell Events to similar formats and exports. (#1618)
* [Quest API] Convert Spell Events to similar formats and exports. Export spell ID, caster ID, caster level, tics remaining, and buff slot to Perl/Lua spell events. - Export e.buff_slot, e.caster_id, e.caster_level, e.spell_id, and e.tics_remaining to `event_spell_buff_tic`, `event_spell_effect`, and `event_spell_fade` in Lua. - Export $buff_slot, $caster_id, $caster_level, $spell_id, $tics_remaining to `EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT`, `EVENT_SPELL_EFFECT_BUFF_TIC_NPC`, `EVENT_SPELL_EFFECT_CLIENT`, `EVENT_SPELL_EFFECT_NPC`, and `EVENT_SPELL_FADE` in Perl. * Formatting. * Remove debug variable.
This commit is contained in:
+39
-38
@@ -161,22 +161,21 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
}
|
||||
}
|
||||
|
||||
if(IsNPC())
|
||||
{
|
||||
std::vector<EQ::Any> args;
|
||||
args.push_back(&buffslot);
|
||||
int i = parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0, &args);
|
||||
if(i != 0){
|
||||
std::string buf = fmt::format(
|
||||
"{} {} {} {}",
|
||||
caster->GetID(),
|
||||
buffs[buffslot].ticsremaining,
|
||||
caster->GetLevel(),
|
||||
buffslot
|
||||
);
|
||||
|
||||
if (IsClient()) {
|
||||
if (parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, buf, 0) != 0) {
|
||||
CalcBonuses();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(IsClient())
|
||||
{
|
||||
std::vector<EQ::Any> args;
|
||||
args.push_back(&buffslot);
|
||||
int i = parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0, &args);
|
||||
if(i != 0){
|
||||
} else if (IsNPC()) {
|
||||
if (parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, buf, 0) != 0) {
|
||||
CalcBonuses();
|
||||
return true;
|
||||
}
|
||||
@@ -3750,24 +3749,20 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster)
|
||||
|
||||
const SPDat_Spell_Struct &spell = spells[buff.spellid];
|
||||
|
||||
if (IsNPC()) {
|
||||
std::vector<EQ::Any> args;
|
||||
args.push_back(&buff.ticsremaining);
|
||||
args.push_back(&buff.casterlevel);
|
||||
args.push_back(&slot);
|
||||
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_NPC, CastToNPC(), nullptr, buff.spellid,
|
||||
caster ? caster->GetID() : 0, &args);
|
||||
if (i != 0) {
|
||||
std::string buf = fmt::format(
|
||||
"{} {} {} {}",
|
||||
caster->GetID(),
|
||||
buffs[slot].ticsremaining,
|
||||
caster->GetLevel(),
|
||||
slot
|
||||
);
|
||||
|
||||
if (IsClient()) {
|
||||
if (parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT, nullptr, CastToClient(), buff.spellid, buf, 0) != 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
std::vector<EQ::Any> args;
|
||||
args.push_back(&buff.ticsremaining);
|
||||
args.push_back(&buff.casterlevel);
|
||||
args.push_back(&slot);
|
||||
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_CLIENT, nullptr, CastToClient(), buff.spellid,
|
||||
caster ? caster->GetID() : 0, &args);
|
||||
if (i != 0) {
|
||||
} else if (IsNPC()) {
|
||||
if (parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_NPC, CastToNPC(), nullptr, buff.spellid, buf, 0) != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4115,16 +4110,22 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
}
|
||||
}
|
||||
|
||||
if(IsClient()) {
|
||||
std::vector<EQ::Any> args;
|
||||
args.push_back(&buffs[slot].casterid);
|
||||
std::string buf = fmt::format(
|
||||
"{} {} {} {}",
|
||||
buffs[slot].casterid,
|
||||
buffs[slot].ticsremaining,
|
||||
buffs[slot].casterlevel,
|
||||
slot
|
||||
);
|
||||
|
||||
parse->EventSpell(EVENT_SPELL_FADE, nullptr, CastToClient(), buffs[slot].spellid, slot, &args);
|
||||
} else if(IsNPC()) {
|
||||
std::vector<EQ::Any> args;
|
||||
args.push_back(&buffs[slot].casterid);
|
||||
|
||||
parse->EventSpell(EVENT_SPELL_FADE, CastToNPC(), nullptr, buffs[slot].spellid, slot, &args);
|
||||
if (IsClient()) {
|
||||
if (parse->EventSpell(EVENT_SPELL_FADE, nullptr, CastToClient(), buffs[slot].spellid, buf, 0) != 0) {
|
||||
return;
|
||||
}
|
||||
} else if (IsNPC()) {
|
||||
if (parse->EventSpell(EVENT_SPELL_FADE, CastToNPC(), nullptr, buffs[slot].spellid, buf, 0) != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i < EFFECT_COUNT; i++)
|
||||
|
||||
Reference in New Issue
Block a user