heading, x_pos, y_pos, and z_pos replaced with m_Position in Mob

This commit is contained in:
Arthur Ice 2014-11-25 20:16:04 -08:00
parent 640aea24bc
commit 53602e3c61
13 changed files with 318 additions and 319 deletions

View File

@ -58,10 +58,10 @@ Beacon::Beacon(Mob *at_mob, int lifetime)
caster_id = 0; caster_id = 0;
// copy location // copy location
x_pos = at_mob->GetX(); m_Position.m_X = at_mob->GetX();
y_pos = at_mob->GetY(); m_Position.m_Y = at_mob->GetY();
z_pos = at_mob->GetZ(); m_Position.m_Z = at_mob->GetZ();
heading = at_mob->GetHeading(); m_Position.m_Heading = at_mob->GetHeading();
if(lifetime) if(lifetime)
{ {

View File

@ -4122,9 +4122,9 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName()); this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName());
// Spawn the bot at the bow owner's loc // Spawn the bot at the bow owner's loc
this->x_pos = botCharacterOwner->GetX(); this->m_Position.m_X = botCharacterOwner->GetX();
this->y_pos = botCharacterOwner->GetY(); this->m_Position.m_Y = botCharacterOwner->GetY();
this->z_pos = botCharacterOwner->GetZ(); this->m_Position.m_Z = botCharacterOwner->GetZ();
// Make the bot look at the bot owner // Make the bot look at the bot owner
FaceTarget(botCharacterOwner); FaceTarget(botCharacterOwner);

View File

@ -399,9 +399,9 @@ Client::~Client() {
{ {
m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.zoneInstance = m_pp.binds[0].instance_id;
x_pos = m_pp.binds[0].x; m_Position.m_X = m_pp.binds[0].x;
y_pos = m_pp.binds[0].y; m_Position.m_Y = m_pp.binds[0].y;
z_pos = m_pp.binds[0].z; m_Position.m_Z = m_pp.binds[0].z;
} }
// we save right now, because the client might be zoning and the world // we save right now, because the client might be zoning and the world
@ -525,11 +525,11 @@ bool Client::Save(uint8 iCommitNow) {
return false; return false;
/* Wrote current basics to PP for saves */ /* Wrote current basics to PP for saves */
m_pp.x = x_pos; m_pp.x = m_Position.m_X;
m_pp.y = y_pos; m_pp.y = m_Position.m_Y;
m_pp.z = z_pos; m_pp.z = m_Position.m_Z;
m_pp.guildrank = guildrank; m_pp.guildrank = guildrank;
m_pp.heading = heading; m_pp.heading = m_Position.m_Heading;
/* Mana and HP */ /* Mana and HP */
if (GetHP() <= 0) { if (GetHP() <= 0) {
@ -3820,7 +3820,7 @@ void Client::Sacrifice(Client *caster)
void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) {
if(!Caster || PendingTranslocate) if(!Caster || PendingTranslocate)
return; return;
const SPDat_Spell_Struct &Spell = spells[SpellID]; const SPDat_Spell_Struct &Spell = spells[SpellID];
@ -4273,7 +4273,7 @@ bool Client::GroupFollow(Client* inviter) {
{ {
GetMerc()->MercJoinClientGroup(); GetMerc()->MercJoinClientGroup();
} }
if (inviter->IsLFP()) 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. // 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(); const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
strcpy(insr->itemnames[L], item->Name); strcpy(insr->itemnames[L], item->Name);
insr->itemicons[L] = aug_weap->Icon; insr->itemicons[L] = aug_weap->Icon;
} }
else { else {
strcpy(insr->itemnames[L], item->Name); strcpy(insr->itemnames[L], item->Name);
insr->itemicons[L] = item->Icon; insr->itemicons[L] = item->Icon;
@ -7460,7 +7460,7 @@ void Client::SendMercPersonalInfo()
uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs! uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs!
MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID]; MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID];
int stancecount = 0; int stancecount = 0;
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
@ -7562,7 +7562,7 @@ void Client::SendMercPersonalInfo()
} }
if (MERC_DEBUG > 0) if (MERC_DEBUG > 0)
Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful"); Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful");
SendMercMerchantResponsePacket(0); SendMercMerchantResponsePacket(0);
} }
else else

View File

@ -1472,10 +1472,10 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
/* Set Mob variables for spawn */ /* Set Mob variables for spawn */
class_ = m_pp.class_; class_ = m_pp.class_;
level = m_pp.level; level = m_pp.level;
x_pos = m_pp.x; m_Position.m_X = m_pp.x;
y_pos = m_pp.y; m_Position.m_Y = m_pp.y;
z_pos = m_pp.z; m_Position.m_Z = m_pp.z;
heading = m_pp.heading; m_Position.m_Heading = m_pp.heading;
race = m_pp.race; race = m_pp.race;
base_race = m_pp.race; base_race = m_pp.race;
gender = m_pp.gender; gender = m_pp.gender;
@ -4380,9 +4380,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
float dist = 0; float dist = 0;
float tmp; float tmp;
tmp = x_pos - ppu->x_pos; tmp = m_Position.m_X - ppu->x_pos;
dist += tmp*tmp; dist += tmp*tmp;
tmp = y_pos - ppu->y_pos; tmp = m_Position.m_Y - ppu->y_pos;
dist += tmp*tmp; dist += tmp*tmp;
dist = sqrt(dist); 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 //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. //his pre-PPU x and y for /rewind, in case he gets stuck.
if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) { if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) {
rewind_x = x_pos; rewind_x = m_Position.m_X;
rewind_y = y_pos; rewind_y = m_Position.m_Y;
rewind_z = z_pos; rewind_z = m_Position.m_Z;
} }
//If the PPU was a large jump, such as a cross zone gate or Call of Hero, //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_z = ppu->delta_z;
delta_heading = ppu->delta_heading; 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 if(MakeRandomFloat(0, 100) < 70)//should be good
CheckIncreaseSkill(SkillTracking, nullptr, -20); CheckIncreaseSkill(SkillTracking, nullptr, -20);
} }
// Break Hide if moving without sneaking and set rewind timer if moved // 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){ if((hidden || improved_hidden) && !sneaking){
hidden = false; hidden = false;
improved_hidden = false; improved_hidden = false;
@ -4589,13 +4589,14 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
// Outgoing client packet // Outgoing client packet
float tmpheading = EQ19toFloat(ppu->heading); 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; m_Position.m_X = ppu->x_pos;
y_pos = ppu->y_pos; m_Position.m_Y = ppu->y_pos;
z_pos = ppu->z_pos; m_Position.m_Z = ppu->z_pos;
animation = ppu->animation; m_Position.m_Heading = tmpheading;
heading = tmpheading; animation = ppu->animation;
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; 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)
{ {
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); CheckIncreaseSkill(SkillSwimming, nullptr, -17);
} }
@ -6607,7 +6608,7 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app)
GroupGeneric_Struct* gf = (GroupGeneric_Struct*)app->pBuffer; GroupGeneric_Struct* gf = (GroupGeneric_Struct*)app->pBuffer;
Mob* inviter = entity_list.GetClientByName(gf->name1); Mob* inviter = entity_list.GetClientByName(gf->name1);
// Inviter and Invitee are in the same zone // Inviter and Invitee are in the same zone
if (inviter != nullptr && inviter->IsClient()) 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 // Inviter is in another zone - Remove merc from group now if any
LeaveGroup(); LeaveGroup();
ServerPacket* pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct)); ServerPacket* pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct));
ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *)pack->pBuffer; ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *)pack->pBuffer;
sgfs->CharacterID = CharacterID(); sgfs->CharacterID = CharacterID();
@ -8019,7 +8020,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app)
InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer; InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer;
Mob* tmp = entity_list.GetMob(insr->TargetID); Mob* tmp = entity_list.GetMob(insr->TargetID);
const Item_Struct* item = nullptr; const Item_Struct* item = nullptr;
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
for (int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) { for (int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) {
const ItemInst* inst = GetInv().GetItem(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->from_slot] = m_pp.spell_book[swapspell->to_slot];
m_pp.spell_book[swapspell->to_slot] = swapspelltemp; 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)){ 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)){ if (!database.SaveCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot)){
database.DeleteCharacterSpell(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; Translocate_Struct *its = (Translocate_Struct*)app->pBuffer;
if (!PendingTranslocate) if (!PendingTranslocate)
return; return;
if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) { 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 // 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. // reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before.
if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) &&
(zone->GetZoneID() == PendingTranslocateData.zone_id && (zone->GetZoneID() == PendingTranslocateData.zone_id &&
zone->GetInstanceID() == PendingTranslocateData.instance_id)) zone->GetInstanceID() == PendingTranslocateData.instance_id))
{ {
PendingTranslocate = false; PendingTranslocate = false;
@ -13627,7 +13628,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
////Was sending the packet back to initiate client zone... ////Was sending the packet back to initiate client zone...
////but that could be abusable, so lets go through proper channels ////but that could be abusable, so lets go through proper channels
MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id, MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id,
PendingTranslocateData.x, PendingTranslocateData.y, PendingTranslocateData.x, PendingTranslocateData.y,
PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited); PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited);
} }
} }

View File

@ -188,7 +188,7 @@ bool Client::Process() {
GetMerc()->Save(); GetMerc()->Save();
GetMerc()->Depop(); GetMerc()->Depop();
} }
Raid *myraid = entity_list.GetRaidByClient(this); Raid *myraid = entity_list.GetRaidByClient(this);
if (myraid) if (myraid)
{ {
@ -581,7 +581,7 @@ bool Client::Process() {
if(projectile_timer.Check()) if(projectile_timer.Check())
SpellProjectileEffect(); SpellProjectileEffect();
if(spellbonuses.GravityEffect == 1) { if(spellbonuses.GravityEffect == 1) {
if(gravity_timer.Check()) if(gravity_timer.Check())
DoGravityEffect(); DoGravityEffect();
@ -800,32 +800,32 @@ void Client::OnDisconnect(bool hard_disconnect) {
if (MyRaid) if (MyRaid)
MyRaid->MemberZoned(this); MyRaid->MemberZoned(this);
parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); parse->EventPlayer(EVENT_DISCONNECT, this, "", 0);
/* QS: PlayerLogConnectDisconnect */ /* QS: PlayerLogConnectDisconnect */
if (RuleB(QueryServ, PlayerLogConnectDisconnect)){ if (RuleB(QueryServ, PlayerLogConnectDisconnect)){
std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", this->GetZoneID(), this->GetInstanceID()); 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); QServ->PlayerLogEvent(Player_Log_Connect_State, this->CharacterID(), event_desc);
} }
} }
Mob *Other = trade->With(); Mob *Other = trade->With();
if(Other) 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); FinishTrade(this);
if(Other->IsClient()) if(Other->IsClient())
Other->CastToClient()->FinishTrade(Other); Other->CastToClient()->FinishTrade(Other);
/* Reset both sides of the trade */ /* Reset both sides of the trade */
trade->Reset(); trade->Reset();
Other->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. 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(); ClearAllProximities();
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply); EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply);
@ -1570,7 +1570,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
if (from_bucket == &m_pp.platinum_shared) if (from_bucket == &m_pp.platinum_shared)
amount_to_add = 0 - amount_to_take; amount_to_add = 0 - amount_to_take;
database.SetSharedPlatinum(AccountID(),amount_to_add); database.SetSharedPlatinum(AccountID(),amount_to_add);
} }
} }
else{ else{
@ -1756,7 +1756,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
} }
SetSkill(skill, t_level); SetSkill(skill, t_level);
} else { } else {
switch(skill) { switch(skill) {
case SkillBrewing: case SkillBrewing:
case SkillMakePoison: case SkillMakePoison:
@ -1958,7 +1958,7 @@ void Client::DoEnduranceUpkeep() {
int upkeep_sum = 0; int upkeep_sum = 0;
int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction + aabonuses.EnduranceReduction; int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction + aabonuses.EnduranceReduction;
bool has_effect = false; bool has_effect = false;
uint32 buffs_i; uint32 buffs_i;
uint32 buff_count = GetMaxTotalSlots(); uint32 buff_count = GetMaxTotalSlots();
@ -2144,9 +2144,9 @@ void Client::HandleRespawnFromHover(uint32 Option)
if (corpse) if (corpse)
{ {
x_pos = corpse->GetX(); m_Position.m_X = corpse->GetX();
y_pos = corpse->GetY(); m_Position.m_Y = corpse->GetY();
z_pos = corpse->GetZ(); m_Position.m_Z = corpse->GetZ();
} }
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10); EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10);
@ -2199,10 +2199,10 @@ void Client::HandleRespawnFromHover(uint32 Option)
SetMana(GetMaxMana()); SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance()); SetEndurance(GetMaxEndurance());
x_pos = chosen->x; m_Position.m_X = chosen->x;
y_pos = chosen->y; m_Position.m_Y = chosen->y;
z_pos = chosen->z; m_Position.m_Z = chosen->z;
heading = chosen->heading; m_Position.m_Heading = chosen->heading;
ClearHover(); ClearHover();
entity_list.RefreshClientXTargets(this); entity_list.RefreshClientXTargets(this);
@ -2212,7 +2212,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
//After they've respawned into the same zone, trigger EVENT_RESPAWN //After they've respawned into the same zone, trigger EVENT_RESPAWN
parse->EventPlayer(EVENT_RESPAWN, this, static_cast<std::string>(itoa(Option)), is_rez ? 1 : 0); parse->EventPlayer(EVENT_RESPAWN, this, static_cast<std::string>(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 //easiest way to make sure it stays at the end and
//doesn't disrupt adding/removing scripted options //doesn't disrupt adding/removing scripted options
respawn_options.pop_back(); respawn_options.pop_back();

View File

@ -249,15 +249,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
0, // uint8 in_qglobal, 0, // uint8 in_qglobal,
0, // uint8 in_maxlevel, 0, // uint8 in_maxlevel,
0 // uint32 in_scalerate 0 // uint32 in_scalerate
), ),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)),
loot_cooldown_timer(10) loot_cooldown_timer(10)
{ {
int i; int i;
PlayerProfile_Struct *pp = &client->GetPP(); PlayerProfile_Struct *pp = &client->GetPP();
ItemInst *item; ItemInst *item;
@ -287,7 +287,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
platinum = 0; platinum = 0;
strcpy(orgname, pp->name); 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 was not being initialized which led to some pretty funky things with newly created corpses */
become_npc = false; become_npc = false;
@ -295,8 +295,8 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
SetPKItem(0); SetPKItem(0);
/* Check Rule to see if we can leave corpses */ /* Check Rule to see if we can leave corpses */
if(!RuleB(Character, LeaveNakedCorpses) || if(!RuleB(Character, LeaveNakedCorpses) ||
RuleB(Character, LeaveCorpses) && RuleB(Character, LeaveCorpses) &&
GetLevel() >= RuleI(Character, DeathItemLossLevel)) { GetLevel() >= RuleI(Character, DeathItemLossLevel)) {
// cash // cash
// Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. // 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; ItemList::iterator cur, end;
cur = itemlist.begin(); cur = itemlist.begin();
end = itemlist.end(); end = itemlist.end();
for (; cur != end; ++cur) { for (; cur != end; ++cur) {
ServerLootItem_Struct* item = *cur; ServerLootItem_Struct* item = *cur;
item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed
memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct));
@ -597,11 +597,11 @@ bool Corpse::Save() {
/* Create New Corpse*/ /* Create New Corpse*/
if (corpse_db_id == 0) { 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 */ /* Update Corpse Data */
else{ 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); safe_delete_array(dbpc);
@ -611,8 +611,8 @@ bool Corpse::Save() {
void Corpse::Delete() { void Corpse::Delete() {
if (IsPlayerCorpse() && corpse_db_id != 0) if (IsPlayerCorpse() && corpse_db_id != 0)
database.DeleteCharacterCorpse(corpse_db_id); database.DeleteCharacterCorpse(corpse_db_id);
corpse_db_id = 0; corpse_db_id = 0;
player_corpse_depop = true; player_corpse_depop = true;
} }
@ -717,7 +717,7 @@ void Corpse::RemoveItem(uint16 lootslot) {
} }
void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ void Corpse::RemoveItem(ServerLootItem_Struct* item_data){
uint8 material; uint8 material;
ItemList::iterator cur,end; ItemList::iterator cur,end;
cur = itemlist.begin(); cur = itemlist.begin();
end = itemlist.end(); end = itemlist.end();
@ -925,7 +925,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
} }
RemoveCash(); RemoveCash();
Save(); Save();
} }
outapp->priority = 6; outapp->priority = 6;
@ -1081,7 +1081,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
} }
if (item != 0) { 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); 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 { 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 */ /* 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); database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item_data->item_id);
/* Delete Item Instance */ /* Delete Item Instance */
RemoveItem(item_data->lootslot); RemoveItem(item_data->lootslot);
} }
/* Remove Bag Contents */ /* 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++) { for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) {
if (bag_item_data[i]) { if (bag_item_data[i]) {
/* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ /* 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 */ /* 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; 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 int x = 0, y = 0; // x = visible items, y = total items
to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper); 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 ** Corpse slot translations are needed until corpse database blobs are converted
** **
** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into ** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into
** the contiguous possessions slot enumeration, the following designations will be used: ** the contiguous possessions slot enumeration, the following designations will be used:
** **
** Designatiom Server Corpse Offset ** Designatiom Server Corpse Offset
** -------------------------------------------------- ** --------------------------------------------------
** MainCharm 0 0 0 ** MainCharm 0 0 0
@ -1518,4 +1518,4 @@ int16 Corpse::CorpseToServerSlot(int16 corpse_slot)
return corpse_slot; return corpse_slot;
} }
*/ */
} }

View File

@ -225,15 +225,15 @@ bool Client::CanFish() {
HeadingDegrees = (int) ((GetHeading()*360)/256); HeadingDegrees = (int) ((GetHeading()*360)/256);
HeadingDegrees = HeadingDegrees % 360; HeadingDegrees = HeadingDegrees % 360;
RodX = x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f); RodX = m_Position.m_X + RodLength * sin(HeadingDegrees * M_PI/180.0f);
RodY = y_pos + RodLength * cos(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). // 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. // and go 1 unit into the water.
Map::Vertex dest; Map::Vertex dest;
dest.x = RodX; dest.x = RodX;
dest.y = RodY; dest.y = RodY;
dest.z = z_pos+10; dest.z = m_Position.m_Z+10;
RodZ = zone->zonemap->FindBestZ(dest, nullptr) + 4; RodZ = zone->zonemap->FindBestZ(dest, nullptr) + 4;
bool in_lava = zone->watermap->InLava(RodX, RodY, RodZ); 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? Message_StringID(MT_Skills, FISHING_LAVA); //Trying to catch a fire elemental or something?
return false; 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? Message_StringID(MT_Skills, FISHING_LAND); //Trying to catch land sharks perhaps?
return false; return false;
} }

View File

@ -157,10 +157,10 @@ Mob::Mob(const char* in_name,
if (runspeed < 0 || runspeed > 20) if (runspeed < 0 || runspeed > 20)
runspeed = 1.25f; runspeed = 1.25f;
heading = in_heading; m_Position.m_Heading = in_heading;
x_pos = in_x_pos; m_Position.m_X = in_x_pos;
y_pos = in_y_pos; m_Position.m_Y = in_y_pos;
z_pos = in_z_pos; m_Position.m_Z = in_z_pos;
light = in_light; light = in_light;
texture = in_texture; texture = in_texture;
helmtexture = in_helmtexture; helmtexture = in_helmtexture;
@ -373,7 +373,7 @@ Mob::Mob(const char* in_name,
m_targetable = true; m_targetable = true;
targetring_x = 0.0f; targetring_x = 0.0f;
targetring_y = 0.0f; targetring_y = 0.0f;
targetring_z = 0.0f; targetring_z = 0.0f;
flymode = FlyMode3; flymode = FlyMode3;
@ -882,10 +882,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
} }
ns->spawn.heading = FloatToEQ19(heading); ns->spawn.heading = FloatToEQ19(m_Position.m_Heading);
ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3; ns->spawn.x = FloatToEQ19(m_Position.m_X);//((int32)x_pos)<<3;
ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3; ns->spawn.y = FloatToEQ19(m_Position.m_Y);//((int32)y_pos)<<3;
ns->spawn.z = FloatToEQ19(z_pos);//((int32)z_pos)<<3; ns->spawn.z = FloatToEQ19(m_Position.m_Z);//((int32)z_pos)<<3;
ns->spawn.spawnId = GetID(); ns->spawn.spawnId = GetID();
ns->spawn.curHp = static_cast<uint8>(GetHPRatio()); ns->spawn.curHp = static_cast<uint8>(GetHPRatio());
ns->spawn.max_hp = 100; //this field needs a better name 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){ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
memset(spu,0xff,sizeof(PlayerPositionUpdateServer_Struct)); memset(spu,0xff,sizeof(PlayerPositionUpdateServer_Struct));
spu->spawn_id = GetID(); spu->spawn_id = GetID();
spu->x_pos = FloatToEQ19(x_pos); spu->x_pos = FloatToEQ19(m_Position.m_X);
spu->y_pos = FloatToEQ19(y_pos); spu->y_pos = FloatToEQ19(m_Position.m_Y);
spu->z_pos = FloatToEQ19(z_pos); spu->z_pos = FloatToEQ19(m_Position.m_Z);
spu->delta_x = NewFloatToEQ13(0); spu->delta_x = NewFloatToEQ13(0);
spu->delta_y = NewFloatToEQ13(0); spu->delta_y = NewFloatToEQ13(0);
spu->delta_z = NewFloatToEQ13(0); spu->delta_z = NewFloatToEQ13(0);
spu->heading = FloatToEQ19(heading); spu->heading = FloatToEQ19(m_Position.m_Heading);
spu->animation = 0; spu->animation = 0;
spu->delta_heading = NewFloatToEQ13(0); spu->delta_heading = NewFloatToEQ13(0);
spu->padding0002 =0; spu->padding0002 =0;
@ -1230,13 +1230,13 @@ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
// this is for SendPosUpdate() // this is for SendPosUpdate()
void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) { void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) {
spu->spawn_id = GetID(); spu->spawn_id = GetID();
spu->x_pos = FloatToEQ19(x_pos); spu->x_pos = FloatToEQ19(m_Position.m_X);
spu->y_pos = FloatToEQ19(y_pos); spu->y_pos = FloatToEQ19(m_Position.m_Y);
spu->z_pos = FloatToEQ19(z_pos); spu->z_pos = FloatToEQ19(m_Position.m_Z);
spu->delta_x = NewFloatToEQ13(delta_x); spu->delta_x = NewFloatToEQ13(delta_x);
spu->delta_y = NewFloatToEQ13(delta_y); spu->delta_y = NewFloatToEQ13(delta_y);
spu->delta_z = NewFloatToEQ13(delta_z); spu->delta_z = NewFloatToEQ13(delta_z);
spu->heading = FloatToEQ19(heading); spu->heading = FloatToEQ19(m_Position.m_Heading);
spu->padding0002 =0; spu->padding0002 =0;
spu->padding0006 =7; spu->padding0006 =7;
spu->padding0014 =0x7f; 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); entity_list.ProcessMove(CastToNPC(), x, y, z);
} }
x_pos = x; m_Position.m_X = x;
y_pos = y; m_Position.m_Y = y;
z_pos = z; m_Position.m_Z = z;
if (heading != 0.01) if (m_Position.m_Heading != 0.01)
this->heading = heading; this->m_Position.m_Heading = heading;
if(IsNPC()) if(IsNPC())
CastToNPC()->SaveGuardSpot(true); CastToNPC()->SaveGuardSpot(true);
if(SendUpdate) if(SendUpdate)
@ -2062,9 +2062,9 @@ bool Mob::CanThisClassBlock(void) const
} }
float Mob::Dist(const Mob &other) const { float Mob::Dist(const Mob &other) const {
float xDiff = other.x_pos - x_pos; float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.y_pos - y_pos; float yDiff = other.m_Position.m_Y - m_Position.m_Y;
float zDiff = other.z_pos - z_pos; float zDiff = other.m_Position.m_Z - m_Position.m_Z;
return sqrtf( (xDiff * xDiff) return sqrtf( (xDiff * xDiff)
+ (yDiff * yDiff) + (yDiff * yDiff)
@ -2072,17 +2072,17 @@ float Mob::Dist(const Mob &other) const {
} }
float Mob::DistNoZ(const Mob &other) const { float Mob::DistNoZ(const Mob &other) const {
float xDiff = other.x_pos - x_pos; float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.y_pos - y_pos; float yDiff = other.m_Position.m_Y - m_Position.m_Y;
return sqrtf( (xDiff * xDiff) return sqrtf( (xDiff * xDiff)
+ (yDiff * yDiff) ); + (yDiff * yDiff) );
} }
float Mob::DistNoRoot(const Mob &other) const { float Mob::DistNoRoot(const Mob &other) const {
float xDiff = other.x_pos - x_pos; float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.y_pos - y_pos; float yDiff = other.m_Position.m_Y - m_Position.m_Y;
float zDiff = other.z_pos - z_pos; float zDiff = other.m_Position.m_Z - m_Position.m_Z;
return ( (xDiff * xDiff) return ( (xDiff * xDiff)
+ (yDiff * yDiff) + (yDiff * yDiff)
@ -2090,9 +2090,9 @@ float Mob::DistNoRoot(const Mob &other) const {
} }
float Mob::DistNoRoot(float x, float y, float z) const { float Mob::DistNoRoot(float x, float y, float z) const {
float xDiff = x - x_pos; float xDiff = x - m_Position.m_X;
float yDiff = y - y_pos; float yDiff = y - m_Position.m_Y;
float zDiff = z - z_pos; float zDiff = z - m_Position.m_Z;
return ( (xDiff * xDiff) return ( (xDiff * xDiff)
+ (yDiff * yDiff) + (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 Mob::DistNoRootNoZ(float x, float y) const {
float xDiff = x - x_pos; float xDiff = x - m_Position.m_X;
float yDiff = y - y_pos; float yDiff = y - m_Position.m_Y;
return ( (xDiff * xDiff) + (yDiff * yDiff) ); return ( (xDiff * xDiff) + (yDiff * yDiff) );
} }
float Mob::DistNoRootNoZ(const Mob &other) const { float Mob::DistNoRootNoZ(const Mob &other) const {
float xDiff = other.x_pos - x_pos; float xDiff = other.m_Position.m_X - m_Position.m_X;
float yDiff = other.y_pos - y_pos; float yDiff = other.m_Position.m_Y - m_Position.m_Y;
return ( (xDiff * xDiff) + (yDiff * yDiff) ); 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() ); entity_list.MessageClose(this, true, 500, MT_Say, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() );
if (target->IsClient()) { 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 { else {
#ifdef BOTS #ifdef BOTS
@ -2266,7 +2266,7 @@ bool Mob::HateSummon() {
} }
#endif //BOTS #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; return true;
@ -2614,9 +2614,9 @@ void Mob::Warp( float x, float y, float z )
entity_list.ProcessMove(CastToNPC(), x, y, z); entity_list.ProcessMove(CastToNPC(), x, y, z);
} }
x_pos = x; m_Position.m_X = x;
y_pos = y; m_Position.m_Y = y;
z_pos = z; m_Position.m_Z = z;
Mob* target = GetTarget(); Mob* target = GetTarget();
if (target) { if (target) {
@ -2829,9 +2829,9 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
if (zone->zonemap != nullptr) if (zone->zonemap != nullptr)
{ {
Map::Vertex me; Map::Vertex me;
me.x = new_x; me.x = m_Position.m_X;
me.y = new_y; me.y = m_Position.m_Y;
me.z = z_pos+z_offset; me.z = m_Position.m_Z + z_offset;
Map::Vertex hit; Map::Vertex hit;
float best_z = zone->zonemap->FindBestZ(me, &hit); float best_z = zone->zonemap->FindBestZ(me, &hit);
if (best_z != -999999) if (best_z != -999999)
@ -2849,9 +2849,9 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
if (zone->zonemap != 0) if (zone->zonemap != 0)
{ {
Map::Vertex me; Map::Vertex me;
me.x = new_x; me.x = m_Position.m_X;
me.y = new_y; me.y = m_Position.m_Y;
me.z = z_pos+z_offset; me.z = m_Position.m_Z+z_offset;
Map::Vertex hit; Map::Vertex hit;
float best_z = zone->zonemap->FindBestZ(me, &hit); float best_z = zone->zonemap->FindBestZ(me, &hit);
if (best_z != -999999) if (best_z != -999999)
@ -3068,7 +3068,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
{ {
if(!target || !IsValidSpell(spell_id)) if(!target || !IsValidSpell(spell_id))
return false; return false;
int spell_trig = 0; int spell_trig = 0;
// Count all the percentage chances to trigger for all effects // Count all the percentage chances to trigger for all effects
for(int i = 0; i < EFFECT_COUNT; i++) 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 (slot < 4){
if (id == "components") { spells[spell_id].components[slot];} 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];} 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<int32>(spells[spell_id].max_dist); } else if (id == "max_dist") {stat = static_cast<int32>(spells[spell_id].max_dist); }
else if (id == "min_range") {stat = static_cast<int32>(spells[spell_id].min_range); } else if (id == "min_range") {stat = static_cast<int32>(spells[spell_id].min_range); }
else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; } else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; }
return stat; return stat;
} }

View File

@ -23,6 +23,7 @@
#include "entity.h" #include "entity.h"
#include "hate_list.h" #include "hate_list.h"
#include "pathing.h" #include "pathing.h"
#include "position.h"
#include <set> #include <set>
#include <vector> #include <vector>
#include <string> #include <string>
@ -176,7 +177,7 @@ public:
bool IsInvisible(Mob* other = 0) const; bool IsInvisible(Mob* other = 0) const;
void SetInvisible(uint8 state); void SetInvisible(uint8 state);
bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon); bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon);
//Song //Song
bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1);
bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot); bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot);
@ -392,10 +393,10 @@ public:
((static_cast<float>(cur_mana) / max_mana) * 100); } ((static_cast<float>(cur_mana) / max_mana) * 100); }
virtual int32 CalcMaxMana(); virtual int32 CalcMaxMana();
uint32 GetNPCTypeID() const { return npctype_id; } uint32 GetNPCTypeID() const { return npctype_id; }
inline const float GetX() const { return x_pos; } inline const float GetX() const { return m_Position.m_X; }
inline const float GetY() const { return y_pos; } inline const float GetY() const { return m_Position.m_Y; }
inline const float GetZ() const { return z_pos; } inline const float GetZ() const { return m_Position.m_Z; }
inline const float GetHeading() const { return heading; } inline const float GetHeading() const { return m_Position.m_Heading; }
inline const float GetSize() const { return size; } inline const float GetSize() const { return size; }
inline const float GetBaseSize() const { return base_size; } inline const float GetBaseSize() const { return base_size; }
inline const float GetTarX() const { return tarx; } inline const float GetTarX() const { return tarx; }
@ -437,8 +438,8 @@ public:
void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu); void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu);
void SendPosition(); void SendPosition();
void SetFlyMode(uint8 flymode); void SetFlyMode(uint8 flymode);
inline void Teleport(Map::Vertex NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y; inline void Teleport(Map::Vertex NewPosition) { m_Position.m_X = NewPosition.x; m_Position.m_Y = NewPosition.y;
z_pos = NewPosition.z; }; m_Position.m_Z = NewPosition.z; };
//AI //AI
static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel); static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel);
@ -459,8 +460,8 @@ public:
bool IsEngaged() { return(!hate_list.IsEmpty()); } bool IsEngaged() { return(!hate_list.IsEmpty()); }
bool HateSummon(); bool HateSummon();
void FaceTarget(Mob* MobToFace = 0); void FaceTarget(Mob* MobToFace = 0);
void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime(); void SetHeading(float iHeading) { if(m_Position.m_Heading != iHeading) { pLastChange = Timer::GetCurrentTime();
heading = iHeading; } } m_Position.m_Heading = iHeading; } }
void WipeHateList(); void WipeHateList();
void AddFeignMemory(Client* attacker); void AddFeignMemory(Client* attacker);
void RemoveFromFeignMemory(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); 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); 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, 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_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, 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_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF,
uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = -1.0f); uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = -1.0f);
virtual void Stun(int duration); virtual void Stun(int duration);
virtual void UnStun(); virtual void UnStun();
@ -617,7 +618,7 @@ public:
bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); }
bool DoHPToManaCovert(uint16 mana_cost = 0); bool DoHPToManaCovert(uint16 mana_cost = 0);
int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); 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); int32 GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg);
void MeleeLifeTap(int32 damage); void MeleeLifeTap(int32 damage);
bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true); bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true);
@ -678,9 +679,9 @@ public:
inline int16 GetTempPetCount() const { return count_TempPet; } inline int16 GetTempPetCount() const { return count_TempPet; }
inline void SetTempPetCount(int16 i) { count_TempPet = i; } inline void SetTempPetCount(int16 i) { count_TempPet = i; }
bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } 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 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 void SetTempPet(bool value) { _IsTempPet = value; }
inline const bodyType GetBodyType() const { return bodytype; } inline const bodyType GetBodyType() const { return bodytype; }
@ -806,7 +807,7 @@ public:
void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; }
// calculate interruption of spell via movement of mob // 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 GetSpellX() const {return spell_x;}
inline float GetSpellY() const {return spell_y;} inline float GetSpellY() const {return spell_y;}
inline float GetSpellZ() const {return spell_z;} inline float GetSpellZ() const {return spell_z;}
@ -860,7 +861,7 @@ public:
Shielders_Struct shielder[MAX_SHIELDERS]; Shielders_Struct shielder[MAX_SHIELDERS];
Trade* trade; Trade* trade;
inline float GetCWPX() const { return(cur_wp_x); } inline float GetCWPX() const { return(cur_wp_x); }
inline float GetCWPY() const { return(cur_wp_y); } inline float GetCWPY() const { return(cur_wp_y); }
inline float GetCWPZ() const { return(cur_wp_z); } inline float GetCWPZ() const { return(cur_wp_z); }
@ -998,10 +999,7 @@ protected:
uint8 level; uint8 level;
uint8 orig_level; uint8 orig_level;
uint32 npctype_id; uint32 npctype_id;
float x_pos; xyz_heading m_Position;
float y_pos;
float z_pos;
float heading;
uint16 animation; uint16 animation;
float base_size; float base_size;
float size; float size;

View File

@ -1792,7 +1792,7 @@ void NPC::AI_DoMovement() {
CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp); CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp);
else 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; bool WaypointChanged, NodeReached;
Map::Vertex Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached); Map::Vertex Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached);

View File

@ -297,7 +297,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
sprintf(temp, "%d", spell_id); sprintf(temp, "%d", spell_id);
parse->EventNPC(EVENT_CAST_BEGIN, CastToNPC(), nullptr, temp, 0); parse->EventNPC(EVENT_CAST_BEGIN, CastToNPC(), nullptr, temp, 0);
} }
//To prevent NPC ghosting when spells are cast from scripts //To prevent NPC ghosting when spells are cast from scripts
if (IsNPC() && IsMoving() && cast_time > 0) if (IsNPC() && IsMoving() && cast_time > 0)
SendPosition(); SendPosition();
@ -1607,7 +1607,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
{ {
if(!spell_target) if(!spell_target)
return false; return false;
ae_center = spell_target; ae_center = spell_target;
CastAction = AETarget; CastAction = AETarget;
} }
@ -1626,7 +1626,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
{ {
if(!spell_target) if(!spell_target)
return false; return false;
ae_center = spell_target; ae_center = spell_target;
CastAction = AETarget; CastAction = AETarget;
} }
@ -2072,7 +2072,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
} else { } else {
// regular PB AE or targeted AE spell - spell_target is null if PB // regular PB AE or targeted AE spell - spell_target is null if PB
if(spell_target) // this must be an AETarget spell if(spell_target) // this must be an AETarget spell
{ {
bool cast_on_target = true; bool cast_on_target = true;
if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && spell_target->IsPetOwnerClient()) if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && spell_target->IsPetOwnerClient())
cast_on_target = false; 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); ConeDirectional(spell_id, resist_adjust);
break; break;
} }
case Beam: case Beam:
{ {
BeamDirectional(spell_id, resist_adjust); 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)) if (IsValidSpell(spells[spell_id].RecourseLink))
SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff); SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff);
if (IsDetrimentalSpell(spell_id)) { if (IsDetrimentalSpell(spell_id)) {
CheckNumHitsRemaining(NUMHIT_OutgoingSpells); CheckNumHitsRemaining(NUMHIT_OutgoingSpells);
@ -3831,9 +3831,9 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster)
rezz->zone_id = zone->GetZoneID(); rezz->zone_id = zone->GetZoneID();
rezz->instance_id = zone->GetInstanceID(); rezz->instance_id = zone->GetInstanceID();
rezz->spellid = spellid; rezz->spellid = spellid;
rezz->x = this->x_pos; rezz->x = this->m_Position.m_X;
rezz->y = this->y_pos; rezz->y = this->m_Position.m_Y;
rezz->z = this->z_pos; rezz->z = this->m_Position.m_Z;
rezz->unknown000 = 0x00000000; rezz->unknown000 = 0x00000000;
rezz->unknown020 = 0x00000000; rezz->unknown020 = 0x00000000;
rezz->unknown088 = 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) if(partial_modifier <= 0)
{ {
return 100; return 100;
} }
else if(partial_modifier >= 100) else if(partial_modifier >= 100)
{ {
return 0; return 0;
@ -4816,7 +4816,7 @@ void Client::UnmemSpell(int slot, bool update_client)
m_pp.mem_spells[slot] = 0xFFFFFFFF; m_pp.mem_spells[slot] = 0xFFFFFFFF;
database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot);
if(update_client) if(update_client)
{ {
MemorizeSpell(slot, m_pp.mem_spells[slot], memSpellForget); 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); mlog(CLIENT__SPELLS, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot);
m_pp.spell_book[slot] = 0xFFFFFFFF; 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) if(update_client)
{ {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteSpell, sizeof(DeleteSpell_Struct)); 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) if(slot >= MAX_PP_DISCIPLINES || slot < 0)
return; 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; m_pp.disciplines.values[slot] = 0;
database.DeleteCharacterDisc(this->CharacterID(), slot); database.DeleteCharacterDisc(this->CharacterID(), slot);
@ -5438,27 +5438,27 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust)
if (IsBeneficialSpell(spell_id) && IsClient()) if (IsBeneficialSpell(spell_id) && IsClient())
beneficial_targets = true; beneficial_targets = true;
std::list<Mob*> targets_in_range; std::list<Mob*> targets_in_range;
std::list<Mob*>::iterator iter; std::list<Mob*>::iterator iter;
entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].range, spells[spell_id].range / 2, targets_in_range); 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(); iter = targets_in_range.begin();
float dX = 0; float dX = 0;
float dY = 0; float dY = 0;
float dZ = 0; float dZ = 0;
CalcDestFromHeading(GetHeading(), spells[spell_id].range, 5, GetX(), GetY(), dX, dY, dZ); CalcDestFromHeading(GetHeading(), spells[spell_id].range, 5, GetX(), GetY(), dX, dY, dZ);
dZ = GetZ(); dZ = GetZ();
//FIND SLOPE: Put it into the form y = mx + b //FIND SLOPE: Put it into the form y = mx + b
float m = (dY - GetY()) / (dX - GetX()); float m = (dY - GetY()) / (dX - GetX());
float b = (GetY() * dX - dY * GetX()) / (dX - GetX()); float b = (GetY() * dX - dY * GetX()) / (dX - GetX());
while(iter != targets_in_range.end()) 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)->BehindMob(this, (*iter)->GetX(),(*iter)->GetY())){
++iter; ++iter;
continue; continue;
@ -5466,7 +5466,7 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust)
//# shortest distance from line to target point //# shortest distance from line to target point
float d = abs( (*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1); float d = abs( (*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1);
if (d <= spells[spell_id].aoerange) if (d <= spells[spell_id].aoerange)
{ {
if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { 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); float heading_to_target = (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f);
while(heading_to_target < 0.0f) while(heading_to_target < 0.0f)
heading_to_target += 360.0f; heading_to_target += 360.0f;
@ -5544,4 +5544,4 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust)
++iter; ++iter;
} }
} }

View File

@ -437,10 +437,10 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) {
guard_heading = 0; guard_heading = 0;
} }
else { else {
guard_x = x_pos; guard_x = m_Position.m_X;
guard_y = y_pos; guard_y = m_Position.m_Y;
guard_z = z_pos; guard_z = m_Position.m_Z;
guard_heading = heading; guard_heading = m_Position.m_Heading;
if(guard_heading == 0) if(guard_heading == 0)
guard_heading = 0.0001; //hack to make IsGuarding simpler 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); 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); SetHeading(guard_heading);
mlog(AI__WAYPOINTS, "Unable to move to next guard position. Probably rooted."); 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) if(moved)
{ {
@ -480,7 +480,7 @@ void Mob::SaveSpawnSpot() {
}*/ }*/
float Mob::CalculateDistance(float x, float y, float z) { 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 Mob::CalculateHeadingToTarget(float in_x, float in_y) {
float angle; float angle;
if (in_x-x_pos > 0) if (in_x-m_Position.m_X > 0)
angle = - 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; angle = - 90 + atan((float)(in_y-m_Position.m_Y) / (float)(in_x-m_Position.m_X)) * 180 / M_PI;
else if (in_x-x_pos < 0) else if (in_x-m_Position.m_X < 0)
angle = + 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; angle = + 90 + atan((float)(in_y-m_Position.m_Y) / (float)(in_x-m_Position.m_X)) * 180 / M_PI;
else // Added? else // Added?
{ {
if (in_y-y_pos > 0) if (in_y-m_Position.m_Y > 0)
angle = 0; angle = 0;
else else
angle = 180; angle = 180;
@ -513,16 +513,16 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
if(GetID()==0) if(GetID()==0)
return true; return true;
if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords if ((m_Position.m_X-x == 0) && (m_Position.m_Y-y == 0)) {//spawn is at target coords
if(z_pos-z != 0) { if(m_Position.m_Z-z != 0) {
z_pos = z; m_Position.m_Z = z;
mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z);
return true; return true;
} }
mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater);
return false; 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); 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); entity_list.ProcessMove(CastToNPC(), x, y, z);
} }
x_pos = x; m_Position.m_X = x;
y_pos = y; m_Position.m_Y = y;
z_pos = z; m_Position.m_Z = z;
return true; return true;
} }
int compare_steps = IsBoat() ? 1 : 20; int compare_steps = IsBoat() ? 1 : 20;
if(tar_ndx < compare_steps && tarx==x && tary==y) { if(tar_ndx < compare_steps && tarx==x && tary==y) {
float new_x = x_pos + tar_vx*tar_vector; float new_x = m_Position.m_X + tar_vx*tar_vector;
float new_y = y_pos + tar_vy*tar_vector; float new_y = m_Position.m_Y + tar_vy*tar_vector;
float new_z = z_pos + tar_vz*tar_vector; float new_z = m_Position.m_Z + tar_vz*tar_vector;
if(IsNPC()) { if(IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
} }
x_pos = new_x; m_Position.m_X = new_x;
y_pos = new_y; m_Position.m_Y = new_y;
z_pos = new_z; 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); 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(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
{ {
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || 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; 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( (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)) if(ABS(z-m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving))
z_pos = z; m_Position.m_Z = z;
else else
z_pos = newz + 1; m_Position.m_Z = newz + 1;
} }
else 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; tary=y;
tarz=z; tarz=z;
float nx = this->x_pos; float nx = this->m_Position.m_X;
float ny = this->y_pos; float ny = this->m_Position.m_Y;
float nz = this->z_pos; float nz = this->m_Position.m_Z;
// float nh = this->heading; // float nh = this->heading;
tar_vx = x - nx; 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_vy = tar_vy/numsteps;
tar_vz = tar_vz/numsteps; tar_vz = tar_vz/numsteps;
float new_x = x_pos + tar_vx; float new_x = m_Position.m_X + tar_vx;
float new_y = y_pos + tar_vy; float new_y = m_Position.m_Y + tar_vy;
float new_z = z_pos + tar_vz; float new_z = m_Position.m_Z + tar_vz;
if(IsNPC()) { if(IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
} }
x_pos = new_x; m_Position.m_X = new_x;
y_pos = new_y; m_Position.m_Y = new_y;
z_pos = new_z; m_Position.m_Z = new_z;
m_Position.m_Heading = CalculateHeadingToTarget(x, y);
tar_ndx=22-numsteps; tar_ndx=22-numsteps;
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);
mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps);
} }
else else
{ {
@ -655,9 +655,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
entity_list.ProcessMove(CastToNPC(), x, y, z); entity_list.ProcessMove(CastToNPC(), x, y, z);
} }
x_pos = x; m_Position.m_X = x;
y_pos = y; m_Position.m_Y = y;
z_pos = z; m_Position.m_Z = z;
mlog(AI__WAYPOINTS, "Only a single step to get there... jumping."); 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 { else {
tar_vector/=20; tar_vector/=20;
float new_x = x_pos + tar_vx*tar_vector; float new_x = m_Position.m_X + tar_vx*tar_vector;
float new_y = y_pos + tar_vy*tar_vector; float new_y = m_Position.m_Y + tar_vy*tar_vector;
float new_z = z_pos + tar_vz*tar_vector; float new_z = m_Position.m_Z + tar_vz*tar_vector;
if(IsNPC()) { if(IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
} }
x_pos = new_x; m_Position.m_X = new_x;
y_pos = new_y; m_Position.m_Y = new_y;
z_pos = new_z; m_Position.m_Z = new_z;
heading = CalculateHeadingToTarget(x, y); m_Position.m_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);
} }
uint8 NPCFlyMode = 0; 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(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) {
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || 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; 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( (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)) if(ABS(z - m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving))
z_pos = z; m_Position.m_Z = z;
else else
z_pos = newz + 1; m_Position.m_Z = newz + 1;
} }
else 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); SetMoving(true);
moved=true; moved=true;
delta_x=x_pos-nx; delta_x=m_Position.m_X-nx;
delta_y=y_pos-ny; delta_y=m_Position.m_Y-ny;
delta_z=z_pos-nz; delta_z=m_Position.m_Z-nz;
delta_heading=0; delta_heading=0;
if (IsClient()) if (IsClient())
@ -746,9 +746,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec
if(GetID()==0) if(GetID()==0)
return true; return true;
float nx = x_pos; float nx = m_Position.m_X;
float ny = y_pos; float ny = m_Position.m_Y;
float nz = z_pos; float nz = m_Position.m_Z;
// if NPC is rooted // if NPC is rooted
if (speed == 0.0) { 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); 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); 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 (tar_vector >= 1.0) {
if(IsNPC()) { if(IsNPC()) {
entity_list.ProcessMove(CastToNPC(), x, y, z); entity_list.ProcessMove(CastToNPC(), x, y, z);
} }
x_pos = x; m_Position.m_X = x;
y_pos = y; m_Position.m_Y = y;
z_pos = z; m_Position.m_Z = z;
mlog(AI__WAYPOINTS, "Close enough, jumping to waypoint"); mlog(AI__WAYPOINTS, "Close enough, jumping to waypoint");
} }
else { else {
float new_x = x_pos + tar_vx*tar_vector; float new_x = m_Position.m_X + tar_vx*tar_vector;
float new_y = y_pos + tar_vy*tar_vector; float new_y = m_Position.m_Y + tar_vy*tar_vector;
float new_z = z_pos + tar_vz*tar_vector; float new_z = m_Position.m_Z + tar_vz*tar_vector;
if(IsNPC()) { if(IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
} }
x_pos = new_x; m_Position.m_X = new_x;
y_pos = new_y; m_Position.m_Y = new_y;
z_pos = new_z; m_Position.m_Z = new_z;
mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z);
} }
uint8 NPCFlyMode = 0; 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(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
{ {
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || 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; 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( (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)) if(ABS(z - m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving))
z_pos = z; m_Position.m_Z = z;
else else
z_pos = newz + 1; m_Position.m_Z = newz + 1;
} }
else 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; tar_ndx=0;
this->SetMoving(true); this->SetMoving(true);
moved=true; moved=true;
delta_x=(x_pos-nx); delta_x=(m_Position.m_X-nx);
delta_y=(y_pos-ny); delta_y=(m_Position.m_Y-ny);
delta_z=(z_pos-nz); delta_z=(m_Position.m_Z-nz);
delta_heading=0;//(heading-nh)*8; delta_heading=0;//(heading-nh)*8;
SendPosUpdate(); 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); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
} }
x_pos = new_x; m_Position.m_X = new_x;
y_pos = new_y; m_Position.m_Y = new_y;
z_pos = new_z; m_Position.m_Z = new_z;
mlog(AI__WAYPOINTS, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); mlog(AI__WAYPOINTS, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z);
if(flymode == FlyMode1) 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(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) )
{ {
if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || 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); 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. if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
z_pos = newz + 1; m_Position.m_Z = newz + 1;
} }
} }
else else
z_pos += 0.1; m_Position.m_Z += 0.1;
} }
void Mob::SendToFixZ(float new_x, float new_y, float new_z) { 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); entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z + 0.1);
} }
x_pos = new_x; m_Position.m_X = new_x;
y_pos = new_y; m_Position.m_Y = new_y;
z_pos = new_z + 0.1; m_Position.m_Z = new_z + 0.1;
//fix up pathing Z, this shouldent be needed IF our waypoints //fix up pathing Z, this shouldent be needed IF our waypoints
//are corrected instead //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(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo))
{ {
if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || 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); 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. if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
z_pos = newz + 1; m_Position.m_Z = newz + 1;
} }
} }
} }

View File

@ -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 //set the player's coordinates in the new zone so they have them
//when they zone into it //when they zone into it
x_pos = dest_x; //these coordinates will now be saved when ~client is called m_Position.m_X = dest_x; //these coordinates will now be saved when ~client is called
y_pos = dest_y; m_Position.m_Y = dest_y;
z_pos = dest_z; m_Position.m_Z = dest_z;
heading = dest_h; // Cripp: fix for zone heading m_Position.m_Heading = dest_h; // Cripp: fix for zone heading
m_pp.heading = dest_h; m_pp.heading = dest_h;
m_pp.zone_id = zone_id; m_pp.zone_id = zone_id;
m_pp.zoneInstance = instance_id; m_pp.zoneInstance = instance_id;
//Force a save so its waiting for them when they zone //Force a save so its waiting for them when they zone
Save(2); Save(2);
if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) { if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) {
// No need to ask worldserver if we're zoning to ourselves (most // 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); SetHeading(heading);
break; break;
case GMSummon: case GMSummon:
zonesummon_x = x_pos = x; zonesummon_x = m_Position.m_X = x;
zonesummon_y = y_pos = y; zonesummon_y = m_Position.m_Y = y;
zonesummon_z = z_pos = z; zonesummon_z = m_Position.m_Z = z;
SetHeading(heading); SetHeading(heading);
zonesummon_id = zoneID; zonesummon_id = zoneID;
@ -518,31 +518,31 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
zonesummon_ignorerestrictions = ignorerestrictions; zonesummon_ignorerestrictions = ignorerestrictions;
break; break;
case GateToBindPoint: case GateToBindPoint:
x = x_pos = m_pp.binds[0].x; x = m_Position.m_X = m_pp.binds[0].x;
y = y_pos = m_pp.binds[0].y; y = m_Position.m_Y = m_pp.binds[0].y;
z = z_pos = m_pp.binds[0].z; z = m_Position.m_Z = m_pp.binds[0].z;
heading = m_pp.binds[0].heading; heading = m_pp.binds[0].heading;
break; break;
case ZoneToBindPoint: case ZoneToBindPoint:
x = x_pos = m_pp.binds[0].x; x = m_Position.m_X = m_pp.binds[0].x;
y = y_pos = m_pp.binds[0].y; y = m_Position.m_Y = m_pp.binds[0].y;
z = z_pos = m_pp.binds[0].z; z = m_Position.m_Z = m_pp.binds[0].z;
heading = m_pp.binds[0].heading; heading = m_pp.binds[0].heading;
zonesummon_ignorerestrictions = 1; 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); 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; break;
case SummonPC: case SummonPC:
zonesummon_x = x_pos = x; zonesummon_x = m_Position.m_X = x;
zonesummon_y = y_pos = y; zonesummon_y = m_Position.m_Y = y;
zonesummon_z = z_pos = z; zonesummon_z = m_Position.m_Z = z;
SetHeading(heading); SetHeading(heading);
break; break;
case Rewind: 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()); 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 = x_pos = x; zonesummon_x = m_Position.m_X = x;
zonesummon_y = y_pos = y; zonesummon_y = m_Position.m_Y = y;
zonesummon_z = z_pos = z; zonesummon_z = m_Position.m_Z = z;
SetHeading(heading); SetHeading(heading);
break; break;
default: default:
@ -652,10 +652,10 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
else { else {
if(zoneID == GetZoneID()) { if(zoneID == GetZoneID()) {
//properly handle proximities //properly handle proximities
entity_list.ProcessMove(this, x_pos, y_pos, z_pos); entity_list.ProcessMove(this, m_Position.m_X, m_Position.m_Y, m_Position.m_Z);
proximity_x = x_pos; proximity_x = m_Position.m_X;
proximity_y = y_pos; proximity_y = m_Position.m_Y;
proximity_z = z_pos; proximity_z = m_Position.m_Z;
//send out updates to people in zone. //send out updates to people in zone.
SendPosition(); SendPosition();
@ -723,9 +723,9 @@ void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y
if (to_zone == -1) { if (to_zone == -1) {
m_pp.binds[0].zoneId = zone->GetZoneID(); 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].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0;
m_pp.binds[0].x = x_pos; m_pp.binds[0].x = m_Position.m_X;
m_pp.binds[0].y = y_pos; m_pp.binds[0].y = m_Position.m_Y;
m_pp.binds[0].z = z_pos; m_pp.binds[0].z = m_Position.m_Z;
} }
else { else {
m_pp.binds[0].zoneId = to_zone; m_pp.binds[0].zoneId = to_zone;