diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/framework/GameSystem/Grid.h | 24 | ||||
-rw-r--r-- | src/game/BattleGroundWS.h | 22 | ||||
-rw-r--r-- | src/game/Level2.cpp | 2 | ||||
-rw-r--r-- | src/game/Map.cpp | 25 | ||||
-rw-r--r-- | src/game/Map.h | 2 | ||||
-rw-r--r-- | src/game/MiscHandler.cpp | 104 | ||||
-rw-r--r-- | src/game/MotionMaster.cpp | 68 | ||||
-rw-r--r-- | src/game/MotionMaster.h | 7 | ||||
-rw-r--r-- | src/game/Object.cpp | 1 | ||||
-rw-r--r-- | src/game/Object.h | 2 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 1 | ||||
-rw-r--r-- | src/game/Unit.cpp | 13 |
12 files changed, 169 insertions, 102 deletions
diff --git a/src/framework/GameSystem/Grid.h b/src/framework/GameSystem/Grid.h index fad792ba5ec..cebaebc68c6 100644 --- a/src/framework/GameSystem/Grid.h +++ b/src/framework/GameSystem/Grid.h @@ -60,16 +60,18 @@ class TRINITY_DLL_DECL Grid /** an object of interested enters the grid */ - template<class SPECIFIC_OBJECT> bool AddWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) + template<class SPECIFIC_OBJECT> void AddWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { - return i_objects.template insert<SPECIFIC_OBJECT>(hdl, obj); + if(!i_objects.template insert<SPECIFIC_OBJECT>(hdl, obj)) + assert(false); } /** an object of interested exits the grid */ - template<class SPECIFIC_OBJECT> bool RemoveWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) + template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { - return i_objects.template remove<SPECIFIC_OBJECT>(obj, hdl); + if(!i_objects.template remove<SPECIFIC_OBJECT>(obj, hdl)) + assert(false); } /** Accessors: Returns a specific type of object in the WORDL_OBJECT_TYPES @@ -114,20 +116,18 @@ class TRINITY_DLL_DECL Grid /** Inserts a container type object into the grid. */ - template<class SPECIFIC_OBJECT> bool AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) + template<class SPECIFIC_OBJECT> void AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { - //if(obj->isActiveObject()) - // m_activeGridObjects.insert(obj); - return i_container.template insert<SPECIFIC_OBJECT>(hdl, obj); + if(!i_container.template insert<SPECIFIC_OBJECT>(hdl, obj)) + assert(false); } /** Removes a containter type object from the grid */ - template<class SPECIFIC_OBJECT> bool RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) + template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl) { - //if(obj->isActiveObject()) - // m_activeGridObjects.erase(obj); - return i_container.template remove<SPECIFIC_OBJECT>(obj, hdl); + if(!i_container.template remove<SPECIFIC_OBJECT>(obj, hdl)) + assert(false); } /*bool NoWorldObjectInGrid() const diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index d52a0117fb5..9a54479abb4 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -23,9 +23,14 @@ #include "BattleGround.h" -#define BG_WS_MAX_TEAM_SCORE 3 -#define BG_WS_FLAG_RESPAWN_TIME (23*IN_MILISECONDS) -#define BG_WS_FLAG_DROP_TIME (10*IN_MILISECONDS) +enum BG_WS_TimerOrScore +{ + BG_WS_MAX_TEAM_SCORE = 3, + BG_WS_FLAG_RESPAWN_TIME = 23000, + BG_WS_FLAG_DROP_TIME = 10000, + BG_WS_SPELL_FORCE_TIME = 600000, + BG_WS_SPELL_BRUTAL_TIME = 900000 +}; enum BG_WS_Sound { @@ -43,7 +48,9 @@ enum BG_WS_SpellId BG_WS_SPELL_WARSONG_FLAG = 23333, BG_WS_SPELL_WARSONG_FLAG_DROPPED = 23334, BG_WS_SPELL_SILVERWING_FLAG = 23335, - BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336 + BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336, + BG_WS_SPELL_FOCUSED_ASSAULT = 46392, + BG_WS_SPELL_BRUTAL_ASSAULT = 46393 }; enum BG_WS_WorldStates @@ -151,6 +158,10 @@ class BattleGroundWS : public BattleGround void RespawnFlag(uint32 Team, bool captured); void RespawnFlagAfterDrop(uint32 Team); uint8 GetFlagState(uint32 team) { return m_FlagState[GetTeamIndexByTeamId(team)]; } + void AddTimedAura(uint32 aura); + void RemoveTimedAura(uint32 aura); + bool IsBrutalTimerDone; + bool IsForceTimerDone; /* Battleground Events */ virtual void EventPlayerDroppedFlag(Player *Source); @@ -183,6 +194,9 @@ class BattleGroundWS : public BattleGround uint32 m_TeamScores[2]; int32 m_FlagsTimer[2]; int32 m_FlagsDropTimer[2]; + + int32 m_FlagSpellForceTimer; + int32 m_FlagSpellBrutalTimer; }; #endif diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 7d8a5fecf1a..40b9cec6a2a 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -2325,7 +2325,7 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args) return true; } - guidlow = target->GetGUIDLow(); + guidlow = target->GetDBTableGUIDLow(); QueryResult *result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow); if( result ) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 493e5b4b112..43676bd1dc6 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -257,7 +257,7 @@ template<> void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell) { // add to world object registry in grid - if(obj->isPet() || obj->HasSharedVision() || obj->isVehicle()) + if(obj->isPet() || obj->isVehicle() || obj->IsTempWorldObject) { (*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj, obj->GetGUID()); } @@ -309,7 +309,7 @@ template<> void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell) { // remove from world object registry in grid - if(obj->isPet() || obj->HasSharedVision() || obj->isVehicle()) + if(obj->isPet() || obj->isVehicle() || obj->IsTempWorldObject) { (*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj, obj->GetGUID()); } @@ -339,20 +339,25 @@ void Map::SwitchGridContainers(T* obj, bool on) if(on) { - if(!grid.RemoveGridObject<T>(obj, obj->GetGUID()) + grid.RemoveGridObject<T>(obj, obj->GetGUID()); + grid.AddWorldObject<T>(obj, obj->GetGUID()); + /*if(!grid.RemoveGridObject<T>(obj, obj->GetGUID()) || !grid.AddWorldObject<T>(obj, obj->GetGUID())) { assert(false); - } + }*/ } else { - if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID()) + grid.RemoveWorldObject<T>(obj, obj->GetGUID()); + grid.AddGridObject<T>(obj, obj->GetGUID()); + /*if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID()) || !grid.AddGridObject<T>(obj, obj->GetGUID())) { assert(false); - } + }*/ } + obj->IsTempWorldObject = on; } template void Map::SwitchGridContainers(Creature *, bool); @@ -1035,6 +1040,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); + c->SetCurrentCell(new_cell); return true; } @@ -1048,10 +1054,9 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) #endif RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); - { - EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); - AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); - } + EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); + AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); + c->SetCurrentCell(new_cell); return true; } diff --git a/src/game/Map.h b/src/game/Map.h index 527bd50ed70..17d9953aa19 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -381,6 +381,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O if(m_activeNonPlayersIter != m_activeNonPlayers.end()) { ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj); + if(itr == m_activeNonPlayers.end()) + return; if(itr==m_activeNonPlayersIter) ++m_activeNonPlayersIter; m_activeNonPlayers.erase(itr); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index c55590d6b67..3a582f96f27 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -487,42 +487,48 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data ) void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote) { - if(!result) - return; - - uint64 friendGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); - uint32 team = Player::TeamForRace((*result)[1].GetUInt8()); - - delete result; - + uint64 friendGuid; + uint32 team; + FriendsResult friendResult; + WorldSession * session = sWorld.FindSession(accountId); + if(!session || !session->GetPlayer()) return; + + friendResult = FRIEND_NOT_FOUND; + friendGuid = 0; - FriendsResult friendResult = FRIEND_NOT_FOUND; - if(friendGuid) + if(result) { - if(friendGuid==session->GetPlayer()->GetGUID()) - friendResult = FRIEND_SELF; - else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR) - friendResult = FRIEND_ENEMY; - else if(session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid))) - friendResult = FRIEND_ALREADY; - else + friendGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); + team = Player::TeamForRace((*result)[1].GetUInt8()); + + delete result; + + if(friendGuid) { - Player* pFriend = ObjectAccessor::FindPlayer(friendGuid); - if( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer())) - friendResult = FRIEND_ADDED_ONLINE; + if(friendGuid==session->GetPlayer()->GetGUID()) + friendResult = FRIEND_SELF; + else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR) + friendResult = FRIEND_ENEMY; + else if(session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid))) + friendResult = FRIEND_ALREADY; else - friendResult = FRIEND_ADDED_OFFLINE; - - if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false)) { - friendResult = FRIEND_LIST_FULL; - sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName()); - } + Player* pFriend = ObjectAccessor::FindPlayer(friendGuid); + if( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer())) + friendResult = FRIEND_ADDED_ONLINE; + else + friendResult = FRIEND_ADDED_OFFLINE; + if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false)) + { + friendResult = FRIEND_LIST_FULL; + sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName()); + } - session->GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote); + session->GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote); + } } } @@ -571,31 +577,37 @@ void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data ) void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 accountId) { - if(!result) - return; - - uint64 IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); - - delete result; - + uint64 IgnoreGuid; + FriendsResult ignoreResult; + WorldSession * session = sWorld.FindSession(accountId); + if(!session || !session->GetPlayer()) return; + + ignoreResult = FRIEND_IGNORE_NOT_FOUND; + IgnoreGuid = 0; - FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND; - if(IgnoreGuid) + if(result) { - if(IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself - ignoreResult = FRIEND_IGNORE_SELF; - else if( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) ) - ignoreResult = FRIEND_IGNORE_ALREADY; - else - { - ignoreResult = FRIEND_IGNORE_ADDED; + IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER); - // ignore list full - if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true)) - ignoreResult = FRIEND_IGNORE_FULL; + delete result; + + if(IgnoreGuid) + { + if(IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself + ignoreResult = FRIEND_IGNORE_SELF; + else if( session->GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)) ) + ignoreResult = FRIEND_IGNORE_ALREADY; + else + { + ignoreResult = FRIEND_IGNORE_ADDED; + + // ignore list full + if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true)) + ignoreResult = FRIEND_IGNORE_FULL; + } } } diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 7bfae33c079..b64c17b6342 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -55,10 +55,13 @@ MotionMaster::Initialize() { MovementGenerator* movement = FactorySelector::selectMovementGenerator((Creature*)i_owner); push( movement == NULL ? &si_idleMovement : movement ); - top()->Initialize(*i_owner); + InitTop(); } else + { push(&si_idleMovement); + needInit[MOTION_SLOT_IDLE] = false; + } } MotionMaster::~MotionMaster() @@ -98,35 +101,37 @@ MotionMaster::UpdateMotion(uint32 diff) delete m_expList; m_expList = NULL; - if (empty()) + if(empty()) Initialize(); - - if (m_cleanFlag & MMCF_RESET) - { + else if(needInitTop()) + InitTop(); + else if (m_cleanFlag & MMCF_RESET) top()->Reset(*i_owner); - m_cleanFlag &= ~MMCF_RESET; - } + + m_cleanFlag &= ~MMCF_RESET; } } void MotionMaster::DirectClean(bool reset) { - while( !empty() && size() > 1 ) + while(size() > 1) { MovementGenerator *curr = top(); pop(); if(curr) DirectDelete(curr); } - if(reset) + if(needInitTop()) + InitTop(); + else if(reset) top()->Reset(*i_owner); } void MotionMaster::DelayedClean() { - while( !empty() && size() > 1 ) + while(size() > 1) { MovementGenerator *curr = top(); pop(); @@ -137,31 +142,33 @@ MotionMaster::DelayedClean() void MotionMaster::DirectExpire(bool reset) { - if( empty() || size() == 1 ) - return; - - MovementGenerator *curr = top(); - pop(); - DirectDelete(curr); + if(size() > 1 ) + { + MovementGenerator *curr = top(); + pop(); + DirectDelete(curr); + } while(!top()) --i_top; if(empty()) Initialize(); - if(reset) + else if(needInitTop()) + InitTop(); + else if(reset) top()->Reset(*i_owner); } void MotionMaster::DelayedExpire() { - if( empty() || size() == 1 ) - return; - - MovementGenerator *curr = top(); - pop(); - DelayedDelete(curr); + if(size() > 1 ) + { + MovementGenerator *curr = top(); + pop(); + DelayedDelete(curr); + } while(!top()) --i_top; @@ -396,7 +403,14 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot) { i_top = slot; } - m->Initialize(*i_owner); + + if(i_top > slot) + needInit[slot] = true; + else + { + m->Initialize(*i_owner); + needInit[slot] = false; + } Impl[slot] = m; } @@ -446,6 +460,12 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const return top()->GetMovementGeneratorType(); } +void MotionMaster::InitTop() +{ + top()->Initialize(*i_owner); + needInit[i_top] = false; +} + void MotionMaster::DirectDelete(_Ty curr) { if(isStatic(curr)) diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h index d362e6574f0..bf3560da321 100644 --- a/src/game/MotionMaster.h +++ b/src/game/MotionMaster.h @@ -68,18 +68,25 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *> //typedef std::stack<MovementGenerator *> Impl; typedef MovementGenerator* _Ty; _Ty Impl[MAX_MOTION_SLOT]; + bool needInit[MAX_MOTION_SLOT]; typedef std::vector<_Ty> ExpireList; int i_top; bool empty() const { return i_top < 0; } void pop() { Impl[i_top] = NULL; --i_top; } void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; } + + bool needInitTop() const { return needInit[i_top]; } + void InitTop(); public: explicit MotionMaster(Unit *unit) : i_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE), i_top(-1) { for(int i = 0; i < MAX_MOTION_SLOT; ++i) + { Impl[i] = NULL; + needInit[i] = true; + } } ~MotionMaster(); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 080a6af41de..ab79ca366e4 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1101,6 +1101,7 @@ WorldObject::WorldObject() mSemaphoreTeleport = false; m_isActive = false; + IsTempWorldObject = false; } void WorldObject::SetWorldObject(bool on) diff --git a/src/game/Object.h b/src/game/Object.h index bf88c4dd2dc..f98c32d46d3 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -506,6 +506,8 @@ class TRINITY_DLL_SPEC WorldObject : public Object template<class NOTIFIER> void VisitNearbyObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); } template<class NOTIFIER> void VisitNearbyGridObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); } template<class NOTIFIER> void VisitNearbyWorldObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); } + bool IsTempWorldObject; + protected: explicit WorldObject(); std::string m_name; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 80abcf0258d..fa0eecfa629 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2298,6 +2298,7 @@ void SpellMgr::LoadSpellCustomAttr() case 38296: //Spitfire Totem case 37676: //Insidious Whisper case 46009: //Negative Energy + case 45641: //Fire Bloom spellInfo->MaxAffectedTargets = 5; break; case 40827: //Sinful Beam diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6771dfdaa80..25c3aee65e4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7868,19 +7868,23 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) void Unit::AddPlayerToVision(Player* plr) { - setActive(true); if(m_sharedVision.empty()) + { + setActive(true); SetWorldObject(true); + } m_sharedVision.push_back(plr); plr->SetFarsightTarget(this); } void Unit::RemovePlayerFromVision(Player* plr) { - setActive(false); m_sharedVision.remove(plr); if(m_sharedVision.empty()) + { + setActive(false); SetWorldObject(false); + } plr->ClearFarsight(); } @@ -8695,7 +8699,8 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint spellProto->Id == 33778 || spellProto->Id == 379 || spellProto->Id == 38395 || spellProto->Id == 40972 || spellProto->Id == 22845 || spellProto->Id == 33504 || - spellProto->Id == 34299) + spellProto->Id == 34299 || spellProto->Id == 27813 || + spellProto->Id == 27817 || spellProto->Id == 27818) return healamount; // Healing Done @@ -12364,7 +12369,6 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) // FORM_SPIRITOFREDEMPTION and related auras pVictim->CastSpell(pVictim,27827,true,NULL,*itr); - pVictim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // should not be attackable SpiritOfRedemption = true; break; } @@ -12375,7 +12379,6 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) { DEBUG_LOG("SET JUST_DIED"); pVictim->setDeathState(JUST_DIED); - pVictim->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // reactive attackable flag } // 10% durability loss on death |