From 7b23c8dc75c0a8b6197410ee316f6b679b267ff9 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 13 May 2013 14:29:50 -0700 Subject: [PATCH] Working on last of Mob:: that can be implemented atm, added safety checks to the lua functions that will be optional later in dev mode. Also changed quest return types to integers instead of doubles as that was non-intuitive --- zone/QuestInterface.h | 12 +- zone/QuestParserCollection.cpp | 62 +- zone/QuestParserCollection.h | 16 +- zone/attack.cpp | 23 +- zone/embparser.cpp | 24 +- zone/embparser.h | 12 +- zone/lua_client.h | 8 + zone/lua_entity.cpp | 54 +- zone/lua_entity.h | 26 +- zone/lua_mob.cpp | 1275 +++++++++++++++++++++++++------- zone/lua_mob.h | 326 ++++---- zone/lua_npc.h | 8 + zone/lua_parser.cpp | 43 +- zone/lua_parser.h | 12 +- zone/mob.h | 46 +- zone/pets.h | 21 - 16 files changed, 1375 insertions(+), 593 deletions(-) diff --git a/zone/QuestInterface.h b/zone/QuestInterface.h index 8bb647b76..b66136467 100644 --- a/zone/QuestInterface.h +++ b/zone/QuestInterface.h @@ -28,12 +28,12 @@ class NPC; class QuestInterface { public: - virtual double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 100.0; } - virtual double EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 100.0; } - virtual double EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 100.0; } - virtual double EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 100.0; } - virtual double EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { return 100.0; } - virtual double EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { return 100.0; } + virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 0; } + virtual int EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 0; } + virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 0; } + virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 0; } + virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { return 0; } + virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { return 0; } virtual bool HasQuestSub(uint32 npcid, const char *subname) { return false; } virtual bool HasGlobalQuestSub(const char *subname) { return false; } diff --git a/zone/QuestParserCollection.cpp b/zone/QuestParserCollection.cpp index e2832c7d1..c2c4838ef 100644 --- a/zone/QuestParserCollection.cpp +++ b/zone/QuestParserCollection.cpp @@ -215,13 +215,21 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, const char *subname) return false; } -double QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std::string data, uint32 extra_data) { - double ret = EventNPCLocal(evt, npc, init, data, extra_data); - EventNPCGlobal(evt, npc, init, data, extra_data); - return ret; +int QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std::string data, uint32 extra_data) { + int rl = EventNPCLocal(evt, npc, init, data, extra_data); + int rg = EventNPCGlobal(evt, npc, init, data, extra_data); + + //Local quests returning non-default values have priority over global quests + if(rl != 0) { + return rl; + } else if(rg != 0) { + return rg; + } + + return 0; } -double QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { +int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { std::map::iterator iter = _npc_quest_status.find(npc->GetNPCTypeID()); if(iter != _npc_quest_status.end()) { //loaded or failed to load @@ -240,33 +248,42 @@ double QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *ini _npc_quest_status[npc->GetNPCTypeID()] = QuestFailedToLoad; } } - return 100.0; + return 0; } -void QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { +int QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { if(_global_npc_quest_status != QuestUnloaded && _global_npc_quest_status != QuestFailedToLoad) { std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); - qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data); + return qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data); } else { std::string filename; QuestInterface *qi = GetQIByGlobalNPCQuest(filename); if(qi) { _global_npc_quest_status = qi->GetIdentifier(); qi->LoadGlobalNPCScript(filename); - qi->EventGlobalNPC(evt, npc, init, data, extra_data); + return qi->EventGlobalNPC(evt, npc, init, data, extra_data); } else { _global_npc_quest_status = QuestFailedToLoad; } } + return 0; } -double QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { - double ret = EventPlayerLocal(evt, client, data, extra_data); - EventPlayerGlobal(evt, client, data, extra_data); - return ret; +int QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { + int rl = EventPlayerLocal(evt, client, data, extra_data); + int rg = EventPlayerGlobal(evt, client, data, extra_data); + + //Local quests returning non-default values have priority over global quests + if(rl != 0) { + return rl; + } else if(rg != 0) { + return rg; + } + + return 0; } -double QuestParserCollection::EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { +int QuestParserCollection::EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { if(_player_quest_status == QuestUnloaded) { std::string filename; QuestInterface *qi = GetQIByPlayerQuest(filename); @@ -281,27 +298,28 @@ double QuestParserCollection::EventPlayerLocal(QuestEventID evt, Client *client, return iter->second->EventPlayer(evt, client, data, extra_data); } } - return 100.0; + return 0; } -void QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { +int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { if(_global_player_quest_status == QuestUnloaded) { std::string filename; QuestInterface *qi = GetQIByGlobalPlayerQuest(filename); if(qi) { _global_player_quest_status = qi->GetIdentifier(); qi->LoadGlobalPlayerScript(filename); - qi->EventGlobalPlayer(evt, client, data, extra_data); + return qi->EventGlobalPlayer(evt, client, data, extra_data); } } else { if(_global_player_quest_status != QuestFailedToLoad) { std::map::iterator iter = _interfaces.find(_global_player_quest_status); - iter->second->EventGlobalPlayer(evt, client, data, extra_data); + return iter->second->EventGlobalPlayer(evt, client, data, extra_data); } } + return 0; } -double QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { +int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { std::string item_script; if(evt == EVENT_SCALE_CALC || evt == EVENT_ITEM_ENTERZONE) { item_script = item->GetItem()->CharmFile; @@ -330,10 +348,10 @@ double QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemIn _item_quest_status[item_script] = QuestFailedToLoad; } } - return 100.0; + return 0; } -double QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { +int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { std::map::iterator iter = _spell_quest_status.find(spell_id); if(iter != _spell_quest_status.end()) { //loaded or failed to load @@ -352,7 +370,7 @@ double QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *cli _spell_quest_status[spell_id] = QuestFailedToLoad; } } - return 100.0; + return 0; } QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string &filename) { diff --git a/zone/QuestParserCollection.h b/zone/QuestParserCollection.h index 71a2daa7b..d7b247a95 100644 --- a/zone/QuestParserCollection.h +++ b/zone/QuestParserCollection.h @@ -48,10 +48,10 @@ public: bool SpellHasQuestSub(uint32 spell_id, const char *subname); bool ItemHasQuestSub(ItemInst *itm, const char *subname); - double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - double EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - double EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); - double EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); + int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + int EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); + int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); private: bool HasQuestSubLocal(uint32 npcid, const char *subname); @@ -59,10 +59,10 @@ private: bool PlayerHasQuestSubLocal(const char *subname); bool PlayerHasQuestSubGlobal(const char *subname); - double EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - void EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - double EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - void EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + int EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + int EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + int EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + int EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data); QuestInterface *GetQIByNPCQuest(uint32 npcid, std::string &filename); QuestInterface *GetQIByGlobalNPCQuest(std::string &filename); diff --git a/zone/attack.cpp b/zone/attack.cpp index 25855a6df..a0716be5b 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1425,7 +1425,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ if(dead) return; //cant die more than once... - if(parse->EventPlayer(EVENT_DEATH, this, "", 0) <= 0.0) { + if(parse->EventPlayer(EVENT_DEATH, this, "", 0) == 1) { return; } @@ -2041,6 +2041,15 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski _ZP(NPC_Death); mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); + Mob *oos = nullptr; + if(killerMob) { + Mob *oos = killerMob->GetOwnerOrSelf(); + if(parse->EventNPC(EVENT_DEATH, this, oos, "", 0) != 0) + { + return; + } + } + if (this->IsEngaged()) { zone->DelAggroMob(); @@ -2064,7 +2073,6 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski Death_Struct* d = (Death_Struct*)app->pBuffer; d->spawn_id = GetID(); d->killer_id = killerMob ? killerMob->GetID() : 0; -// d->unknown12 = 1; d->bindzoneid = 0; d->spell_id = spell == SPELL_UNKNOWN ? 0xffffffff : spell; d->attack_skill = SkillDamageTypes[attack_skill]; @@ -2348,22 +2356,19 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski entity_list.RemoveFromXTargets(this); // Parse quests even if we're killed by an NPC - if(killerMob) { - Mob *oos = killerMob->GetOwnerOrSelf(); - parse->EventNPC(EVENT_DEATH, this, oos, "", 0); - + if(oos) { mod_npc_killed(oos); uint16 emoteid = this->GetEmoteID(); if(emoteid != 0) - this->DoNPCEmote(ONDEATH,emoteid); + this->DoNPCEmote(ONDEATH, emoteid); if(oos->IsNPC()) { parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0); uint16 emoteid = oos->GetEmoteID(); if(emoteid != 0) - oos->CastToNPC()->DoNPCEmote(KILLEDNPC,emoteid); - killerMob->TrySpellOnKill(killed_level,spell); + oos->CastToNPC()->DoNPCEmote(KILLEDNPC, emoteid); + killerMob->TrySpellOnKill(killed_level, spell); } } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 84020b954..b64e06338 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -196,34 +196,34 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d HandleQueue(); } -double PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { +int PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, false); - return 100.0; + return 0; } -double PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { +int PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true); - return 100.0; + return 0; } -double PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { +int PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, false); - return 100.0; + return 0; } -double PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { +int PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true); - return 100.0; + return 0; } -double PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { +int PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data, false); - return 100.0; + return 0; } -double PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { +int PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data, false); - return 100.0; + return 0; } bool PerlembParser::HasQuestSub(uint32 npcid, const char *subname) { diff --git a/zone/embparser.h b/zone/embparser.h index acdcae269..bc38d4076 100644 --- a/zone/embparser.h +++ b/zone/embparser.h @@ -55,12 +55,12 @@ public: PerlembParser(); ~PerlembParser(); - virtual double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - virtual double EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - virtual double EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - virtual double EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - virtual double EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); - virtual double EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); + virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + virtual int EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); + virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); virtual bool HasQuestSub(uint32 npcid, const char *subname); virtual bool HasGlobalQuestSub(const char *subname); diff --git a/zone/lua_client.h b/zone/lua_client.h index 8a094be9b..3474bd35f 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -12,6 +12,14 @@ public: Lua_Client() { d_ = nullptr; } Lua_Client(Client *d) { d_ = d; } virtual ~Lua_Client() { } + + operator Client* () { + if(d_) { + return reinterpret_cast(d_); + } + + return nullptr; + } }; #endif diff --git a/zone/lua_entity.cpp b/zone/lua_entity.cpp index ea35597be..6a5547413 100644 --- a/zone/lua_entity.cpp +++ b/zone/lua_entity.cpp @@ -6,68 +6,72 @@ #include "lua_client.h" #include "lua_npc.h" -bool Lua_Entity::NullPtr() { +bool Lua_Entity::Null() { return d_ == nullptr; } +bool Lua_Entity::Valid() { + return d_ != nullptr; +} + bool Lua_Entity::IsClient() { - Entity *ent = reinterpret_cast(d_); - return ent->IsClient(); + Lua_Safe_Call_Bool(Entity); + return self->IsClient(); } bool Lua_Entity::IsNPC() { - Entity *ent = reinterpret_cast(d_); - return ent->IsNPC(); + Lua_Safe_Call_Bool(Entity); + return self->IsNPC(); } bool Lua_Entity::IsMob() { - Entity *ent = reinterpret_cast(d_); - return ent->IsMob(); + Lua_Safe_Call_Bool(Entity); + return self->IsMob(); } bool Lua_Entity::IsMerc() { - Entity *ent = reinterpret_cast(d_); - return ent->IsMerc(); + Lua_Safe_Call_Bool(Entity); + return self->IsMerc(); } bool Lua_Entity::IsCorpse() { - Entity *ent = reinterpret_cast(d_); - return ent->IsCorpse(); + Lua_Safe_Call_Bool(Entity); + return self->IsCorpse(); } bool Lua_Entity::IsPlayerCorpse() { - Entity *ent = reinterpret_cast(d_); - return ent->IsPlayerCorpse(); + Lua_Safe_Call_Bool(Entity); + return self->IsPlayerCorpse(); } bool Lua_Entity::IsNPCCorpse() { - Entity *ent = reinterpret_cast(d_); - return ent->IsNPCCorpse(); + Lua_Safe_Call_Bool(Entity); + return self->IsNPCCorpse(); } bool Lua_Entity::IsObject() { - Entity *ent = reinterpret_cast(d_); - return ent->IsObject(); + Lua_Safe_Call_Bool(Entity); + return self->IsObject(); } bool Lua_Entity::IsDoor() { - Entity *ent = reinterpret_cast(d_); - return ent->IsDoor(); + Lua_Safe_Call_Bool(Entity); + return self->IsDoor(); } bool Lua_Entity::IsTrap() { - Entity *ent = reinterpret_cast(d_); - return ent->IsTrap(); + Lua_Safe_Call_Bool(Entity); + return self->IsTrap(); } bool Lua_Entity::IsBeacon() { - Entity *ent = reinterpret_cast(d_); - return ent->IsBeacon(); + Lua_Safe_Call_Bool(Entity); + return self->IsBeacon(); } int Lua_Entity::GetID() { - Entity *ent = reinterpret_cast(d_); - return ent->GetID(); + Lua_Safe_Call_Bool(Entity); + return self->GetID(); } Lua_Client Lua_Entity::CastToClient() { diff --git a/zone/lua_entity.h b/zone/lua_entity.h index 50596382a..77a0ff4eb 100644 --- a/zone/lua_entity.h +++ b/zone/lua_entity.h @@ -11,11 +11,18 @@ class Lua_Mob; //class Lua_Object; //class Lua_Doors; //class Lua_Trap; -//class Lua_Beacon; +//class Lua_Item; -#define Lua_Safe_Cast(type, m, other) \ - type *m = nullptr; \ - m = reinterpret_cast(other.d_); +//TODO: Remove the error checking by a flag since this adds significant overhead to each c call +#define Lua_Safe_Call_Void(Type) if(!d_) { return; } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_Bool(Type) if(!d_) { return false; } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_Int(Type) if(!d_) { return 0; } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_Real(Type) if(!d_) { return 0.0; } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_String(Type) if(!d_) { return ""; } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_Entity(Type) if(!d_) { return Lua_Entity(); } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_Mob(Type) if(!d_) { return Lua_Mob(); } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_NPC(Type) if(!d_) { return Lua_NPC(); } Type *self = reinterpret_cast(d_); +#define Lua_Safe_Call_Client(Type) if(!d_) { return Lua_Client(); } Type *self = reinterpret_cast(d_); class Lua_Entity { @@ -24,7 +31,16 @@ public: Lua_Entity(Entity *d) : d_(d) { } virtual ~Lua_Entity() { } - bool NullPtr(); + operator Entity* () { + if(d_) { + return reinterpret_cast(d_); + } + + return nullptr; + } + + bool Null(); + bool Valid(); bool IsClient(); bool IsNPC(); bool IsMob(); diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index b43b28594..a097d72d0 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -4,748 +4,1449 @@ #include "lua_mob.h" const char *Lua_Mob::GetName() { - Mob *m = reinterpret_cast(d_); - return m->GetName(); + Lua_Safe_Call_String(Mob); + return self->GetName(); } void Lua_Mob::Depop() { - Depop(true); + Lua_Safe_Call_Void(Mob); + return self->Depop(); } void Lua_Mob::Depop(bool start_spawn_timer) { - Mob *m = reinterpret_cast(d_); - return m->Depop(start_spawn_timer); + Lua_Safe_Call_Void(Mob); + return self->Depop(start_spawn_timer); } void Lua_Mob::RogueAssassinate(Lua_Mob other) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - m->RogueAssassinate(o); + Lua_Safe_Call_Void(Mob); + self->RogueAssassinate(other); } bool Lua_Mob::BehindMob() { - return BehindMob(nullptr, 0.0f, 0.0f); + Lua_Safe_Call_Bool(Mob); + return self->BehindMob(); } bool Lua_Mob::BehindMob(Lua_Mob other) { - return BehindMob(other, 0.0f, 0.0f); + Lua_Safe_Call_Bool(Mob); + return self->BehindMob(other); } bool Lua_Mob::BehindMob(Lua_Mob other, float x) { - return BehindMob(other, x, 0.0f); + Lua_Safe_Call_Bool(Mob); + return self->BehindMob(other, x); } bool Lua_Mob::BehindMob(Lua_Mob other, float x, float y) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - return m->BehindMob(o, x, y); + Lua_Safe_Call_Bool(Mob); + return self->BehindMob(other, x, y); } void Lua_Mob::SetLevel(int level) { - SetLevel(level, false); + Lua_Safe_Call_Void(Mob); + self->SetLevel(level); } void Lua_Mob::SetLevel(int level, bool command) { - Mob *m = reinterpret_cast(d_); - m->SetLevel(level, command); + Lua_Safe_Call_Void(Mob); + self->SetLevel(level, command); } void Lua_Mob::SendWearChange(int material_slot) { - Mob *m = reinterpret_cast(d_); - m->SendWearChange(material_slot); + Lua_Safe_Call_Void(Mob); + self->SendWearChange(material_slot); } uint32 Lua_Mob::GetEquipment(int material_slot) { - Mob *m = reinterpret_cast(d_); - return m->GetEquipment(material_slot); + Lua_Safe_Call_Int(Mob); + return self->GetEquipment(material_slot); } int32 Lua_Mob::GetEquipmentMaterial(int material_slot) { - Mob *m = reinterpret_cast(d_); - return m->GetEquipmentMaterial(material_slot); + Lua_Safe_Call_Int(Mob); + return self->GetEquipmentMaterial(material_slot); } uint32 Lua_Mob::GetEquipmentColor(int material_slot) { - Mob *m = reinterpret_cast(d_); - return m->GetEquipmentColor(material_slot); + Lua_Safe_Call_Int(Mob); + return self->GetEquipmentColor(material_slot); } uint32 Lua_Mob::GetArmorTint(int i) { - Mob *m = reinterpret_cast(d_); - return m->GetArmorTint(i); + Lua_Safe_Call_Int(Mob); + return self->GetArmorTint(i); } bool Lua_Mob::IsMoving() { - Mob *m = reinterpret_cast(d_); - return m->IsMoving(); + Lua_Safe_Call_Bool(Mob); + return self->IsMoving(); } void Lua_Mob::GotoBind() { - Mob *m = reinterpret_cast(d_); - m->GoToBind(); + Lua_Safe_Call_Void(Mob); + self->GoToBind(); } void Lua_Mob::Gate() { - Mob *m = reinterpret_cast(d_); - m->Gate(); + Lua_Safe_Call_Void(Mob); + self->Gate(); } bool Lua_Mob::Attack(Lua_Mob other) { - return Attack(other, 13, false, false, false); + Lua_Safe_Call_Bool(Mob); + return self->Attack(other); } bool Lua_Mob::Attack(Lua_Mob other, int hand) { - return Attack(other, hand, false, false, false); + Lua_Safe_Call_Bool(Mob); + return self->Attack(other, hand); } bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte) { - return Attack(other, hand, from_riposte, false, false); + Lua_Safe_Call_Bool(Mob); + return self->Attack(other, hand, from_riposte); } bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_strikethrough) { - return Attack(other, hand, from_riposte, is_strikethrough, false); + Lua_Safe_Call_Bool(Mob); + return self->Attack(other, hand, from_riposte, is_strikethrough); } bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_strikethrough, bool is_from_spell) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - return m->Attack(o, hand, from_riposte, is_strikethrough, is_from_spell); + Lua_Safe_Call_Bool(Mob); + return self->Attack(other, hand, from_riposte, is_strikethrough, is_from_spell); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill) { - Damage(from, damage, spell_id, attack_skill, true, -1, false); + Lua_Safe_Call_Void(Mob); + return self->Damage(from, damage, spell_id, static_cast(attack_skill)); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill, bool avoidable) { - Damage(from, damage, spell_id, attack_skill, avoidable, -1, false); + Lua_Safe_Call_Void(Mob); + return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill, bool avoidable, int buffslot) { - Damage(from, damage, spell_id, attack_skill, avoidable, buffslot, false); + Lua_Safe_Call_Void(Mob); + return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill, bool avoidable, int buffslot, bool buff_tic) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, f, from); - m->Damage(f, damage, spell_id, static_cast(attack_skill), avoidable, buffslot, buff_tic); + Lua_Safe_Call_Void(Mob); + return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot, buff_tic); } void Lua_Mob::RangedAttack(Lua_Mob other) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - m->RangedAttack(o); + Lua_Safe_Call_Void(Mob); + self->RangedAttack(other); } void Lua_Mob::ThrowingAttack(Lua_Mob other) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - m->ThrowingAttack(o); + Lua_Safe_Call_Void(Mob); + self->ThrowingAttack(other); } void Lua_Mob::Heal() { - Mob *m = reinterpret_cast(d_); - m->Heal(); + Lua_Safe_Call_Void(Mob); + self->Heal(); } void Lua_Mob::HealDamage(uint32 amount) { - Mob *m = reinterpret_cast(d_); - HealDamage(amount, nullptr); + Lua_Safe_Call_Void(Mob) + self->HealDamage(amount); } void Lua_Mob::HealDamage(uint32 amount, Lua_Mob other) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - m->HealDamage(amount, o); + Lua_Safe_Call_Void(Mob) + self->HealDamage(amount, other); } uint32 Lua_Mob::GetLevelCon(int other) { - Mob *m = reinterpret_cast(d_); - return m->GetLevelCon(other); + Lua_Safe_Call_Int(Mob) + return self->GetLevelCon(other); } uint32 Lua_Mob::GetLevelCon(int my, int other) { - Mob *m = reinterpret_cast(d_); - return m->GetLevelCon(my, other); + Lua_Safe_Call_Int(Mob) + return self->GetLevelCon(my, other); } void Lua_Mob::SetHP(int hp) { - Mob *m = reinterpret_cast(d_); - m->SetHP(hp); + Lua_Safe_Call_Void(Mob) + self->SetHP(hp); } void Lua_Mob::DoAnim(int anim_num) { - DoAnim(anim_num, 0, true, 0); + Lua_Safe_Call_Void(Mob) + self->DoAnim(anim_num); } void Lua_Mob::DoAnim(int anim_num, int type) { - DoAnim(anim_num, type, true, 0); + Lua_Safe_Call_Void(Mob) + self->DoAnim(anim_num, type); } void Lua_Mob::DoAnim(int anim_num, int type, bool ackreq) { - DoAnim(anim_num, type, ackreq, 0); + Lua_Safe_Call_Void(Mob) + self->DoAnim(anim_num, type, ackreq); } void Lua_Mob::DoAnim(int anim_num, int type, bool ackreq, int filter) { - Mob *m = reinterpret_cast(d_); - m->DoAnim(anim_num, type, ackreq, static_cast(filter)); + Lua_Safe_Call_Void(Mob) + self->DoAnim(anim_num, type, ackreq, static_cast(filter)); } void Lua_Mob::ChangeSize(double in_size) { - ChangeSize(in_size, false); + Lua_Safe_Call_Void(Mob) + self->ChangeSize(in_size); } void Lua_Mob::ChangeSize(double in_size, bool no_restriction) { - Mob *m = reinterpret_cast(d_); - m->ChangeSize(in_size, no_restriction); + Lua_Safe_Call_Void(Mob) + self->ChangeSize(in_size, no_restriction); } void Lua_Mob::GMMove(double x, double y, double z) { - GMMove(x, y, z, 0.01, true); + Lua_Safe_Call_Void(Mob) + self->GMMove(x, y, z); } void Lua_Mob::GMMove(double x, double y, double z, double heading) { - GMMove(x, y, z, heading, true); + Lua_Safe_Call_Void(Mob) + self->GMMove(x, y, z, heading); } void Lua_Mob::GMMove(double x, double y, double z, double heading, bool send_update) { - Mob *m = reinterpret_cast(d_); - m->GMMove(x, y, z, heading, send_update); + Lua_Safe_Call_Void(Mob) + self->GMMove(x, y, z, heading, send_update); } void Lua_Mob::SendPosUpdate() { - SendPosUpdate(false); + Lua_Safe_Call_Void(Mob) + self->SendPosUpdate(); } void Lua_Mob::SendPosUpdate(bool send_to_self) { - Mob *m = reinterpret_cast(d_); - m->SendPosUpdate(send_to_self ? 1 : 0); + Lua_Safe_Call_Void(Mob) + self->SendPosUpdate(send_to_self ? 1 : 0); } void Lua_Mob::SendPosition() { - Mob *m = reinterpret_cast(d_); - m->SendPosition(); + Lua_Safe_Call_Void(Mob) + self->SendPosition(); } bool Lua_Mob::HasProcs() { - Mob *m = reinterpret_cast(d_); - return m->HasProcs(); + Lua_Safe_Call_Bool(Mob) + return self->HasProcs(); } bool Lua_Mob::IsInvisible() { - return IsInvisible(Lua_Mob(nullptr)); + Lua_Safe_Call_Bool(Mob) + return self->IsInvisible(); } bool Lua_Mob::IsInvisible(Lua_Mob other) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, o, other); - - return m->IsInvisible(o); + Lua_Safe_Call_Bool(Mob) + return self->IsInvisible(other); } void Lua_Mob::SetInvisible(int state) { - Mob *m = reinterpret_cast(d_); - m->SetInvisible(state); + Lua_Safe_Call_Void(Mob) + self->SetInvisible(state); } bool Lua_Mob::FindBuff(int spell_id) { - Mob *m = reinterpret_cast(d_); - return m->FindBuff(spell_id); + Lua_Safe_Call_Bool(Mob) + return self->FindBuff(spell_id); } bool Lua_Mob::FindType(int type) { - return FindType(type, false, 100); + Lua_Safe_Call_Bool(Mob) + return self->FindType(type); } bool Lua_Mob::FindType(int type, bool offensive) { - return FindType(type, offensive, 100); + Lua_Safe_Call_Bool(Mob) + return self->FindType(type, offensive); } bool Lua_Mob::FindType(int type, bool offensive, int threshold) { - Mob *m = reinterpret_cast(d_); - return m->FindType(type, offensive, threshold); + Lua_Safe_Call_Bool(Mob) + return self->FindType(type, offensive, threshold); } int Lua_Mob::GetBuffSlotFromType(int slot) { - Mob *m = reinterpret_cast(d_); - return m->GetBuffSlotFromType(slot); + Lua_Safe_Call_Bool(Mob) + return self->GetBuffSlotFromType(slot); } void Lua_Mob::MakePet(int spell_id, const char* pet_type) { - MakePet(spell_id, pet_type, nullptr); + Lua_Safe_Call_Void(Mob) + self->MakePet(spell_id, pet_type); } void Lua_Mob::MakePet(int spell_id, const char* pet_type, const char *pet_name) { - Mob *m = reinterpret_cast(d_); - m->MakePet(spell_id, pet_type, pet_name); + Lua_Safe_Call_Void(Mob) + self->MakePet(spell_id, pet_type, pet_name); } void Lua_Mob::MakePoweredPet(int spell_id, const char* pet_type, int pet_power) { - MakePoweredPet(spell_id, pet_type, pet_power, nullptr); + Lua_Safe_Call_Void(Mob) + self->MakePoweredPet(spell_id, pet_type, pet_power); } void Lua_Mob::MakePoweredPet(int spell_id, const char* pet_type, int pet_power, const char *pet_name) { - Mob *m = reinterpret_cast(d_); - m->MakePoweredPet(spell_id, pet_type, pet_power, pet_name); + Lua_Safe_Call_Void(Mob) + self->MakePoweredPet(spell_id, pet_type, pet_power, pet_name); } int Lua_Mob::GetBaseRace() { - Mob *m = reinterpret_cast(d_); - return m->GetBaseRace(); + Lua_Safe_Call_Int(Mob) + return self->GetBaseRace(); } int Lua_Mob::GetBaseGender() { - Mob *m = reinterpret_cast(d_); - return m->GetBaseGender(); + Lua_Safe_Call_Int(Mob) + return self->GetBaseGender(); } int Lua_Mob::GetDeity() { - Mob *m = reinterpret_cast(d_); - return m->GetDeity(); + Lua_Safe_Call_Int(Mob) + return self->GetDeity(); } int Lua_Mob::GetRace() { - Mob *m = reinterpret_cast(d_); - return m->GetRace(); + Lua_Safe_Call_Int(Mob) + return self->GetRace(); } int Lua_Mob::GetGender() { - Mob *m = reinterpret_cast(d_); - return m->GetGender(); + Lua_Safe_Call_Int(Mob) + return self->GetGender(); } int Lua_Mob::GetTexture() { - Mob *m = reinterpret_cast(d_); - return m->GetTexture(); + Lua_Safe_Call_Int(Mob) + return self->GetTexture(); } int Lua_Mob::GetHelmTexture() { - Mob *m = reinterpret_cast(d_); - return m->GetHelmTexture(); + Lua_Safe_Call_Int(Mob) + return self->GetHelmTexture(); } int Lua_Mob::GetHairColor() { - Mob *m = reinterpret_cast(d_); - return m->GetHairColor(); + Lua_Safe_Call_Int(Mob) + return self->GetHairColor(); } int Lua_Mob::GetBeardColor() { - Mob *m = reinterpret_cast(d_); - return m->GetBeardColor(); + Lua_Safe_Call_Int(Mob) + return self->GetBeardColor(); } int Lua_Mob::GetEyeColor1() { - Mob *m = reinterpret_cast(d_); - return m->GetEyeColor1(); + Lua_Safe_Call_Int(Mob) + return self->GetEyeColor1(); } int Lua_Mob::GetEyeColor2() { - Mob *m = reinterpret_cast(d_); - return m->GetEyeColor2(); + Lua_Safe_Call_Int(Mob) + return self->GetEyeColor2(); } int Lua_Mob::GetHairStyle() { - Mob *m = reinterpret_cast(d_); - return m->GetHairStyle(); + Lua_Safe_Call_Int(Mob) + return self->GetHairStyle(); } int Lua_Mob::GetLuclinFace() { - Mob *m = reinterpret_cast(d_); - return m->GetLuclinFace(); + Lua_Safe_Call_Int(Mob) + return self->GetLuclinFace(); } int Lua_Mob::GetBeard() { - Mob *m = reinterpret_cast(d_); - return m->GetBeard(); + Lua_Safe_Call_Int(Mob) + return self->GetBeard(); } int Lua_Mob::GetDrakkinHeritage() { - Mob *m = reinterpret_cast(d_); - return m->GetDrakkinHeritage(); + Lua_Safe_Call_Int(Mob) + return self->GetDrakkinHeritage(); } int Lua_Mob::GetDrakkinTattoo() { - Mob *m = reinterpret_cast(d_); - return m->GetDrakkinTattoo(); + Lua_Safe_Call_Int(Mob) + return self->GetDrakkinTattoo(); } int Lua_Mob::GetDrakkinDetails() { - Mob *m = reinterpret_cast(d_); - return m->GetDrakkinDetails(); + Lua_Safe_Call_Int(Mob) + return self->GetDrakkinDetails(); } int Lua_Mob::GetClass() { - Mob *m = reinterpret_cast(d_); - return m->GetClass(); + Lua_Safe_Call_Int(Mob) + return self->GetClass(); } int Lua_Mob::GetLevel() { - Mob *m = reinterpret_cast(d_); - return m->GetLevel(); + Lua_Safe_Call_Int(Mob) + return self->GetLevel(); } const char *Lua_Mob::GetCleanName() { - Mob *m = reinterpret_cast(d_); - return m->GetCleanName(); + Lua_Safe_Call_String(Mob) + return self->GetCleanName(); } Lua_Mob Lua_Mob::GetTarget() { - Mob *m = reinterpret_cast(d_); - return Lua_Mob(m->GetTarget()); + Lua_Safe_Call_Mob(Mob) + return Lua_Mob(self->GetTarget()); } void Lua_Mob::SetTarget(Lua_Mob t) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, tar, t); - m->SetTarget(tar); + Lua_Safe_Call_Void(Mob) + self->SetTarget(t); } double Lua_Mob::GetHPRatio() { - Mob *m = reinterpret_cast(d_); - return m->GetHPRatio(); + Lua_Safe_Call_Real(Mob) + return self->GetHPRatio(); } bool Lua_Mob::IsWarriorClass() { - Mob *m = reinterpret_cast(d_); - return m->IsWarriorClass(); + Lua_Safe_Call_Bool(Mob) + return self->IsWarriorClass(); } int Lua_Mob::GetHP() { - Mob *m = reinterpret_cast(d_); - return m->GetHP(); + Lua_Safe_Call_Int(Mob) + return self->GetHP(); } int Lua_Mob::GetMaxHP() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxHP(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxHP(); } int Lua_Mob::GetItemHPBonuses() { - Mob *m = reinterpret_cast(d_); - return m->GetItemHPBonuses(); + Lua_Safe_Call_Int(Mob) + return self->GetItemHPBonuses(); } int Lua_Mob::GetSpellHPBonuses() { - Mob *m = reinterpret_cast(d_); - return m->GetSpellHPBonuses(); + Lua_Safe_Call_Int(Mob) + return self->GetSpellHPBonuses(); } double Lua_Mob::GetWalkspeed() { - Mob *m = reinterpret_cast(d_); - return m->GetWalkspeed(); + Lua_Safe_Call_Real(Mob) + return self->GetWalkspeed(); } double Lua_Mob::GetRunspeed() { - Mob *m = reinterpret_cast(d_); - return m->GetRunspeed(); + Lua_Safe_Call_Real(Mob) + return self->GetRunspeed(); } int Lua_Mob::GetCasterLevel(int spell_id) { - Mob *m = reinterpret_cast(d_); - return m->GetCasterLevel(spell_id); + Lua_Safe_Call_Int(Mob) + return self->GetCasterLevel(spell_id); } int Lua_Mob::GetMaxMana() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxMana(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxMana(); } int Lua_Mob::GetMana() { - Mob *m = reinterpret_cast(d_); - return m->GetMana(); + Lua_Safe_Call_Int(Mob) + return self->GetMana(); } int Lua_Mob::SetMana(int mana) { - Mob *m = reinterpret_cast(d_); - return m->SetMana(mana); + Lua_Safe_Call_Int(Mob) + return self->SetMana(mana); } double Lua_Mob::GetManaRatio() { - Mob *m = reinterpret_cast(d_); - return m->GetManaRatio(); + Lua_Safe_Call_Real(Mob) + return self->GetManaRatio(); } int Lua_Mob::GetAC() { - Mob *m = reinterpret_cast(d_); - return m->GetAC(); + Lua_Safe_Call_Int(Mob) + return self->GetAC(); } int Lua_Mob::GetATK() { - Mob *m = reinterpret_cast(d_); - return m->GetATK(); + Lua_Safe_Call_Int(Mob) + return self->GetATK(); } int Lua_Mob::GetSTR() { - Mob *m = reinterpret_cast(d_); - return m->GetSTR(); + Lua_Safe_Call_Int(Mob) + return self->GetSTR(); } int Lua_Mob::GetSTA() { - Mob *m = reinterpret_cast(d_); - return m->GetSTA(); + Lua_Safe_Call_Int(Mob) + return self->GetSTA(); } int Lua_Mob::GetDEX() { - Mob *m = reinterpret_cast(d_); - return m->GetDEX(); + Lua_Safe_Call_Int(Mob) + return self->GetDEX(); } int Lua_Mob::GetAGI() { - Mob *m = reinterpret_cast(d_); - return m->GetAGI(); + Lua_Safe_Call_Int(Mob) + return self->GetAGI(); } int Lua_Mob::GetINT() { - Mob *m = reinterpret_cast(d_); - return m->GetINT(); + Lua_Safe_Call_Int(Mob) + return self->GetINT(); } int Lua_Mob::GetWIS() { - Mob *m = reinterpret_cast(d_); - return m->GetWIS(); + Lua_Safe_Call_Int(Mob) + return self->GetWIS(); } int Lua_Mob::GetCHA() { - Mob *m = reinterpret_cast(d_); - return m->GetCHA(); + Lua_Safe_Call_Int(Mob) + return self->GetCHA(); } int Lua_Mob::GetMR() { - Mob *m = reinterpret_cast(d_); - return m->GetMR(); + Lua_Safe_Call_Int(Mob) + return self->GetMR(); } int Lua_Mob::GetFR() { - Mob *m = reinterpret_cast(d_); - return m->GetFR(); + Lua_Safe_Call_Int(Mob) + return self->GetFR(); } int Lua_Mob::GetDR() { - Mob *m = reinterpret_cast(d_); - return m->GetDR(); + Lua_Safe_Call_Int(Mob) + return self->GetDR(); } int Lua_Mob::GetPR() { - Mob *m = reinterpret_cast(d_); - return m->GetPR(); + Lua_Safe_Call_Int(Mob) + return self->GetPR(); } int Lua_Mob::GetCR() { - Mob *m = reinterpret_cast(d_); - return m->GetCR(); + Lua_Safe_Call_Int(Mob) + return self->GetCR(); } int Lua_Mob::GetCorruption() { - Mob *m = reinterpret_cast(d_); - return m->GetCorrup(); + Lua_Safe_Call_Int(Mob) + return self->GetCorrup(); } int Lua_Mob::GetMaxSTR() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxSTR(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxSTR(); } int Lua_Mob::GetMaxSTA() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxSTA(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxSTA(); } int Lua_Mob::GetMaxDEX() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxDEX(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxDEX(); } int Lua_Mob::GetMaxAGI() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxAGI(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxAGI(); } int Lua_Mob::GetMaxINT() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxINT(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxINT(); } int Lua_Mob::GetMaxWIS() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxWIS(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxWIS(); } int Lua_Mob::GetMaxCHA() { - Mob *m = reinterpret_cast(d_); - return m->GetMaxCHA(); + Lua_Safe_Call_Int(Mob) + return self->GetMaxCHA(); } double Lua_Mob::GetActSpellRange(int spell_id, double range) { - return GetActSpellRange(spell_id, range, false); + Lua_Safe_Call_Real(Mob) + return self->GetActSpellRange(spell_id, range); } double Lua_Mob::GetActSpellRange(int spell_id, double range, bool is_bard) { - Mob *m = reinterpret_cast(d_); - return m->GetActSpellRange(spell_id, range, is_bard); + Lua_Safe_Call_Real(Mob) + return self->GetActSpellRange(spell_id, range, is_bard); } int Lua_Mob::GetActSpellDamage(int spell_id, int value) { - Mob *m = reinterpret_cast(d_); - return m->GetActSpellDamage(spell_id, value); + Lua_Safe_Call_Int(Mob); + return self->GetActSpellDamage(spell_id, value); } int Lua_Mob::GetActSpellHealing(int spell_id, int value) { - Mob *m = reinterpret_cast(d_); - return m->GetActSpellHealing(spell_id, value); + Lua_Safe_Call_Int(Mob); + return self->GetActSpellHealing(spell_id, value); } int Lua_Mob::GetActSpellCost(int spell_id, int cost) { - Mob *m = reinterpret_cast(d_); - return m->GetActSpellCost(spell_id, cost); + Lua_Safe_Call_Int(Mob); + return self->GetActSpellCost(spell_id, cost); } int Lua_Mob::GetActSpellDuration(int spell_id, int duration) { - Mob *m = reinterpret_cast(d_); - return m->GetActSpellDuration(spell_id, duration); + Lua_Safe_Call_Int(Mob); + return self->GetActSpellDuration(spell_id, duration); } int Lua_Mob::GetActSpellCasttime(int spell_id, int cast_time) { - Mob *m = reinterpret_cast(d_); - return m->GetActSpellCasttime(spell_id, cast_time); + Lua_Safe_Call_Int(Mob); + return self->GetActSpellCasttime(spell_id, cast_time); } double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster) { - return ResistSpell(resist_type, spell_id, caster, false, 0, false); + Lua_Safe_Call_Real(Mob); + return self->ResistSpell(resist_type, spell_id, caster); } double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override) { - return ResistSpell(resist_type, spell_id, caster, use_resist_override, 0, false); + Lua_Safe_Call_Real(Mob); + return self->ResistSpell(resist_type, spell_id, caster, use_resist_override); } double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override) { - return ResistSpell(resist_type, spell_id, caster, use_resist_override, resist_override, false); + Lua_Safe_Call_Real(Mob); + return self->ResistSpell(resist_type, spell_id, caster, use_resist_override, resist_override); } double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override, bool charisma_check) { - Mob *m = reinterpret_cast(d_); - Lua_Safe_Cast(Mob, c, caster); - - return m->ResistSpell(resist_type, spell_id, c, use_resist_override, resist_override, charisma_check); + Lua_Safe_Call_Real(Mob); + return self->ResistSpell(resist_type, spell_id, caster, use_resist_override, resist_override, charisma_check); } int Lua_Mob::GetSpecializeSkillValue(int spell_id) { - Mob *m = reinterpret_cast(d_); - return m->GetSpecializeSkillValue(spell_id); + Lua_Safe_Call_Int(Mob); + return self->GetSpecializeSkillValue(spell_id); } int Lua_Mob::GetNPCTypeID() { - Mob *m = reinterpret_cast(d_); - return m->GetNPCTypeID(); + Lua_Safe_Call_Int(Mob); + return self->GetNPCTypeID(); } bool Lua_Mob::IsTargeted() { - Mob *m = reinterpret_cast(d_); - return m->IsTargeted(); + Lua_Safe_Call_Bool(Mob); + return self->IsTargeted(); } double Lua_Mob::GetX() { - Mob *m = reinterpret_cast(d_); - return m->GetX(); + Lua_Safe_Call_Real(Mob); + return self->GetX(); } double Lua_Mob::GetY() { - Mob *m = reinterpret_cast(d_); - return m->GetY(); + Lua_Safe_Call_Real(Mob); + return self->GetY(); } double Lua_Mob::GetZ() { - Mob *m = reinterpret_cast(d_); - return m->GetZ(); + Lua_Safe_Call_Real(Mob); + return self->GetZ(); } double Lua_Mob::GetHeading() { - Mob *m = reinterpret_cast(d_); - return m->GetHeading(); + Lua_Safe_Call_Real(Mob); + return self->GetHeading(); } double Lua_Mob::GetWaypointX() { - Mob *m = reinterpret_cast(d_); - return m->GetCWPX(); + Lua_Safe_Call_Real(Mob); + return self->GetCWPX(); } double Lua_Mob::GetWaypointY() { - Mob *m = reinterpret_cast(d_); - return m->GetCWPY(); + Lua_Safe_Call_Real(Mob); + return self->GetCWPY(); } double Lua_Mob::GetWaypointZ() { - Mob *m = reinterpret_cast(d_); - return m->GetCWPZ(); + Lua_Safe_Call_Real(Mob); + return self->GetCWPZ(); } double Lua_Mob::GetWaypointH() { - Mob *m = reinterpret_cast(d_); - return m->GetCWPH(); + Lua_Safe_Call_Real(Mob); + return self->GetCWPH(); } double Lua_Mob::GetWaypointPause() { - Mob *m = reinterpret_cast(d_); - return m->GetCWPP(); + Lua_Safe_Call_Real(Mob); + return self->GetCWPP(); } int Lua_Mob::GetWaypointID() { - Mob *m = reinterpret_cast(d_); - return m->GetCWP(); + Lua_Safe_Call_Int(Mob); + return self->GetCWP(); } void Lua_Mob::SetCurrentWP(int wp) { - Mob *m = reinterpret_cast(d_); - m->SetCurrentWP(wp); + Lua_Safe_Call_Void(Mob); + self->SetCurrentWP(wp); } double Lua_Mob::GetSize() { - Mob *m = reinterpret_cast(d_); - return m->GetSize(); + Lua_Safe_Call_Real(Mob); + return self->GetSize(); } void Lua_Mob::SetFollowID(int id) { - Mob *m = reinterpret_cast(d_); - m->SetFollowID(id); + Lua_Safe_Call_Void(Mob); + self->SetFollowID(id); } int Lua_Mob::GetFollowID() { - Mob *m = reinterpret_cast(d_); - return m->GetFollowID(); + Lua_Safe_Call_Int(Mob); + return self->GetFollowID(); } void Lua_Mob::Message(int type, const char *message) { - Mob *m = reinterpret_cast(d_); - m->Message(type, message); + Lua_Safe_Call_Void(Mob); + self->Message(type, message); } void Lua_Mob::Message_StringID(int type, int string_id, uint32 distance) { - Mob *m = reinterpret_cast(d_); - m->Message_StringID(type, string_id, distance); + Lua_Safe_Call_Void(Mob); + self->Message_StringID(type, string_id, distance); } void Lua_Mob::Say(const char *message) { - Mob *m = reinterpret_cast(d_); - m->Say(message); + Lua_Safe_Call_Void(Mob); + self->Say(message); } void Lua_Mob::Shout(const char *message) { - Mob *m = reinterpret_cast(d_); - m->Shout(message); + Lua_Safe_Call_Void(Mob); + self->Shout(message); } void Lua_Mob::Emote(const char *message) { - Mob *m = reinterpret_cast(d_); - m->Emote(message); + Lua_Safe_Call_Void(Mob); + self->Emote(message); } void Lua_Mob::InterruptSpell() { - InterruptSpell(65535U); + Lua_Safe_Call_Void(Mob); + self->InterruptSpell(); } void Lua_Mob::InterruptSpell(int spell_id) { - Mob *m = reinterpret_cast(d_); - m->InterruptSpell(spell_id); + Lua_Safe_Call_Void(Mob); + self->InterruptSpell(spell_id); } +//bool Lua_Mob::CastSpell(int spell_id, int target_id) { +// Lua_Safe_Call_Void(Mob) +// return self->CastSpell(spell_id, target_id); +//} +// +//bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot) { +// Lua_Safe_Call_Void(Mob) +// return self->CastSpell(spell_id, target_id, slot); +//} +// +//bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time) { +// Lua_Safe_Call_Void(Mob) +// return self->CastSpell(spell_id, target_id, slot, cast_time); +//} +// +//bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost) { +// Lua_Safe_Call_Void(Mob) +// return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost); +//} +// +//bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot) { +// Lua_Safe_Call_Void(Mob) +// return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot)); +//} +// +//bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, +// int timer_duration) { +// Lua_Safe_Call_Void(Mob) +// return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), +// static_cast(timer), static_cast(timer_duration)); +//} +// +//bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, +// int timer_duration, int resist_adjust) { +// Lua_Safe_Call_Void(Mob) +// int16 res = resist_adjust; +// +// return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), +// static_cast(timer), static_cast(timer_duration), 0, &res); +//} +// +//bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target) { +// return SpellFinished(spell_id, target, 10, 0, 0xFFFFFFFF, 0, false); +//} +// +//bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot) { +// return SpellFinished(spell_id, target, slot, 0, 0xFFFFFFFF, 0, false); +//} +// +//bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used) { +// return SpellFinished(spell_id, target, slot, mana_used, 0xFFFFFFFF, 0, false); +//} +// +//bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot) { +// return SpellFinished(spell_id, target, slot, mana_used, inventory_slot, 0, false); +//} +// +//bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust) { +// return SpellFinished(spell_id, target, slot, mana_used, inventory_slot, resist_adjust, false); +//} +// +//bool Lua_Mob::SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust, bool proc) { +// Lua_Safe_Call_Void(Mob) +// Lua_Safe_Cast(Mob, t, target); +// return self->SpellFinished(spell_id, t, slot, mana_used, inventory_slot, resist_adjust, proc); +//} +// +//void Lua_Mob::SpellEffect(Lua_Mob caster, int spell_id, double partial) { +// Lua_Safe_Call_Void(Mob) +// Lua_Safe_Cast(Mob, c, caster); +// +// self->SpellEffect(c, spell_id, partial); +// Lua_Safe_Cast(Mob, c, caster); +//} +// +//bool Lua_Mob::IsImmuneToSpell(int spell_id, Lua_Mob caster) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeBySpellID(int spell_id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeByEffect(int effect_id, int skip_slot) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeAll() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeDetrimental() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeBySlot(int slot, bool recalc_bonuses) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeDetrimentalByCaster(Lua_Mob caster) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffFadeBySitModifier() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::BuffModifyDurationBySpellID(int spell_id, int new_duration) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::CanBuffStack(int spell_id, int caster_level, bool fail_if_overwrite) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsCasting() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::CastingSpellID() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetAppearance(int app) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetAppearance(int app, bool ignore_self) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetAppearance() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetPetID() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetOwnerID() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetPetType(int type) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetPetType() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetBodyType() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetBodyType(int type) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::Stun(int duration) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::UnStun() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::Spin() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::Kill() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetInvul(bool invul) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::GetInvul() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetExtraHaste(int haste) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetHaste() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetMonkHandToHandDamage() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetMonkHandToHandDelay() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CanThisClassDoubleAttack() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CanThisClassDualWield() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CanThisClassRiposte() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CanThisClassDodge() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CanThisClassParry() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CanThisClassBlock() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetClassLevelFactor() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::Mesmerize() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsMezzed() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsStunned() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::StartEnrage() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsEnraged() { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetReverseFactionCon(Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsAIControlled() { +// Lua_Safe_Call_Void(Mob) +//} +// +//double Lua_Mob::GetAggroRange() { +// Lua_Safe_Call_Void(Mob) +//} +// +//double Lua_Mob::GetAssistRange() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetPetOrder(int order) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetPetOrder() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsRoamer() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsRooted() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::AddToHateList(Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::AddToHateList(Lua_Mob other, int hate) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::AddToHateList(Lua_Mob other, int hate, int damage) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_help) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_help, bool frenzy) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_help, bool frenzy, bool buff_tic) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::RemoveFromHateList(Lua_Mob mob) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetHate(Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetHate(Lua_Mob other, int hate) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetHate(Lua_Mob other, int hate, int damage) { +// Lua_Safe_Call_Void(Mob) +//} +// +//uint32 Lua_Mob::GetHateAmount(Lua_Mob tmob) { +// Lua_Safe_Call_Void(Mob) +//} +// +//uint32 Lua_Mob::GetHateAmount(Lua_Mob tmob, bool is_damage) { +// Lua_Safe_Call_Void(Mob) +//} +// +//uint32 Lua_Mob::GetDamageAmount(Lua_Mob tmob) { +// Lua_Safe_Call_Void(Mob) +//} +// +//Lua_Mob Lua_Mob::GetHateTop() { +// Lua_Safe_Call_Void(Mob) +//} +// +//Lua_Mob Lua_Mob::GetHateDamageTop(Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// +//Lua_Mob Lua_Mob::GetHateRandom() { +// Lua_Safe_Call_Void(Mob) +//} +// +//Lua_Mob Lua_Mob::GetHateMost() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsEngaged() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::HateSummon() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::FaceTarget() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::FaceTarget(Lua_Mob mob_to_face) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetHeading(double new_h) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::WipeHateList() { +// Lua_Safe_Call_Void(Mob) +//} +// +//double Lua_Mob::CalculateHeadingToTarget(double x, double y) { +// Lua_Safe_Call_Void(Mob) +//} +// +//double Lua_Mob::CalculateDistance(double x, double y, double z) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SendTo(double new_x, double new_y, double new_z) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SendToFixZ(double new_x, double new_y, double new_z) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::NPCSpecialAttacks(const char* parse, int permtag) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool remove) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetResist(int type) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::Charmed() { +// Lua_Safe_Call_Void(Mob) +//} +// +//uint32 Lua_Mob::GetLevelHP(int level) { +// Lua_Safe_Call_Void(Mob) +//} +// +//uint32 Lua_Mob::GetAA(int level) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::CheckAggroAmount(int spell_id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::CheckAggroAmount(int spell_id, bool is_proc) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::CheckHealAggroAmount(int spell_id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::CheckHealAggroAmount(int spell_id, uint32 heal_possible) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::DivineAura() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetOOCRegen(int new_regen) { +// Lua_Safe_Call_Void(Mob) +//} +// +//const Lua_Mob::char* GetEntityVariable(const char *id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetEntityVariable(const char *id, const char *m_var) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::EntityVariableExists(const char *id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CombatRange(Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage, int hate_override) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage, int hate_override, int reuse_time) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, bool hit_chance) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse, int chance_mod) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse, int chance_mod, int focus) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse, int chance_mod, int focus, bool can_riposte) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CheckLoS(Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// // make sure this is CheckLoSFN +//bool Lua_Mob::CheckLoSToLoc(double x, double y, double z) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::CheckLoSToLoc(double x, double y, double z, double mob_size) { +// Lua_Safe_Call_Void(Mob) +//} +// +//double Lua_Mob::FindGroundZ(double new_x, double new_y) { +// Lua_Safe_Call_Void(Mob) +//} +// +//double Lua_Mob::FindGroundZ(double new_x, double new_y, double z_offset) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle, double tilt) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle, double tilt, double arc) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::HasNPCSpecialAtk(const char* parse) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, Lua_Client client) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetFlyMode(int value) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetTexture(int value) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetRace(int value) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetGender(int value) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SendIllusionPacket(int in_race, int in_gender, int in_texture, int in_helmtexture, int in_haircolor, int in_beardcolor, int in_eyecolor1, int in_eyecolor2, int in_hairstyle, int in_luclinface, int in_beard, int in_aa_title, uint32 in_drakkin_heritage, uint32 in_drakkin_tattoo, uint32 in_drakkin_details, double in_size) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::QuestReward(Lua_Client c) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::QuestReward(Lua_Client c, uint32 silver) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::QuestReward(Lua_Client c, uint32 silver, uint32 gold) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::QuestReward(Lua_Client c, uint32 silver, uint32 gold, uint32 platinum) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::CameraEffect(uint32 duration, uint32 intensity) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SendSpellEffect(uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20, bool perm_effect, Lua_Client client) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::TempName(const char *new_name) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetGlobal(const char *var_name, const char *new_value, int options, const char *duration) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetGlobal(const char *var_name, const char *new_value, int options, const char *duration, Lua_Mob other) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::TarGlobal(const char *var_name, const char *value, const char *duration, int npc_id, int char_id, int zone_id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DelGlobal(const char *var_name) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetSlotTint(int slot, int red, int green, int blue) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::WearChange(int material_slot, int texture, uint32 color) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::DoKnockback(Lua_Mob caster, uint32 pushback, uint32 pushup) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::RemoveNimbusEffect(int effect_id) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsRunning() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetRunning(bool v) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetTargetable(bool v) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ModSkillDmgTaken(int skill_num, int value) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetModSkillDmgTaken(int skill_num) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetSkillDmgTaken(int skill_num) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetAllowBeneficial(bool v) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::GetAllowBeneficial() { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsBeneficialAllowed(Lua_Mob target) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::ModVulnerability(int resist, int value) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetModVulnerability(int resist) { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetDisableMelee(bool v) { +// Lua_Safe_Call_Void(Mob) +//} +// +//bool Lua_Mob::IsMeleeDisabled() { +// Lua_Safe_Call_Void(Mob) +//} +// +//void Lua_Mob::SetFlurryChance(int v) { +// Lua_Safe_Call_Void(Mob) +//} +// +//int Lua_Mob::GetFlurryChance() { +// Lua_Safe_Call_Void(Mob) +//} + + #endif diff --git a/zone/lua_mob.h b/zone/lua_mob.h index 619c29cf5..07b4b3de1 100644 --- a/zone/lua_mob.h +++ b/zone/lua_mob.h @@ -13,8 +13,15 @@ public: Lua_Mob(Mob *d) { d_ = d; } virtual ~Lua_Mob() { } - const char *GetName(); + operator Mob* () { + if(d_) { + return reinterpret_cast(d_); + } + return nullptr; + } + + const char *GetName(); void Depop(); void Depop(bool start_spawn_timer); void RogueAssassinate(Lua_Mob other); @@ -166,148 +173,183 @@ public: void Emote(const char *message); void InterruptSpell(); void InterruptSpell(int spell_id); - //CastSpell - //SpellFinished - //IsImmuneToSpell - //BuffFadeBySpellID - //BuffFadeByEffect - //BuffFadeAll - //BuffFadeBySlot - //CanBuffStack - //IsCasting - //CastingSpellID - //SetAppearance - //GetAppearance - //GetRunAnimSpeed - //SetRunAnimSpeed - //SetPetID - //GetPetID - //SetOwnerID - //GetOwnerID - //GetPetType - //GetBodyType - //Stun - //Spin - //Kill - //SetInvul - //GetInvul - //SetExtraHaste - //GetHaste - //GetMonkHandToHandDamage - //CanThisClassDoubleAttack - //CanThisClassDualWield - //CanThisClassRiposte - //CanThisClassDodge - //CanThisClassParry - //GetMonkHandToHandDelay - //GetClassLevelFactor - //Mesmerize - //IsMezzed - //IsStunned - //StartEnrage - //IsEnraged - //GetReverseFactionCon - //IsAIControlled - //GetAggroRange - //GetAssistRange - //SetPetOrder - //GetPetOrder - //IsRoamer - //IsRooted - //AddToHateList - //SetHate - //GetHateAmount - //GetDamageAmount - //GetHateTop - //GetHateDamageTop - //GetHateRandom - //IsEngaged - //HateSummon - //FaceTarget - //SetHeading - //WipeHateList - //CheckAggro - //CalculateHeadingToTarget - //CalculateNewPosition - //CalculateNewPosition2 - //CalculateDistance - //SendTo - //SendToFixZ - //NPCSpecialAttacks - //DontHealMeBefore - //DontBuffMeBefore - //DontDotMeBefore - //DontRootMeBefore - //DontSnareMeBefore - //GetResist - //GetShieldTarget - //SetShieldTarget - //Charmed - //GetLevelHP - //GetZoneID - //CheckAggroAmount - //CheckHealAggroAmount - //GetAA - //DivineAura - //AddFeignMemory - //RemoveFromFeignMemory - //ClearFeignMemory - //SetOOCRegen - //GetEntityVariable - //SetEntityVariable - //EntityVariableExists - //GetHateList - //SignalClient - //CombatRange - //DoSpecialAttackDamage - //CheckLoS - //CheckLoSToLoc - //FindGroundZ - //ProjectileAnim - //HasNPCSpecialAtk - //SendAppearanceEffect - //SetFlyMode - //SetTexture - //SetRace - //SetGender - //SendIllusion - //MakeTempPet - //QuestReward - //CameraEffect - //SpellEffect - //TempName - //GetItemStat - //SetGlobal - //TarGlobal - //DelGlobal - //SetSlotTint - //WearChange - //DoKnockback - //RemoveNimbusEffect - //IsRunning - //SetRunning - //SetBodyType - //SetDeltas - //SetLD - //SetTargetDestSteps - //SetTargetable - //MakeTempPet - //ModSkillDmgTaken - //GetModSkillDmgTaken - //GetSkillDmgTaken - //SetAllowBeneficial - //GetAllowBeneficial - //IsBeneficialAllowed - //ModVulnerability - //GetModVulnerability - //DoMeleeSkillAttackDmg - //DoArcheryAttackDmg - //DoThrowingAttackDmg - //SetDisableMelee - //IsMeleeDisabled - //SetFlurryChance - //GetFlurryChance + /*bool CastSpell(int spell_id, int target_id); + bool CastSpell(int spell_id, int target_id, int slot); + bool CastSpell(int spell_id, int target_id, int slot, int cast_time); + bool CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost); + bool CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot); + bool CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, int timer_duration); + bool CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, int timer_duration, + int resist_adjust); + bool SpellFinished(int spell_id, Lua_Mob target); + bool SpellFinished(int spell_id, Lua_Mob target, int slot); + bool SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used); + bool SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot); + bool SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust); + bool SpellFinished(int spell_id, Lua_Mob target, int slot, int mana_used, uint32 inventory_slot, int resist_adjust, bool proc); + void SpellEffect(Lua_Mob caster, int spell_id, double partial); + bool IsImmuneToSpell(int spell_id, Lua_Mob caster); + void BuffFadeBySpellID(int spell_id); + void BuffFadeByEffect(int effect_id, int skip_slot); + void BuffFadeAll(); + void BuffFadeDetrimental(); + void BuffFadeBySlot(int slot, bool recalc_bonuses); + void BuffFadeDetrimentalByCaster(Lua_Mob caster); + void BuffFadeBySitModifier(); + void BuffModifyDurationBySpellID(int spell_id, int new_duration); + int CanBuffStack(int spell_id, int caster_level, bool fail_if_overwrite); + bool IsCasting(); + int CastingSpellID(); + void SetAppearance(int app); + void SetAppearance(int app, bool ignore_self); + int GetAppearance(); + int GetPetID(); + int GetOwnerID(); + void SetPetType(int type); + int GetPetType(); + int GetBodyType(); + void SetBodyType(int type); + void Stun(int duration); + void UnStun(); + void Spin(); + void Kill(); + void SetInvul(bool invul); + bool GetInvul(); + void SetExtraHaste(int haste); + int GetHaste(); + int GetMonkHandToHandDamage(); + int GetMonkHandToHandDelay(); + bool CanThisClassDoubleAttack(); + bool CanThisClassDualWield(); + bool CanThisClassRiposte(); + bool CanThisClassDodge(); + bool CanThisClassParry(); + bool CanThisClassBlock(); + int GetClassLevelFactor(); + void Mesmerize(); + bool IsMezzed(); + bool IsStunned(); + void StartEnrage(); + bool IsEnraged(); + int GetReverseFactionCon(Lua_Mob other); + bool IsAIControlled(); + double GetAggroRange(); + double GetAssistRange(); + void SetPetOrder(int order); + int GetPetOrder(); + bool IsRoamer(); + bool IsRooted(); + void AddToHateList(Lua_Mob other); + void AddToHateList(Lua_Mob other, int hate); + void AddToHateList(Lua_Mob other, int hate, int damage); + void AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_help); + void AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_help, bool frenzy); + void AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_help, bool frenzy, bool buff_tic); + bool RemoveFromHateList(Lua_Mob mob); + void SetHate(Lua_Mob other); + void SetHate(Lua_Mob other, int hate); + void SetHate(Lua_Mob other, int hate, int damage); + uint32 GetHateAmount(Lua_Mob tmob); + uint32 GetHateAmount(Lua_Mob tmob, bool is_damage); + uint32 GetDamageAmount(Lua_Mob tmob); + Lua_Mob GetHateTop(); + Lua_Mob GetHateDamageTop(Lua_Mob other); + Lua_Mob GetHateRandom(); + Lua_Mob GetHateMost(); + bool IsEngaged(); + bool HateSummon(); + void FaceTarget(); + void FaceTarget(Lua_Mob mob_to_face); + void SetHeading(double new_h); + void WipeHateList(); + double CalculateHeadingToTarget(double x, double y); + double CalculateDistance(double x, double y, double z); + void SendTo(double new_x, double new_y, double new_z); + void SendToFixZ(double new_x, double new_y, double new_z); + void NPCSpecialAttacks(const char* parse, int permtag); + void NPCSpecialAttacks(const char* parse, int permtag, bool reset); + void NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool remove); + int GetResist(int type); + bool Charmed(); + uint32 GetLevelHP(int level); + uint32 GetAA(int level); + int CheckAggroAmount(int spell_id); + int CheckAggroAmount(int spell_id, bool is_proc); + int CheckHealAggroAmount(int spell_id); + int CheckHealAggroAmount(int spell_id, uint32 heal_possible); + bool DivineAura(); + void SetOOCRegen(int new_regen); + const char* GetEntityVariable(const char *id); + void SetEntityVariable(const char *id, const char *m_var); + bool EntityVariableExists(const char *id); + bool CombatRange(Lua_Mob other); + void DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage); + void DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage, int hate_override); + void DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage, int hate_override, int reuse_time); + void DoSpecialAttackDamage(Lua_Mob who, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, bool hit_chance); + void DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse); + void DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse, int chance_mod); + void DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse, int chance_mod, int focus); + void DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skillinuse, int chance_mod, int focus, bool can_riposte); + bool CheckLoS(Lua_Mob other); // make sure this is CheckLoSFN + bool CheckLoSToLoc(double x, double y, double z); + bool CheckLoSToLoc(double x, double y, double z, double mob_size); + double FindGroundZ(double new_x, double new_y); + double FindGroundZ(double new_x, double new_y, double z_offset); + void ProjectileAnimation(Lua_Mob to, int item_id); + void ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow); + void ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed); + void ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle); + void ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle, double tilt); + void ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle, double tilt, double arc); + bool HasNPCSpecialAtk(const char* parse); + void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5); + void SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, Lua_Client client); + void SetFlyMode(int value); + void SetTexture(int value); + void SetRace(int value); + void SetGender(int value); + void SendIllusionPacket(int in_race, int in_gender, int in_texture, int in_helmtexture, int in_haircolor, int in_beardcolor, + int in_eyecolor1, int in_eyecolor2, int in_hairstyle, int in_luclinface, int in_beard, int in_aa_title, + uint32 in_drakkin_heritage, uint32 in_drakkin_tattoo, uint32 in_drakkin_details, double in_size); + void QuestReward(Lua_Client c); + void QuestReward(Lua_Client c, uint32 silver); + void QuestReward(Lua_Client c, uint32 silver, uint32 gold); + void QuestReward(Lua_Client c, uint32 silver, uint32 gold, uint32 platinum); + void CameraEffect(uint32 duration, uint32 intensity); + void SendSpellEffect(uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20, bool perm_effect, + Lua_Client client); + void TempName(const char *new_name); + void SetGlobal(const char *var_name, const char *new_value, int options, const char *duration); + void SetGlobal(const char *var_name, const char *new_value, int options, const char *duration, Lua_Mob other); + void TarGlobal(const char *var_name, const char *value, const char *duration, int npc_id, int char_id, int zone_id); + void DelGlobal(const char *var_name); + void SetSlotTint(int slot, int red, int green, int blue); + void WearChange(int material_slot, int texture, uint32 color); + void DoKnockback(Lua_Mob caster, uint32 pushback, uint32 pushup); + void RemoveNimbusEffect(int effect_id); + bool IsRunning(); + void SetRunning(bool v); + void SetTargetable(bool v); + void ModSkillDmgTaken(int skill_num, int value); + int GetModSkillDmgTaken(int skill_num); + int GetSkillDmgTaken(int skill_num); + void SetAllowBeneficial(bool v); + bool GetAllowBeneficial(); + bool IsBeneficialAllowed(Lua_Mob target); + void ModVulnerability(int resist, int value); + int GetModVulnerability(int resist); + void SetDisableMelee(bool v); + bool IsMeleeDisabled(); + void SetFlurryChance(int v); + int GetFlurryChance(); + */ + + //GetHateList - Requires classes not yet exported + //SignalClient - Gonna do this differently + //DoArcheryAttackDmg - Requires classes not yet exported + //DoThrowingAttackDmg - Requires classes not yet exported }; #endif diff --git a/zone/lua_npc.h b/zone/lua_npc.h index 673c1af8f..862757b37 100644 --- a/zone/lua_npc.h +++ b/zone/lua_npc.h @@ -12,6 +12,14 @@ public: Lua_NPC() { d_ = nullptr; } Lua_NPC(NPC *d) { d_ = d; } virtual ~Lua_NPC() { } + + operator NPC* () { + if(d_) { + return reinterpret_cast(d_); + } + + return nullptr; + } }; #endif diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index b1469f4cb..c817c185f 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -83,23 +83,23 @@ LuaParser::~LuaParser() { ClearStates(); } -double LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { +int LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { if(evt >= _LargestEventID) { - return 100.0; + return 0; } if(!npc) { - return 100.0; + return 0; } if(evt != EVENT_SPAWN && evt != EVENT_SAY) { - return 100.0; + return 0; } const char *sub_name = LuaEvents[evt]; if(!HasQuestSub(npc->GetNPCTypeID(), sub_name)) { - return 100.0; + return 0; } std::stringstream package_name; @@ -108,7 +108,7 @@ double LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string da lua_State *L = nullptr; auto iter = states_.find(package_name.str()); if(iter == states_.end()) { - return 100.0; + return 0; } L = iter->second; @@ -136,40 +136,40 @@ double LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string da if(lua_pcall(L, arg_count, ret_count, 0)) { printf("Error: %s\n", lua_tostring(L, -1)); - return 100.0; + return 0; } if(lua_isnumber(L, -1)) { - double ret = lua_tonumber(L, -1); + int ret = static_cast(lua_tointeger(L, -1)); return ret; } } catch(std::exception &ex) { printf("%s\n", ex.what()); - return 100.0; + return 0; } - return 100.0; + return 0; } -double LuaParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { - return 100.0; +int LuaParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { + return 0; } -double LuaParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { - return 100.0; +int LuaParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { + return 0; } -double LuaParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { - return 100.0; +int LuaParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { + return 0; } -double LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { - return 100.0; +int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { + return 0; } -double LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { - return 100.0; +int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { + return 00; } bool LuaParser::HasQuestSub(uint32 npc_id, const char *subname) { @@ -343,7 +343,8 @@ void LuaParser::MapFunctions(lua_State *L) { [ luabind::class_("Entity") .def(luabind::constructor<>()) - .def("NullPtr", &Lua_Entity::NullPtr) + .property("null", &Lua_Entity::Null) + .property("valid", &Lua_Entity::Valid) .def("IsClient", &Lua_Entity::IsClient) .def("IsNPC", &Lua_Entity::IsNPC) .def("IsMob", &Lua_Entity::IsMob) diff --git a/zone/lua_parser.h b/zone/lua_parser.h index 859ab8838..74397d432 100644 --- a/zone/lua_parser.h +++ b/zone/lua_parser.h @@ -17,12 +17,12 @@ public: LuaParser(); ~LuaParser(); - virtual double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - virtual double EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); - virtual double EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - virtual double EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); - virtual double EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); - virtual double EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); + virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + virtual int EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data); + virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data); + virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data); + virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data); virtual bool HasQuestSub(uint32 npc_id, const char *subname); virtual bool HasGlobalQuestSub(const char *subname); diff --git a/zone/mob.h b/zone/mob.h index 3c3767842..44b7b9f6e 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -693,38 +693,38 @@ public: void ProcessFlee(); void CheckFlee(); - inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);} - float CalculateHeadingToTarget(float in_x, float in_y); - bool CalculateNewPosition(float x, float y, float z, float speed, bool checkZ = false); - virtual bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = true); - float CalculateDistance(float x, float y, float z); - float GetGroundZ(float new_x, float new_y, float z_offset=0.0); - void SendTo(float new_x, float new_y, float new_z); - void SendToFixZ(float new_x, float new_y, float new_z); - void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false); - inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; } - inline uint32 DontBuffMeBefore() const { return pDontBuffMeBefore; } - inline uint32 DontDotMeBefore() const { return pDontDotMeBefore; } - inline uint32 DontRootMeBefore() const { return pDontRootMeBefore; } - inline uint32 DontSnareMeBefore() const { return pDontSnareMeBefore; } - inline uint32 DontCureMeBefore() const { return pDontCureMeBefore; } - void SetDontRootMeBefore(uint32 time) { pDontRootMeBefore = time; } - void SetDontHealMeBefore(uint32 time) { pDontHealMeBefore = time; } - void SetDontBuffMeBefore(uint32 time) { pDontBuffMeBefore = time; } - void SetDontDotMeBefore(uint32 time) { pDontDotMeBefore = time; } - void SetDontSnareMeBefore(uint32 time) { pDontSnareMeBefore = time; } - void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } + inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);} + float CalculateHeadingToTarget(float in_x, float in_y); + bool CalculateNewPosition(float x, float y, float z, float speed, bool checkZ = false); + virtual bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = true); + float CalculateDistance(float x, float y, float z); + float GetGroundZ(float new_x, float new_y, float z_offset=0.0); + void SendTo(float new_x, float new_y, float new_z); + void SendToFixZ(float new_x, float new_y, float new_z); + void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false); + inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; } + inline uint32 DontBuffMeBefore() const { return pDontBuffMeBefore; } + inline uint32 DontDotMeBefore() const { return pDontDotMeBefore; } + inline uint32 DontRootMeBefore() const { return pDontRootMeBefore; } + inline uint32 DontSnareMeBefore() const { return pDontSnareMeBefore; } + inline uint32 DontCureMeBefore() const { return pDontCureMeBefore; } + void SetDontRootMeBefore(uint32 time) { pDontRootMeBefore = time; } + void SetDontHealMeBefore(uint32 time) { pDontHealMeBefore = time; } + void SetDontBuffMeBefore(uint32 time) { pDontBuffMeBefore = time; } + void SetDontDotMeBefore(uint32 time) { pDontDotMeBefore = time; } + void SetDontSnareMeBefore(uint32 time) { pDontSnareMeBefore = time; } + void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } // calculate interruption of spell via movement of mob void SaveSpellLoc() {spell_x = x_pos; spell_y = y_pos; spell_z = z_pos; } inline float GetSpellX() const {return spell_x;} inline float GetSpellY() const {return spell_y;} inline float GetSpellZ() const {return spell_z;} - inline bool IsGrouped() const { return isgrouped; } + inline bool IsGrouped() const { return isgrouped; } void SetGrouped(bool v); inline bool IsRaidGrouped() const { return israidgrouped; } void SetRaidGrouped(bool v); - inline bool IsLooting() const { return islooting; } + inline bool IsLooting() const { return islooting; } void SetLooting(bool val) { islooting = val; } bool CheckWillAggro(Mob *mob); diff --git a/zone/pets.h b/zone/pets.h index 420e69699..d215ea831 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -25,27 +25,6 @@ Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power); }; -/* - * I dont have the patience to take on this project today.... -class Pet : public NPC { -public: - enum eStandingPetOrder { SPO_Follow, SPO_Sit, SPO_Guard }; - - - const uint16 pet_spell_id; - - inline void SetPetOrder(eStandingPetOrder i) { pStandingPetOrder = i; } - inline eStandingPetOrder GetPetOrder() const { return pStandingPetOrder; } -// void SetPetType(uint16 in_type) { typeofpet = in_type; } // put this here because only NPCs can be anything but charmed pets - void GetPetState(SpellBuff_Struct *buffs, uint32 *items, char *name); - void SetPetState(SpellBuff_Struct *buffs, uint32 *items); -protected: -// uint16 typeofpet; // 0xFF = charmed - - eStandingPetOrder pStandingPetOrder; - bool taunting; - Timer taunt_timer; //for pet taunting -};*/ #endif