mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +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
|
||||
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`
|
||||
|
||||
//send damage packet...
|
||||
|
||||
22
zone/bot.cpp
22
zone/bot.cpp
@ -755,7 +755,7 @@ void Bot::GenerateBaseStats() {
|
||||
this->Corrup = CorruptionResist;
|
||||
SetBotSpellID(BotSpellID);
|
||||
this->size = BotSize;
|
||||
|
||||
|
||||
this->pAggroRange = 0;
|
||||
this->pAssistRange = 0;
|
||||
this->raid_target = false;
|
||||
@ -1381,18 +1381,18 @@ int32 Bot::GenerateBaseHitPoints()
|
||||
uint32 lm = GetClassLevelFactor();
|
||||
int32 Post255;
|
||||
int32 NormalSTA = GetSTA();
|
||||
|
||||
|
||||
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd))
|
||||
{
|
||||
float SoDPost255;
|
||||
|
||||
|
||||
if(((NormalSTA - 255) / 2) > 0)
|
||||
SoDPost255 = ((NormalSTA - 255) / 2);
|
||||
else
|
||||
SoDPost255 = 0;
|
||||
|
||||
|
||||
int hp_factor = GetClassHPFactor();
|
||||
|
||||
|
||||
if(level < 41)
|
||||
{
|
||||
new_base_hp = (5 + (GetLevel() * hp_factor / 12) + ((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
|
||||
@ -1420,7 +1420,7 @@ int32 Bot::GenerateBaseHitPoints()
|
||||
new_base_hp = (5)+(GetLevel()*lm/10) + (((NormalSTA-Post255)*GetLevel()*lm/3000)) + ((Post255*1)*lm/6000);
|
||||
}
|
||||
this->base_hp = new_base_hp;
|
||||
|
||||
|
||||
return new_base_hp;
|
||||
}
|
||||
|
||||
@ -2342,7 +2342,7 @@ bool Bot::IsBotNameAvailable(char *botName, std::string* errorMessage) {
|
||||
if (results.RowCount()) { //Name already in use!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true; //We made it with a valid name!
|
||||
}
|
||||
|
||||
@ -2901,7 +2901,7 @@ bool Bot::Process()
|
||||
SetEndurance(GetEndurance() + CalcEnduranceRegen() + RestRegenEndurance);
|
||||
}
|
||||
|
||||
if (sendhpupdate_timer.Check()) {
|
||||
if (sendhpupdate_timer.Check(false)) {
|
||||
SendHPUpdate();
|
||||
|
||||
if(HasPet())
|
||||
@ -5894,7 +5894,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att
|
||||
|
||||
// delete from group data
|
||||
RemoveBotFromGroup(this, g);
|
||||
|
||||
|
||||
//Make sure group still exists if it doesnt they were already updated in RemoveBotFromGroup
|
||||
g = GetGroup();
|
||||
if (!g)
|
||||
@ -5912,7 +5912,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att
|
||||
g->members[j] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update the client group
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
|
||||
GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
|
||||
@ -10823,7 +10823,7 @@ void Bot::CalcItemBonuses(StatBonuses* newbon)
|
||||
AddItemBonuses(item, newbon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Caps
|
||||
if(newbon->HPRegen > CalcHPRegenCap())
|
||||
newbon->HPRegen = CalcHPRegenCap();
|
||||
|
||||
@ -116,7 +116,7 @@ Client::Client(EQStreamInterface* ieqs)
|
||||
),
|
||||
//these must be listed in the order they appear in client.h
|
||||
position_timer(250),
|
||||
hpupdate_timer(1800),
|
||||
hpupdate_timer(2000),
|
||||
camp_timer(29000),
|
||||
process_timer(100),
|
||||
stamina_timer(40000),
|
||||
@ -8631,4 +8631,4 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
|
||||
|
||||
QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1257,6 +1257,8 @@ public:
|
||||
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 ResetHPUpdateTimer() { hpupdate_timer.Start(); }
|
||||
protected:
|
||||
friend class Mob;
|
||||
void CalcItemBonuses(StatBonuses* newbon);
|
||||
|
||||
@ -129,7 +129,9 @@ bool Client::Process() {
|
||||
if(IsTracking() && (GetClientVersion() >= ClientVersion::SoD) && TrackingTimer.Check())
|
||||
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();
|
||||
|
||||
if(mana_timer.Check())
|
||||
|
||||
20
zone/mob.cpp
20
zone/mob.cpp
@ -1266,7 +1266,7 @@ void Mob::CreateHPPacket(EQApplicationPacket* app)
|
||||
}
|
||||
|
||||
// sends hp update of this mob to people who might care
|
||||
void Mob::SendHPUpdate()
|
||||
void Mob::SendHPUpdate(bool skip_self)
|
||||
{
|
||||
EQApplicationPacket hp_app;
|
||||
Group *group;
|
||||
@ -1355,8 +1355,7 @@ void Mob::SendHPUpdate()
|
||||
}
|
||||
|
||||
// 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));
|
||||
SpawnHPUpdate_Struct* ds = (SpawnHPUpdate_Struct*)hp_app2->pBuffer;
|
||||
ds->cur_hp = CastToClient()->GetHP() - itembonuses.HP;
|
||||
@ -1365,6 +1364,7 @@ void Mob::SendHPUpdate()
|
||||
CastToClient()->QueuePacket(hp_app2);
|
||||
safe_delete(hp_app2);
|
||||
}
|
||||
ResetHPUpdateTimer(); // delay the timer
|
||||
}
|
||||
|
||||
// this one just warps the mob to the current location
|
||||
@ -4205,25 +4205,25 @@ int32 Mob::GetItemStat(uint32 itemid, const char *identifier)
|
||||
std::string Mob::GetGlobal(const char *varname) {
|
||||
int qgCharid = 0;
|
||||
int qgNpcid = 0;
|
||||
|
||||
|
||||
if (this->IsNPC())
|
||||
qgNpcid = this->GetNPCTypeID();
|
||||
|
||||
|
||||
if (this->IsClient())
|
||||
qgCharid = this->CastToClient()->CharacterID();
|
||||
|
||||
|
||||
QGlobalCache *qglobals = nullptr;
|
||||
std::list<QGlobal> globalMap;
|
||||
|
||||
|
||||
if (this->IsClient())
|
||||
qglobals = this->CastToClient()->GetQGlobals();
|
||||
|
||||
|
||||
if (this->IsNPC())
|
||||
qglobals = this->CastToNPC()->GetQGlobals();
|
||||
|
||||
if(qglobals)
|
||||
QGlobalCache::Combine(globalMap, qglobals->GetBucket(), qgNpcid, qgCharid, zone->GetZoneID());
|
||||
|
||||
|
||||
std::list<QGlobal>::iterator iter = globalMap.begin();
|
||||
while(iter != globalMap.end()) {
|
||||
if ((*iter).name.compare(varname) == 0)
|
||||
@ -4231,7 +4231,7 @@ std::string Mob::GetGlobal(const char *varname) {
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
|
||||
return "Undefined";
|
||||
}
|
||||
|
||||
|
||||
@ -508,7 +508,8 @@ public:
|
||||
static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns);
|
||||
virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
|
||||
void CreateHPPacket(EQApplicationPacket* app);
|
||||
void SendHPUpdate();
|
||||
void SendHPUpdate(bool skip_self = false);
|
||||
virtual void ResetHPUpdateTimer() {}; // does nothing
|
||||
|
||||
//Util
|
||||
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),
|
||||
assist_timer(AIassistcheck_delay),
|
||||
qglobal_purge_timer(30000),
|
||||
sendhpupdate_timer(1000),
|
||||
sendhpupdate_timer(2000),
|
||||
enraged_timer(1000),
|
||||
taunt_timer(TauntReuseTime * 1000),
|
||||
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){
|
||||
SendHPUpdate();
|
||||
}
|
||||
|
||||
@ -407,6 +407,7 @@ public:
|
||||
void SetHeroForgeModel(uint32 model) { herosforgemodel = model; }
|
||||
|
||||
bool IsRaidTarget() const { return raid_target; };
|
||||
void ResetHPUpdateTimer() { sendhpupdate_timer.Start(); }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user