From 4c8ff6e6a306407ecf1a2fd7bc5ce0b7b95786b9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 22 Mar 2013 19:55:01 +0100 Subject: Core/Auth: Updated AuthResult enum --- src/server/authserver/Authentication/AuthCodes.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h index 416d14ba5a0..df7de3ed684 100644 --- a/src/server/authserver/Authentication/AuthCodes.h +++ b/src/server/authserver/Authentication/AuthCodes.h @@ -30,17 +30,22 @@ enum AuthResult WOW_FAIL_DB_BUSY = 0x08, WOW_FAIL_VERSION_INVALID = 0x09, WOW_FAIL_VERSION_UPDATE = 0x0A, + WOW_FAIL_INVALID_SERVER = 0x0B, WOW_FAIL_SUSPENDED = 0x0C, + WOW_FAIL_FAIL_NOACCESS = 0x0D, WOW_SUCCESS_SURVEY = 0x0E, WOW_FAIL_PARENTCONTROL = 0x0F, WOW_FAIL_LOCKED_ENFORCED = 0x10, WOW_FAIL_TRIAL_ENDED = 0x11, WOW_FAIL_USE_BATTLENET = 0x12, - WOW_FAIL_TOO_FAST = 0x16, - WOW_FAIL_CHARGEBACK = 0x17, + WOW_FAIL_ANTI_INDULGENCE = 0x13, + WOW_FAIL_EXPIRED = 0x14, + WOW_FAIL_NO_GAME_ACCOUNT = 0x15, + WOW_FAIL_CHARGEBACK = 0x16, + WOW_FAIL_INTERNET_GAME_ROOM_WITHOUT_BNET = 0x17, WOW_FAIL_GAME_ACCOUNT_LOCKED = 0x18, - WOW_FAIL_INTERNET_GAME_ROOM_WITHOUT_BNET = 0x19, - WOW_FAIL_UNLOCKABLE_LOCK = 0x20, + WOW_FAIL_UNLOCKABLE_LOCK = 0x19, + WOW_FAIL_CONVERSION_REQUIRED = 0x20, WOW_FAIL_DISCONNECTED = 0xFF }; -- cgit v1.2.3 From ccb95c74625ab67a3eaf0f4d54206b2d6104da07 Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 22 Mar 2013 21:31:49 +0100 Subject: Script/Spell: Apply Shadow's Fate to Sindragosa Sindgragosa is summoned in instance script and would not pass the modified check otherwise Related to: #9487 --- src/server/scripts/Spells/spell_item.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index c9c75cdb134..0c9817ba167 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -813,6 +813,7 @@ class spell_item_scroll_of_recall : public SpellScriptLoader enum ShadowsFate { SPELL_SOUL_FEAST = 71203, + NPC_SINDRAGOSA = 36853 }; class spell_item_unsated_craving : public SpellScriptLoader @@ -831,7 +832,7 @@ class spell_item_unsated_craving : public SpellScriptLoader return false; Unit* target = procInfo.GetActionTarget(); - if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || target->isSummon()) + if (!target || target->GetTypeId() != TYPEID_UNIT || target->GetCreatureType() == CREATURE_TYPE_CRITTER || (target->GetEntry() != NPC_SINDRAGOSA && target->isSummon())) return false; return true; -- cgit v1.2.3 From 7c36e3a298ce243631848b94364c185a863d1526 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 25 Mar 2013 10:36:30 +0100 Subject: Core/Misc: Minor optimizations (+ code changes to reduce differences with 4.3.4 branch) --- src/server/game/Entities/Creature/Creature.h | 6 +- src/server/game/Entities/GameObject/GameObject.h | 1 + src/server/game/Entities/Object/Object.cpp | 242 +++++++++++---------- src/server/game/Entities/Object/Object.h | 163 ++++++++------ src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Entities/Unit/Unit.h | 1 + .../SerpentShrine/boss_fathomlord_karathress.cpp | 2 +- .../boss_warchief_kargath_bladefist.cpp | 20 +- src/server/scripts/Outland/zone_shattrath_city.cpp | 54 ++--- 9 files changed, 266 insertions(+), 225 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 6e771d2761b..1b59c273d52 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -29,13 +29,13 @@ #include -class SpellInfo; - class CreatureAI; +class CreatureGroup; +class Group; class Quest; class Player; +class SpellInfo; class WorldSession; -class CreatureGroup; enum CreatureFlagsExtra { diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 3f16ea5f273..164735a56b5 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -27,6 +27,7 @@ #include "DatabaseEnv.h" class GameObjectAI; +class Group; #define MAX_GAMEOBJECT_QUEST_ITEMS 6 diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 5b6bf87057f..4ec0a93f71f 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -16,13 +16,13 @@ * with this program. If not, see . */ +#include "Object.h" #include "Common.h" #include "SharedDefines.h" #include "WorldPacket.h" #include "Opcodes.h" #include "Log.h" #include "World.h" -#include "Object.h" #include "Creature.h" #include "Player.h" #include "Vehicle.h" @@ -204,7 +204,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c if (!target) return; - uint8 updatetype = UPDATETYPE_CREATE_OBJECT; + uint8 updateType = UPDATETYPE_CREATE_OBJECT; uint16 flags = m_updateFlag; /** lower flag1 **/ @@ -215,22 +215,22 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c { // UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses... if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER)) - updatetype = UPDATETYPE_CREATE_OBJECT2; + updateType = UPDATETYPE_CREATE_OBJECT2; // UPDATETYPE_CREATE_OBJECT2 for pets... if (target->GetPetGUID() == GetGUID()) - updatetype = UPDATETYPE_CREATE_OBJECT2; + updateType = UPDATETYPE_CREATE_OBJECT2; // UPDATETYPE_CREATE_OBJECT2 for some gameobject types... if (isType(TYPEMASK_GAMEOBJECT)) { - switch (((GameObject*)this)->GetGoType()) + switch (ToGameObject()->GetGoType()) { case GAMEOBJECT_TYPE_TRAP: case GAMEOBJECT_TYPE_DUEL_ARBITER: case GAMEOBJECT_TYPE_FLAGSTAND: case GAMEOBJECT_TYPE_FLAGDROP: - updatetype = UPDATETYPE_CREATE_OBJECT2; + updateType = UPDATETYPE_CREATE_OBJECT2; break; case GAMEOBJECT_TYPE_TRANSPORT: flags |= UPDATEFLAG_TRANSPORT; @@ -242,24 +242,24 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c if (isType(TYPEMASK_UNIT)) { - if (((Unit*)this)->getVictim()) + if (ToUnit()->getVictim()) flags |= UPDATEFLAG_HAS_TARGET; } } - //sLog->outDebug("BuildCreateUpdate: update-type: %u, object-type: %u got flags: %X, flags2: %X", updatetype, m_objectTypeId, flags, flags2); + //sLog->outDebug("BuildCreateUpdate: update-type: %u, object-type: %u got flags: %X, flags2: %X", updateType, m_objectTypeId, flags, flags2); ByteBuffer buf(500); - buf << (uint8)updatetype; + buf << uint8(updateType); buf.append(GetPackGUID()); - buf << (uint8)m_objectTypeId; + buf << uint8(m_objectTypeId); _BuildMovementUpdate(&buf, flags); UpdateMask updateMask; updateMask.SetCount(m_valuesCount); _SetCreateBits(&updateMask, target); - _BuildValuesUpdate(updatetype, &buf, &updateMask, target); + _BuildValuesUpdate(updateType, &buf, &updateMask, target); data->AddUpdateBlock(buf); } @@ -278,7 +278,7 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) c { ByteBuffer buf(500); - buf << (uint8) UPDATETYPE_VALUES; + buf << uint8(UPDATETYPE_VALUES); buf.append(GetPackGUID()); UpdateMask updateMask; @@ -360,64 +360,73 @@ uint16 Object::GetUInt16Value(uint16 index, uint8 offset) const void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const { + Unit const* unit = NULL; + WorldObject const* object = NULL; + + if (isType(TYPEMASK_UNIT)) + unit = ToUnit(); + else + object = ((WorldObject*)this); + *data << uint16(flags); // update flags // 0x20 if (flags & UPDATEFLAG_LIVING) { - ((Unit*)this)->BuildMovementPacket(data); + unit->BuildMovementPacket(data); - *data << ((Unit*)this)->GetSpeed(MOVE_WALK); - *data << ((Unit*)this)->GetSpeed(MOVE_RUN); - *data << ((Unit*)this)->GetSpeed(MOVE_RUN_BACK); - *data << ((Unit*)this)->GetSpeed(MOVE_SWIM); - *data << ((Unit*)this)->GetSpeed(MOVE_SWIM_BACK); - *data << ((Unit*)this)->GetSpeed(MOVE_FLIGHT); - *data << ((Unit*)this)->GetSpeed(MOVE_FLIGHT_BACK); - *data << ((Unit*)this)->GetSpeed(MOVE_TURN_RATE); - *data << ((Unit*)this)->GetSpeed(MOVE_PITCH_RATE); + *data << unit->GetSpeed(MOVE_WALK) + << unit->GetSpeed(MOVE_RUN) + << unit->GetSpeed(MOVE_RUN_BACK) + << unit->GetSpeed(MOVE_SWIM) + << unit->GetSpeed(MOVE_SWIM_BACK) + << unit->GetSpeed(MOVE_FLIGHT) + << unit->GetSpeed(MOVE_FLIGHT_BACK) + << unit->GetSpeed(MOVE_TURN_RATE) + << unit->GetSpeed(MOVE_PITCH_RATE); // 0x08000000 - if (((Unit*)this)->m_movementInfo.GetMovementFlags() & MOVEMENTFLAG_SPLINE_ENABLED) - Movement::PacketBuilder::WriteCreate(*((Unit*)this)->movespline, *data); + if (unit->m_movementInfo.GetMovementFlags() & MOVEMENTFLAG_SPLINE_ENABLED) + Movement::PacketBuilder::WriteCreate(*unit->movespline, *data); } else { if (flags & UPDATEFLAG_POSITION) { - Transport* transport = ((WorldObject*)this)->GetTransport(); + Transport* transport = object->GetTransport(); + if (transport) data->append(transport->GetPackGUID()); else *data << uint8(0); - *data << ((WorldObject*)this)->GetPositionX(); - *data << ((WorldObject*)this)->GetPositionY(); + *data << object->GetPositionX(); + *data << object->GetPositionY(); if (isType(TYPEMASK_UNIT)) - *data << ((Unit*)this)->GetPositionZMinusOffset(); + *data << unit->GetPositionZMinusOffset(); else - *data << ((WorldObject*)this)->GetPositionZ(); + *data << object->GetPositionZ(); if (transport) { - *data << ((WorldObject*)this)->GetTransOffsetX(); - *data << ((WorldObject*)this)->GetTransOffsetY(); - *data << ((WorldObject*)this)->GetTransOffsetZ(); + *data << object->GetTransOffsetX(); + *data << object->GetTransOffsetY(); + *data << object->GetTransOffsetZ(); } else { - *data << ((WorldObject*)this)->GetPositionX(); - *data << ((WorldObject*)this)->GetPositionY(); + *data << object->GetPositionX(); + *data << object->GetPositionY(); if (isType(TYPEMASK_UNIT)) - *data << ((Unit*)this)->GetPositionZMinusOffset(); + *data << unit->GetPositionZMinusOffset(); else - *data << ((WorldObject*)this)->GetPositionZ(); + *data << object->GetPositionZ(); } - *data << ((WorldObject*)this)->GetOrientation(); + *data << object->GetOrientation(); if (GetTypeId() == TYPEID_CORPSE) - *data << float(((WorldObject*)this)->GetOrientation()); + *data << float(object->GetOrientation()); else *data << float(0); } @@ -426,13 +435,13 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const // 0x40 if (flags & UPDATEFLAG_STATIONARY_POSITION) { - *data << ((WorldObject*)this)->GetPositionX(); - *data << ((WorldObject*)this)->GetPositionY(); + *data << object->GetPositionX(); + *data << object->GetPositionY(); if (isType(TYPEMASK_UNIT)) - *data << ((Unit*)this)->GetPositionZMinusOffset(); + *data << unit->GetPositionZMinusOffset(); else - *data << ((WorldObject*)this)->GetPositionZ(); - *data << ((WorldObject*)this)->GetOrientation(); + *data << object->GetPositionZ(); + *data << object->GetOrientation(); } } } @@ -476,7 +485,7 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const // 0x4 if (flags & UPDATEFLAG_HAS_TARGET) { - if (Unit* victim = ((Unit*)this)->getVictim()) + if (Unit* victim = unit->getVictim()) data->append(victim->GetPackGUID()); else *data << uint8(0); @@ -492,67 +501,71 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const if (flags & UPDATEFLAG_VEHICLE) { /// @todo Allow players to aquire this updateflag. - *data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID); - *data << float(((Creature*)this)->GetOrientation()); + *data << uint32(unit->GetVehicleKit()->GetVehicleInfo()->m_ID); + *data << float(unit->GetOrientation()); } // 0x200 if (flags & UPDATEFLAG_ROTATION) - { - *data << int64(((GameObject*)this)->GetRotation()); - } + *data << int64(ToGameObject()->GetRotation()); } -void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* updateMask, Player* target) const +void Object::_BuildValuesUpdate(uint8 updateType, ByteBuffer* data, UpdateMask* updateMask, Player* target) const { if (!target) return; bool IsActivateToQuest = false; - if (updatetype == UPDATETYPE_CREATE_OBJECT || updatetype == UPDATETYPE_CREATE_OBJECT2) - { - if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsDynTransport()) - { - if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) - IsActivateToQuest = true; - if (((GameObject*)this)->GetGoArtKit()) - updateMask->SetBit(GAMEOBJECT_BYTES_1); - } - else if (isType(TYPEMASK_UNIT)) - { - if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) - updateMask->SetBit(UNIT_FIELD_AURASTATE); - } + // Before trying to convert to each type there is a check, so safe + Unit const* unit = ToUnit(); + GameObject const* go = ToGameObject(); + + if (unit) + { + if (unit->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) + updateMask->SetBit(UNIT_FIELD_AURASTATE); } - else // case UPDATETYPE_VALUES + else if (go) { - if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) + if (updateType == UPDATETYPE_CREATE_OBJECT || updateType == UPDATETYPE_CREATE_OBJECT2) { - if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster()) - IsActivateToQuest = true; - - updateMask->SetBit(GAMEOBJECT_BYTES_1); + if (!go->IsDynTransport()) + { + if (go->ActivateToQuest(target) || target->isGameMaster()) + IsActivateToQuest = true; - if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST && ToGameObject()->GetGOInfo()->chest.groupLootRules && - ToGameObject()->HasLootRecipient()) - updateMask->SetBit(GAMEOBJECT_FLAGS); + if (go->GetGoArtKit()) + updateMask->SetBit(GAMEOBJECT_BYTES_1); + } } - else if (isType(TYPEMASK_UNIT)) + else { - if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK)) - updateMask->SetBit(UNIT_FIELD_AURASTATE); + if (!go->IsTransport()) + { + if (go->ActivateToQuest(target) || target->isGameMaster()) + IsActivateToQuest = true; + + updateMask->SetBit(GAMEOBJECT_BYTES_1); + + if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.groupLootRules && + go->HasLootRecipient()) + { + updateMask->SetBit(GAMEOBJECT_FLAGS); + } + } } } - WPAssert(updateMask && updateMask->GetCount() == m_valuesCount); + ASSERT(updateMask && updateMask->GetCount() == m_valuesCount); - *data << (uint8)updateMask->GetBlockCount(); + *data << uint8(updateMask->GetBlockCount()); updateMask->AppendToPacket(data); // 2 specialized loops for speed optimization in non-unit case - if (isType(TYPEMASK_UNIT)) // unit (creature/player) case + if (unit) // unit (creature/player) case { + Creature const* creature = ToCreature(); for (uint16 index = 0; index < m_valuesCount; ++index) { if (updateMask->GetBit(index)) @@ -569,7 +582,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* if (appendValue & UNIT_NPC_FLAG_TRAINER) { - if (!this->ToCreature()->isCanTrainingOf(target, false)) + if (!creature->isCanTrainingOf(target, false)) appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION); } } @@ -578,8 +591,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* } else if (index == UNIT_FIELD_AURASTATE) { - // Check per caster aura states to not enable using a pell in client if specified aura is not by target - *data << ((Unit*)this)->BuildAuraStateUpdateForTarget(target); + // Check per caster aura states to not enable using a spell in client if specified aura is not by target + *data << unit->BuildAuraStateUpdateForTarget(target); } // FIXME: Some values at server stored in float format but must be sent to client in uint32 format else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME) @@ -608,7 +621,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* { if (GetTypeId() == TYPEID_UNIT) { - CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate(); + CreatureTemplate const* cinfo = creature->GetCreatureTemplate(); // this also applies for transform auras if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(ToUnit()->getTransForm())) @@ -648,7 +661,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* { uint32 dynamicFlags = m_uint32Values[index]; - if (Creature const* creature = ToCreature()) + if (creature) { if (creature->hasLootRecipient()) { @@ -673,16 +686,14 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* } // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras - if (Unit const* unit = ToUnit()) - if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) - if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) - dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; + if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT) + if (!unit->HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, target->GetGUID())) + dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT; *data << dynamicFlags; } // FG: pretend that OTHER players in own group are friendly ("blue") else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE) { - Unit const* unit = ToUnit(); if (unit->IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && unit->IsInRaidWith(target)) { FactionTemplateEntry const* ft1 = unit->getFactionTemplateEntry(); @@ -715,7 +726,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* } } } - else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case + else if (go) // gameobject case { for (uint16 index = 0; index < m_valuesCount; ++index) { @@ -726,7 +737,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* { if (IsActivateToQuest) { - switch (ToGameObject()->GetGoType()) + switch (go->GetGoType()) { case GAMEOBJECT_TYPE_CHEST: if (target->isGameMaster()) @@ -766,8 +777,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* else if (index == GAMEOBJECT_FLAGS) { uint32 flags = m_uint32Values[index]; - if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST) - if (ToGameObject()->GetGOInfo()->chest.groupLootRules && !ToGameObject()->IsLootAllowedFor(target)) + if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST) + if (go->GetGOInfo()->chest.groupLootRules && !go->IsLootAllowedFor(target)) flags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE; *data << flags; @@ -1294,6 +1305,14 @@ bool Object::PrintIndexError(uint32 index, bool set) const return false; } +bool Position::operator==(Position const &a) +{ + return (G3D::fuzzyEq(a.m_positionX, m_positionX) && + G3D::fuzzyEq(a.m_positionY, m_positionY) && + G3D::fuzzyEq(a.m_positionZ, m_positionZ) && + G3D::fuzzyEq(a.m_orientation, m_orientation)); +} + bool Position::HasInLine(WorldObject const* target, float width) const { if (!HasInArc(M_PI, target)) @@ -1703,7 +1722,7 @@ void Position::RelocateOffset(const Position & offset) m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI)); m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation())); m_positionZ = GetPositionZ() + offset.GetPositionZ(); - m_orientation = GetOrientation() + offset.GetOrientation(); + SetOrientation(GetOrientation() + offset.GetOrientation()); } void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const @@ -1714,7 +1733,7 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation()); retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation()); retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ(); - retOffset.m_orientation = endPos.GetOrientation() - GetOrientation(); + retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation()); } float Position::GetAngle(const Position* obj) const @@ -1755,25 +1774,25 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos) } } -bool Position::HasInArc(float arc, const Position* obj) const +bool Position::HasInArc(float arc, const Position* obj, float border) const { // always have self in arc if (obj == this) return true; // move arc to range 0.. 2*pi - arc = MapManager::NormalizeOrientation(arc); + arc = NormalizeOrientation(arc); float angle = GetAngle(obj); angle -= m_orientation; // move angle to range -pi ... +pi - angle = MapManager::NormalizeOrientation(angle); + angle = NormalizeOrientation(angle); if (angle > M_PI) angle -= 2.0f*M_PI; - float lborder = -1 * (arc/2.0f); // in range -pi..0 - float rborder = (arc/2.0f); // in range 0..pi + float lborder = -1 * (arc/border); // in range -pi..0 + float rborder = (arc/border); // in range 0..pi return ((angle >= lborder) && (angle <= rborder)); } @@ -2037,7 +2056,7 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const const WorldObject* seer = this; // Pets don't have detection, they use the detection of their masters - if (const Unit* thisUnit = ToUnit()) + if (Unit const* thisUnit = ToUnit()) if (Unit* controller = thisUnit->GetCharmerOrOwner()) seer = controller; @@ -2096,8 +2115,9 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const float distance = GetExactDist(obj); float combatReach = 0.0f; - if (isType(TYPEMASK_UNIT)) - combatReach = ((Unit*)this)->GetCombatReach(); + Unit const* unit = ToUnit(); + if (unit) + combatReach = unit->GetCombatReach(); if (distance < combatReach) return true; @@ -2105,14 +2125,14 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const if (!HasInArc(M_PI, obj)) return false; + GameObject const* go = ToGameObject(); for (uint32 i = 0; i < TOTAL_STEALTH_TYPES; ++i) { if (!(obj->m_stealth.GetFlags() & (1 << i))) continue; - if (isType(TYPEMASK_UNIT)) - if (((Unit*)this)->HasAuraTypeWithMiscvalue(SPELL_AURA_DETECT_STEALTH, i)) - return true; + if (unit && unit->HasAuraTypeWithMiscvalue(SPELL_AURA_DETECT_STEALTH, i)) + return true; // Starting points int32 detectionValue = 30; @@ -2124,8 +2144,8 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const // Apply modifiers detectionValue += m_stealthDetect.GetValue(StealthType(i)); - if (obj->isType(TYPEMASK_GAMEOBJECT)) - if (Unit* owner = ((GameObject*)obj)->GetOwner()) + if (go) + if (Unit* owner = go->GetOwner()) detectionValue -= int32(owner->getLevelForTarget(this) - 1) * 5; detectionValue -= obj->m_stealth.GetValue(StealthType(i)); @@ -2955,7 +2975,7 @@ float WorldObject::GetObjectSize() const void WorldObject::MovePosition(Position &pos, float dist, float angle) { - angle += m_orientation; + angle += GetOrientation(); float destx, desty, destz, ground, floor; destx = pos.m_positionX + dist * std::cos(angle); desty = pos.m_positionY + dist * std::sin(angle); @@ -3000,7 +3020,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float angle) { - angle += m_orientation; + angle += GetOrientation(); float destx, desty, destz, ground, floor; pos.m_positionZ += 2.0f; destx = pos.m_positionX + dist * std::cos(angle); @@ -3063,7 +3083,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float Trinity::NormalizeMapCoord(pos.m_positionX); Trinity::NormalizeMapCoord(pos.m_positionY); UpdateAllowedPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); - pos.m_orientation = m_orientation; + pos.SetOrientation(GetOrientation()); } void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 6c54ccfbdf7..70a7bcd7f39 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -21,10 +21,8 @@ #include "Common.h" #include "UpdateMask.h" -#include "UpdateData.h" #include "GridReference.h" #include "ObjectDefines.h" -#include "GridDefines.h" #include "Map.h" #include @@ -101,20 +99,21 @@ enum NotifyFlags NOTIFY_ALL = 0xFF }; -class WorldPacket; -class UpdateData; -class ByteBuffer; -class WorldSession; +class Corpse; class Creature; -class Player; -class InstanceScript; +class CreatureAI; +class DynamicObject; class GameObject; +class Map; +class InstanceScript; +class Player; class TempSummon; -class Vehicle; -class CreatureAI; -class ZoneScript; -class Unit; class Transport; +class Unit; +class UpdateData; +class WorldObject; +class WorldPacket; +class ZoneScript; typedef UNORDERED_MAP UpdateDataMapType; @@ -225,6 +224,9 @@ class Object Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast(this); else return NULL; } Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast(this); else return NULL; } + DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return NULL; } + DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast(this); else return NULL; } + protected: Object(); @@ -288,21 +290,31 @@ struct Position float m_positionX; float m_positionY; float m_positionZ; +// Better to limit access to m_orientation field, but this will be hard to achieve with many scripts using array initialization for this structure +//private: float m_orientation; +//public: + + bool operator==(Position const &a); + + inline bool operator!=(Position const &a) + { + return !(operator==(a)); + } void Relocate(float x, float y) { m_positionX = x; m_positionY = y;} void Relocate(float x, float y, float z) { m_positionX = x; m_positionY = y; m_positionZ = z; } void Relocate(float x, float y, float z, float orientation) - { m_positionX = x; m_positionY = y; m_positionZ = z; m_orientation = orientation; } - void Relocate(const Position &pos) - { m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; m_orientation = pos.m_orientation; } - void Relocate(const Position* pos) - { m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; m_orientation = pos->m_orientation; } - void RelocateOffset(const Position &offset); + { m_positionX = x; m_positionY = y; m_positionZ = z; SetOrientation(orientation); } + void Relocate(Position const &pos) + { m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; SetOrientation(pos.m_orientation); } + void Relocate(Position const* pos) + { m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; SetOrientation(pos->m_orientation); } + void RelocateOffset(Position const &offset); void SetOrientation(float orientation) - { m_orientation = orientation; } + { m_orientation = NormalizeOrientation(orientation); } float GetPositionX() const { return m_positionX; } float GetPositionY() const { return m_positionY; } @@ -336,39 +348,54 @@ struct Position { float dx = m_positionX - x; float dy = m_positionY - y; return dx*dx + dy*dy; } float GetExactDist2d(const float x, const float y) const { return sqrt(GetExactDist2dSq(x, y)); } - float GetExactDist2dSq(const Position* pos) const + float GetExactDist2dSq(Position const* pos) const { float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; return dx*dx + dy*dy; } - float GetExactDist2d(const Position* pos) const + float GetExactDist2d(Position const* pos) const { return sqrt(GetExactDist2dSq(pos)); } float GetExactDistSq(float x, float y, float z) const { float dz = m_positionZ - z; return GetExactDist2dSq(x, y) + dz*dz; } float GetExactDist(float x, float y, float z) const { return sqrt(GetExactDistSq(x, y, z)); } - float GetExactDistSq(const Position* pos) const + float GetExactDistSq(Position const* pos) const { float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; float dz = m_positionZ - pos->m_positionZ; return dx*dx + dy*dy + dz*dz; } - float GetExactDist(const Position* pos) const + float GetExactDist(Position const* pos) const { return sqrt(GetExactDistSq(pos)); } - void GetPositionOffsetTo(const Position & endPos, Position & retOffset) const; + void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const; - float GetAngle(const Position* pos) const; + float GetAngle(Position const* pos) const; float GetAngle(float x, float y) const; - float GetRelativeAngle(const Position* pos) const + float GetRelativeAngle(Position const* pos) const { return GetAngle(pos) - m_orientation; } float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; } void GetSinCos(float x, float y, float &vsin, float &vcos) const; bool IsInDist2d(float x, float y, float dist) const { return GetExactDist2dSq(x, y) < dist * dist; } - bool IsInDist2d(const Position* pos, float dist) const + bool IsInDist2d(Position const* pos, float dist) const { return GetExactDist2dSq(pos) < dist * dist; } bool IsInDist(float x, float y, float z, float dist) const { return GetExactDistSq(x, y, z) < dist * dist; } - bool IsInDist(const Position* pos, float dist) const + bool IsInDist(Position const* pos, float dist) const { return GetExactDistSq(pos) < dist * dist; } - bool HasInArc(float arcangle, const Position* pos) const; + bool HasInArc(float arcangle, Position const* pos, float border = 2.0f) const; bool HasInLine(WorldObject const* target, float width) const; std::string ToString() const; + + // modulos a radian orientation to the range of 0..2PI + static float NormalizeOrientation(float o) + { + // fmod only supports positive numbers. Thus we have + // to emulate negative numbers + if (o < 0) + { + float mod = o *-1; + mod = fmod(mod, 2.0f * static_cast(M_PI)); + mod = -mod + 2.0f * static_cast(M_PI); + return mod; + } + return fmod(o, 2.0f * static_cast(M_PI)); + } }; ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer); ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const& streamer); @@ -378,39 +405,31 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st struct MovementInfo { // common - uint64 guid; - uint32 flags; - uint16 flags2; + uint64 guid; + uint32 flags; + uint16 flags2; Position pos; - uint32 time; + uint32 time; // transport - uint64 t_guid; + uint64 t_guid; Position t_pos; - uint32 t_time; - uint32 t_time2; - int8 t_seat; + int8 t_seat; + uint32 t_time; + uint32 t_time2; // swimming/flying - float pitch; + float pitch; // falling - uint32 fallTime; + uint32 fallTime; // jumping - float j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed; + float j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed; // spline - float splineElevation; + float splineElevation; - MovementInfo() - { - pos.Relocate(0, 0, 0, 0); - guid = 0; - flags = 0; - flags2 = 0; - time = t_time = t_time2 = fallTime = 0; - splineElevation = 0; - pitch = j_zspeed = j_sinAngle = j_cosAngle = j_xyspeed = 0.0f; - t_guid = 0; - t_pos.Relocate(0, 0, 0, 0); - t_seat = -1; - } + MovementInfo() : + guid(), flags(), flags2(), pos(), time(), t_guid(), t_pos(), + t_seat(-1), t_time(), t_time2(), pitch(), fallTime(), + j_zspeed(), j_sinAngle(), j_cosAngle(), j_xyspeed() + { } uint32 GetMovementFlags() const { return flags; } void SetMovementFlags(uint32 flag) { flags = flag; } @@ -498,14 +517,14 @@ class WorldObject : public Object, public WorldLocation void MovePositionToFirstCollision(Position &pos, float dist, float angle); void GetFirstCollisionPosition(Position &pos, float dist, float angle); void GetRandomNearPosition(Position &pos, float radius); - void GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const; + void GetContactPoint(WorldObject const* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const; float GetObjectSize() const; void UpdateGroundPositionZ(float x, float y, float &z) const; void UpdateAllowedPositionZ(float x, float y, float &z) const; - void GetRandomPoint(const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const; - void GetRandomPoint(const Position &srcPos, float distance, Position &pos) const; + void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const; + void GetRandomPoint(Position const &srcPos, float distance, Position &pos) const; uint32 GetInstanceId() const { return m_InstanceId; } @@ -525,24 +544,24 @@ class WorldObject : public Object, public WorldLocation virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; } - float GetDistance(const WorldObject* obj) const; - float GetDistance(const Position &pos) const; + float GetDistance(WorldObject const* obj) const; + float GetDistance(Position const &pos) const; float GetDistance(float x, float y, float z) const; - float GetDistance2d(const WorldObject* obj) const; + float GetDistance2d(WorldObject const* obj) const; float GetDistance2d(float x, float y) const; - float GetDistanceZ(const WorldObject* obj) const; + float GetDistanceZ(WorldObject const* obj) const; - bool IsSelfOrInSameMap(const WorldObject* obj) const; - bool IsInMap(const WorldObject* obj) const; + bool IsSelfOrInSameMap(WorldObject const* obj) const; + bool IsInMap(WorldObject const* obj) const; bool IsWithinDist3d(float x, float y, float z, float dist) const; - bool IsWithinDist3d(const Position* pos, float dist) const; + bool IsWithinDist3d(Position const* pos, float dist) const; bool IsWithinDist2d(float x, float y, float dist) const; - bool IsWithinDist2d(const Position* pos, float dist) const; + bool IsWithinDist2d(Position const* pos, float dist) const; // use only if you will sure about placing both object at same map bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const; bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const; bool IsWithinLOS(float x, float y, float z) const; - bool IsWithinLOSInMap(const WorldObject* obj) const; + bool IsWithinLOSInMap(WorldObject const* obj) const; bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) const; bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const; bool IsInRange2d(float x, float y, float minRange, float maxRange) const; @@ -550,7 +569,7 @@ class WorldObject : public Object, public WorldLocation bool isInFront(WorldObject const* target, float arc = M_PI) const; bool isInBack(WorldObject const* target, float arc = M_PI) const; - bool IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size = 0) const; + bool IsInBetween(WorldObject const* obj1, WorldObject const* obj2, float size = 0) const; virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units @@ -581,7 +600,7 @@ class WorldObject : public Object, public WorldLocation float GetGridActivationRange() const; float GetVisibilityRange() const; - float GetSightRange(const WorldObject* target = NULL) const; + float GetSightRange(WorldObject const* target = NULL) const; bool canSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const; FlaggedValuesArray32 m_stealth; @@ -608,7 +627,7 @@ class WorldObject : public Object, public WorldLocation void SetZoneScript(); ZoneScript* GetZoneScript() const { return m_zoneScript; } - TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const; + TempSummon* SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const; TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0) const; GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime); Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL); @@ -710,13 +729,13 @@ namespace Trinity class ObjectDistanceOrderPred { public: - ObjectDistanceOrderPred(const WorldObject* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {} - bool operator()(const WorldObject* pLeft, const WorldObject* pRight) const + ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {} + bool operator()(WorldObject const* pLeft, WorldObject const* pRight) const { return m_ascending ? m_refObj->GetDistanceOrder(pLeft, pRight) : !m_refObj->GetDistanceOrder(pLeft, pRight); } private: - const WorldObject* m_refObj; + WorldObject const* m_refObj; const bool m_ascending; }; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 87ca7a6c62b..bf73feeae16 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9934,7 +9934,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin AddPct(DoneTotalMod, (*i)->GetAmount()); // done scripted mod (take it from owner) - Unit const * const owner = GetOwner() ? GetOwner() : this; + Unit const* owner = GetOwner() ? GetOwner() : this; AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 49df2659433..4896f29d205 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -19,6 +19,7 @@ #ifndef __UNIT_H #define __UNIT_H +#include "DBCStructure.h" #include "EventProcessor.h" #include "FollowerReference.h" #include "FollowerRefManager.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 38f02622e5a..0a6c09093f1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -672,7 +672,7 @@ public: if (Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000)) { - Cyclone->ToCreature()->SetObjectScale(3.0f); + Cyclone->SetObjectScale(3.0f); Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Cyclone->setFaction(me->getFaction()); Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index 2cfe73ea719..a13d91e8bff 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -164,24 +164,24 @@ class boss_warchief_kargath_bladefist : public CreatureScript { for (std::vector::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr) { - Unit* temp = Unit::GetUnit(*me, *itr); - if (temp && temp->isAlive()) + Creature* creature = Unit::GetCreature(*me, *itr); + if (creature && creature->isAlive()) { - temp->GetMotionMaster()->Clear(true); - me->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - temp->ToCreature()->RemoveCorpse(); + creature->GetMotionMaster()->Clear(true); + me->DealDamage(creature, creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + creature->RemoveCorpse(); } } adds.clear(); for (std::vector::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr) { - Unit* temp = Unit::GetUnit(*me, *itr); - if (temp && temp->isAlive()) + Creature* creature = Unit::GetCreature(*me, *itr); + if (creature && creature->isAlive()) { - temp->GetMotionMaster()->Clear(true); - me->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - temp->ToCreature()->RemoveCorpse(); + creature->GetMotionMaster()->Clear(true); + me->DealDamage(creature, creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + creature->RemoveCorpse(); } } assassins.clear(); diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp index 95ba9476905..4af11191708 100644 --- a/src/server/scripts/Outland/zone_shattrath_city.cpp +++ b/src/server/scripts/Outland/zone_shattrath_city.cpp @@ -474,16 +474,16 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->setFaction(1194); - if (Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) + if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) { - Creepjack->ToCreature()->AI()->EnterEvadeMode(); + Creepjack->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - if (Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20)) + if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20)) { - Malone->ToCreature()->AI()->EnterEvadeMode(); + Malone->AI()->EnterEvadeMode(); Malone->setFaction(1194); Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -521,31 +521,31 @@ public: { if (Event) SayTimer = NextStep(++Step); - } else SayTimer -= diff; + } + else + SayTimer -= diff; if (Attack) { - Player* player = Unit::GetPlayer(*me, PlayerGUID); me->setFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (player) - { - Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); - if (Creepjack) - { - Creepjack->Attack(player, true); - Creepjack->setFaction(14); - Creepjack->GetMotionMaster()->MoveChase(player); - Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); - if (Malone) + if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) { - Malone->Attack(player, true); - Malone->setFaction(14); - Malone->GetMotionMaster()->MoveChase(player); - Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) + { + Creepjack->Attack(player, true); + Creepjack->setFaction(14); + Creepjack->GetMotionMaster()->MoveChase(player); + Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20)) + { + Malone->Attack(player, true); + Malone->setFaction(14); + Malone->GetMotionMaster()->MoveChase(player); + Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } DoStartMovement(player); AttackStart(player); } @@ -557,17 +557,17 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveAllAuras(); - if (Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) + if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) { - Creepjack->ToCreature()->AI()->EnterEvadeMode(); + Creepjack->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); Creepjack->GetMotionMaster()->MoveTargetedHome(); Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - if (Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20)) + if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20)) { - Malone->ToCreature()->AI()->EnterEvadeMode(); + Malone->AI()->EnterEvadeMode(); Malone->setFaction(1194); Malone->GetMotionMaster()->MoveTargetedHome(); Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); -- cgit v1.2.3 From 1a6a23ec96c7646d2753198f93eaba62d2732a83 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 25 Mar 2013 13:26:48 +0100 Subject: Core/Misc: Minor optimizations (+code changes to reduce differences with 4.3.4 branch) Core/Logging: Create new logger type "Cheat". Will be used to log all cheat attempts --- src/server/game/Entities/Object/Object.cpp | 2 +- src/server/game/Entities/Object/Object.h | 1 - .../game/Entities/Object/Updates/UpdateData.h | 2 + src/server/game/Entities/Pet/Pet.cpp | 63 ++++---- src/server/game/Entities/Player/Player.cpp | 14 +- src/server/game/Entities/Player/Player.h | 10 +- src/server/game/Entities/Player/SocialMgr.cpp | 11 +- src/server/game/Entities/Player/SocialMgr.h | 1 - src/server/game/Entities/Unit/Unit.h | 41 +++-- src/server/game/Events/GameEventMgr.cpp | 4 +- src/server/game/Globals/ObjectAccessor.cpp | 29 ++++ src/server/game/Globals/ObjectAccessor.h | 29 +--- src/server/game/Grids/GridDefines.h | 6 +- src/server/game/Grids/NGrid.h | 13 +- src/server/game/Groups/Group.cpp | 10 +- src/server/game/Instances/InstanceSaveMgr.cpp | 3 +- src/server/game/Instances/InstanceScript.cpp | 2 + src/server/game/Loot/LootMgr.cpp | 17 +-- src/server/game/Loot/LootMgr.h | 1 - src/server/game/Maps/MapInstanced.cpp | 2 - src/server/game/Maps/MapManager.h | 15 -- src/server/game/Spells/Auras/SpellAuras.h | 15 +- src/server/game/Spells/Spell.h | 4 +- .../ChamberOfAspects/RubySanctum/boss_halion.cpp | 2 +- .../IcecrownCitadel/boss_lord_marrowgar.cpp | 5 +- .../scripts/Northrend/Nexus/Oculus/boss_varos.cpp | 3 +- src/server/shared/CMakeLists.txt | 3 +- src/server/shared/Containers.h | 1 + .../Cryptography/Authentication/AuthCrypt.cpp | 13 +- .../shared/Cryptography/Authentication/AuthCrypt.h | 1 - src/server/shared/Cryptography/BigNumber.cpp | 9 +- src/server/shared/Cryptography/HMACSHA1.cpp | 2 +- src/server/shared/Database/DatabaseWorkerPool.h | 4 +- src/server/shared/Debugging/Errors.cpp | 38 +++++ src/server/shared/Debugging/Errors.h | 24 ++- .../shared/Debugging/WheatyExceptionReport.cpp | 2 + src/server/shared/Logging/Appender.cpp | 2 + src/server/shared/Logging/Appender.h | 13 +- src/server/shared/Logging/LogOperation.h | 3 +- src/server/shared/Packets/ByteBuffer.cpp | 95 ++++++++++++ src/server/shared/Packets/ByteBuffer.h | 167 +++++++-------------- src/server/worldserver/worldserver.conf.dist | 3 +- 42 files changed, 374 insertions(+), 311 deletions(-) create mode 100644 src/server/shared/Debugging/Errors.cpp create mode 100644 src/server/shared/Packets/ByteBuffer.cpp (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 4ec0a93f71f..83d192e8a83 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -3015,7 +3015,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) Trinity::NormalizeMapCoord(pos.m_positionX); Trinity::NormalizeMapCoord(pos.m_positionY); UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); - pos.m_orientation = m_orientation; + pos.SetOrientation(GetOrientation()); } void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float angle) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 70a7bcd7f39..9acd3cc3026 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -104,7 +104,6 @@ class Creature; class CreatureAI; class DynamicObject; class GameObject; -class Map; class InstanceScript; class Player; class TempSummon; diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h index fb4ec930c41..654db149ca0 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.h +++ b/src/server/game/Entities/Object/Updates/UpdateData.h @@ -20,6 +20,8 @@ #define __UPDATEDATA_H #include "ByteBuffer.h" +#include + class WorldPacket; enum OBJECT_UPDATE_TYPE diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index d32c37975dc..990c315e052 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -34,12 +34,12 @@ #define PET_XP_FACTOR 0.05f -Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner, true), - m_usedTalentCount(0), m_removed(false), - m_happinessTimer(7500), m_petType(type), m_duration(0), - m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) +Pet::Pet(Player* owner, PetType type) : + Guardian(NULL, owner, true), m_usedTalentCount(0), m_removed(false), + m_happinessTimer(7500), m_petType(type), m_duration(0), m_auraRaidUpdateMask(0), m_loading(false), + m_declinedname(NULL) { - ASSERT(m_owner->GetTypeId() == TYPEID_PLAYER); + ASSERT(GetOwner()->GetTypeId() == TYPEID_PLAYER); m_unitTypeMask |= UNIT_MASK_PET; if (type == HUNTER_PET) @@ -563,7 +563,7 @@ void Pet::Update(uint32 diff) { if (owner->GetPetGUID() != GetGUID()) { - sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName().c_str()); + sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), GetOwner()->GetName().c_str()); Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); return; } @@ -832,19 +832,24 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) //Determine pet type PetType petType = MAX_PET_TYPE; - if (isPet() && m_owner->GetTypeId() == TYPEID_PLAYER) + if (isPet() && GetOwner()->GetTypeId() == TYPEID_PLAYER) { - if ((m_owner->getClass() == CLASS_WARLOCK) - || (m_owner->getClass() == CLASS_SHAMAN) // Fire Elemental - || (m_owner->getClass() == CLASS_DEATH_KNIGHT)) // Risen Ghoul + if (GetOwner()->getClass() == CLASS_WARLOCK + || GetOwner()->getClass() == CLASS_SHAMAN // Fire Elemental + || GetOwner()->getClass() == CLASS_DEATH_KNIGHT) // Risen Ghoul + { petType = SUMMON_PET; - else if (m_owner->getClass() == CLASS_HUNTER) + } + else if (GetOwner()->getClass() == CLASS_HUNTER) { petType = HUNTER_PET; m_unitTypeMask |= UNIT_MASK_HUNTER_PET; } else - sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass()); + { + sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", + GetEntry(), GetOwner()->getClass()); + } } uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry; @@ -911,12 +916,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { case SUMMON_PET: { - //the damage bonus used for pets is either fire or shadow damage, whatever is higher - uint32 fire = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE); - uint32 shadow = m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW); - uint32 val = (fire > shadow) ? fire : shadow; - SetBonusDamage(int32 (val * 0.15f)); - //bonusAP += val * 0.57; + // the damage bonus used for pets is either fire or shadow damage, whatever is higher + int32 fire = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE); + int32 shadow = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW); + int32 val = (fire > shadow) ? fire : shadow; + if (val < 0) + val = 0; + + SetBonusDamage(val * 0.15f); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); @@ -941,14 +948,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { case 510: // mage Water Elemental { - SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); + SetBonusDamage(int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); break; } case 1964: //force of nature { if (!pInfo) SetCreateHealth(30 + 30*petlevel); - float bonusDmg = m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f; + float bonusDmg = GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE) * 0.15f; SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - (petlevel / 2) + bonusDmg)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + (petlevel / 2) + bonusDmg)); break; @@ -968,7 +975,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateHealth(40*petlevel); SetCreateMana(28 + 10*petlevel); } - SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f)); + SetBonusDamage(int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE) * 0.5f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel)); break; @@ -980,7 +987,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateMana(28 + 10*petlevel); SetCreateHealth(28 + 30*petlevel); } - int32 bonus_dmg = (int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f)); + int32 bonus_dmg = int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW)* 0.3f); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel) + bonus_dmg)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel) + bonus_dmg)); @@ -1009,16 +1016,16 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float((petlevel * 4 - petlevel))); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((petlevel * 4 + petlevel))); - SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(m_owner->GetArmor()) * 0.35f); // Bonus Armor (35% of player armor) - SetModifierValue(UNIT_MOD_STAT_STAMINA, BASE_VALUE, float(m_owner->GetStat(STAT_STAMINA)) * 0.3f); // Bonus Stamina (30% of player stamina) + SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(GetOwner()->GetArmor()) * 0.35f); // Bonus Armor (35% of player armor) + SetModifierValue(UNIT_MOD_STAT_STAMINA, BASE_VALUE, float(GetOwner()->GetStat(STAT_STAMINA)) * 0.3f); // Bonus Stamina (30% of player stamina) if (!HasAura(58877))//prevent apply twice for the 2 wolves AddAura(58877, this);//Spirit Hunt, passive, Spirit Wolves' attacks heal them and their master for 150% of damage done. break; } case 31216: // Mirror Image { - SetBonusDamage(int32(m_owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); - SetDisplayId(m_owner->GetDisplayId()); + SetBonusDamage(int32(GetOwner()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST) * 0.33f)); + SetDisplayId(GetOwner()->GetDisplayId()); if (!pInfo) { SetCreateMana(28 + 30*petlevel); @@ -1033,7 +1040,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateMana(28 + 10*petlevel); SetCreateHealth(28 + 30*petlevel); } - SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f)); + SetBonusDamage(int32(GetOwner()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); break; @@ -1041,7 +1048,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) case 28017: // Bloodworms { SetCreateHealth(4 * petlevel); - SetBonusDamage(int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); + SetBonusDamage(int32(GetOwner()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4))); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4))); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 49d210fca2c..bed7d9642ac 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12113,14 +12113,8 @@ void Player::RemoveAmmo() UpdateDamagePhysical(RANGED_ATTACK); } -Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId) -{ - AllowedLooterSet allowedLooters; - return StoreNewItem(dest, item, update, randomPropertyId, allowedLooters); -} - // Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case. -Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters) +Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet const& allowedLooters) { uint32 count = 0; for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) @@ -12241,7 +12235,6 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool AddEnchantmentDurations(pItem); AddItemDurations(pItem); - const ItemTemplate* proto = pItem->GetTemplate(); for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger @@ -16172,6 +16165,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) { uint16 addkillcount = 1; uint32 real_entry = entry; + Creature* killed = NULL; if (guid) { Creature* killed = GetMap()->GetCreature(guid); @@ -16180,7 +16174,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) } StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : NULL); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, killed); for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { @@ -26013,7 +26007,7 @@ void Player::RefundItem(Item* item) { ItemPosCountVec dest; InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count); - ASSERT(msg == EQUIP_ERR_OK) /// Already checked before + ASSERT(msg == EQUIP_ERR_OK); /// Already checked before Item* it = StoreNewItem(dest, itemid, true); SendNewItem(it, count, true, false, true); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 6458de47378..1c0fa4ea93d 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -907,13 +907,13 @@ class PlayerTaxi bool IsTaximaskNodeKnown(uint32 nodeidx) const { uint8 field = uint8((nodeidx - 1) / 32); - uint32 submask = 1<<((nodeidx-1)%32); + uint32 submask = 1 << ((nodeidx-1) % 32); return (m_taximask[field] & submask) == submask; } bool SetTaximaskNode(uint32 nodeidx) { uint8 field = uint8((nodeidx - 1) / 32); - uint32 submask = 1<<((nodeidx-1)%32); + uint32 submask = 1 << ((nodeidx-1) % 32); if ((m_taximask[field] & submask) != submask) { m_taximask[field] |= submask; @@ -1022,7 +1022,7 @@ class TradeData uint32 m_spell; // m_player apply spell to non-traded slot item uint64 m_spellCastItem; // applied spell casted by item use - uint64 m_items[TRADE_SLOT_COUNT]; // traded itmes from m_player side including non-traded slot + uint64 m_items[TRADE_SLOT_COUNT]; // traded items from m_player side including non-traded slot }; class KillRewarder @@ -1235,8 +1235,7 @@ class Player : public Unit, public GridObject InventoryResult CanUseItem(ItemTemplate const* pItem) const; InventoryResult CanUseAmmo(uint32 item) const; InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const; - Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0); - Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet &allowedLooters); + Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, AllowedLooterSet const& allowedLooters = AllowedLooterSet()); Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update); Item* EquipNewItem(uint16 pos, uint32 item, bool update); Item* EquipItem(uint16 pos, Item* pItem, bool update); @@ -2665,4 +2664,5 @@ template T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas basevalue = T((float)basevalue + diff); return T(diff); } + #endif diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 6f5927492bf..2b053995e1b 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -27,15 +27,8 @@ #include "Util.h" #include "AccountMgr.h" -PlayerSocial::PlayerSocial() -{ - m_playerGUID = 0; -} - -PlayerSocial::~PlayerSocial() -{ - m_playerSocialMap.clear(); -} +PlayerSocial::PlayerSocial(): m_playerGUID() +{ } uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) { diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h index 0e73af8f809..4f2a4fdde72 100644 --- a/src/server/game/Entities/Player/SocialMgr.h +++ b/src/server/game/Entities/Player/SocialMgr.h @@ -104,7 +104,6 @@ class PlayerSocial friend class SocialMgr; public: PlayerSocial(); - ~PlayerSocial(); // adding/removing bool AddToSocialList(uint32 friend_guid, bool ignore); void RemoveFromSocialList(uint32 friend_guid, bool ignore); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 4896f29d205..c972f97788f 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -127,14 +127,32 @@ enum SpellValueMod SPELLVALUE_AURA_STACK }; -typedef std::pair CustomSpellValueMod; -class CustomSpellValues : public std::vector +class CustomSpellValues { - public: - void AddSpellMod(SpellValueMod mod, int32 value) - { - push_back(std::make_pair(mod, value)); - } + typedef std::pair CustomSpellValueMod; + typedef std::vector StorageType; + +public: + typedef StorageType::const_iterator const_iterator; + +public: + void AddSpellMod(SpellValueMod mod, int32 value) + { + storage_.push_back(CustomSpellValueMod(mod, value)); + } + + const_iterator begin() const + { + return storage_.begin(); + } + + const_iterator end() const + { + return storage_.end(); + } + +private: + StorageType storage_; }; enum SpellFacingFlags @@ -1411,10 +1429,13 @@ class Unit : public WorldObject void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL); void ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage, SpellInfo const* procAura = NULL); - void GetProcAurasTriggeredOnEvent(std::list& aurasTriggeringProc, std::list* procAuras, ProcEventInfo eventInfo); + void GetProcAurasTriggeredOnEvent(AuraApplicationList& aurasTriggeringProc, AuraApplicationList* procAuras, ProcEventInfo eventInfo); void TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo); - void TriggerAurasProcOnEvent(std::list* myProcAuras, std::list* targetProcAuras, Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo); - void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, std::list& procAuras); + void TriggerAurasProcOnEvent(AuraApplicationList* myProcAuras, AuraApplicationList* targetProcAuras, + Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, + uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, + DamageInfo* damageInfo, HealInfo* healInfo); + void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationList& procAuras); void HandleEmoteCommand(uint32 anim_id); void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 685ac9029ed..9141f77b852 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -205,7 +205,7 @@ void GameEventMgr::LoadFromDB() { { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 + // 0 1 2 3 4 5 6 7 QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event"); if (!result) { @@ -792,7 +792,7 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 + // 0 1 2 3 4 5 QueryResult result = WorldDatabase.Query("SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC"); if (!result) diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 0ea66a056fb..08075235bab 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -47,6 +47,35 @@ ObjectAccessor::~ObjectAccessor() { } +template T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) +{ + T* obj = HashMapHolder::Find(guid); + if (!obj || obj->GetMapId() != mapid) + return NULL; + + CellCoord p = Trinity::ComputeCellCoord(x, y); + if (!p.IsCoordValid()) + { + sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); + return NULL; + } + + CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); + if (!q.IsCoordValid()) + { + sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); + return NULL; + } + + int32 dx = int32(p.x_coord) - int32(q.x_coord); + int32 dy = int32(p.y_coord) - int32(q.y_coord); + + if (dx > -2 && dx < 2 && dy > -2 && dy < 2) + return obj; + else + return NULL; +} + Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/) { Player* player = HashMapHolder::Find(guid); diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 6a53d58c57f..1abe3550729 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -138,34 +138,7 @@ class ObjectAccessor return NULL; } - template static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) - { - T* obj = HashMapHolder::Find(guid); - if (!obj || obj->GetMapId() != mapid) - return NULL; - - CellCoord p = Trinity::ComputeCellCoord(x, y); - if (!p.IsCoordValid()) - { - sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); - return NULL; - } - - CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); - if (!q.IsCoordValid()) - { - sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); - return NULL; - } - - int32 dx = int32(p.x_coord) - int32(q.x_coord); - int32 dy = int32(p.y_coord) - int32(q.y_coord); - - if (dx > -2 && dx < 2 && dy > -2 && dy < 2) - return obj; - else - return NULL; - } + template static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/); // these functions return objects only if in map of specified object static WorldObject* GetWorldObject(WorldObject const&, uint64); diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index 14c0588c3b4..ad48e4fd128 100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.h @@ -85,13 +85,11 @@ template struct CoordPair { CoordPair(uint32 x=0, uint32 y=0) - : x_coord(x) - , y_coord(y) + : x_coord(x), y_coord(y) {} CoordPair(const CoordPair &obj) - : x_coord(obj.x_coord) - , y_coord(obj.y_coord) + : x_coord(obj.x_coord), y_coord(obj.y_coord) {} CoordPair & operator=(const CoordPair &obj) diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h index f64c54c8c43..65cdd3a6033 100644 --- a/src/server/game/Grids/NGrid.h +++ b/src/server/game/Grids/NGrid.h @@ -78,15 +78,10 @@ class NGrid { public: typedef Grid GridType; - NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true) - : i_gridId(id) - , i_GridInfo(GridInfo(expiry, unload)) - , i_x(x) - , i_y(y) - , i_cellstate(GRID_STATE_INVALID) - , i_GridObjectDataLoaded(false) - { - } + NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true) : + i_gridId(id), i_GridInfo(GridInfo(expiry, unload)), i_x(x), i_y(y), + i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false) + { } GridType& GetGridType(const uint32 x, const uint32 y) { diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index fe06c172e3f..8df65364b8a 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1336,8 +1336,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) item->is_looted = true; roll->getLoot()->NotifyItemRemoved(roll->itemSlot); roll->getLoot()->unlootedCount--; - AllowedLooterSet looters = item->GetAllowedLooters(); - player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters()); } else { @@ -1389,8 +1388,7 @@ void Group::CountTheRoll(Rolls::iterator rollI) item->is_looted = true; roll->getLoot()->NotifyItemRemoved(roll->itemSlot); roll->getLoot()->unlootedCount--; - AllowedLooterSet looters = item->GetAllowedLooters(); - player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, item->GetAllowedLooters()); } else { @@ -2126,7 +2124,7 @@ void Group::SetLfgRoles(uint64 guid, const uint8 roles) return; slot->roles = roles; - SendUpdate(); + SendUpdate(); } bool Group::IsFull() const @@ -2174,7 +2172,7 @@ uint32 Group::GetLowGUID() const return GUID_LOPART(m_guid); } -const char * Group::GetLeaderName() const +char const* Group::GetLeaderName() const { return m_leaderName.c_str(); } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index c4967e46623..498abbdc597 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -51,14 +51,13 @@ InstanceSaveManager::~InstanceSaveManager() ++next; (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); } - save->m_playerList.clear(); for (InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next) { ++next; (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true); } - save->m_groupList.clear(); + delete save; } } diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index bfd9bd62647..0b4c32500e0 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -403,6 +403,8 @@ void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8 case ENCOUNTER_FRAME_ENGAGE: case ENCOUNTER_FRAME_DISENGAGE: case ENCOUNTER_FRAME_UPDATE_PRIORITY: + if (!unit) + return; data.append(unit->GetPackGUID()); data << uint8(param1); break; diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index da219c66b9b..fcef203738a 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -861,17 +861,16 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { if (lv.permission == NONE_PERMISSION) { - b << uint32(0); //gold + b << uint32(0); // gold b << uint8(0); // item count - return b; // nothing output more + return b; } Loot &l = lv.loot; uint8 itemsShown = 0; - //gold - b << uint32(l.gold); + b << uint32(l.gold); //gold size_t count_pos = b.wpos(); // pos of item count byte b << uint8(0); // item count placeholder @@ -954,7 +953,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) break; } default: - return b; // nothing output more + return b; } LootSlotType slotType = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT; @@ -1226,15 +1225,11 @@ void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, Lo LootTemplate::~LootTemplate() { - while (!Entries.empty()) - { - delete Entries.back(); - Entries.pop_back(); - } + for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i) + delete *i; for (size_t i = 0; i < Groups.size(); ++i) delete Groups[i]; - Groups.clear(); } // Adds an entry to the group (at loading stage) diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 5c858a35242..d338f6f503b 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -100,7 +100,6 @@ enum LootSlotType class Player; class LootStore; -class ConditionMgr; struct LootStoreItem { diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index c2079c22e76..62fec9e4b20 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -29,8 +29,6 @@ MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL) { - // initialize instanced maps list - m_InstancedMaps.clear(); // fill with zero memset(&GridMapReference, 0, MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_GRIDS*sizeof(uint16)); } diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 76876044bb7..09e09a80148 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -104,21 +104,6 @@ class MapManager return IsValidMapCoord(loc.GetMapId(), loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation()); } - // modulos a radian orientation to the range of 0..2PI - static float NormalizeOrientation(float o) - { - // fmod only supports positive numbers. Thus we have - // to emulate negative numbers - if (o < 0) - { - float mod = o *-1; - mod = fmod(mod, 2.0f * static_cast(M_PI)); - mod = -mod + 2.0f * static_cast(M_PI); - return mod; - } - return fmod(o, 2.0f * static_cast(M_PI)); - } - void DoDelayedMovesAndRemoves(); void LoadTransports(); diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index bd351548255..73832a632c3 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -23,7 +23,6 @@ #include "SpellInfo.h" #include "Unit.h" -class Unit; class SpellInfo; struct SpellModifier; struct ProcTriggerSpell; @@ -153,7 +152,15 @@ class Aura bool IsArea() const; bool IsPassive() const; bool IsDeathPersistent() const; - bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); } + + bool IsRemovedOnShapeLost(Unit* target) const + { + return GetCasterGUID() == target->GetGUID() + && m_spellInfo->Stances + && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) + && !(m_spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT); + } + bool CanBeSaved() const; bool IsRemoved() const { return m_isRemoved; } bool CanBeSentToClient() const; @@ -166,7 +173,7 @@ class Aura void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount); // helpers for aura effects - bool HasEffect(uint8 effIndex) const { return bool(GetEffect(effIndex)); } + bool HasEffect(uint8 effIndex) const { return GetEffect(effIndex) != NULL; } bool HasEffectType(AuraType type) const; AuraEffect* GetEffect(uint8 effIndex) const { ASSERT (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; } uint8 GetEffectMask() const { uint8 effMask = 0; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_effects[i]) effMask |= 1< & applicationList) const; + void GetApplicationList(Unit::AuraApplicationList& applicationList) const; const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 47ce299c05d..191a7461fe9 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -456,7 +456,7 @@ class Spell void SetAutoRepeat(bool rep) { m_autoRepeat = rep; } void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; } bool IsNextMeleeSwingSpell() const; - bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; }; + bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; } bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; } bool IsAutoActionResetSpell() const; @@ -491,7 +491,7 @@ class Spell Unit* const m_caster; - SpellValue * const m_spellValue; + SpellValue* const m_spellValue; uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection // e.g. damage around area spell trigered by victim aura and damage enemies of aura caster diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 48bc162c82c..c36815b49f3 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1020,7 +1020,7 @@ class npc_meteor_strike_initial : public CreatureScript _meteorList.clear(); for (uint8 i = 0; i < 4; i++) { - angle[i] = MapManager::NormalizeOrientation(angle[i]); + angle[i] = Position::NormalizeOrientation(angle[i]); me->SetOrientation(angle[i]); me->GetNearPosition(newPos, 10.0f, 0.0f); // Exact distance if (Creature* meteor = me->SummonCreature(NPC_METEOR_STRIKE_NORTH + i, newPos, TEMPSUMMON_TIMED_DESPAWN, 30000)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 7e72ad00a3c..7d508b154eb 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -19,7 +19,6 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellAuras.h" -#include "MapManager.h" #include "MoveSplineInit.h" #include "Player.h" #include "icecrown_citadel.h" @@ -372,7 +371,7 @@ class npc_coldflame : public CreatureScript if (owner->HasAura(SPELL_BONE_STORM)) { - float ang = MapManager::NormalizeOrientation(pos.GetAngle(me)); + float ang = Position::NormalizeOrientation(pos.GetAngle(me)); me->SetOrientation(ang); owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetObjectSize(), ang); } @@ -385,7 +384,7 @@ class npc_coldflame : public CreatureScript return; } - float ang = MapManager::NormalizeOrientation(pos.GetAngle(target)); + float ang = Position::NormalizeOrientation(pos.GetAngle(target)); me->SetOrientation(ang); owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetObjectSize(), ang); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index a2b5d340410..111e6b2c7aa 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -20,7 +20,6 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" #include "oculus.h" -#include "MapManager.h" enum Says { @@ -121,7 +120,7 @@ public: coreEnergizeOrientation = me->GetOrientation(); firstCoreEnergize = true; } else - coreEnergizeOrientation = MapManager::NormalizeOrientation(coreEnergizeOrientation - 2.0f); + coreEnergizeOrientation = Position::NormalizeOrientation(coreEnergizeOrientation - 2.0f); DoCast(me, SPELL_ENERGIZE_CORES_VISUAL); events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index 01ccf648b31..447819b0431 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -16,6 +16,7 @@ file(GLOB_RECURSE sources_Configuration Configuration/*.cpp Configuration/*.h) file(GLOB_RECURSE sources_Cryptography Cryptography/*.cpp Cryptography/*.h) file(GLOB_RECURSE sources_Database Database/*.cpp Database/*.h) file(GLOB_RECURSE sources_DataStores DataStores/*.cpp DataStores/*.h) +file(GLOB_RECURSE sources_Debugging Debugging/*.cpp Debugging/*.h) file(GLOB_RECURSE sources_Dynamic Dynamic/*.cpp Dynamic/*.h) file(GLOB_RECURSE sources_Logging Logging/*.cpp Logging/*.h) file(GLOB_RECURSE sources_Packets Packets/*.cpp Packets/*.h) @@ -39,13 +40,13 @@ set(shared_STAT_SRCS ${sources_Cryptography} ${sources_Database} ${sources_DataStores} + ${sources_Debugging} ${sources_Dynamic} ${sources_Logging} ${sources_Packets} ${sources_Threading} ${sources_Utilities} ${sources_localdir} - Debugging/Errors.h ) include_directories( diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h index 83c691a99e2..b33954d7ea4 100644 --- a/src/server/shared/Containers.h +++ b/src/server/shared/Containers.h @@ -18,6 +18,7 @@ #ifndef TRINITY_CONTAINERS_H #define TRINITY_CONTAINERS_H +#include "Define.h" #include //! Because circular includes are bad diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp index 0f68fcb6c37..003c09e4589 100644 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp @@ -20,15 +20,10 @@ #include "Cryptography/HMACSHA1.h" #include "Cryptography/BigNumber.h" -AuthCrypt::AuthCrypt() : _clientDecrypt(SHA_DIGEST_LENGTH), _serverEncrypt(SHA_DIGEST_LENGTH) - , _initialized(false) -{ -} - -AuthCrypt::~AuthCrypt() -{ - -} +AuthCrypt::AuthCrypt() : + _clientDecrypt(SHA_DIGEST_LENGTH), _serverEncrypt(SHA_DIGEST_LENGTH), + _initialized(false) +{ } void AuthCrypt::Init(BigNumber* K) { diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.h b/src/server/shared/Cryptography/Authentication/AuthCrypt.h index 200681afd08..95e773b586e 100644 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.h +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.h @@ -27,7 +27,6 @@ class AuthCrypt { public: AuthCrypt(); - ~AuthCrypt(); void Init(BigNumber* K); void DecryptRecv(uint8 *, size_t); diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp index 37778cceab8..06ea57b662e 100644 --- a/src/server/shared/Cryptography/BigNumber.cpp +++ b/src/server/shared/Cryptography/BigNumber.cpp @@ -24,18 +24,15 @@ #include BigNumber::BigNumber() - : _bn(BN_new()) - , _array(NULL) + : _bn(BN_new()), _array(NULL) { } BigNumber::BigNumber(BigNumber const& bn) - : _bn(BN_dup(bn._bn)) - , _array(NULL) + : _bn(BN_dup(bn._bn)), _array(NULL) { } BigNumber::BigNumber(uint32 val) - : _bn(BN_new()) - , _array(NULL) + : _bn(BN_new()), _array(NULL) { BN_set_word(_bn, val); } diff --git a/src/server/shared/Cryptography/HMACSHA1.cpp b/src/server/shared/Cryptography/HMACSHA1.cpp index ab50eb9981a..297b4e90316 100644 --- a/src/server/shared/Cryptography/HMACSHA1.cpp +++ b/src/server/shared/Cryptography/HMACSHA1.cpp @@ -40,7 +40,7 @@ void HmacHash::Finalize() { uint32 length = 0; HMAC_Final(&m_ctx, (uint8*)m_digest, &length); - ASSERT(length == SHA_DIGEST_LENGTH) + ASSERT(length == SHA_DIGEST_LENGTH); } uint8 *HmacHash::ComputeHash(BigNumber* bn) diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 524a3de2628..a197610c6b5 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -55,8 +55,8 @@ class DatabaseWorkerPool memset(_connectionCount, 0, sizeof(_connectionCount)); _connections.resize(IDX_SIZE); - WPFatal (mysql_thread_safe(), "Used MySQL library isn't thread-safe."); - WPFatal (mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION, "TrinityCore does not support MySQL versions below 5.1"); + WPFatal(mysql_thread_safe(), "Used MySQL library isn't thread-safe."); + WPFatal(mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION, "TrinityCore does not support MySQL versions below 5.1"); } ~DatabaseWorkerPool() diff --git a/src/server/shared/Debugging/Errors.cpp b/src/server/shared/Debugging/Errors.cpp new file mode 100644 index 00000000000..bd299906de0 --- /dev/null +++ b/src/server/shared/Debugging/Errors.cpp @@ -0,0 +1,38 @@ +#include "Errors.h" +#include "Log.h" + +#include +#include + +namespace Trinity { + +void Assert(char const *file, int line, char const *function, char const *message) +{ + ACE_Stack_Trace st; + fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", + file, line, function, message, st.c_str()); + *((volatile int*)NULL) = 0; +} + +void Fatal(char const *file, int line, char const *function, char const *message) +{ + sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", + file, line, function, message); + ACE_OS::sleep(10); + *((volatile int*)NULL) = 0; +} + +void Error(char const *file, int line, char const *function, char const *message) +{ + sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ERROR:\n %s\n", + file, line, function, message); + *((volatile int*)NULL) = 0; +} + +void Warning(char const *file, int line, char const *function, char const *message) +{ + sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", + file, line, function, message); +} + +} // namespace Trinity diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index 10e94634e9a..554b20c3648 100644 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -19,15 +19,23 @@ #ifndef TRINITYCORE_ERRORS_H #define TRINITYCORE_ERRORS_H -#include "Common.h" -#include "Log.h" -#include -#include +namespace Trinity { -#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } } -#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } } -#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } } -#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } } +void Assert(char const *file, int line, char const *function, char const *message); + +void Fatal(char const *file, int line, char const *function, char const *message); + +void Error(char const *file, int line, char const *function, char const *message); + +void Warning(char const *file, int line, char const *function, char const *message); + +} // namespace Trinity + +#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while(0) +#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) +#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) +#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) #define ASSERT WPAssert + #endif diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index d07e579ab5d..d4bd630ca25 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -3,6 +3,8 @@ // MSDN Magazine, 2002 // FILE: WheatyExceptionReport.CPP //========================================== +#include "CompilerDefs.h" + #if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__) #define WIN32_LEAN_AND_MEAN #pragma warning(disable:4996) diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index efb141d1060..cde94fe3a7c 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -218,6 +218,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "SOAP"; case LOG_FILTER_RBAC: return "RBAC"; + case LOG_FILTER_CHEAT: + return "CHEAT"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index e11bc40c42f..983f6a5ddbe 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -68,10 +68,11 @@ enum LogFilterType LOG_FILTER_SERVER_LOADING = 40, LOG_FILTER_OPCODES = 41, LOG_FILTER_SOAP = 42, - LOG_FILTER_RBAC = 43 + LOG_FILTER_RBAC = 43, + LOG_FILTER_CHEAT = 44 }; -const uint8 MaxLogFilter = 43; +const uint8 MaxLogFilter = 45; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel @@ -108,12 +109,8 @@ enum AppenderFlags struct LogMessage { LogMessage(LogLevel _level, LogFilterType _type, std::string _text) - : level(_level) - , type(_type) - , text(_text) - { - mtime = time(NULL); - } + : level(_level), type(_type), text(_text), mtime(time(NULL)) + { } static std::string getTimeStr(time_t time); std::string getTimeStr(); diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h index 0a0dde3bb61..40017cb87f4 100644 --- a/src/server/shared/Logging/LogOperation.h +++ b/src/server/shared/Logging/LogOperation.h @@ -25,8 +25,7 @@ class LogOperation { public: LogOperation(Logger* _logger, LogMessage* _msg) - : logger(_logger) - , msg(_msg) + : logger(_logger), msg(_msg) { } ~LogOperation(); diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp new file mode 100644 index 00000000000..a14cf3477af --- /dev/null +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -0,0 +1,95 @@ +#include "ByteBuffer.h" +#include "Log.h" + +#include +#include + +ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, + size_t size, size_t valueSize) +{ + std::ostringstream ss; + ACE_Stack_Trace trace; + + ss << "Attempted to " << (add ? "put" : "get") << " value with size: " + << valueSize << " in ByteBuffer (pos: " << pos << " size: " << size + << ")\n\n" << trace.c_str(); + + message().assign(ss.str()); +} + +ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, + size_t valueSize) +{ + std::ostringstream ss; + ACE_Stack_Trace trace; + + ss << "Attempted to put a " + << (valueSize > 0 ? "NULL-pointer" : "zero-sized value") + << " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n" + << trace.c_str(); + + message().assign(ss.str()); +} + +void ByteBuffer::print_storage() const +{ + if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output + return; + + std::ostringstream o; + o << "STORAGE_SIZE: " << size(); + for (uint32 i = 0; i < size(); ++i) + o << read(i) << " - "; + o << " "; + + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); +} + +void ByteBuffer::textlike() const +{ + if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output + return; + + std::ostringstream o; + o << "STORAGE_SIZE: " << size(); + for (uint32 i = 0; i < size(); ++i) + { + char buf[1]; + snprintf(buf, 1, "%c", read(i)); + o << buf; + } + o << " "; + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); +} + +void ByteBuffer::hexlike() const +{ + if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output + return; + + uint32 j = 1, k = 1; + + std::ostringstream o; + o << "STORAGE_SIZE: " << size(); + + for (uint32 i = 0; i < size(); ++i) + { + char buf[3]; + snprintf(buf, 1, "%2X ", read(i)); + if ((i == (j * 8)) && ((i != (k * 16)))) + { + o << "| "; + ++j; + } + else if (i == (k * 16)) + { + o << "\n"; + ++k; + ++j; + } + + o << buf; + } + o << " "; + sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); +} diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index ceab4ca442e..9b16c2e9c0b 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -19,64 +19,47 @@ #ifndef _BYTEBUFFER_H #define _BYTEBUFFER_H -#include "Common.h" +#include "Define.h" #include "Debugging/Errors.h" -#include "Logging/Log.h" #include "Utilities/ByteConverter.h" -class ByteBufferException +#include +#include +#include +#include +#include + +#include + +// Root of ByteBuffer exception hierarchy +class ByteBufferException : public std::exception { - public: - ByteBufferException(size_t pos, size_t size, size_t valueSize) - : Pos(pos), Size(size), ValueSize(valueSize) - { - } +public: + ~ByteBufferException() throw() { } - protected: - size_t Pos; - size_t Size; - size_t ValueSize; + char const * what() const throw() { return msg_.c_str(); } + +protected: + std::string & message() throw() { return msg_; } + +private: + std::string msg_; }; class ByteBufferPositionException : public ByteBufferException { - public: - ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize) - : ByteBufferException(pos, size, valueSize), _add(add) - { - PrintError(); - } - - protected: - void PrintError() const - { - ACE_Stack_Trace trace; - - sLog->outError(LOG_FILTER_NETWORKIO, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stacktrace: %s]", - (_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str()); - } +public: + ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize); - private: - bool _add; + ~ByteBufferPositionException() throw() { } }; class ByteBufferSourceException : public ByteBufferException { - public: - ByteBufferSourceException(size_t pos, size_t size, size_t valueSize) - : ByteBufferException(pos, size, valueSize) - { - PrintError(); - } +public: + ByteBufferSourceException(size_t pos, size_t size, size_t valueSize); - protected: - void PrintError() const - { - ACE_Stack_Trace trace; - - sLog->outError(LOG_FILTER_NETWORKIO, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")\n[Stacktrace: %s]", - (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str()); - } + ~ByteBufferSourceException() throw() { } }; class ByteBuffer @@ -85,19 +68,21 @@ class ByteBuffer const static size_t DEFAULT_SIZE = 0x1000; // constructor - ByteBuffer(): _rpos(0), _wpos(0) + ByteBuffer() : _rpos(0), _wpos(0) { _storage.reserve(DEFAULT_SIZE); } - // constructor - ByteBuffer(size_t res): _rpos(0), _wpos(0) + ByteBuffer(size_t reserve) : _rpos(0), _wpos(0) { - _storage.reserve(res); + _storage.reserve(reserve); } // copy constructor - ByteBuffer(const ByteBuffer &buf): _rpos(buf._rpos), _wpos(buf._wpos), _storage(buf._storage) { } + ByteBuffer(const ByteBuffer &buf) : _rpos(buf._rpos), _wpos(buf._wpos), + _storage(buf._storage) + { + } void clear() { @@ -275,9 +260,18 @@ class ByteBuffer return *this; } - uint8 operator[](size_t pos) const + uint8& operator[](size_t const pos) { - return read(pos); + if (pos >= size()) + throw ByteBufferPositionException(false, pos, 1, size()); + return _storage[pos]; + } + + uint8 const& operator[](size_t const pos) const + { + if (pos >= size()) + throw ByteBufferPositionException(false, pos, 1, size()); + return _storage[pos]; } size_t rpos() const { return _rpos; } @@ -331,7 +325,7 @@ class ByteBuffer { if (_rpos + len > size()) throw ByteBufferPositionException(false, _rpos, len, size()); - memcpy(dest, &_storage[_rpos], len); + std::memcpy(dest, &_storage[_rpos], len); _rpos += len; } @@ -362,8 +356,7 @@ class ByteBuffer uint32 ReadPackedTime() { uint32 packedDate = read(); - tm lt; - memset(<, 0, sizeof(lt)); + tm lt = tm(); lt.tm_min = packedDate & 0x3F; lt.tm_hour = (packedDate >> 6) & 0x1F; @@ -423,7 +416,7 @@ class ByteBuffer if (_storage.size() < _wpos + cnt) _storage.resize(_wpos + cnt); - memcpy(&_storage[_wpos], src, cnt); + std::memcpy(&_storage[_wpos], src, cnt); _wpos += cnt; } @@ -476,71 +469,14 @@ class ByteBuffer if (!src) throw ByteBufferSourceException(_wpos, size(), cnt); - memcpy(&_storage[pos], src, cnt); + std::memcpy(&_storage[pos], src, cnt); } - void print_storage() const - { - if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output - return; + void print_storage() const; - std::ostringstream o; - o << "STORAGE_SIZE: " << size(); - for (uint32 i = 0; i < size(); ++i) - o << read(i) << " - "; - o << " "; + void textlike() const; - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); - } - - void textlike() const - { - if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output - return; - - std::ostringstream o; - o << "STORAGE_SIZE: " << size(); - for (uint32 i = 0; i < size(); ++i) - { - char buf[1]; - snprintf(buf, 1, "%c", read(i)); - o << buf; - } - o << " "; - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); - } - - void hexlike() const - { - if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output - return; - - uint32 j = 1, k = 1; - - std::ostringstream o; - o << "STORAGE_SIZE: " << size(); - - for (uint32 i = 0; i < size(); ++i) - { - char buf[3]; - snprintf(buf, 1, "%2X ", read(i)); - if ((i == (j * 8)) && ((i != (k * 16)))) - { - o << "| "; - ++j; - } - else if (i == (k * 16)) - { - o << "\n"; - ++k; - ++j; - } - - o << buf; - } - o << " "; - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); - } + void hexlike() const; protected: size_t _rpos, _wpos; @@ -652,5 +588,6 @@ inline void ByteBuffer::read_skip() { read_skip(); } + #endif diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 0802aca43ce..bf19240407f 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1123,7 +1123,7 @@ AccountInstancesPerHour = 5 # RBAC.DefaultGroups # Description: Comma separated list of groups to be added to any account # Check auth.rbac_groups for correct ids -# Default: "" (No group) +# Default: "" (No group) RBAC.DefaultGroups = "" @@ -2712,6 +2712,7 @@ Appenders=Console Server GM DBErrors Char RA Warden Chat # 41 - Opcodes (just id and name sent / received) # 42 - SOAP # 43 - RBAC (Role Based Access Control) +# 44 - Cheat (used to log cheat attempts) # # LogLevel # 0 - (Disabled) -- cgit v1.2.3