From d9d89ba9b340dceba6d36f62df81cb40faea5dca Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 17:34:45 -0800 Subject: [PATCH] GetCWPX(), GetCWPY(), GetCWPZ(), GetCWPH() converted to GetCurrentWayPoint --- zone/command.cpp | 60 +++++++++++++++++++++++------------------------ zone/lua_mob.cpp | 32 ++++++++++++------------- zone/mob.h | 5 +--- zone/perl_mob.cpp | 10 ++++---- 4 files changed, 52 insertions(+), 55 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 27516d5a5..37d252698 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2551,7 +2551,7 @@ void command_peekinv(Client *c, const Seperator *sep) peekTrade = 0x20, peekWorld = 0x40 } ; - + if (!c->GetTarget() || !c->GetTarget()->IsClient()) { c->Message(0, "You must have a PC target selected for this command"); return; @@ -2605,10 +2605,10 @@ void command_peekinv(Client *c, const Seperator *sep) instMain = targetClient->GetInv().GetItem(MainPowerSource); itemData = (instMain ? instMain->GetItem() : nullptr); itemLinkCore = nullptr; - + if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); c->Message((itemData == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", @@ -2625,9 +2625,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "InvSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2640,9 +2640,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2665,9 +2665,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", MainCursor, cursorDepth, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2680,9 +2680,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2700,9 +2700,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "TributeSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2717,9 +2717,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null" ); - + c->Message((itemData == 0), "BankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2732,9 +2732,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2749,9 +2749,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2764,9 +2764,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2782,9 +2782,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "TradeSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2797,9 +2797,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2824,9 +2824,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i", (EmuConstants::WORLD_BEGIN + indexMain), ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2839,9 +2839,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", INVALID_INDEX, indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -7590,7 +7590,7 @@ void command_pf(Client *c, const Seperator *sep) { Mob *who = c->GetTarget(); c->Message(0, "POS: (%.2f, %.2f, %.2f)", who->GetX(), who->GetY(), who->GetZ()); - c->Message(0, "WP: (%.2f, %.2f, %.2f) (%d/%d)", who->GetCWPX(), who->GetCWPY(), who->GetCWPZ(), who->GetCWP(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1); + c->Message(0, "WP: %s (%d/%d)", to_string(who->GetCurrentWayPoint()).c_str(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1); c->Message(0, "TAR: (%.2f, %.2f, %.2f)", who->GetTarX(), who->GetTarY(), who->GetTarZ()); c->Message(0, "TARV: (%.2f, %.2f, %.2f)", who->GetTarVX(), who->GetTarVY(), who->GetTarVZ()); c->Message(0, "|TV|=%.2f index=%d", who->GetTarVector(), who->GetTarNDX()); diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 50a8b50a7..089f311bf 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -626,7 +626,7 @@ double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool 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, +double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override, bool charisma_check) { Lua_Safe_Call_Real(); return self->ResistSpell(resist_type, spell_id, caster, use_resist_override, resist_override, charisma_check); @@ -669,22 +669,22 @@ double Lua_Mob::GetHeading() { double Lua_Mob::GetWaypointX() { Lua_Safe_Call_Real(); - return self->GetCWPX(); + return self->GetCurrentWayPoint().m_X; } double Lua_Mob::GetWaypointY() { Lua_Safe_Call_Real(); - return self->GetCWPY(); + return self->GetCurrentWayPoint().m_Y; } double Lua_Mob::GetWaypointZ() { Lua_Safe_Call_Real(); - return self->GetCWPZ(); + return self->GetCurrentWayPoint().m_Z; } double Lua_Mob::GetWaypointH() { Lua_Safe_Call_Real(); - return self->GetCWPH(); + return self->GetCurrentWayPoint().m_Heading; } double Lua_Mob::GetWaypointPause() { @@ -772,19 +772,19 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, in 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, +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_Bool(); - return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), + 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, +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_Bool(); int16 res = resist_adjust; - return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), + 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); } @@ -836,7 +836,7 @@ Lua_Mob Lua_Mob::GetOwner() { Lua_HateList Lua_Mob::GetHateList() { Lua_Safe_Call_Class(Lua_HateList); Lua_HateList ret; - + auto h_list = self->GetHateList(); auto iter = h_list.begin(); while(iter != h_list.end()) { @@ -1217,7 +1217,7 @@ bool Lua_Mob::EntityVariableExists(const char *name) { void Lua_Mob::Signal(uint32 id) { Lua_Safe_Call_Void(); - + if(self->IsClient()) { self->CastToClient()->Signal(id); } else if(self->IsNPC()) { @@ -1250,7 +1250,7 @@ void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, in self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time); } -void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, +void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, bool hit_chance) { Lua_Safe_Call_Void(); self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time, hit_chance); @@ -1281,7 +1281,7 @@ void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ self->DoThrowingAttackDmg(other, range_weapon, item, weapon_damage, chance_mod); } -void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_Item item, int weapon_damage, int chance_mod, +void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_Item item, int weapon_damage, int chance_mod, int focus) { Lua_Safe_Call_Void(); self->DoThrowingAttackDmg(other, range_weapon, item, weapon_damage, chance_mod, focus); @@ -1332,7 +1332,7 @@ void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_I self->DoArcheryAttackDmg(other, range_weapon, ammo, weapon_damage, chance_mod); } -void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ItemInst ammo, int weapon_damage, int chance_mod, +void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ItemInst ammo, int weapon_damage, int chance_mod, int focus) { Lua_Safe_Call_Void(); self->DoArcheryAttackDmg(other, range_weapon, ammo, weapon_damage, chance_mod, focus); @@ -1390,7 +1390,7 @@ void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double 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(); - self->ProjectileAnimation(to, item_id, is_arrow, static_cast(speed), static_cast(angle), static_cast(tilt), + self->ProjectileAnimation(to, item_id, is_arrow, static_cast(speed), static_cast(angle), static_cast(tilt), static_cast(arc)); } @@ -1630,7 +1630,7 @@ void Lua_Mob::SendSpellEffect(uint32 effect_id, uint32 duration, uint32 finish_d self->SendSpellEffect(effect_id, duration, finish_delay, zone_wide, unk020, perm_effect); } -void Lua_Mob::SendSpellEffect(uint32 effect_id, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk020, bool perm_effect, +void Lua_Mob::SendSpellEffect(uint32 effect_id, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk020, bool perm_effect, Lua_Client c) { Lua_Safe_Call_Void(); self->SendSpellEffect(effect_id, duration, finish_delay, zone_wide, unk020, perm_effect, c); diff --git a/zone/mob.h b/zone/mob.h index bbab7eaa5..57da56de5 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -862,10 +862,7 @@ public: Shielders_Struct shielder[MAX_SHIELDERS]; Trade* trade; - inline float GetCWPX() const { return(m_CurrentWayPoint.m_X); } - inline float GetCWPY() const { return(m_CurrentWayPoint.m_Y); } - inline float GetCWPZ() const { return(m_CurrentWayPoint.m_Z); } - inline float GetCWPH() const { return(m_CurrentWayPoint.m_Heading); } + inline xyz_heading GetCurrentWayPoint() const { return m_CurrentWayPoint; } inline float GetCWPP() const { return(static_cast(cur_wp_pause)); } inline int GetCWP() const { return(cur_wp); } void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; } diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index c47b463d3..f41685a1c 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -1615,7 +1615,7 @@ XS(XS_Mob_TypesTempPet) else Perl_croak(aTHX_ "target is not of type Mob"); - + if (items < 7) sticktarg = false; else { @@ -3525,7 +3525,7 @@ XS(XS_Mob_GetWaypointX) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPX(); + RETVAL = THIS->GetCurrentWayPoint().m_X; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -3551,7 +3551,7 @@ XS(XS_Mob_GetWaypointY) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPY(); + RETVAL = THIS->GetCurrentWayPoint().m_Y; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -3577,7 +3577,7 @@ XS(XS_Mob_GetWaypointZ) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPZ(); + RETVAL = THIS->GetCurrentWayPoint().m_Z; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -3603,7 +3603,7 @@ XS(XS_Mob_GetWaypointH) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPH(); + RETVAL = THIS->GetCurrentWayPoint().m_Heading; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1);