diff --git a/zone/lua_entity.cpp b/zone/lua_entity.cpp index 1daf94b8d..ea35597be 100644 --- a/zone/lua_entity.cpp +++ b/zone/lua_entity.cpp @@ -6,6 +6,10 @@ #include "lua_client.h" #include "lua_npc.h" +bool Lua_Entity::NullPtr() { + return d_ == nullptr; +} + bool Lua_Entity::IsClient() { Entity *ent = reinterpret_cast(d_); return ent->IsClient(); diff --git a/zone/lua_entity.h b/zone/lua_entity.h index c73be6590..50596382a 100644 --- a/zone/lua_entity.h +++ b/zone/lua_entity.h @@ -24,6 +24,7 @@ public: Lua_Entity(Entity *d) : d_(d) { } virtual ~Lua_Entity() { } + bool NullPtr(); bool IsClient(); bool IsNPC(); bool IsMob(); diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 28d42532a..b43b28594 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -158,5 +158,594 @@ void Lua_Mob::HealDamage(uint32 amount, Lua_Mob other) { m->HealDamage(amount, o); } +uint32 Lua_Mob::GetLevelCon(int other) { + Mob *m = reinterpret_cast(d_); + return m->GetLevelCon(other); +} + +uint32 Lua_Mob::GetLevelCon(int my, int other) { + Mob *m = reinterpret_cast(d_); + return m->GetLevelCon(my, other); +} + +void Lua_Mob::SetHP(int hp) { + Mob *m = reinterpret_cast(d_); + m->SetHP(hp); +} + +void Lua_Mob::DoAnim(int anim_num) { + DoAnim(anim_num, 0, true, 0); +} + +void Lua_Mob::DoAnim(int anim_num, int type) { + DoAnim(anim_num, type, true, 0); +} + +void Lua_Mob::DoAnim(int anim_num, int type, bool ackreq) { + DoAnim(anim_num, type, ackreq, 0); +} + +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)); +} + +void Lua_Mob::ChangeSize(double in_size) { + ChangeSize(in_size, false); +} + +void Lua_Mob::ChangeSize(double in_size, bool no_restriction) { + Mob *m = reinterpret_cast(d_); + m->ChangeSize(in_size, no_restriction); +} + +void Lua_Mob::GMMove(double x, double y, double z) { + GMMove(x, y, z, 0.01, true); +} + +void Lua_Mob::GMMove(double x, double y, double z, double heading) { + GMMove(x, y, z, heading, true); +} + +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); +} + +void Lua_Mob::SendPosUpdate() { + SendPosUpdate(false); +} + +void Lua_Mob::SendPosUpdate(bool send_to_self) { + Mob *m = reinterpret_cast(d_); + m->SendPosUpdate(send_to_self ? 1 : 0); +} + +void Lua_Mob::SendPosition() { + Mob *m = reinterpret_cast(d_); + m->SendPosition(); +} + +bool Lua_Mob::HasProcs() { + Mob *m = reinterpret_cast(d_); + return m->HasProcs(); +} + +bool Lua_Mob::IsInvisible() { + return IsInvisible(Lua_Mob(nullptr)); +} + +bool Lua_Mob::IsInvisible(Lua_Mob other) { + Mob *m = reinterpret_cast(d_); + Lua_Safe_Cast(Mob, o, other); + + return m->IsInvisible(o); +} + +void Lua_Mob::SetInvisible(int state) { + Mob *m = reinterpret_cast(d_); + m->SetInvisible(state); +} + +bool Lua_Mob::FindBuff(int spell_id) { + Mob *m = reinterpret_cast(d_); + return m->FindBuff(spell_id); +} + +bool Lua_Mob::FindType(int type) { + return FindType(type, false, 100); +} + +bool Lua_Mob::FindType(int type, bool offensive) { + return FindType(type, offensive, 100); +} + +bool Lua_Mob::FindType(int type, bool offensive, int threshold) { + Mob *m = reinterpret_cast(d_); + return m->FindType(type, offensive, threshold); +} + +int Lua_Mob::GetBuffSlotFromType(int slot) { + Mob *m = reinterpret_cast(d_); + return m->GetBuffSlotFromType(slot); +} + +void Lua_Mob::MakePet(int spell_id, const char* pet_type) { + MakePet(spell_id, pet_type, nullptr); +} + +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); +} + +void Lua_Mob::MakePoweredPet(int spell_id, const char* pet_type, int pet_power) { + MakePoweredPet(spell_id, pet_type, pet_power, nullptr); +} + +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); +} + +int Lua_Mob::GetBaseRace() { + Mob *m = reinterpret_cast(d_); + return m->GetBaseRace(); +} + +int Lua_Mob::GetBaseGender() { + Mob *m = reinterpret_cast(d_); + return m->GetBaseGender(); +} + +int Lua_Mob::GetDeity() { + Mob *m = reinterpret_cast(d_); + return m->GetDeity(); +} + +int Lua_Mob::GetRace() { + Mob *m = reinterpret_cast(d_); + return m->GetRace(); +} + +int Lua_Mob::GetGender() { + Mob *m = reinterpret_cast(d_); + return m->GetGender(); +} + +int Lua_Mob::GetTexture() { + Mob *m = reinterpret_cast(d_); + return m->GetTexture(); +} + +int Lua_Mob::GetHelmTexture() { + Mob *m = reinterpret_cast(d_); + return m->GetHelmTexture(); +} + +int Lua_Mob::GetHairColor() { + Mob *m = reinterpret_cast(d_); + return m->GetHairColor(); +} + +int Lua_Mob::GetBeardColor() { + Mob *m = reinterpret_cast(d_); + return m->GetBeardColor(); +} + +int Lua_Mob::GetEyeColor1() { + Mob *m = reinterpret_cast(d_); + return m->GetEyeColor1(); +} + +int Lua_Mob::GetEyeColor2() { + Mob *m = reinterpret_cast(d_); + return m->GetEyeColor2(); +} + +int Lua_Mob::GetHairStyle() { + Mob *m = reinterpret_cast(d_); + return m->GetHairStyle(); +} + +int Lua_Mob::GetLuclinFace() { + Mob *m = reinterpret_cast(d_); + return m->GetLuclinFace(); +} + +int Lua_Mob::GetBeard() { + Mob *m = reinterpret_cast(d_); + return m->GetBeard(); +} + +int Lua_Mob::GetDrakkinHeritage() { + Mob *m = reinterpret_cast(d_); + return m->GetDrakkinHeritage(); +} + +int Lua_Mob::GetDrakkinTattoo() { + Mob *m = reinterpret_cast(d_); + return m->GetDrakkinTattoo(); +} + +int Lua_Mob::GetDrakkinDetails() { + Mob *m = reinterpret_cast(d_); + return m->GetDrakkinDetails(); +} + +int Lua_Mob::GetClass() { + Mob *m = reinterpret_cast(d_); + return m->GetClass(); +} + +int Lua_Mob::GetLevel() { + Mob *m = reinterpret_cast(d_); + return m->GetLevel(); +} + +const char *Lua_Mob::GetCleanName() { + Mob *m = reinterpret_cast(d_); + return m->GetCleanName(); +} + +Lua_Mob Lua_Mob::GetTarget() { + Mob *m = reinterpret_cast(d_); + return Lua_Mob(m->GetTarget()); +} + +void Lua_Mob::SetTarget(Lua_Mob t) { + Mob *m = reinterpret_cast(d_); + Lua_Safe_Cast(Mob, tar, t); + m->SetTarget(tar); +} + +double Lua_Mob::GetHPRatio() { + Mob *m = reinterpret_cast(d_); + return m->GetHPRatio(); +} + +bool Lua_Mob::IsWarriorClass() { + Mob *m = reinterpret_cast(d_); + return m->IsWarriorClass(); +} + +int Lua_Mob::GetHP() { + Mob *m = reinterpret_cast(d_); + return m->GetHP(); +} + +int Lua_Mob::GetMaxHP() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxHP(); +} + +int Lua_Mob::GetItemHPBonuses() { + Mob *m = reinterpret_cast(d_); + return m->GetItemHPBonuses(); +} + +int Lua_Mob::GetSpellHPBonuses() { + Mob *m = reinterpret_cast(d_); + return m->GetSpellHPBonuses(); +} + +double Lua_Mob::GetWalkspeed() { + Mob *m = reinterpret_cast(d_); + return m->GetWalkspeed(); +} + +double Lua_Mob::GetRunspeed() { + Mob *m = reinterpret_cast(d_); + return m->GetRunspeed(); +} + +int Lua_Mob::GetCasterLevel(int spell_id) { + Mob *m = reinterpret_cast(d_); + return m->GetCasterLevel(spell_id); +} + +int Lua_Mob::GetMaxMana() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxMana(); +} + +int Lua_Mob::GetMana() { + Mob *m = reinterpret_cast(d_); + return m->GetMana(); +} + +int Lua_Mob::SetMana(int mana) { + Mob *m = reinterpret_cast(d_); + return m->SetMana(mana); +} + +double Lua_Mob::GetManaRatio() { + Mob *m = reinterpret_cast(d_); + return m->GetManaRatio(); +} + +int Lua_Mob::GetAC() { + Mob *m = reinterpret_cast(d_); + return m->GetAC(); +} + +int Lua_Mob::GetATK() { + Mob *m = reinterpret_cast(d_); + return m->GetATK(); +} + +int Lua_Mob::GetSTR() { + Mob *m = reinterpret_cast(d_); + return m->GetSTR(); +} + +int Lua_Mob::GetSTA() { + Mob *m = reinterpret_cast(d_); + return m->GetSTA(); +} + +int Lua_Mob::GetDEX() { + Mob *m = reinterpret_cast(d_); + return m->GetDEX(); +} + +int Lua_Mob::GetAGI() { + Mob *m = reinterpret_cast(d_); + return m->GetAGI(); +} + +int Lua_Mob::GetINT() { + Mob *m = reinterpret_cast(d_); + return m->GetINT(); +} + +int Lua_Mob::GetWIS() { + Mob *m = reinterpret_cast(d_); + return m->GetWIS(); +} + +int Lua_Mob::GetCHA() { + Mob *m = reinterpret_cast(d_); + return m->GetCHA(); +} + +int Lua_Mob::GetMR() { + Mob *m = reinterpret_cast(d_); + return m->GetMR(); +} + +int Lua_Mob::GetFR() { + Mob *m = reinterpret_cast(d_); + return m->GetFR(); +} + +int Lua_Mob::GetDR() { + Mob *m = reinterpret_cast(d_); + return m->GetDR(); +} + +int Lua_Mob::GetPR() { + Mob *m = reinterpret_cast(d_); + return m->GetPR(); +} + +int Lua_Mob::GetCR() { + Mob *m = reinterpret_cast(d_); + return m->GetCR(); +} + +int Lua_Mob::GetCorruption() { + Mob *m = reinterpret_cast(d_); + return m->GetCorrup(); +} + +int Lua_Mob::GetMaxSTR() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxSTR(); +} + +int Lua_Mob::GetMaxSTA() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxSTA(); +} + +int Lua_Mob::GetMaxDEX() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxDEX(); +} + +int Lua_Mob::GetMaxAGI() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxAGI(); +} + +int Lua_Mob::GetMaxINT() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxINT(); +} + +int Lua_Mob::GetMaxWIS() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxWIS(); +} + +int Lua_Mob::GetMaxCHA() { + Mob *m = reinterpret_cast(d_); + return m->GetMaxCHA(); +} + +double Lua_Mob::GetActSpellRange(int spell_id, double range) { + return GetActSpellRange(spell_id, range, false); +} + +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); +} + +int Lua_Mob::GetActSpellDamage(int spell_id, int value) { + Mob *m = reinterpret_cast(d_); + return m->GetActSpellDamage(spell_id, value); +} + +int Lua_Mob::GetActSpellHealing(int spell_id, int value) { + Mob *m = reinterpret_cast(d_); + return m->GetActSpellHealing(spell_id, value); +} + +int Lua_Mob::GetActSpellCost(int spell_id, int cost) { + Mob *m = reinterpret_cast(d_); + return m->GetActSpellCost(spell_id, cost); +} + +int Lua_Mob::GetActSpellDuration(int spell_id, int duration) { + Mob *m = reinterpret_cast(d_); + return m->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); +} + +double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster) { + return ResistSpell(resist_type, spell_id, caster, false, 0, false); +} + +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); +} + +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); +} + +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); +} + +int Lua_Mob::GetSpecializeSkillValue(int spell_id) { + Mob *m = reinterpret_cast(d_); + return m->GetSpecializeSkillValue(spell_id); +} + +int Lua_Mob::GetNPCTypeID() { + Mob *m = reinterpret_cast(d_); + return m->GetNPCTypeID(); +} + +bool Lua_Mob::IsTargeted() { + Mob *m = reinterpret_cast(d_); + return m->IsTargeted(); +} + +double Lua_Mob::GetX() { + Mob *m = reinterpret_cast(d_); + return m->GetX(); +} + +double Lua_Mob::GetY() { + Mob *m = reinterpret_cast(d_); + return m->GetY(); +} + +double Lua_Mob::GetZ() { + Mob *m = reinterpret_cast(d_); + return m->GetZ(); +} + +double Lua_Mob::GetHeading() { + Mob *m = reinterpret_cast(d_); + return m->GetHeading(); +} + +double Lua_Mob::GetWaypointX() { + Mob *m = reinterpret_cast(d_); + return m->GetCWPX(); +} + +double Lua_Mob::GetWaypointY() { + Mob *m = reinterpret_cast(d_); + return m->GetCWPY(); +} + +double Lua_Mob::GetWaypointZ() { + Mob *m = reinterpret_cast(d_); + return m->GetCWPZ(); +} + +double Lua_Mob::GetWaypointH() { + Mob *m = reinterpret_cast(d_); + return m->GetCWPH(); +} + +double Lua_Mob::GetWaypointPause() { + Mob *m = reinterpret_cast(d_); + return m->GetCWPP(); +} + +int Lua_Mob::GetWaypointID() { + Mob *m = reinterpret_cast(d_); + return m->GetCWP(); +} + +void Lua_Mob::SetCurrentWP(int wp) { + Mob *m = reinterpret_cast(d_); + m->SetCurrentWP(wp); +} + +double Lua_Mob::GetSize() { + Mob *m = reinterpret_cast(d_); + return m->GetSize(); +} + +void Lua_Mob::SetFollowID(int id) { + Mob *m = reinterpret_cast(d_); + m->SetFollowID(id); +} + +int Lua_Mob::GetFollowID() { + Mob *m = reinterpret_cast(d_); + return m->GetFollowID(); +} + +void Lua_Mob::Message(int type, const char *message) { + Mob *m = reinterpret_cast(d_); + m->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); +} + +void Lua_Mob::Say(const char *message) { + Mob *m = reinterpret_cast(d_); + m->Say(message); +} + +void Lua_Mob::Shout(const char *message) { + Mob *m = reinterpret_cast(d_); + m->Shout(message); +} + +void Lua_Mob::Emote(const char *message) { + Mob *m = reinterpret_cast(d_); + m->Emote(message); +} + +void Lua_Mob::InterruptSpell() { + InterruptSpell(65535U); +} + +void Lua_Mob::InterruptSpell(int spell_id) { + Mob *m = reinterpret_cast(d_); + m->InterruptSpell(spell_id); +} + #endif diff --git a/zone/lua_mob.h b/zone/lua_mob.h index f4dbb56e3..619c29cf5 100644 --- a/zone/lua_mob.h +++ b/zone/lua_mob.h @@ -46,96 +46,268 @@ public: void Heal(); void HealDamage(uint32 amount); void HealDamage(uint32 amount, Lua_Mob other); + uint32 GetLevelCon(int other); + uint32 GetLevelCon(int my, int other); + void SetHP(int hp); + void DoAnim(int anim_num); + void DoAnim(int anim_num, int type); + void DoAnim(int anim_num, int type, bool ackreq); + void DoAnim(int anim_num, int type, bool ackreq, int filter); + void ChangeSize(double in_size); + void ChangeSize(double in_size, bool no_restriction); + void GMMove(double x, double y, double z); + void GMMove(double x, double y, double z, double heading); + void GMMove(double x, double y, double z, double heading, bool send_update); + void SendPosUpdate(); + void SendPosUpdate(bool send_to_self); + void SendPosition(); + bool HasProcs(); + bool IsInvisible(); + bool IsInvisible(Lua_Mob other); + void SetInvisible(int state); + bool FindBuff(int spell_id); + bool FindType(int type); + bool FindType(int type, bool offensive); + bool FindType(int type, bool offensive, int threshold); + int GetBuffSlotFromType(int slot); + void MakePet(int spell_id, const char* pet_type); + void MakePet(int spell_id, const char* pet_type, const char *pet_name); + void MakePoweredPet(int spell_id, const char* pet_type, int pet_power); + void MakePoweredPet(int spell_id, const char* pet_type, int pet_power, const char *pet_name); + int GetBaseRace(); + int GetBaseGender(); + int GetDeity(); + int GetRace(); + int GetGender(); + int GetTexture(); + int GetHelmTexture(); + int GetHairColor(); + int GetBeardColor(); + int GetEyeColor1(); + int GetEyeColor2(); + int GetHairStyle(); + int GetLuclinFace(); + int GetBeard(); + int GetDrakkinHeritage(); + int GetDrakkinTattoo(); + int GetDrakkinDetails(); + int GetClass(); + int GetLevel(); + const char *GetCleanName(); + Lua_Mob GetTarget(); + void SetTarget(Lua_Mob t); + double GetHPRatio(); + bool IsWarriorClass(); + int GetHP(); + int GetMaxHP(); + int GetItemHPBonuses(); + int GetSpellHPBonuses(); + double GetWalkspeed(); + double GetRunspeed(); + int GetCasterLevel(int spell_id); + int GetMaxMana(); + int GetMana(); + int SetMana(int mana); + double GetManaRatio(); + int GetAC(); + int GetATK(); + int GetSTR(); + int GetSTA(); + int GetDEX(); + int GetAGI(); + int GetINT(); + int GetWIS(); + int GetCHA(); + int GetMR(); + int GetFR(); + int GetDR(); + int GetPR(); + int GetCR(); + int GetCorruption(); + int GetMaxSTR(); + int GetMaxSTA(); + int GetMaxDEX(); + int GetMaxAGI(); + int GetMaxINT(); + int GetMaxWIS(); + int GetMaxCHA(); + double GetActSpellRange(int spell_id, double range); + double GetActSpellRange(int spell_id, double range, bool is_bard); + int GetActSpellDamage(int spell_id, int value); + int GetActSpellHealing(int spell_id, int value); + int GetActSpellCost(int spell_id, int cost); + int GetActSpellDuration(int spell_id, int duration); + int GetActSpellCasttime(int spell_id, int cast_time); + double ResistSpell(int resist_type, int spell_id, Lua_Mob caster); + double ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override); + double ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override); + double ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override, bool charisma_check); + int GetSpecializeSkillValue(int spell_id); + int GetNPCTypeID(); + bool IsTargeted(); + double GetX(); + double GetY(); + double GetZ(); + double GetHeading(); + double GetWaypointX(); + double GetWaypointY(); + double GetWaypointZ(); + double GetWaypointH(); + double GetWaypointPause(); + int GetWaypointID(); + void SetCurrentWP(int wp); + double GetSize(); + void SetFollowID(int id); + int GetFollowID(); + void Message(int type, const char *message); + void Message_StringID(int type, int string_id, uint32 distance); + void Say(const char *message); + void Shout(const char *message); + 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 - //uint32 GetLevelCon(int other); - //uint32 GetLevelCon(int my, int other); - //void SetHP(int hp); - //void DoAnim(int anim_num); - //void DoAnim(int anim_num, int type); - //void DoAnim(int anim_num, int type, bool ackreq); - //void DoAnim(int anim_num, int type, bool ackreq, eqFilterType filter); - //void ChangeSize(float in_size); - //void ChangeSize(float in_size, bool no_restriction); - //void GMMove(float x, float y, float z); - //void GMMove(float x, float y, float z, float heading); - //void GMMove(float x, float y, float z, float heading, bool SendUpdate); - //void SendPosUpdate(); - //void SendPosUpdate(bool send_to_self); - //void SendPosition(); - //bool HasProcs(); - //bool IsInvisible(); - //bool IsInvisible(Lua_Mob other); - //void SetInvisible(int state); - //bool FindBuff(uint16 spell_id); - //bool FindType(uint16 type); - //bool FindType(uint16 type, bool bOffensive); - //bool FindType(uint16 type, bool bOffensive, uint16 threshold); - //int GetBuffSlotFromType(int slot); - //void MakePet(int spell_id, const char* pet_type); - //void MakePet(int spell_id, const char* pet_type, const char *pet_name); - //void MakePoweredPet(int spell_id, const char* pet_type); - //void MakePoweredPet(int spell_id, const char* pet_type, int pet_power); - //void MakePoweredPet(int spell_id, const char* pet_type, int pet_power, const char *pet_name); - //int GetBaseRace(); - //int GetBaseGender(); - //int GetDeity(); - //int GetRace(); - //int GetGender(); - //int GetTexture(); - //int GetHelmTexture(); - //int GetHairColor(); - //int GetBeardColor(); - //int GetEyeColor1(); - //int GetEyeColor2(); - //int GetHairStyle(); - //int GetLuclinFace(); - //int GetBeard(); - //int GetDrakkinHeritage(); - //int GetDrakkinTattoo(); - //int GetDrakkinDetails(); - //int GetClass(); - //int GetLevel(); - //const char *GetCleanName(); - //Lua_Mob GetTarget(); - //void SetTarget(Lua_Mob t); -/* - -"GetHPRatio"), XS_Mob_GetHPRatio, file, "$"); -"IsWarriorClass"), XS_Mob_IsWarriorClass, file, "$"); -"GetHP"), XS_Mob_GetHP, file, "$"); -"GetMaxHP"), XS_Mob_GetMaxHP, file, "$"); -"GetItemHPBonuses"), XS_Mob_GetItemHPBonuses, file, "$"); -"GetSpellHPBonuses"), XS_Mob_GetSpellHPBonuses, file, "$"); -"GetWalkspeed"), XS_Mob_GetWalkspeed, file, "$"); -"GetRunspeed"), XS_Mob_GetRunspeed, file, "$"); -"GetCasterLevel"), XS_Mob_GetCasterLevel, file, "$$"); -"GetMaxMana"), XS_Mob_GetMaxMana, file, "$"); -"GetMana"), XS_Mob_GetMana, file, "$"); -"SetMana"), XS_Mob_SetMana, file, "$$"); -"GetManaRatio"), XS_Mob_GetManaRatio, file, "$"); -"GetAC"), XS_Mob_GetAC, file, "$"); -"GetATK"), XS_Mob_GetATK, file, "$"); -"GetSTR"), XS_Mob_GetSTR, file, "$"); -"GetSTA"), XS_Mob_GetSTA, file, "$"); -"GetDEX"), XS_Mob_GetDEX, file, "$"); -"GetAGI"), XS_Mob_GetAGI, file, "$"); -"GetINT"), XS_Mob_GetINT, file, "$"); -"GetWIS"), XS_Mob_GetWIS, file, "$"); -"GetCHA"), XS_Mob_GetCHA, file, "$"); -"GetMR"), XS_Mob_GetMR, file, "$"); -"GetFR"), XS_Mob_GetFR, file, "$"); -"GetDR"), XS_Mob_GetDR, file, "$"); -"GetPR"), XS_Mob_GetPR, file, "$"); -"GetCR"), XS_Mob_GetCR, file, "$"); -"GetCorruption"), XS_Mob_GetCR, file, "$"); -"GetMaxSTR"), XS_Mob_GetMaxSTR, file, "$"); -"GetMaxSTA"), XS_Mob_GetMaxSTA, file, "$"); -"GetMaxDEX"), XS_Mob_GetMaxDEX, file, "$"); -"GetMaxAGI"), XS_Mob_GetMaxAGI, file, "$"); -"GetMaxINT"), XS_Mob_GetMaxINT, file, "$"); -"GetMaxWIS"), XS_Mob_GetMaxWIS, file, "$"); -"GetMaxCHA"), XS_Mob_GetMaxCHA, file, "$"); -*/ }; #endif diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 6cd3eb050..b1469f4cb 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -92,6 +92,11 @@ double LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string da return 100.0; } + if(evt != EVENT_SPAWN && evt != EVENT_SAY) { + return 100.0; + } + + const char *sub_name = LuaEvents[evt]; if(!HasQuestSub(npc->GetNPCTypeID(), sub_name)) { return 100.0; @@ -107,15 +112,28 @@ double LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string da } L = iter->second; - Lua_NPC l_npc(npc); - try { - luabind::object l_npc_o = luabind::object(L, l_npc); lua_getfield(L, LUA_GLOBALSINDEX, sub_name); + + Lua_NPC l_npc(npc); + Lua_Client l_client; + luabind::object l_npc_o = luabind::object(L, l_npc); + l_npc_o.push(L); + int arg_count = 1; int ret_count = 1; - l_npc_o.push(L); + if(evt == EVENT_SAY) { + l_client.d_ = init; + luabind::object l_client_o = luabind::object(L, l_client); + l_client_o.push(L); + + lua_pushstring(L, data.c_str()); + lua_pushinteger(L, extra_data); + + arg_count += 3; + } + if(lua_pcall(L, arg_count, ret_count, 0)) { printf("Error: %s\n", lua_tostring(L, -1)); return 100.0; @@ -325,6 +343,7 @@ void LuaParser::MapFunctions(lua_State *L) { [ luabind::class_("Entity") .def(luabind::constructor<>()) + .def("NullPtr", &Lua_Entity::NullPtr) .def("IsClient", &Lua_Entity::IsClient) .def("IsNPC", &Lua_Entity::IsNPC) .def("IsMob", &Lua_Entity::IsMob) @@ -372,7 +391,128 @@ void LuaParser::MapFunctions(lua_State *L) { .def("ThrowingAttack", &Lua_Mob::ThrowingAttack) .def("Heal", &Lua_Mob::Heal) .def("HealDamage", (void(Lua_Mob::*)(uint32))&Lua_Mob::HealDamage) - .def("HealDamage", (void(Lua_Mob::*)(uint32,Lua_Mob))&Lua_Mob::HealDamage), + .def("HealDamage", (void(Lua_Mob::*)(uint32,Lua_Mob))&Lua_Mob::HealDamage) + .def("GetLevelCon", (uint32(Lua_Mob::*)(int))&Lua_Mob::GetLevelCon) + .def("GetLevelCon", (uint32(Lua_Mob::*)(int,int))&Lua_Mob::GetLevelCon) + .def("SetHP", &Lua_Mob::SetHP) + .def("DoAnim", (void(Lua_Mob::*)(int))&Lua_Mob::DoAnim) + .def("DoAnim", (void(Lua_Mob::*)(int,int))&Lua_Mob::DoAnim) + .def("DoAnim", (void(Lua_Mob::*)(int,int,bool))&Lua_Mob::DoAnim) + .def("DoAnim", (void(Lua_Mob::*)(int,int,bool,int))&Lua_Mob::DoAnim) + .def("ChangeSize", (void(Lua_Mob::*)(double))&Lua_Mob::ChangeSize) + .def("ChangeSize", (void(Lua_Mob::*)(double,bool))&Lua_Mob::ChangeSize) + .def("GMMove", (void(Lua_Mob::*)(double,double,double))&Lua_Mob::GMMove) + .def("GMMove", (void(Lua_Mob::*)(double,double,double,double))&Lua_Mob::GMMove) + .def("GMMove", (void(Lua_Mob::*)(double,double,double,double,bool))&Lua_Mob::GMMove) + .def("SendPosUpdate", (void(Lua_Mob::*)(void))&Lua_Mob::SendPosUpdate) + .def("SendPosUpdate", (void(Lua_Mob::*)(bool))&Lua_Mob::SendPosUpdate) + .def("SendPosition", &Lua_Mob::SendPosition) + .def("HasProcs", &Lua_Mob::HasProcs) + .def("IsInvisible", (bool(Lua_Mob::*)(void))&Lua_Mob::IsInvisible) + .def("IsInvisible", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsInvisible) + .def("SetInvisible", &Lua_Mob::SetInvisible) + .def("FindBuff", &Lua_Mob::FindBuff) + .def("FindType", (bool(Lua_Mob::*)(int))&Lua_Mob::FindType) + .def("FindType", (bool(Lua_Mob::*)(int,bool))&Lua_Mob::FindType) + .def("FindType", (bool(Lua_Mob::*)(int,bool,int))&Lua_Mob::FindType) + .def("GetBuffSlotFromType", &Lua_Mob::GetBuffSlotFromType) + .def("MakePet", (void(Lua_Mob::*)(int,const char*))&Lua_Mob::MakePet) + .def("MakePet", (void(Lua_Mob::*)(int,const char*,const char*))&Lua_Mob::MakePet) + .def("MakePoweredPet", (void(Lua_Mob::*)(int,const char*,int))&Lua_Mob::MakePoweredPet) + .def("MakePoweredPet", (void(Lua_Mob::*)(int,const char*,int,const char*))&Lua_Mob::MakePoweredPet) + .def("GetBaseRace", &Lua_Mob::GetBaseRace) + .def("GetBaseGender", &Lua_Mob::GetBaseGender) + .def("GetDeity", &Lua_Mob::GetDeity) + .def("GetRace", &Lua_Mob::GetRace) + .def("GetGender", &Lua_Mob::GetGender) + .def("GetTexture", &Lua_Mob::GetTexture) + .def("GetHelmTexture", &Lua_Mob::GetHelmTexture) + .def("GetHairColor", &Lua_Mob::GetHairColor) + .def("GetBeardColor", &Lua_Mob::GetBeardColor) + .def("GetEyeColor1", &Lua_Mob::GetEyeColor1) + .def("GetEyeColor2", &Lua_Mob::GetEyeColor2) + .def("GetHairStyle", &Lua_Mob::GetHairStyle) + .def("GetLuclinFace", &Lua_Mob::GetLuclinFace) + .def("GetBeard", &Lua_Mob::GetBeard) + .def("GetDrakkinHeritage", &Lua_Mob::GetDrakkinHeritage) + .def("GetDrakkinTattoo", &Lua_Mob::GetDrakkinTattoo) + .def("GetDrakkinDetails", &Lua_Mob::GetDrakkinDetails) + .def("GetClass", &Lua_Mob::GetClass) + .def("GetLevel", &Lua_Mob::GetLevel) + .def("GetCleanName", &Lua_Mob::GetCleanName) + .def("GetTarget", &Lua_Mob::GetTarget) + .def("SetTarget", &Lua_Mob::SetTarget) + .def("GetHPRatio", &Lua_Mob::GetHPRatio) + .def("IsWarriorClass", &Lua_Mob::IsWarriorClass) + .def("GetHP", &Lua_Mob::GetHP) + .def("GetMaxHP", &Lua_Mob::GetMaxHP) + .def("GetItemHPBonuses", &Lua_Mob::GetItemHPBonuses) + .def("GetSpellHPBonuses", &Lua_Mob::GetSpellHPBonuses) + .def("GetWalkspeed", &Lua_Mob::GetWalkspeed) + .def("GetRunspeed", &Lua_Mob::GetRunspeed) + .def("GetCasterLevel", &Lua_Mob::GetCasterLevel) + .def("GetMaxMana", &Lua_Mob::GetMaxMana) + .def("GetMana", &Lua_Mob::GetMana) + .def("SetMana", &Lua_Mob::SetMana) + .def("GetManaRatio", &Lua_Mob::GetManaRatio) + .def("GetAC", &Lua_Mob::GetAC) + .def("GetATK", &Lua_Mob::GetATK) + .def("GetSTR", &Lua_Mob::GetSTR) + .def("GetSTA", &Lua_Mob::GetSTA) + .def("GetDEX", &Lua_Mob::GetDEX) + .def("GetAGI", &Lua_Mob::GetAGI) + .def("GetINT", &Lua_Mob::GetINT) + .def("GetWIS", &Lua_Mob::GetWIS) + .def("GetCHA", &Lua_Mob::GetCHA) + .def("GetMR", &Lua_Mob::GetMR) + .def("GetFR", &Lua_Mob::GetFR) + .def("GetDR", &Lua_Mob::GetDR) + .def("GetPR", &Lua_Mob::GetPR) + .def("GetCR", &Lua_Mob::GetCR) + .def("GetCorruption", &Lua_Mob::GetCorruption) + .def("GetMaxSTR", &Lua_Mob::GetMaxSTR) + .def("GetMaxSTA", &Lua_Mob::GetMaxSTA) + .def("GetMaxDEX", &Lua_Mob::GetMaxDEX) + .def("GetMaxAGI", &Lua_Mob::GetMaxAGI) + .def("GetMaxINT", &Lua_Mob::GetMaxINT) + .def("GetMaxWIS", &Lua_Mob::GetMaxWIS) + .def("GetMaxCHA", &Lua_Mob::GetMaxCHA) + .def("GetActSpellRange", (double(Lua_Mob::*)(int,double))&Lua_Mob::GetActSpellRange) + .def("GetActSpellRange", (double(Lua_Mob::*)(int,double,bool))&Lua_Mob::GetActSpellRange) + .def("GetActSpellDamage", &Lua_Mob::GetActSpellDamage) + .def("GetActSpellHealing", &Lua_Mob::GetActSpellHealing) + .def("GetActSpellCost", &Lua_Mob::GetActSpellCost) + .def("GetActSpellDuration", &Lua_Mob::GetActSpellDuration) + .def("GetActSpellCasttime", &Lua_Mob::GetActSpellCasttime) + .def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob))&Lua_Mob::ResistSpell) + .def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob,bool))&Lua_Mob::ResistSpell) + .def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob,bool,int))&Lua_Mob::ResistSpell) + .def("ResistSpell", (double(Lua_Mob::*)(int,int,Lua_Mob,bool,int,bool))&Lua_Mob::ResistSpell) + .def("GetSpecializeSkillValue", &Lua_Mob::GetSpecializeSkillValue) + .def("GetNPCTypeID", &Lua_Mob::GetNPCTypeID) + .def("IsTargeted", &Lua_Mob::IsTargeted) + .def("GetX", &Lua_Mob::GetX) + .def("GetY", &Lua_Mob::GetY) + .def("GetZ", &Lua_Mob::GetZ) + .def("GetHeading", &Lua_Mob::GetHeading) + .def("GetWaypointX", &Lua_Mob::GetWaypointX) + .def("GetWaypointY", &Lua_Mob::GetWaypointY) + .def("GetWaypointZ", &Lua_Mob::GetWaypointZ) + .def("GetWaypointH", &Lua_Mob::GetWaypointH) + .def("GetWaypointPause", &Lua_Mob::GetWaypointPause) + .def("GetWaypointID", &Lua_Mob::GetWaypointID) + .def("SetCurrentWP", &Lua_Mob::SetCurrentWP) + .def("GetSize", &Lua_Mob::GetSize) + .def("SetFollowID", &Lua_Mob::SetFollowID) + .def("GetFollowID", &Lua_Mob::GetFollowID) + .def("Message", &Lua_Mob::Message) + .def("Message_StringID", &Lua_Mob::Message_StringID) + .def("Say", &Lua_Mob::Say) + .def("Shout", &Lua_Mob::Shout) + .def("Emote", &Lua_Mob::Emote) + .def("InterruptSpell", (void(Lua_Mob::*)(void))&Lua_Mob::InterruptSpell) + .def("InterruptSpell", (void(Lua_Mob::*)(int))&Lua_Mob::InterruptSpell) + , luabind::class_("Client") .def(luabind::constructor<>()),