Added throttling to some appearance packets, also removed responding to client light packets. With the new light code we'll tell the client when the light has changed not the other way around.

This commit is contained in:
KimLS 2015-02-07 15:54:42 -08:00
parent edbd055277
commit 452b1a1eae
4 changed files with 38 additions and 15 deletions

View File

@ -141,6 +141,11 @@ Client::Client(EQStreamInterface* ieqs)
merc_timer(RuleI(Mercs, UpkeepIntervalMS)), merc_timer(RuleI(Mercs, UpkeepIntervalMS)),
ItemTickTimer(10000), ItemTickTimer(10000),
ItemQuestTimer(500), ItemQuestTimer(500),
anim_change_timer(100),
anon_toggle_timer(250),
afk_toggle_timer(250),
helm_toggle_timer(250),
light_update_timer(250),
m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number
m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f), m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f),
m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f), m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f),

View File

@ -1465,6 +1465,11 @@ private:
Timer TrackingTimer; Timer TrackingTimer;
Timer RespawnFromHoverTimer; Timer RespawnFromHoverTimer;
Timer merc_timer; Timer merc_timer;
Timer anim_change_timer;
Timer anon_toggle_timer;
Timer afk_toggle_timer;
Timer helm_toggle_timer;
Timer light_update_timer;
glm::vec3 m_Proximity; glm::vec3 m_Proximity;

View File

@ -12640,6 +12640,10 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
else if (sa->type == AT_Anim) { else if (sa->type == AT_Anim) {
if (IsAIControlled()) if (IsAIControlled())
return; return;
if(!anim_change_timer.Check())
return;
if (sa->parameter == ANIM_STAND) { if (sa->parameter == ANIM_STAND) {
SetAppearance(eaStanding); SetAppearance(eaStanding);
playeraction = 0; playeraction = 0;
@ -12673,15 +12677,6 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
SetFeigned(false); SetFeigned(false);
} }
// This is from old code
// I have no clue what it's for
/*
else if (sa->parameter == 0x05) {
// Illusion
std::cout << "Illusion packet recv'd:" << std::endl;
DumpPacket(app);
}
*/
else { else {
std::cerr << "Client " << name << " unknown apperance " << (int)sa->parameter << std::endl; std::cerr << "Client " << name << " unknown apperance " << (int)sa->parameter << std::endl;
return; return;
@ -12690,6 +12685,10 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
entity_list.QueueClients(this, app, true); entity_list.QueueClients(this, app, true);
} }
else if (sa->type == AT_Anon) { else if (sa->type == AT_Anon) {
if(!anon_toggle_timer.Check()) {
return;
}
// For Anon/Roleplay // For Anon/Roleplay
if (sa->parameter == 1) { // Anon if (sa->parameter == 1) { // Anon
m_pp.anon = 1; m_pp.anon = 1;
@ -12711,13 +12710,18 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
return; return;
} }
else if (sa->type == AT_AFK) { else if (sa->type == AT_AFK) {
this->AFK = (sa->parameter == 1); if(afk_toggle_timer.Check()) {
AFK = (sa->parameter == 1);
entity_list.QueueClients(this, app, true); entity_list.QueueClients(this, app, true);
} }
}
else if (sa->type == AT_Split) { else if (sa->type == AT_Split) {
m_pp.autosplit = (sa->parameter == 1); m_pp.autosplit = (sa->parameter == 1);
} }
else if (sa->type == AT_Sneak) { else if (sa->type == AT_Sneak) {
if(sneaking == 0)
return;
if (sa->parameter != 0) if (sa->parameter != 0)
{ {
if (!HasSkill(SkillSneak)) if (!HasSkill(SkillSneak))
@ -12729,7 +12733,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
} }
return; return;
} }
this->sneaking = 0; sneaking = 0;
entity_list.QueueClients(this, app, true); entity_list.QueueClients(this, app, true);
} }
else if (sa->type == AT_Size) else if (sa->type == AT_Size)
@ -12741,7 +12745,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
} }
else if (sa->type == AT_Light) // client emitting light (lightstone, shiny shield) else if (sa->type == AT_Light) // client emitting light (lightstone, shiny shield)
{ {
entity_list.QueueClients(this, app, false); //don't do anything with this
} }
else if (sa->type == AT_Levitate) else if (sa->type == AT_Levitate)
{ {
@ -12750,9 +12754,11 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
} }
else if (sa->type == AT_ShowHelm) else if (sa->type == AT_ShowHelm)
{ {
if(helm_toggle_timer.Check()) {
m_pp.showhelm = (sa->parameter == 1); m_pp.showhelm = (sa->parameter == 1);
entity_list.QueueClients(this, app, true); entity_list.QueueClients(this, app, true);
} }
}
else { else {
std::cout << "Unknown SpawnAppearance type: 0x" << std::hex << std::setw(4) << std::setfill('0') << sa->type << std::dec std::cout << "Unknown SpawnAppearance type: 0x" << std::hex << std::setw(4) << std::setfill('0') << sa->type << std::dec
<< " value: 0x" << std::hex << std::setw(8) << std::setfill('0') << sa->parameter << std::dec << std::endl; << " value: 0x" << std::hex << std::setw(8) << std::setfill('0') << sa->parameter << std::dec << std::endl;

View File

@ -260,6 +260,13 @@ bool Client::Process() {
} }
} }
if(light_update_timer.Check()) {
UpdateEquipLightValue();
if(UpdateActiveLightValue()) {
SendAppearancePacket(AT_Light, GetActiveLightValue());
}
}
bool may_use_attacks = false; bool may_use_attacks = false;
/* /*
Things which prevent us from attacking: Things which prevent us from attacking: