mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-15 00:22:27 +00:00
Cut down on some HP update spam
This increases the timer that mobs will send out updates (It could probably be increased more) This will also reset the timer every time SendHPUpdate is called to prevent sending like 3+ completely useless updates at once Also skip sending the update to the client if we're sending an OP_Damage with the damage since the client will apply this number
This commit is contained in:
parent
03bc245318
commit
42a5ddcf77
@ -3693,7 +3693,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
|
|||||||
|
|
||||||
//send an HP update if we are hurt
|
//send an HP update if we are hurt
|
||||||
if(GetHP() < GetMaxHP())
|
if(GetHP() < GetMaxHP())
|
||||||
SendHPUpdate();
|
SendHPUpdate(!iBuffTic); // the OP_Damage actually updates the client in these cases, so we skill them
|
||||||
} //end `if damage was done`
|
} //end `if damage was done`
|
||||||
|
|
||||||
//send damage packet...
|
//send damage packet...
|
||||||
|
|||||||
@ -2901,7 +2901,7 @@ bool Bot::Process()
|
|||||||
SetEndurance(GetEndurance() + CalcEnduranceRegen() + RestRegenEndurance);
|
SetEndurance(GetEndurance() + CalcEnduranceRegen() + RestRegenEndurance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendhpupdate_timer.Check()) {
|
if (sendhpupdate_timer.Check(false)) {
|
||||||
SendHPUpdate();
|
SendHPUpdate();
|
||||||
|
|
||||||
if(HasPet())
|
if(HasPet())
|
||||||
|
|||||||
@ -116,7 +116,7 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
),
|
),
|
||||||
//these must be listed in the order they appear in client.h
|
//these must be listed in the order they appear in client.h
|
||||||
position_timer(250),
|
position_timer(250),
|
||||||
hpupdate_timer(1800),
|
hpupdate_timer(2000),
|
||||||
camp_timer(29000),
|
camp_timer(29000),
|
||||||
process_timer(100),
|
process_timer(100),
|
||||||
stamina_timer(40000),
|
stamina_timer(40000),
|
||||||
|
|||||||
@ -1257,6 +1257,8 @@ public:
|
|||||||
int32 GetMeleeDamage(Mob* other, bool GetMinDamage = false);
|
int32 GetMeleeDamage(Mob* other, bool GetMinDamage = false);
|
||||||
|
|
||||||
void QuestReward(Mob* target, uint32 copper = 0, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0, uint32 itemid = 0, uint32 exp = 0, bool faction = false);
|
void QuestReward(Mob* target, uint32 copper = 0, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0, uint32 itemid = 0, uint32 exp = 0, bool faction = false);
|
||||||
|
|
||||||
|
void ResetHPUpdateTimer() { hpupdate_timer.Start(); }
|
||||||
protected:
|
protected:
|
||||||
friend class Mob;
|
friend class Mob;
|
||||||
void CalcItemBonuses(StatBonuses* newbon);
|
void CalcItemBonuses(StatBonuses* newbon);
|
||||||
|
|||||||
@ -129,7 +129,9 @@ bool Client::Process() {
|
|||||||
if(IsTracking() && (GetClientVersion() >= ClientVersion::SoD) && TrackingTimer.Check())
|
if(IsTracking() && (GetClientVersion() >= ClientVersion::SoD) && TrackingTimer.Check())
|
||||||
DoTracking();
|
DoTracking();
|
||||||
|
|
||||||
if(hpupdate_timer.Check())
|
// SendHPUpdate calls hpupdate_timer.Start so it can delay this timer, so lets not reset with the check
|
||||||
|
// since the function will anyways
|
||||||
|
if(hpupdate_timer.Check(false))
|
||||||
SendHPUpdate();
|
SendHPUpdate();
|
||||||
|
|
||||||
if(mana_timer.Check())
|
if(mana_timer.Check())
|
||||||
|
|||||||
@ -1266,7 +1266,7 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sends hp update of this mob to people who might care
|
// sends hp update of this mob to people who might care
|
||||||
void Mob::SendHPUpdate()
|
void Mob::SendHPUpdate(bool skip_self)
|
||||||
{
|
{
|
||||||
EQApplicationPacket hp_app;
|
EQApplicationPacket hp_app;
|
||||||
Group *group;
|
Group *group;
|
||||||
@ -1355,8 +1355,7 @@ void Mob::SendHPUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send to self - we need the actual hps here
|
// send to self - we need the actual hps here
|
||||||
if(IsClient())
|
if(IsClient() && !skip_self) {
|
||||||
{
|
|
||||||
EQApplicationPacket* hp_app2 = new EQApplicationPacket(OP_HPUpdate,sizeof(SpawnHPUpdate_Struct));
|
EQApplicationPacket* hp_app2 = new EQApplicationPacket(OP_HPUpdate,sizeof(SpawnHPUpdate_Struct));
|
||||||
SpawnHPUpdate_Struct* ds = (SpawnHPUpdate_Struct*)hp_app2->pBuffer;
|
SpawnHPUpdate_Struct* ds = (SpawnHPUpdate_Struct*)hp_app2->pBuffer;
|
||||||
ds->cur_hp = CastToClient()->GetHP() - itembonuses.HP;
|
ds->cur_hp = CastToClient()->GetHP() - itembonuses.HP;
|
||||||
@ -1365,6 +1364,7 @@ void Mob::SendHPUpdate()
|
|||||||
CastToClient()->QueuePacket(hp_app2);
|
CastToClient()->QueuePacket(hp_app2);
|
||||||
safe_delete(hp_app2);
|
safe_delete(hp_app2);
|
||||||
}
|
}
|
||||||
|
ResetHPUpdateTimer(); // delay the timer
|
||||||
}
|
}
|
||||||
|
|
||||||
// this one just warps the mob to the current location
|
// this one just warps the mob to the current location
|
||||||
|
|||||||
@ -508,7 +508,8 @@ public:
|
|||||||
static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns);
|
static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns);
|
||||||
virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
|
virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
|
||||||
void CreateHPPacket(EQApplicationPacket* app);
|
void CreateHPPacket(EQApplicationPacket* app);
|
||||||
void SendHPUpdate();
|
void SendHPUpdate(bool skip_self = false);
|
||||||
|
virtual void ResetHPUpdateTimer() {}; // does nothing
|
||||||
|
|
||||||
//Util
|
//Util
|
||||||
static uint32 RandomTimer(int min, int max);
|
static uint32 RandomTimer(int min, int max);
|
||||||
|
|||||||
@ -115,7 +115,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if
|
|||||||
knightattack_timer(1000),
|
knightattack_timer(1000),
|
||||||
assist_timer(AIassistcheck_delay),
|
assist_timer(AIassistcheck_delay),
|
||||||
qglobal_purge_timer(30000),
|
qglobal_purge_timer(30000),
|
||||||
sendhpupdate_timer(1000),
|
sendhpupdate_timer(2000),
|
||||||
enraged_timer(1000),
|
enraged_timer(1000),
|
||||||
taunt_timer(TauntReuseTime * 1000),
|
taunt_timer(TauntReuseTime * 1000),
|
||||||
m_SpawnPoint(position),
|
m_SpawnPoint(position),
|
||||||
@ -650,7 +650,8 @@ bool NPC::Process()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendhpupdate_timer.Check() && (IsTargeted() || (IsPet() && GetOwner() && GetOwner()->IsClient()))) {
|
// we might actually want to reset in this check ... won't until issues arise at least :P
|
||||||
|
if (sendhpupdate_timer.Check(false) && (IsTargeted() || (IsPet() && GetOwner() && GetOwner()->IsClient()))) {
|
||||||
if(!IsFullHP || cur_hp<max_hp){
|
if(!IsFullHP || cur_hp<max_hp){
|
||||||
SendHPUpdate();
|
SendHPUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -407,6 +407,7 @@ public:
|
|||||||
void SetHeroForgeModel(uint32 model) { herosforgemodel = model; }
|
void SetHeroForgeModel(uint32 model) { herosforgemodel = model; }
|
||||||
|
|
||||||
bool IsRaidTarget() const { return raid_target; };
|
bool IsRaidTarget() const { return raid_target; };
|
||||||
|
void ResetHPUpdateTimer() { sendhpupdate_timer.Start(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user