diff --git a/zone/beacon.cpp b/zone/beacon.cpp index 9b88dd524..4713e7c63 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -58,10 +58,10 @@ Beacon::Beacon(Mob *at_mob, int lifetime) caster_id = 0; // copy location - x_pos = at_mob->GetX(); - y_pos = at_mob->GetY(); - z_pos = at_mob->GetZ(); - heading = at_mob->GetHeading(); + m_Position.m_X = at_mob->GetX(); + m_Position.m_Y = at_mob->GetY(); + m_Position.m_Z = at_mob->GetZ(); + m_Position.m_Heading = at_mob->GetHeading(); if(lifetime) { diff --git a/zone/bot.cpp b/zone/bot.cpp index a68273fae..2a8921dd7 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4122,9 +4122,9 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) { this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName()); // Spawn the bot at the bow owner's loc - this->x_pos = botCharacterOwner->GetX(); - this->y_pos = botCharacterOwner->GetY(); - this->z_pos = botCharacterOwner->GetZ(); + this->m_Position.m_X = botCharacterOwner->GetX(); + this->m_Position.m_Y = botCharacterOwner->GetY(); + this->m_Position.m_Z = botCharacterOwner->GetZ(); // Make the bot look at the bot owner FaceTarget(botCharacterOwner); diff --git a/zone/client.cpp b/zone/client.cpp index 9541959ba..2c6c73b8a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -399,9 +399,9 @@ Client::~Client() { { m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zoneInstance = m_pp.binds[0].instance_id; - x_pos = m_pp.binds[0].x; - y_pos = m_pp.binds[0].y; - z_pos = m_pp.binds[0].z; + m_Position.m_X = m_pp.binds[0].x; + m_Position.m_Y = m_pp.binds[0].y; + m_Position.m_Z = m_pp.binds[0].z; } // we save right now, because the client might be zoning and the world @@ -525,11 +525,11 @@ bool Client::Save(uint8 iCommitNow) { return false; /* Wrote current basics to PP for saves */ - m_pp.x = x_pos; - m_pp.y = y_pos; - m_pp.z = z_pos; + m_pp.x = m_Position.m_X; + m_pp.y = m_Position.m_Y; + m_pp.z = m_Position.m_Z; m_pp.guildrank = guildrank; - m_pp.heading = heading; + m_pp.heading = m_Position.m_Heading; /* Mana and HP */ if (GetHP() <= 0) { @@ -3820,7 +3820,7 @@ void Client::Sacrifice(Client *caster) void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { - if(!Caster || PendingTranslocate) + if(!Caster || PendingTranslocate) return; const SPDat_Spell_Struct &Spell = spells[SpellID]; @@ -4273,7 +4273,7 @@ bool Client::GroupFollow(Client* inviter) { { GetMerc()->MercJoinClientGroup(); } - + if (inviter->IsLFP()) { // If the player who invited us to a group is LFP, have them update world now that we have joined their group. @@ -5832,7 +5832,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = aug_weap->Icon; - } + } else { strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = item->Icon; @@ -7460,7 +7460,7 @@ void Client::SendMercPersonalInfo() uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs! MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID]; - + int stancecount = 0; stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) @@ -7562,7 +7562,7 @@ void Client::SendMercPersonalInfo() } if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful"); - + SendMercMerchantResponsePacket(0); } else diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 000ed8fcc..06611b413 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1472,10 +1472,10 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* Set Mob variables for spawn */ class_ = m_pp.class_; level = m_pp.level; - x_pos = m_pp.x; - y_pos = m_pp.y; - z_pos = m_pp.z; - heading = m_pp.heading; + m_Position.m_X = m_pp.x; + m_Position.m_Y = m_pp.y; + m_Position.m_Z = m_pp.z; + m_Position.m_Heading = m_pp.heading; race = m_pp.race; base_race = m_pp.race; gender = m_pp.gender; @@ -4380,9 +4380,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) float dist = 0; float tmp; - tmp = x_pos - ppu->x_pos; + tmp = m_Position.m_X - ppu->x_pos; dist += tmp*tmp; - tmp = y_pos - ppu->y_pos; + tmp = m_Position.m_Y - ppu->y_pos; dist += tmp*tmp; dist = sqrt(dist); @@ -4534,9 +4534,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) //If the player has moved more than units for x or y, then we'll store //his pre-PPU x and y for /rewind, in case he gets stuck. if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) { - rewind_x = x_pos; - rewind_y = y_pos; - rewind_z = z_pos; + rewind_x = m_Position.m_X; + rewind_y = m_Position.m_Y; + rewind_z = m_Position.m_Z; } //If the PPU was a large jump, such as a cross zone gate or Call of Hero, @@ -4563,13 +4563,13 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) delta_z = ppu->delta_z; delta_heading = ppu->delta_heading; - if(IsTracking() && ((x_pos!=ppu->x_pos) || (y_pos!=ppu->y_pos))){ + if(IsTracking() && ((m_Position.m_X!=ppu->x_pos) || (m_Position.m_Y!=ppu->y_pos))){ if(MakeRandomFloat(0, 100) < 70)//should be good CheckIncreaseSkill(SkillTracking, nullptr, -20); } // Break Hide if moving without sneaking and set rewind timer if moved - if(ppu->y_pos != y_pos || ppu->x_pos != x_pos){ + if(ppu->y_pos != m_Position.m_Y || ppu->x_pos != m_Position.m_X){ if((hidden || improved_hidden) && !sneaking){ hidden = false; improved_hidden = false; @@ -4589,13 +4589,14 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) // Outgoing client packet float tmpheading = EQ19toFloat(ppu->heading); - if (!FCMP(ppu->y_pos, y_pos) || !FCMP(ppu->x_pos, x_pos) || !FCMP(tmpheading, heading) || ppu->animation != animation) + if (!FCMP(ppu->y_pos, m_Position.m_Y) || !FCMP(ppu->x_pos, m_Position.m_X) || !FCMP(tmpheading, m_Position.m_Heading) || ppu->animation != animation) { - x_pos = ppu->x_pos; - y_pos = ppu->y_pos; - z_pos = ppu->z_pos; - animation = ppu->animation; - heading = tmpheading; + m_Position.m_X = ppu->x_pos; + m_Position.m_Y = ppu->y_pos; + m_Position.m_Z = ppu->z_pos; + m_Position.m_Heading = tmpheading; + animation = ppu->animation; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; @@ -4609,7 +4610,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if(zone->watermap) { - if(zone->watermap->InLiquid(x_pos, y_pos, z_pos)) + if(zone->watermap->InLiquid(m_Position.m_X, m_Position.m_Y, m_Position.m_Z)) { CheckIncreaseSkill(SkillSwimming, nullptr, -17); } @@ -6607,7 +6608,7 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) GroupGeneric_Struct* gf = (GroupGeneric_Struct*)app->pBuffer; Mob* inviter = entity_list.GetClientByName(gf->name1); - + // Inviter and Invitee are in the same zone if (inviter != nullptr && inviter->IsClient()) { @@ -6622,7 +6623,7 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { // Inviter is in another zone - Remove merc from group now if any LeaveGroup(); - + ServerPacket* pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct)); ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *)pack->pBuffer; sgfs->CharacterID = CharacterID(); @@ -8019,7 +8020,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer; Mob* tmp = entity_list.GetMob(insr->TargetID); const Item_Struct* item = nullptr; - + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for (int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) { const ItemInst* inst = GetInv().GetItem(L); @@ -12807,9 +12808,9 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) m_pp.spell_book[swapspell->from_slot] = m_pp.spell_book[swapspell->to_slot]; m_pp.spell_book[swapspell->to_slot] = swapspelltemp; - /* Save Spell Swaps */ + /* Save Spell Swaps */ if (!database.SaveCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot)){ - database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); + database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); } if (!database.SaveCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot)){ database.DeleteCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot); @@ -13595,7 +13596,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) } Translocate_Struct *its = (Translocate_Struct*)app->pBuffer; - if (!PendingTranslocate) + if (!PendingTranslocate) return; if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) { @@ -13616,7 +13617,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) // to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are // reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before. if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && - (zone->GetZoneID() == PendingTranslocateData.zone_id && + (zone->GetZoneID() == PendingTranslocateData.zone_id && zone->GetInstanceID() == PendingTranslocateData.instance_id)) { PendingTranslocate = false; @@ -13627,7 +13628,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) ////Was sending the packet back to initiate client zone... ////but that could be abusable, so lets go through proper channels MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id, - PendingTranslocateData.x, PendingTranslocateData.y, + PendingTranslocateData.x, PendingTranslocateData.y, PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited); } } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c4eb01f4a..42b1316ef 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -188,7 +188,7 @@ bool Client::Process() { GetMerc()->Save(); GetMerc()->Depop(); } - + Raid *myraid = entity_list.GetRaidByClient(this); if (myraid) { @@ -581,7 +581,7 @@ bool Client::Process() { if(projectile_timer.Check()) SpellProjectileEffect(); - + if(spellbonuses.GravityEffect == 1) { if(gravity_timer.Check()) DoGravityEffect(); @@ -800,32 +800,32 @@ void Client::OnDisconnect(bool hard_disconnect) { if (MyRaid) MyRaid->MemberZoned(this); - parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); + parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); /* QS: PlayerLogConnectDisconnect */ if (RuleB(QueryServ, PlayerLogConnectDisconnect)){ std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", this->GetZoneID(), this->GetInstanceID()); QServ->PlayerLogEvent(Player_Log_Connect_State, this->CharacterID(), event_desc); - } + } } - Mob *Other = trade->With(); + Mob *Other = trade->With(); if(Other) { - mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items."); + mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) Other->CastToClient()->FinishTrade(Other); /* Reset both sides of the trade */ - trade->Reset(); + trade->Reset(); Other->trade->Reset(); } database.SetFirstLogon(CharacterID(), 0); //We change firstlogon status regardless of if a player logs out to zone or not, because we only want to trigger it on their first login from world. - /* Remove ourself from all proximities */ + /* Remove ourself from all proximities */ ClearAllProximities(); EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply); @@ -1570,7 +1570,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) if (from_bucket == &m_pp.platinum_shared) amount_to_add = 0 - amount_to_take; - database.SetSharedPlatinum(AccountID(),amount_to_add); + database.SetSharedPlatinum(AccountID(),amount_to_add); } } else{ @@ -1756,7 +1756,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) } SetSkill(skill, t_level); - } else { + } else { switch(skill) { case SkillBrewing: case SkillMakePoison: @@ -1958,7 +1958,7 @@ void Client::DoEnduranceUpkeep() { int upkeep_sum = 0; int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction + aabonuses.EnduranceReduction; - + bool has_effect = false; uint32 buffs_i; uint32 buff_count = GetMaxTotalSlots(); @@ -2144,9 +2144,9 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse) { - x_pos = corpse->GetX(); - y_pos = corpse->GetY(); - z_pos = corpse->GetZ(); + m_Position.m_X = corpse->GetX(); + m_Position.m_Y = corpse->GetY(); + m_Position.m_Z = corpse->GetZ(); } EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10); @@ -2199,10 +2199,10 @@ void Client::HandleRespawnFromHover(uint32 Option) SetMana(GetMaxMana()); SetEndurance(GetMaxEndurance()); - x_pos = chosen->x; - y_pos = chosen->y; - z_pos = chosen->z; - heading = chosen->heading; + m_Position.m_X = chosen->x; + m_Position.m_Y = chosen->y; + m_Position.m_Z = chosen->z; + m_Position.m_Heading = chosen->heading; ClearHover(); entity_list.RefreshClientXTargets(this); @@ -2212,7 +2212,7 @@ void Client::HandleRespawnFromHover(uint32 Option) //After they've respawned into the same zone, trigger EVENT_RESPAWN parse->EventPlayer(EVENT_RESPAWN, this, static_cast(itoa(Option)), is_rez ? 1 : 0); - //Pop Rez option from the respawn options list; + //Pop Rez option from the respawn options list; //easiest way to make sure it stays at the end and //doesn't disrupt adding/removing scripted options respawn_options.pop_back(); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8be978350..5c56be256 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -249,15 +249,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( 0, // uint8 in_qglobal, 0, // uint8 in_maxlevel, 0 // uint32 in_scalerate - ), + ), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), - loot_cooldown_timer(10) + loot_cooldown_timer(10) { int i; - + PlayerProfile_Struct *pp = &client->GetPP(); ItemInst *item; @@ -287,7 +287,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( platinum = 0; strcpy(orgname, pp->name); - strcpy(name, pp->name); + strcpy(name, pp->name); /* become_npc was not being initialized which led to some pretty funky things with newly created corpses */ become_npc = false; @@ -295,8 +295,8 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( SetPKItem(0); /* Check Rule to see if we can leave corpses */ - if(!RuleB(Character, LeaveNakedCorpses) || - RuleB(Character, LeaveCorpses) && + if(!RuleB(Character, LeaveNakedCorpses) || + RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) { // cash // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. @@ -589,7 +589,7 @@ bool Corpse::Save() { ItemList::iterator cur, end; cur = itemlist.begin(); end = itemlist.end(); - for (; cur != end; ++cur) { + for (; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); @@ -597,11 +597,11 @@ bool Corpse::Save() { /* Create New Corpse*/ if (corpse_db_id == 0) { - corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); + corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading); } /* Update Corpse Data */ else{ - corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); + corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading, IsRezzed()); } safe_delete_array(dbpc); @@ -611,8 +611,8 @@ bool Corpse::Save() { void Corpse::Delete() { if (IsPlayerCorpse() && corpse_db_id != 0) - database.DeleteCharacterCorpse(corpse_db_id); - + database.DeleteCharacterCorpse(corpse_db_id); + corpse_db_id = 0; player_corpse_depop = true; } @@ -717,7 +717,7 @@ void Corpse::RemoveItem(uint16 lootslot) { } void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ - uint8 material; + uint8 material; ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); @@ -925,7 +925,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } RemoveCash(); - Save(); + Save(); } outapp->priority = 6; @@ -1081,7 +1081,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } if (item != 0) { - if (item_data){ + if (item_data){ inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); } else { @@ -1156,7 +1156,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item_data->item_id); /* Delete Item Instance */ - RemoveItem(item_data->lootslot); + RemoveItem(item_data->lootslot); } /* Remove Bag Contents */ @@ -1164,9 +1164,9 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { if (bag_item_data[i]) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ - database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id); + database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id); /* Delete Item Instance */ - RemoveItem(bag_item_data[i]); + RemoveItem(bag_item_data[i]); } } } @@ -1241,7 +1241,7 @@ void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.NPC = 2; } -void Corpse::QueryLoot(Client* to) { +void Corpse::QueryLoot(Client* to) { int x = 0, y = 0; // x = visible items, y = total items to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper); @@ -1415,10 +1415,10 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 corpse_db_id){ /* ** Corpse slot translations are needed until corpse database blobs are converted -** +** ** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into ** the contiguous possessions slot enumeration, the following designations will be used: -** +** ** Designatiom Server Corpse Offset ** -------------------------------------------------- ** MainCharm 0 0 0 @@ -1518,4 +1518,4 @@ int16 Corpse::CorpseToServerSlot(int16 corpse_slot) return corpse_slot; } */ -} \ No newline at end of file +} diff --git a/zone/forage.cpp b/zone/forage.cpp index d1008031a..24482017c 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -225,15 +225,15 @@ bool Client::CanFish() { HeadingDegrees = (int) ((GetHeading()*360)/256); HeadingDegrees = HeadingDegrees % 360; - RodX = x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f); - RodY = y_pos + RodLength * cos(HeadingDegrees * M_PI/180.0f); + RodX = m_Position.m_X + RodLength * sin(HeadingDegrees * M_PI/180.0f); + RodY = m_Position.m_Y + RodLength * cos(HeadingDegrees * M_PI/180.0f); // Do BestZ to find where the line hanging from the rod intersects the water (if it is water). // and go 1 unit into the water. Map::Vertex dest; dest.x = RodX; dest.y = RodY; - dest.z = z_pos+10; + dest.z = m_Position.m_Z+10; RodZ = zone->zonemap->FindBestZ(dest, nullptr) + 4; bool in_lava = zone->watermap->InLava(RodX, RodY, RodZ); @@ -243,7 +243,7 @@ bool Client::CanFish() { Message_StringID(MT_Skills, FISHING_LAVA); //Trying to catch a fire elemental or something? return false; } - if((!in_water) || (z_pos-RodZ)>LineLength) { //Didn't hit the water OR the water is too far below us + if((!in_water) || (m_Position.m_Z-RodZ)>LineLength) { //Didn't hit the water OR the water is too far below us Message_StringID(MT_Skills, FISHING_LAND); //Trying to catch land sharks perhaps? return false; } diff --git a/zone/mob.cpp b/zone/mob.cpp index a7d141b30..cb2f6e35d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -157,10 +157,10 @@ Mob::Mob(const char* in_name, if (runspeed < 0 || runspeed > 20) runspeed = 1.25f; - heading = in_heading; - x_pos = in_x_pos; - y_pos = in_y_pos; - z_pos = in_z_pos; + m_Position.m_Heading = in_heading; + m_Position.m_X = in_x_pos; + m_Position.m_Y = in_y_pos; + m_Position.m_Z = in_z_pos; light = in_light; texture = in_texture; helmtexture = in_helmtexture; @@ -373,7 +373,7 @@ Mob::Mob(const char* in_name, m_targetable = true; targetring_x = 0.0f; - targetring_y = 0.0f; + targetring_y = 0.0f; targetring_z = 0.0f; flymode = FlyMode3; @@ -882,10 +882,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); } - ns->spawn.heading = FloatToEQ19(heading); - ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3; - ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3; - ns->spawn.z = FloatToEQ19(z_pos);//((int32)z_pos)<<3; + ns->spawn.heading = FloatToEQ19(m_Position.m_Heading); + ns->spawn.x = FloatToEQ19(m_Position.m_X);//((int32)x_pos)<<3; + ns->spawn.y = FloatToEQ19(m_Position.m_Y);//((int32)y_pos)<<3; + ns->spawn.z = FloatToEQ19(m_Position.m_Z);//((int32)z_pos)<<3; ns->spawn.spawnId = GetID(); ns->spawn.curHp = static_cast(GetHPRatio()); ns->spawn.max_hp = 100; //this field needs a better name @@ -1211,13 +1211,13 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) { void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){ memset(spu,0xff,sizeof(PlayerPositionUpdateServer_Struct)); spu->spawn_id = GetID(); - spu->x_pos = FloatToEQ19(x_pos); - spu->y_pos = FloatToEQ19(y_pos); - spu->z_pos = FloatToEQ19(z_pos); + spu->x_pos = FloatToEQ19(m_Position.m_X); + spu->y_pos = FloatToEQ19(m_Position.m_Y); + spu->z_pos = FloatToEQ19(m_Position.m_Z); spu->delta_x = NewFloatToEQ13(0); spu->delta_y = NewFloatToEQ13(0); spu->delta_z = NewFloatToEQ13(0); - spu->heading = FloatToEQ19(heading); + spu->heading = FloatToEQ19(m_Position.m_Heading); spu->animation = 0; spu->delta_heading = NewFloatToEQ13(0); spu->padding0002 =0; @@ -1230,13 +1230,13 @@ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){ // this is for SendPosUpdate() void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) { spu->spawn_id = GetID(); - spu->x_pos = FloatToEQ19(x_pos); - spu->y_pos = FloatToEQ19(y_pos); - spu->z_pos = FloatToEQ19(z_pos); + spu->x_pos = FloatToEQ19(m_Position.m_X); + spu->y_pos = FloatToEQ19(m_Position.m_Y); + spu->z_pos = FloatToEQ19(m_Position.m_Z); spu->delta_x = NewFloatToEQ13(delta_x); spu->delta_y = NewFloatToEQ13(delta_y); spu->delta_z = NewFloatToEQ13(delta_z); - spu->heading = FloatToEQ19(heading); + spu->heading = FloatToEQ19(m_Position.m_Heading); spu->padding0002 =0; spu->padding0006 =7; spu->padding0014 =0x7f; @@ -1361,11 +1361,11 @@ void Mob::GMMove(float x, float y, float z, float heading, bool SendUpdate) { entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; - if (heading != 0.01) - this->heading = heading; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; + if (m_Position.m_Heading != 0.01) + this->m_Position.m_Heading = heading; if(IsNPC()) CastToNPC()->SaveGuardSpot(true); if(SendUpdate) @@ -2062,9 +2062,9 @@ bool Mob::CanThisClassBlock(void) const } float Mob::Dist(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; - float zDiff = other.z_pos - z_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; + float zDiff = other.m_Position.m_Z - m_Position.m_Z; return sqrtf( (xDiff * xDiff) + (yDiff * yDiff) @@ -2072,17 +2072,17 @@ float Mob::Dist(const Mob &other) const { } float Mob::DistNoZ(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; return sqrtf( (xDiff * xDiff) + (yDiff * yDiff) ); } float Mob::DistNoRoot(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; - float zDiff = other.z_pos - z_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; + float zDiff = other.m_Position.m_Z - m_Position.m_Z; return ( (xDiff * xDiff) + (yDiff * yDiff) @@ -2090,9 +2090,9 @@ float Mob::DistNoRoot(const Mob &other) const { } float Mob::DistNoRoot(float x, float y, float z) const { - float xDiff = x - x_pos; - float yDiff = y - y_pos; - float zDiff = z - z_pos; + float xDiff = x - m_Position.m_X; + float yDiff = y - m_Position.m_Y; + float zDiff = z - m_Position.m_Z; return ( (xDiff * xDiff) + (yDiff * yDiff) @@ -2100,15 +2100,15 @@ float Mob::DistNoRoot(float x, float y, float z) const { } float Mob::DistNoRootNoZ(float x, float y) const { - float xDiff = x - x_pos; - float yDiff = y - y_pos; + float xDiff = x - m_Position.m_X; + float yDiff = y - m_Position.m_Y; return ( (xDiff * xDiff) + (yDiff * yDiff) ); } float Mob::DistNoRootNoZ(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; return ( (xDiff * xDiff) + (yDiff * yDiff) ); } @@ -2253,7 +2253,7 @@ bool Mob::HateSummon() { entity_list.MessageClose(this, true, 500, MT_Say, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() ); if (target->IsClient()) { - target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x_pos, y_pos, z_pos, target->GetHeading(), 0, SummonPC); + target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, target->GetHeading(), 0, SummonPC); } else { #ifdef BOTS @@ -2266,7 +2266,7 @@ bool Mob::HateSummon() { } #endif //BOTS - target->GMMove(x_pos, y_pos, z_pos, target->GetHeading()); + target->GMMove(m_Position.m_X, m_Position.m_Y, m_Position.m_Z, target->GetHeading()); } return true; @@ -2614,9 +2614,9 @@ void Mob::Warp( float x, float y, float z ) entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; Mob* target = GetTarget(); if (target) { @@ -2829,9 +2829,9 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset) if (zone->zonemap != nullptr) { Map::Vertex me; - me.x = new_x; - me.y = new_y; - me.z = z_pos+z_offset; + me.x = m_Position.m_X; + me.y = m_Position.m_Y; + me.z = m_Position.m_Z + z_offset; Map::Vertex hit; float best_z = zone->zonemap->FindBestZ(me, &hit); if (best_z != -999999) @@ -2849,9 +2849,9 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset) if (zone->zonemap != 0) { Map::Vertex me; - me.x = new_x; - me.y = new_y; - me.z = z_pos+z_offset; + me.x = m_Position.m_X; + me.y = m_Position.m_Y; + me.z = m_Position.m_Z+z_offset; Map::Vertex hit; float best_z = zone->zonemap->FindBestZ(me, &hit); if (best_z != -999999) @@ -3068,7 +3068,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) { if(!target || !IsValidSpell(spell_id)) return false; - + int spell_trig = 0; // Count all the percentage chances to trigger for all effects for(int i = 0; i < EFFECT_COUNT; i++) @@ -5060,7 +5060,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) if (slot < 4){ if (id == "components") { spells[spell_id].components[slot];} - else if (id == "component_counts") {spells[spell_id].component_counts[slot];} + else if (id == "component_counts") {spells[spell_id].component_counts[slot];} else if (id == "NoexpendReagent") {spells[spell_id].NoexpendReagent[slot];} } @@ -5138,7 +5138,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) else if (id == "max_dist") {stat = static_cast(spells[spell_id].max_dist); } else if (id == "min_range") {stat = static_cast(spells[spell_id].min_range); } else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; } - + return stat; } diff --git a/zone/mob.h b/zone/mob.h index a4dd2d665..9b57bbc6a 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -23,6 +23,7 @@ #include "entity.h" #include "hate_list.h" #include "pathing.h" +#include "position.h" #include #include #include @@ -176,7 +177,7 @@ public: bool IsInvisible(Mob* other = 0) const; void SetInvisible(uint8 state); bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon); - + //Song bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot); @@ -392,10 +393,10 @@ public: ((static_cast(cur_mana) / max_mana) * 100); } virtual int32 CalcMaxMana(); uint32 GetNPCTypeID() const { return npctype_id; } - inline const float GetX() const { return x_pos; } - inline const float GetY() const { return y_pos; } - inline const float GetZ() const { return z_pos; } - inline const float GetHeading() const { return heading; } + inline const float GetX() const { return m_Position.m_X; } + inline const float GetY() const { return m_Position.m_Y; } + inline const float GetZ() const { return m_Position.m_Z; } + inline const float GetHeading() const { return m_Position.m_Heading; } inline const float GetSize() const { return size; } inline const float GetBaseSize() const { return base_size; } inline const float GetTarX() const { return tarx; } @@ -437,8 +438,8 @@ public: void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu); void SendPosition(); void SetFlyMode(uint8 flymode); - inline void Teleport(Map::Vertex NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y; - z_pos = NewPosition.z; }; + inline void Teleport(Map::Vertex NewPosition) { m_Position.m_X = NewPosition.x; m_Position.m_Y = NewPosition.y; + m_Position.m_Z = NewPosition.z; }; //AI static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel); @@ -459,8 +460,8 @@ public: bool IsEngaged() { return(!hate_list.IsEmpty()); } bool HateSummon(); void FaceTarget(Mob* MobToFace = 0); - void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime(); - heading = iHeading; } } + void SetHeading(float iHeading) { if(m_Position.m_Heading != iHeading) { pLastChange = Timer::GetCurrentTime(); + m_Position.m_Heading = iHeading; } } void WipeHateList(); void AddFeignMemory(Client* attacker); void RemoveFromFeignMemory(Client* attacker); @@ -566,10 +567,10 @@ public: int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false); uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0); - void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, - uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, - uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, - uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, + void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, + uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, + uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, + uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = -1.0f); virtual void Stun(int duration); virtual void UnStun(); @@ -617,7 +618,7 @@ public: bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } bool DoHPToManaCovert(uint16 mana_cost = 0); int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); - int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect); + int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect); int32 GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg); void MeleeLifeTap(int32 damage); bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true); @@ -678,9 +679,9 @@ public: inline int16 GetTempPetCount() const { return count_TempPet; } inline void SetTempPetCount(int16 i) { count_TempPet = i; } bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } - inline bool IsPetOwnerClient() const { return pet_owner_client; } + inline bool IsPetOwnerClient() const { return pet_owner_client; } inline void SetPetOwnerClient(bool value) { pet_owner_client = value; } - inline bool IsTempPet() const { return _IsTempPet; } + inline bool IsTempPet() const { return _IsTempPet; } inline void SetTempPet(bool value) { _IsTempPet = value; } inline const bodyType GetBodyType() const { return bodytype; } @@ -806,7 +807,7 @@ public: 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; } + void SaveSpellLoc() {spell_x = m_Position.m_X; spell_y = m_Position.m_Y; spell_z = m_Position.m_Z; } inline float GetSpellX() const {return spell_x;} inline float GetSpellY() const {return spell_y;} inline float GetSpellZ() const {return spell_z;} @@ -860,7 +861,7 @@ public: Shielders_Struct shielder[MAX_SHIELDERS]; Trade* trade; - + inline float GetCWPX() const { return(cur_wp_x); } inline float GetCWPY() const { return(cur_wp_y); } inline float GetCWPZ() const { return(cur_wp_z); } @@ -998,10 +999,7 @@ protected: uint8 level; uint8 orig_level; uint32 npctype_id; - float x_pos; - float y_pos; - float z_pos; - float heading; + xyz_heading m_Position; uint16 animation; float base_size; float size; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 614ba984d..67b0e6678 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1792,7 +1792,7 @@ void NPC::AI_DoMovement() { CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp); else { - if(!((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z))) + if(!((m_Position.m_X == guard_x) && (m_Position.m_Y == guard_y) && (m_Position.m_Z == guard_z))) { bool WaypointChanged, NodeReached; Map::Vertex Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached); diff --git a/zone/spells.cpp b/zone/spells.cpp index 69ded563c..f50d74bbf 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -297,7 +297,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, sprintf(temp, "%d", spell_id); parse->EventNPC(EVENT_CAST_BEGIN, CastToNPC(), nullptr, temp, 0); } - + //To prevent NPC ghosting when spells are cast from scripts if (IsNPC() && IsMoving() && cast_time > 0) SendPosition(); @@ -1607,7 +1607,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) return false; - + ae_center = spell_target; CastAction = AETarget; } @@ -1626,7 +1626,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) return false; - + ae_center = spell_target; CastAction = AETarget; } @@ -2072,7 +2072,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } else { // regular PB AE or targeted AE spell - spell_target is null if PB if(spell_target) // this must be an AETarget spell - { + { bool cast_on_target = true; if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && spell_target->IsPetOwnerClient()) cast_on_target = false; @@ -2181,7 +2181,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 ConeDirectional(spell_id, resist_adjust); break; } - + case Beam: { BeamDirectional(spell_id, resist_adjust); @@ -3704,7 +3704,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (IsValidSpell(spells[spell_id].RecourseLink)) SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff); - + if (IsDetrimentalSpell(spell_id)) { CheckNumHitsRemaining(NUMHIT_OutgoingSpells); @@ -3831,9 +3831,9 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) rezz->zone_id = zone->GetZoneID(); rezz->instance_id = zone->GetInstanceID(); rezz->spellid = spellid; - rezz->x = this->x_pos; - rezz->y = this->y_pos; - rezz->z = this->z_pos; + rezz->x = this->m_Position.m_X; + rezz->y = this->m_Position.m_Y; + rezz->z = this->m_Position.m_Z; rezz->unknown000 = 0x00000000; rezz->unknown020 = 0x00000000; rezz->unknown088 = 0x00000000; @@ -4495,7 +4495,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(partial_modifier <= 0) { return 100; - } + } else if(partial_modifier >= 100) { return 0; @@ -4816,7 +4816,7 @@ void Client::UnmemSpell(int slot, bool update_client) m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); - + if(update_client) { MemorizeSpell(slot, m_pp.mem_spells[slot], memSpellForget); @@ -4860,8 +4860,8 @@ void Client::UnscribeSpell(int slot, bool update_client) mlog(CLIENT__SPELLS, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; - - database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); + + database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); if(update_client) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteSpell, sizeof(DeleteSpell_Struct)); @@ -4889,7 +4889,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - mlog(CLIENT__SPELLS, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + mlog(CLIENT__SPELLS, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -5438,27 +5438,27 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) if (IsBeneficialSpell(spell_id) && IsClient()) beneficial_targets = true; - + std::list targets_in_range; std::list::iterator iter; entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].range, spells[spell_id].range / 2, targets_in_range); iter = targets_in_range.begin(); - + float dX = 0; float dY = 0; float dZ = 0; - + CalcDestFromHeading(GetHeading(), spells[spell_id].range, 5, GetX(), GetY(), dX, dY, dZ); dZ = GetZ(); - + //FIND SLOPE: Put it into the form y = mx + b float m = (dY - GetY()) / (dX - GetX()); float b = (GetY() * dX - dY * GetX()) / (dX - GetX()); - + while(iter != targets_in_range.end()) { - if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) + if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) || (*iter)->BehindMob(this, (*iter)->GetX(),(*iter)->GetY())){ ++iter; continue; @@ -5466,7 +5466,7 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) //# shortest distance from line to target point float d = abs( (*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1); - + if (d <= spells[spell_id].aoerange) { if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { @@ -5513,7 +5513,7 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) } float heading_to_target = (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f); - + while(heading_to_target < 0.0f) heading_to_target += 360.0f; @@ -5544,4 +5544,4 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) ++iter; } -} \ No newline at end of file +} diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index cfefe73f3..4cb3b2e84 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -437,10 +437,10 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = 0; } else { - guard_x = x_pos; - guard_y = y_pos; - guard_z = z_pos; - guard_heading = heading; + guard_x = m_Position.m_X; + guard_y = m_Position.m_Y; + guard_z = m_Position.m_Z; + guard_heading = m_Position.m_Heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); @@ -452,7 +452,7 @@ void NPC::NextGuardPosition() { SetHeading(guard_heading); mlog(AI__WAYPOINTS, "Unable to move to next guard position. Probably rooted."); } - else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) + else if((m_Position.m_X == guard_x) && (m_Position.m_Y == guard_y) && (m_Position.m_Z == guard_z)) { if(moved) { @@ -480,7 +480,7 @@ void Mob::SaveSpawnSpot() { }*/ float Mob::CalculateDistance(float x, float y, float z) { - return (float)sqrtf( ((x_pos-x)*(x_pos-x)) + ((y_pos-y)*(y_pos-y)) + ((z_pos-z)*(z_pos-z)) ); + return (float)sqrtf( ((m_Position.m_X-x)*(m_Position.m_X-x)) + ((m_Position.m_Y-y)*(m_Position.m_Y-y)) + ((m_Position.m_Z-z)*(m_Position.m_Z-z)) ); } /* @@ -491,13 +491,13 @@ uint8 NPC::CalculateHeadingToNextWaypoint() { float Mob::CalculateHeadingToTarget(float in_x, float in_y) { float angle; - if (in_x-x_pos > 0) - angle = - 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; - else if (in_x-x_pos < 0) - angle = + 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; + if (in_x-m_Position.m_X > 0) + angle = - 90 + atan((float)(in_y-m_Position.m_Y) / (float)(in_x-m_Position.m_X)) * 180 / M_PI; + else if (in_x-m_Position.m_X < 0) + angle = + 90 + atan((float)(in_y-m_Position.m_Y) / (float)(in_x-m_Position.m_X)) * 180 / M_PI; else // Added? { - if (in_y-y_pos > 0) + if (in_y-m_Position.m_Y > 0) angle = 0; else angle = 180; @@ -513,16 +513,16 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(GetID()==0) return true; - if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords - if(z_pos-z != 0) { - z_pos = z; + if ((m_Position.m_X-x == 0) && (m_Position.m_Y-y == 0)) {//spawn is at target coords + if(m_Position.m_Z-z != 0) { + m_Position.m_Z = z; mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } - else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) + else if ((ABS(m_Position.m_X - x) < 0.1) && (ABS(m_Position.m_Y - y) < 0.1)) { mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); @@ -530,25 +530,25 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; return true; } int compare_steps = IsBoat() ? 1 : 20; if(tar_ndx < compare_steps && tarx==x && tary==y) { - float new_x = x_pos + tar_vx*tar_vector; - float new_y = y_pos + tar_vy*tar_vector; - float new_z = z_pos + tar_vz*tar_vector; + float new_x = m_Position.m_X + tar_vx*tar_vector; + float new_y = m_Position.m_Y + tar_vy*tar_vector; + float new_z = m_Position.m_Z + tar_vz*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); @@ -563,25 +563,25 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { - if((ABS(x - x_pos) < 0.5) && (ABS(y - y_pos) < 0.5)) + if((ABS(x - m_Position.m_X) < 0.5) && (ABS(y - m_Position.m_Y) < 0.5)) { - if(ABS(z-z_pos) <= RuleR(Map, FixPathingZMaxDeltaMoving)) - z_pos = z; + if(ABS(z-m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving)) + m_Position.m_Z = z; else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } } } @@ -600,9 +600,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b tary=y; tarz=z; - float nx = this->x_pos; - float ny = this->y_pos; - float nz = this->z_pos; + float nx = this->m_Position.m_X; + float ny = this->m_Position.m_Y; + float nz = this->m_Position.m_Z; // float nh = this->heading; tar_vx = x - nx; @@ -635,19 +635,19 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b tar_vy = tar_vy/numsteps; tar_vz = tar_vz/numsteps; - float new_x = x_pos + tar_vx; - float new_y = y_pos + tar_vy; - float new_z = z_pos + tar_vz; + float new_x = m_Position.m_X + tar_vx; + float new_y = m_Position.m_Y + tar_vy; + float new_z = m_Position.m_Z + tar_vz; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; + m_Position.m_Heading = CalculateHeadingToTarget(x, y); tar_ndx=22-numsteps; - heading = CalculateHeadingToTarget(x, y); - mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z, numsteps); } else { @@ -655,9 +655,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; mlog(AI__WAYPOINTS, "Only a single step to get there... jumping."); @@ -667,18 +667,18 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b else { tar_vector/=20; - float new_x = x_pos + tar_vx*tar_vector; - float new_y = y_pos + tar_vy*tar_vector; - float new_z = z_pos + tar_vz*tar_vector; + float new_x = m_Position.m_X + tar_vx*tar_vector; + float new_y = m_Position.m_Y + tar_vy*tar_vector; + float new_z = m_Position.m_Z + tar_vz*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; - heading = CalculateHeadingToTarget(x, y); - mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; + m_Position.m_Heading = CalculateHeadingToTarget(x, y); + mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z, numsteps); } uint8 NPCFlyMode = 0; @@ -692,25 +692,25 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { - if(ABS(x - x_pos) < 0.5 && ABS(y - y_pos) < 0.5) + if(ABS(x - m_Position.m_X) < 0.5 && ABS(y - m_Position.m_Y) < 0.5) { - if(ABS(z - z_pos) <= RuleR(Map, FixPathingZMaxDeltaMoving)) - z_pos = z; + if(ABS(z - m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving)) + m_Position.m_Z = z; else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } else - z_pos = newz+1; + m_Position.m_Z = newz+1; } } } @@ -718,9 +718,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b SetMoving(true); moved=true; - delta_x=x_pos-nx; - delta_y=y_pos-ny; - delta_z=z_pos-nz; + delta_x=m_Position.m_X-nx; + delta_y=m_Position.m_Y-ny; + delta_z=m_Position.m_Z-nz; delta_heading=0; if (IsClient()) @@ -746,9 +746,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec if(GetID()==0) return true; - float nx = x_pos; - float ny = y_pos; - float nz = z_pos; + float nx = m_Position.m_X; + float ny = m_Position.m_Y; + float nz = m_Position.m_Z; // if NPC is rooted if (speed == 0.0) { @@ -780,30 +780,30 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec // -------------------------------------------------------------------------- test_vector=sqrtf (x*x + y*y + z*z); tar_vector = speed / sqrtf (tar_vx*tar_vx + tar_vy*tar_vy + tar_vz*tar_vz); - heading = CalculateHeadingToTarget(x, y); + m_Position.m_Heading = CalculateHeadingToTarget(x, y); if (tar_vector >= 1.0) { if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; mlog(AI__WAYPOINTS, "Close enough, jumping to waypoint"); } else { - float new_x = x_pos + tar_vx*tar_vector; - float new_y = y_pos + tar_vy*tar_vector; - float new_z = z_pos + tar_vz*tar_vector; + float new_x = m_Position.m_X + tar_vx*tar_vector; + float new_y = m_Position.m_Y + tar_vy*tar_vector; + float new_z = m_Position.m_Z + tar_vz*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; - mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; + mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z); } uint8 NPCFlyMode = 0; @@ -817,25 +817,25 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { - if(ABS(x - x_pos) < 0.5 && ABS(y - y_pos) < 0.5) + if(ABS(x - m_Position.m_X) < 0.5 && ABS(y - m_Position.m_Y) < 0.5) { - if(ABS(z - z_pos) <= RuleR(Map, FixPathingZMaxDeltaMoving)) - z_pos = z; + if(ABS(z - m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving)) + m_Position.m_Z = z; else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } else - z_pos = newz+1; + m_Position.m_Z = newz+1; } } } @@ -845,9 +845,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec tar_ndx=0; this->SetMoving(true); moved=true; - delta_x=(x_pos-nx); - delta_y=(y_pos-ny); - delta_z=(z_pos-nz); + delta_x=(m_Position.m_X-nx); + delta_y=(m_Position.m_Y-ny); + delta_z=(m_Position.m_Z-nz); delta_heading=0;//(heading-nh)*8; SendPosUpdate(); } @@ -948,9 +948,9 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; mlog(AI__WAYPOINTS, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) @@ -961,20 +961,20 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) ) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } } else - z_pos += 0.1; + m_Position.m_Z += 0.1; } void Mob::SendToFixZ(float new_x, float new_y, float new_z) { @@ -982,9 +982,9 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z + 0.1); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z + 0.1; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z + 0.1; //fix up pathing Z, this shouldent be needed IF our waypoints //are corrected instead @@ -992,16 +992,16 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo)) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 6ac85cff6..fe6bcf557 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -347,16 +347,16 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc //set the player's coordinates in the new zone so they have them //when they zone into it - x_pos = dest_x; //these coordinates will now be saved when ~client is called - y_pos = dest_y; - z_pos = dest_z; - heading = dest_h; // Cripp: fix for zone heading + m_Position.m_X = dest_x; //these coordinates will now be saved when ~client is called + m_Position.m_Y = dest_y; + m_Position.m_Z = dest_z; + m_Position.m_Heading = dest_h; // Cripp: fix for zone heading m_pp.heading = dest_h; m_pp.zone_id = zone_id; m_pp.zoneInstance = instance_id; //Force a save so its waiting for them when they zone - Save(2); + Save(2); if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) { // No need to ask worldserver if we're zoning to ourselves (most @@ -500,9 +500,9 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case GMSummon: - zonesummon_x = x_pos = x; - zonesummon_y = y_pos = y; - zonesummon_z = z_pos = z; + zonesummon_x = m_Position.m_X = x; + zonesummon_y = m_Position.m_Y = y; + zonesummon_z = m_Position.m_Z = z; SetHeading(heading); zonesummon_id = zoneID; @@ -518,31 +518,31 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z zonesummon_ignorerestrictions = ignorerestrictions; break; case GateToBindPoint: - x = x_pos = m_pp.binds[0].x; - y = y_pos = m_pp.binds[0].y; - z = z_pos = m_pp.binds[0].z; + x = m_Position.m_X = m_pp.binds[0].x; + y = m_Position.m_Y = m_pp.binds[0].y; + z = m_Position.m_Z = m_pp.binds[0].z; heading = m_pp.binds[0].heading; break; case ZoneToBindPoint: - x = x_pos = m_pp.binds[0].x; - y = y_pos = m_pp.binds[0].y; - z = z_pos = m_pp.binds[0].z; + x = m_Position.m_X = m_pp.binds[0].x; + y = m_Position.m_Y = m_pp.binds[0].y; + z = m_Position.m_Z = m_pp.binds[0].z; heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; LogFile->write(EQEMuLog::Debug, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: - zonesummon_x = x_pos = x; - zonesummon_y = y_pos = y; - zonesummon_z = z_pos = z; + zonesummon_x = m_Position.m_X = x; + zonesummon_y = m_Position.m_Y = y; + zonesummon_z = m_Position.m_Z = z; SetHeading(heading); break; case Rewind: - LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); - zonesummon_x = x_pos = x; - zonesummon_y = y_pos = y; - zonesummon_z = z_pos = z; + LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + zonesummon_x = m_Position.m_X = x; + zonesummon_y = m_Position.m_Y = y; + zonesummon_z = m_Position.m_Z = z; SetHeading(heading); break; default: @@ -652,10 +652,10 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z else { if(zoneID == GetZoneID()) { //properly handle proximities - entity_list.ProcessMove(this, x_pos, y_pos, z_pos); - proximity_x = x_pos; - proximity_y = y_pos; - proximity_z = z_pos; + entity_list.ProcessMove(this, m_Position.m_X, m_Position.m_Y, m_Position.m_Z); + proximity_x = m_Position.m_X; + proximity_y = m_Position.m_Y; + proximity_z = m_Position.m_Z; //send out updates to people in zone. SendPosition(); @@ -723,9 +723,9 @@ void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y if (to_zone == -1) { m_pp.binds[0].zoneId = zone->GetZoneID(); m_pp.binds[0].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0; - m_pp.binds[0].x = x_pos; - m_pp.binds[0].y = y_pos; - m_pp.binds[0].z = z_pos; + m_pp.binds[0].x = m_Position.m_X; + m_pp.binds[0].y = m_Position.m_Y; + m_pp.binds[0].z = m_Position.m_Z; } else { m_pp.binds[0].zoneId = to_zone;