Added direct inventory access, and event_loot for items and event_weapon_proc for items

This commit is contained in:
KimLS
2013-06-20 14:03:22 -07:00
parent d8a1d84a49
commit 7b894a7c61
21 changed files with 483 additions and 88 deletions
+26 -8
View File
@@ -141,7 +141,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
if(IsNPC())
{
int i = parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0);
std::vector<void*> 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){
CalcBonuses();
return true;
@@ -149,7 +151,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}
else if(IsClient())
{
int i = parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0);
std::vector<void*> 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){
CalcBonuses();
return true;
@@ -3001,7 +3005,7 @@ void Mob::BuffProcess()
{
if (buffs[buffs_i].spellid != SPELL_UNKNOWN)
{
DoBuffTic(buffs[buffs_i].spellid, buffs[buffs_i].ticsremaining, buffs[buffs_i].casterlevel, entity_list.GetMob(buffs[buffs_i].casterid));
DoBuffTic(buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining, buffs[buffs_i].casterlevel, entity_list.GetMob(buffs[buffs_i].casterid));
// If the Mob died during DoBuffTic, then the buff we are currently processing will have been removed
if(buffs[buffs_i].spellid == SPELL_UNKNOWN)
continue;
@@ -3051,7 +3055,7 @@ void Mob::BuffProcess()
}
}
void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, Mob* caster) {
void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caster_level, Mob* caster) {
_ZP(Mob_DoBuffTic);
int effect, effect_value;
@@ -3066,14 +3070,22 @@ void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, M
if(IsNPC())
{
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0);
std::vector<void*> args;
args.push_back(&ticsremaining);
args.push_back(&caster_level);
args.push_back(&slot);
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0, &args);
if(i != 0) {
return;
}
}
else
{
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0);
std::vector<void*> args;
args.push_back(&ticsremaining);
args.push_back(&caster_level);
args.push_back(&slot);
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0, &args);
if(i != 0) {
return;
}
@@ -3334,9 +3346,15 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
}
if(IsClient()) {
parse->EventSpell(EVENT_SPELL_FADE, nullptr, CastToClient(), buffs[slot].spellid, slot);
std::vector<void*> args;
args.push_back(&buffs[slot].casterid);
parse->EventSpell(EVENT_SPELL_FADE, nullptr, CastToClient(), buffs[slot].spellid, slot, &args);
} else if(IsNPC()) {
parse->EventSpell(EVENT_SPELL_FADE, CastToNPC(), nullptr, buffs[slot].spellid, slot);
std::vector<void*> args;
args.push_back(&buffs[slot].casterid);
parse->EventSpell(EVENT_SPELL_FADE, CastToNPC(), nullptr, buffs[slot].spellid, slot, &args);
}
for (int i=0; i < EFFECT_COUNT; i++)