Merge branch 'master' into auras

This commit is contained in:
Michael Cook (mackal) 2017-07-16 01:14:53 -04:00
commit 6fcd39b4f8
3 changed files with 19 additions and 23 deletions

View File

@ -1437,10 +1437,8 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
} }
} }
/* Used for NPCs mainly */ /* Used for mobs standing still - this does not send a delta */
void Mob::SendPosition() void Mob::SendPosition() {
{
auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer; PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
MakeSpawnUpdateNoDelta(spu); MakeSpawnUpdateNoDelta(spu);
@ -1457,7 +1455,7 @@ void Mob::SendPosition()
safe_delete(app); safe_delete(app);
} }
// this one is for mobs on the move, with deltas - this makes them walk /* Position updates for mobs on the move */
void Mob::SendPositionUpdate(uint8 iSendToSelf) { void Mob::SendPositionUpdate(uint8 iSendToSelf) {
auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer; PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
@ -2729,25 +2727,25 @@ bool Mob::HateSummon() {
return false; return false;
} }
void Mob::FaceTarget(Mob* MobToFace) { void Mob::FaceTarget(Mob* mob_to_face /*= 0*/) {
Mob* facemob = MobToFace; Mob* faced_mob = mob_to_face;
if(!facemob) { if(!faced_mob) {
if(!GetTarget()) { if(!GetTarget()) {
return; return;
} }
else { else {
facemob = GetTarget(); faced_mob = GetTarget();
} }
} }
float oldheading = GetHeading(); float current_heading = GetHeading();
float newheading = CalculateHeadingToTarget(facemob->GetX(), facemob->GetY()); float new_heading = CalculateHeadingToTarget(faced_mob->GetX(), faced_mob->GetY());
if(oldheading != newheading) { if(current_heading != new_heading) {
SetHeading(newheading); SetHeading(new_heading);
if(moving) if (moving) {
SendPositionUpdate(); SendPositionUpdate();
else }
{ else {
SendPosition(); SendPosition();
} }
} }

View File

@ -576,7 +576,7 @@ public:
void SetPrimaryAggro(bool value) { PrimaryAggro = value; if (value) AssistAggro = false; } void SetPrimaryAggro(bool value) { PrimaryAggro = value; if (value) AssistAggro = false; }
void SetAssistAggro(bool value) { AssistAggro = value; if (PrimaryAggro) AssistAggro = false; } void SetAssistAggro(bool value) { AssistAggro = value; if (PrimaryAggro) AssistAggro = false; }
bool HateSummon(); bool HateSummon();
void FaceTarget(Mob* MobToFace = 0); void FaceTarget(Mob* mob_to_face = 0);
void SetHeading(float iHeading) { if(m_Position.w != iHeading) { pLastChange = Timer::GetCurrentTime(); void SetHeading(float iHeading) { if(m_Position.w != iHeading) { pLastChange = Timer::GetCurrentTime();
m_Position.w = iHeading; } } m_Position.w = iHeading; } }
void WipeHateList(); void WipeHateList();

View File

@ -134,17 +134,15 @@ void NPC::PauseWandering(int pausetime)
{ // causes wandering to stop but is resumable { // causes wandering to stop but is resumable
// 0 pausetime means pause until resumed // 0 pausetime means pause until resumed
// otherwise automatically resume when time is up // otherwise automatically resume when time is up
if (GetGrid() != 0) if (GetGrid() != 0) {
{ moving = false;
DistractedFromGrid = true; DistractedFromGrid = true;
Log(Logs::Detail, Logs::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); Log(Logs::Detail, Logs::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime);
SendPosition(); SendPosition();
if (pausetime<1) if (pausetime < 1) { // negative grid number stops him dead in his tracks until ResumeWandering()
{ // negative grid number stops him dead in his tracks until ResumeWandering()
SetGrid(0 - GetGrid()); SetGrid(0 - GetGrid());
} }
else else { // specified waiting time, he'll resume after that
{ // specified waiting time, he'll resume after that
AI_walking_timer->Start(pausetime * 1000); // set the timer AI_walking_timer->Start(pausetime * 1000); // set the timer
} }
} }