From c6cbe4c77c5fcd4d296f31d471b4806ebe3d099d Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 25 Mar 2012 16:22:24 +0200 Subject: Core/DBLayer: Convert PAppend() queries to prepared statements No.1 --- src/server/game/Handlers/PetHandler.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/server/game/Handlers/PetHandler.cpp') diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 8da7683459e..8a7c264ef67 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -647,15 +647,26 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data) SQLTransaction trans = CharacterDatabase.BeginTransaction(); if (isdeclined) { - for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) - CharacterDatabase.EscapeString(declinedname.name[i]); - trans->PAppend("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); - trans->PAppend("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u', '%u', '%s', '%s', '%s', '%s', '%s')", - pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, _player->GetGUIDLow()); + stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber()); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, _player->GetGUIDLow()); + + for (uint8 i = 0; i < 5; i++) + stmt->setString(i+1, declinedname.name[i]); + + trans->Append(stmt); } - CharacterDatabase.EscapeString(name); - trans->PAppend("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_NAME); + stmt->setString(0, name); + stmt->setUInt32(1, _player->GetGUIDLow()); + stmt->setUInt32(2, pet->GetCharmInfo()->GetPetNumber()); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped -- cgit v1.2.3 From 71c02fb54d461716bc2273a2544122bfc5397808 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 25 Mar 2012 18:32:00 +0200 Subject: Core/DBLayer: Convert PAppend() queries to prepared statements No.2 --- src/server/game/Entities/Pet/Pet.cpp | 136 +++++++++++++++++---- src/server/game/Handlers/PetHandler.cpp | 1 - .../Database/Implementation/CharacterDatabase.cpp | 14 ++- .../Database/Implementation/CharacterDatabase.h | 12 ++ 4 files changed, 134 insertions(+), 29 deletions(-) (limited to 'src/server/game/Handlers/PetHandler.cpp') diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 0a1479af41b..f3dbabe59d1 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -266,10 +266,20 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c if (fields[7].GetUInt8()) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u' AND id <> '%u'", - PET_SAVE_NOT_IN_SLOT, ownerid, PET_SAVE_AS_CURRENT, m_charmInfo->GetPetNumber()); - trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND id = '%u'", - PET_SAVE_AS_CURRENT, ownerid, m_charmInfo->GetPetNumber()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID); + stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT)); + stmt->setUInt32(1, ownerid); + stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt32(3, m_charmInfo->GetPetNumber()); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); + stmt->setUInt8(0, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt32(1, ownerid); + stmt->setUInt32(2, m_charmInfo->GetPetNumber()); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } @@ -400,17 +410,30 @@ void Pet::SavePetToDB(PetSaveMode mode) CharacterDatabase.EscapeString(name); trans = CharacterDatabase.BeginTransaction(); // remove current data - trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", ownerLowGUID, m_charmInfo->GetPetNumber()); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_ID); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + trans->Append(stmt); // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT) if (mode <= PET_SAVE_LAST_STABLE_SLOT) - trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'", - PET_SAVE_NOT_IN_SLOT, ownerLowGUID, uint32(mode)); + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT); + stmt->setUInt32(0, ownerLowGUID); + stmt->setUInt8(1, uint8(mode)); + trans->Append(stmt); + } // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT)) - trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')", - ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT); + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT); + stmt->setUInt32(0, ownerLowGUID); + stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT)); + stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT)); + trans->Append(stmt); + } + // save pet std::ostringstream ss; ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) " @@ -432,7 +455,7 @@ void Pet::SavePetToDB(PetSaveMode mode) for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i) { ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' ' - << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; + << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; }; ss << "', " @@ -454,11 +477,27 @@ void Pet::SavePetToDB(PetSaveMode mode) void Pet::DeleteFromDB(uint32 guidlow) { SQLTransaction trans = CharacterDatabase.BeginTransaction(); - trans->PAppend("DELETE FROM character_pet WHERE id = '%u'", guidlow); - trans->PAppend("DELETE FROM character_pet_declinedname WHERE id = '%u'", guidlow); - trans->PAppend("DELETE FROM pet_aura WHERE guid = '%u'", guidlow); - trans->PAppend("DELETE FROM pet_spell WHERE guid = '%u'", guidlow); - trans->PAppend("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", guidlow); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_ID); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_AURAS); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELLS); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_COOLDOWNS); + stmt->setUInt32(0, guidlow); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); } @@ -1097,7 +1136,9 @@ void Pet::_LoadSpellCooldowns() void Pet::_SaveSpellCooldowns(SQLTransaction& trans) { - trans->PAppend("DELETE FROM pet_spell_cooldown WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_COOLDOWNS); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + trans->Append(stmt); time_t curTime = time(NULL); @@ -1108,7 +1149,12 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans) m_CreatureSpellCooldowns.erase(itr++); else { - trans->PAppend("INSERT INTO pet_spell_cooldown (guid, spell, time) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, uint32(itr->second)); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL_COOLDOWN); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + stmt->setUInt32(2, uint32(itr->second)); + trans->Append(stmt); + ++itr; } } @@ -1142,18 +1188,37 @@ void Pet::_SaveSpells(SQLTransaction& trans) if (itr->second.type == PETSPELL_FAMILY) continue; + PreparedStatement* stmt; + switch (itr->second.state) { case PETSPELL_REMOVED: - trans->PAppend("DELETE FROM pet_spell WHERE guid = '%u' and spell = '%u'", m_charmInfo->GetPetNumber(), itr->first); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_BY_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + trans->Append(stmt); + m_spells.erase(itr); continue; case PETSPELL_CHANGED: - trans->PAppend("DELETE FROM pet_spell WHERE guid = '%u' and spell = '%u'", m_charmInfo->GetPetNumber(), itr->first); - trans->PAppend("INSERT INTO pet_spell (guid, spell, active) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second.active); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_BY_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + trans->Append(stmt); + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second.active); + trans->Append(stmt); + break; case PETSPELL_NEW: - trans->PAppend("INSERT INTO pet_spell (guid, spell, active) VALUES ('%u', '%u', '%u')", m_charmInfo->GetPetNumber(), itr->first, itr->second.active); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second.active); + trans->Append(stmt); break; case PETSPELL_UNCHANGED: continue; @@ -1238,7 +1303,9 @@ void Pet::_LoadAuras(uint32 timediff) void Pet::_SaveAuras(SQLTransaction& trans) { - trans->PAppend("DELETE FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber()); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_AURAS); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + trans->Append(stmt); for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr) { @@ -1272,11 +1339,26 @@ void Pet::_SaveAuras(SQLTransaction& trans) // don't save guid of caster in case we are caster of the spell - guid for pet is generated every pet load, so it won't match saved guid anyways uint64 casterGUID = (itr->second->GetCasterGUID() == GetGUID()) ? 0 : itr->second->GetCasterGUID(); - trans->PAppend("INSERT INTO pet_aura (guid, caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges) " - "VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u')", - m_charmInfo->GetPetNumber(), casterGUID, itr->second->GetId(), effMask, recalculateMask, - itr->second->GetStackAmount(), damage[0], damage[1], damage[2], baseDamage[0], baseDamage[1], baseDamage[2], - itr->second->GetMaxDuration(), itr->second->GetDuration(), itr->second->GetCharges()); + uint8 index = 0; + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_AURA); + stmt->setUInt32(index++, m_charmInfo->GetPetNumber()); + stmt->setUInt64(index++, casterGUID); + stmt->setUInt32(index++, itr->second->GetId()); + stmt->setUInt8(index++, effMask); + stmt->setUInt8(index++, recalculateMask); + stmt->setUInt8(index++, itr->second->GetStackAmount()); + stmt->setInt32(index++, damage[0]); + stmt->setInt32(index++, damage[1]); + stmt->setInt32(index++, damage[2]); + stmt->setInt32(index++, baseDamage[0]); + stmt->setInt32(index++, baseDamage[1]); + stmt->setInt32(index++, baseDamage[2]); + stmt->setInt32(index++, itr->second->GetMaxDuration()); + stmt->setInt32(index++, itr->second->GetDuration()); + stmt->setUInt8(index++, itr->second->GetCharges()); + + trans->Append(stmt); } } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 8a7c264ef67..1fa6d9fc0ed 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -648,7 +648,6 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data) if (isdeclined) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); - stmt->setUInt32(0, _player->GetGUIDLow()); stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber()); trans->Append(stmt); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 6bbbddad3cf..cf3b7fdd5e6 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -465,10 +465,22 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_GROUP_INSTANCE_BY_MAP_DIFF, "DELETE FROM group_instance USING group_instance LEFT JOIN instance ON group_instance.instance = id WHERE map = ? and difficulty = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_INSTANCE_BY_MAP_DIFF, "DELETE FROM instance WHERE map = ? and difficulty = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_MAIL_ITEM_BY_ID, "DELETE FROM mail_items WHERE mail_id = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_DECLINEDNAME, "DELETE FROM character_pet_declinedname WHERE owner = ? AND id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_DECLINEDNAME, "DELETE FROM character_pet_declinedname WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_ADD_CHAR_PET_DECLINEDNAME, "INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHAR_PET_NAME, "UPDATE character_pet SET name = ?, renamed = 1 WHERE owner = ? AND id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_INS_PETITION, "INSERT INTO petition (ownerguid, petitionguid, name, type) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_PETITION_BY_GUID, "DELETE FROM petition WHERE petitionguid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_DEL_PETITION_SIGNATURE_BY_GUID, "DELETE FROM petition_sign WHERE petitionguid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND slot = ? AND id <> ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT, "UPDATE character_pet SET slot = ? WHERE owner = ? AND slot = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_UPD_CHAR_PET_SLOT_BY_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_BY_ID, "DELETE FROM character_pet WHERE id = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_CHAR_PET_BY_SLOT, "DELETE FROM character_pet WHERE owner = ? AND (slot = ? OR slot > ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_AURAS, "DELETE FROM pet_aura WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_SPELLS, "DELETE FROM pet_spell WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_SPELL_COOLDOWNS, "DELETE FROM pet_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PET_SPELL_COOLDOWN, "INSERT INTO pet_spell_cooldown (guid, spell, time) VALUES (?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_DEL_PET_SPELL_BY_SPELL, "DELETE FROM pet_spell WHERE guid = ? and spell = ?", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PET_SPELL, "INSERT INTO pet_spell (guid, spell, active) VALUES (?, ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(CHAR_INS_PET_AURA, "INSERT INTO pet_aura (guid, caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index ac920f0f25c..0fce8d51c2f 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -434,6 +434,18 @@ enum CharacterDatabaseStatements CHAR_INS_PETITION, CHAR_DEL_PETITION_BY_GUID, CHAR_DEL_PETITION_SIGNATURE_BY_GUID, + CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID, + CHAR_UDP_CHAR_PET_SLOT_BY_SLOT, + CHAR_UPD_CHAR_PET_SLOT_BY_ID, + CHAR_DEL_CHAR_PET_BY_ID, + CHAR_DEL_CHAR_PET_BY_SLOT, + CHAR_DEL_PET_AURAS, + CHAR_DEL_PET_SPELLS, + CHAR_DEL_PET_SPELL_COOLDOWNS, + CHAR_INS_PET_SPELL_COOLDOWN, + CHAR_DEL_PET_SPELL_BY_SPELL, + CHAR_INS_PET_SPELL, + CHAR_INS_PET_AURA, MAX_CHARACTERDATABASE_STATEMENTS, }; -- cgit v1.2.3 From b843688fa8326579427381b9ee15f2b42d49f42e Mon Sep 17 00:00:00 2001 From: MrSmite Date: Thu, 5 Apr 2012 20:32:02 -0400 Subject: PeAI update * Better handle target selection for defensive pets. Adds triggers for when owner is damaged or begins attacking something. * Defensive pets no longer run off as soon as a mob aggros the owner but rather at first damage to owner or owner first attack * Pets on stay will continue to attack unless target unreachable --- src/server/game/AI/CoreAI/PetAI.cpp | 61 +++++++++++++++++++++++++++++---- src/server/game/AI/CoreAI/PetAI.h | 2 ++ src/server/game/AI/CreatureAI.h | 6 ++++ src/server/game/Entities/Unit/Unit.cpp | 19 ++++++++++ src/server/game/Handlers/PetHandler.cpp | 2 -- src/server/game/Spells/Spell.cpp | 15 ++++++-- 6 files changed, 95 insertions(+), 10 deletions(-) (limited to 'src/server/game/Handlers/PetHandler.cpp') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 295768f9d3e..bcec8d273b9 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -109,17 +109,25 @@ void PetAI::UpdateAI(const uint32 diff) } else if (owner && me->GetCharmInfo()) //no victim { - Unit* nextTarget = SelectNextTarget(); + // Only aggressive pets do target search every update. + // Defensive pets do target search only in these cases: + // * Owner attacks something - handled by OwnerAttacked() + // * Owner receives damage - handled by OwnerDamagedBy() + // * Pet is in combat and current target dies - handled by KilledUnit() + if (me->HasReactState(REACT_AGGRESSIVE)) + { + Unit* nextTarget = SelectNextTarget(); - if (me->HasReactState(REACT_PASSIVE)) - _stopAttack(); - else if (nextTarget) - AttackStart(nextTarget); + if (nextTarget) + AttackStart(nextTarget); + else + HandleReturnMovement(); + } else HandleReturnMovement(); } else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); + HandleReturnMovement(); if (!me->GetCharmInfo()) return; @@ -302,6 +310,47 @@ void PetAI::AttackStart(Unit* target) DoAttack(target, true); } +void PetAI::OwnerDamagedBy(Unit* attacker) +{ + // Called when owner takes damage. Allows defensive pets to know + // that their owner might need help + + if (!attacker) + return; + + // Passive pets don't do anything + if (me->HasReactState(REACT_PASSIVE)) + return; + + // Prevent pet from disengaging from current target + if (me->getVictim() && me->getVictim()->isAlive()) + return; + + // Continue to evaluate and attack if necessary + AttackStart(attacker); +} + +void PetAI::OwnerAttacked(Unit* target) +{ + // Called when owner attacks something. Allows defensive pets to know + // that they need to assist + + // Target might be NULL if called from spell with invalid cast targets + if (!target) + return; + + // Passive pets don't do anything + if (me->HasReactState(REACT_PASSIVE)) + return; + + // Prevent pet from disengaging from current target + if (me->getVictim() && me->getVictim()->isAlive()) + return; + + // Continue to evaluate and attack if necessary + AttackStart(target); +} + Unit* PetAI::SelectNextTarget() { // Provides next target selection after current target death diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 730ab12a3ca..ed3e2305556 100755 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -40,6 +40,8 @@ class PetAI : public CreatureAI void KilledUnit(Unit* /*victim*/); void AttackStart(Unit* target); void MovementInform(uint32 moveType, uint32 data); + void OwnerDamagedBy(Unit* attacker); + void OwnerAttacked(Unit* target); private: bool _isVisible(Unit*) const; diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 423b00291e7..94ac452b9f3 100755 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -138,6 +138,12 @@ class CreatureAI : public UnitAI // Called at text emote receive from player virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {} + // Called when owner takes damage + virtual void OwnerDamagedBy(Unit* /*attacker*/) {} + + // Called when owner attacks something + virtual void OwnerAttacked(Unit* /*target*/) {} + /// == Triggered Actions Requested ================== // Called when creature attack expected (if creature can and no have current victim) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b49ce1bf075..94ef6edbeca 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -572,6 +572,15 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (IsAIEnabled) GetAI()->DamageDealt(victim, damage, damagetype); + // Signal to pets that their owner was attacked + if (victim->GetTypeId() == TYPEID_PLAYER) + { + Pet* pet = victim->ToPlayer()->GetPet(); + + if (pet && pet->isAlive()) + pet->AI()->OwnerDamagedBy(this); + } + if (damagetype != NODAMAGE) { // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras) @@ -9515,6 +9524,16 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (meleeAttack) SendMeleeAttackStart(victim); + // Let the pet know we've started attacking someting. Handles melee attacks only + // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode + if (this->GetTypeId() == TYPEID_PLAYER) + { + Pet* playerPet = this->ToPlayer()->GetPet(); + + if (playerPet && playerPet->isAlive()) + playerPet->AI()->OwnerAttacked(victim); + } + return true; } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 1fa6d9fc0ed..e54bee96b8b 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -153,8 +153,6 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid switch (spellid) { case COMMAND_STAY: //flat=1792 //STAY - pet->AttackStop(); - pet->InterruptNonMeleeSpells(false); pet->StopMoving(); pet->GetMotionMaster()->Clear(false); pet->GetMotionMaster()->MoveIdle(); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 82a89e97e4b..ea4b79cf99a 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3101,11 +3101,22 @@ void Spell::cast(bool skipCheck) return; } - // now that we've done the basic check, now run the scripts - // should be done before the spell is actually executed if (Player* playerCaster = m_caster->ToPlayer()) + { + // now that we've done the basic check, now run the scripts + // should be done before the spell is actually executed sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck); + // Let any pets know we've attacked something. As of 3.0.2 pets begin + // attacking their owner's target immediately + if (Pet* playerPet = playerCaster->GetPet()) + { + if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT)) + { + playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit()); + } + } + } SetExecutedCurrently(true); if (m_caster->GetTypeId() != TYPEID_PLAYER && m_targets.GetUnitTarget() && m_targets.GetUnitTarget() != m_caster) -- cgit v1.2.3 From a32f4f439b609b368ad2d57408f27ec7a78e8f39 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 3 Jun 2012 05:41:30 +0200 Subject: Core/Protocol: Move some debug messages to their appropriate debug output mask. --- src/server/game/Handlers/AuthHandler.cpp | 2 +- src/server/game/Handlers/MiscHandler.cpp | 38 +++++++++++++++---------------- src/server/game/Handlers/PetHandler.cpp | 6 +++-- src/server/game/Handlers/QueryHandler.cpp | 10 ++++---- src/server/game/Handlers/SpellHandler.cpp | 23 +++++++++++-------- src/server/game/Server/WorldSession.cpp | 6 ++--- 6 files changed, 45 insertions(+), 40 deletions(-) (limited to 'src/server/game/Handlers/PetHandler.cpp') diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp index 9a3e756dda3..49027bdf497 100755 --- a/src/server/game/Handlers/AuthHandler.cpp +++ b/src/server/game/Handlers/AuthHandler.cpp @@ -31,7 +31,7 @@ void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos) if (!shortForm) { packet << uint32(queuePos); // Queue position - packet << uint8(0); // Unk 3.3.0 + packet << uint8(0); // Realm has a free character migration - bool } SendPacket(&packet); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 8484ac52d27..11f0857ca2b 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -494,7 +494,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) uint32 newZone; recv_data >> newZone; - sLog->outDetail("WORLD: Recvd ZONE_UPDATE: %u", newZone); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone); // use server size data uint32 newzone, newarea; @@ -730,7 +730,7 @@ void WorldSession::HandleBugOpcode(WorldPacket & recv_data) void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) { - sLog->outDetail("WORLD: Received CMSG_RECLAIM_CORPSE"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE"); uint64 guid; recv_data >> guid; @@ -767,7 +767,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) { - sLog->outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE"); uint64 guid; uint8 status; @@ -938,7 +938,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) { - sLog->outDetail("WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); uint32 type, timestamp, decompressedSize; recv_data >> type >> timestamp >> decompressedSize; @@ -993,7 +993,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) { - sLog->outDetail("WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); uint32 type; recv_data >> type; @@ -1072,18 +1072,18 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/) { - sLog->outStaticDebug("WORLD: Player is watching cinema"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC"); } void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/) { - sLog->outStaticDebug("WORLD: Which movie to play"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); } void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) { /* WorldSession::Update(getMSTime());*/ - sLog->outStaticDebug("WORLD: Time Lag/Synchronization Resent/Update"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_TIME_SKIPPED"); uint64 guid; recv_data.readPackGUID(guid); @@ -1105,7 +1105,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data) { - sLog->outStaticDebug("WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); // no used recv_data.rfinish(); // prevent warnings spam @@ -1193,13 +1193,17 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) { uint64 guid; recv_data >> guid; - sLog->outStaticDebug("Inspected guid is " UI64FMTD, guid); + + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT"); _player->SetSelection(guid); Player* player = ObjectAccessor::FindPlayer(guid); - if (!player) // wrong player + if (!player) + { + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); return; + } uint32 talent_points = 0x47; uint32 guid_size = player->GetPackGUID().wpos(); @@ -1230,7 +1234,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) if (!player) { - sLog->outError("InspectHonorStats: WTF, player not found..."); + sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); return; } @@ -1246,10 +1250,6 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) { - // write in client console: worldport 469 452 6454 2536 180 or /console worldport 469 452 6454 2536 180 - // Received opcode CMSG_WORLD_TELEPORT - // Time is ***, map=469, x=452.000000, y=6454.000000, z=2536.000000, orient=3.141593 - uint32 time; uint32 mapid; float PositionX; @@ -1264,20 +1264,20 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) recv_data >> PositionZ; recv_data >> Orientation; // o (3.141593 = 180 degrees) - //sLog->outDebug("Received opcode CMSG_WORLD_TELEPORT"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_WORLD_TELEPORT"); + if (GetPlayer()->isInFlight()) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); return; } - sLog->outStaticDebug("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, mapid, PositionX, PositionY, PositionZ, Orientation); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName(), time, mapid, PositionX, PositionY, PositionZ, Orientation); if (AccountMgr::IsAdminAccount(GetSecurity())) GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation); else SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received worldport command from player %s", GetPlayer()->GetName()); } void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index e54bee96b8b..321c0ada247 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -339,9 +339,11 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid if (unit_target2->GetTypeId() == TYPEID_PLAYER) pet->SendUpdateToPlayer((Player*)unit_target2); } + if (Unit* powner = pet->GetCharmerOrOwner()) if (powner->GetTypeId() == TYPEID_PLAYER) - pet->SendUpdateToPlayer(powner->ToPlayer()); + pet->SendUpdateToPlayer(powner->ToPlayer()); + result = SPELL_CAST_OK; } @@ -741,7 +743,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { - sLog->outDetail("WORLD: CMSG_PET_CAST_SPELL"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL"); uint64 guid; uint8 castCount; diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 628cdbbdd5e..4fb90bed10b 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -113,7 +113,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName); } } - sLog->outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); // guess size WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 100); data << uint32(entry); // creature entry @@ -179,7 +179,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); } } - sLog->outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150); data << uint32(entry); data << uint32(info->type); @@ -209,7 +209,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) { - sLog->outDetail("WORLD: Received MSG_CORPSE_QUERY"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY"); Corpse* corpse = GetPlayer()->GetCorpse(); @@ -264,7 +264,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) uint64 guid; recv_data >> textID; - sLog->outDetail("WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); recv_data >> guid; GetPlayer()->SetSelection(guid); @@ -344,7 +344,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) /// Only _static_ data is sent in this packet !!! void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) { - sLog->outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY"); uint32 pageID; recv_data >> pageID; diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 1affdf0aff7..c02bb43a353 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -99,7 +99,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); ItemTemplate const* proto = pItem->GetTemplate(); if (!proto) @@ -175,7 +175,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) { - sLog->outDetail("WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); Player* pUser = _player; @@ -658,13 +658,16 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) recvPacket >> z; Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid); - Spell* spell = caster ? caster->FindCurrentSpellBySpellId(spellId) : NULL; - if (spell && spell->m_targets.HasDst()) - { - Position pos = *spell->m_targets.GetDstPos(); - pos.Relocate(x, y, z); - spell->m_targets.ModDst(pos); - } + if (!caster) + return; + + Spell* spell = caster->FindCurrentSpellBySpellId(spellId); + if (!spell || !spell->m_targets.HasDst()) + return; + + Position pos = *spell->m_targets.GetDstPos(); + pos.Relocate(x, y, z); + spell->m_targets.ModDst(pos); WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21); data << uint64(casterGuid); @@ -672,5 +675,5 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) data << float(x); data << float(y); data << float(z); - SendPacket(&data); + caster->SendMessageToSet(&data, true); } diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 7756e686388..81ec5495421 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -208,7 +208,7 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Logging helper for unexpected opcodes void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason) { - sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s", GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, reason); } @@ -216,7 +216,7 @@ void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, /// Logging helper for unexpected opcodes void WorldSession::LogUnprocessedTail(WorldPacket* packet) { - sLog->outError("SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), uint32(packet->rpos()), uint32(packet->wpos())); packet->print_storage(); } @@ -334,7 +334,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) LogUnprocessedTail(packet); break; case STATUS_NEVER: - sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)", + sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)", GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); break; -- cgit v1.2.3