Merge. Revision history for source files should be all back now.
--HG-- branch : trunk rename : sql/CMakeLists.txt => sql/tools/CMakeLists.txt rename : src/server/game/Pools/PoolHandler.cpp => src/server/game/Pools/PoolMgr.cpp rename : src/server/game/Pools/PoolHandler.h => src/server/game/Pools/PoolMgr.h rename : src/server/game/PrecompiledHeaders/NixCorePCH.cpp => src/server/game/PrecompiledHeaders/gamePCH.cpp rename : src/server/game/PrecompiledHeaders/NixCorePCH.h => src/server/game/PrecompiledHeaders/gamePCH.h
This commit is contained in:
@@ -231,7 +231,7 @@ void PetAI::UpdateAllies()
|
||||
Unit* owner = me->GetCharmerOrOwner();
|
||||
Group *pGroup = NULL;
|
||||
|
||||
m_updateAlliesTimer = 10*IN_MILISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
|
||||
m_updateAlliesTimer = 10*IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
|
||||
|
||||
if (!owner)
|
||||
return;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef TRINITY_UNITAI_H
|
||||
#define TRINITY_UNITAI_H
|
||||
|
||||
#include "Platform/Define.h"
|
||||
#include "Define.h"
|
||||
#include <list>
|
||||
#include "Unit.h"
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#define TRINITY_CREATUREAIFACTORY_H
|
||||
|
||||
//#include "Policies/Singleton.h"
|
||||
#include "Dynamic/ObjectRegistry.h"
|
||||
#include "Dynamic/FactoryHolder.h"
|
||||
#include "ObjectRegistry.h"
|
||||
#include "FactoryHolder.h"
|
||||
|
||||
struct SelectableAI : public FactoryHolder<CreatureAI>, public Permissible<Creature>
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define CREATUREAIIMPL_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Platform/Define.h"
|
||||
#include "Define.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
@@ -21,22 +21,19 @@
|
||||
#include "Creature.h"
|
||||
#include "CreatureAISelector.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
#include "MovementGenerator.h"
|
||||
#include "Pet.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "CreatureAIFactory.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(CreatureAIRegistry);
|
||||
INSTANTIATE_SINGLETON_1(MovementGeneratorRegistry);
|
||||
|
||||
namespace FactorySelector
|
||||
{
|
||||
CreatureAI* selectAI(Creature *creature)
|
||||
{
|
||||
const CreatureAICreator *ai_factory = NULL;
|
||||
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
|
||||
CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance());
|
||||
|
||||
if (creature->isPet())
|
||||
ai_factory = ai_registry.GetRegistryItem("PetAI");
|
||||
@@ -106,7 +103,7 @@ namespace FactorySelector
|
||||
|
||||
MovementGenerator* selectMovementGenerator(Creature *creature)
|
||||
{
|
||||
MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance());
|
||||
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
|
||||
assert(creature->GetCreatureInfo() != NULL);
|
||||
const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
caster = target;
|
||||
|
||||
//Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
|
||||
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
|
||||
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS));
|
||||
|
||||
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
|
||||
if (action.cast.castFlags & CAST_AURA_NOT_PRESENT)
|
||||
@@ -492,7 +492,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
else
|
||||
{
|
||||
//Interrupt any previous spell
|
||||
if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTURRUPT_PREVIOUS)
|
||||
if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTERRUPT_PREVIOUS)
|
||||
caster->InterruptNonMeleeSpells(false);
|
||||
|
||||
caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED));
|
||||
@@ -1331,12 +1331,12 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
|
||||
if ((*itr).Event.receive_emote.emoteId != text_emote)
|
||||
return;
|
||||
|
||||
Condition* cond = new Condition();
|
||||
cond->mConditionType = ConditionType((*itr).Event.receive_emote.condition);
|
||||
cond->mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
|
||||
cond->mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
|
||||
Condition cond;
|
||||
cond.mConditionType = ConditionType((*itr).Event.receive_emote.condition);
|
||||
cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
|
||||
cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
|
||||
|
||||
if (cond->Meets(pPlayer))
|
||||
if (cond.Meets(pPlayer))
|
||||
{
|
||||
sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
|
||||
ProcessEvent(*itr, pPlayer);
|
||||
|
||||
@@ -150,7 +150,7 @@ enum Target
|
||||
|
||||
enum CastFlags
|
||||
{
|
||||
CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
|
||||
CAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
|
||||
CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
|
||||
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
|
||||
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
|
||||
|
||||
@@ -17,19 +17,16 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "SQLStorage.h"
|
||||
#include "CreatureEventAI.h"
|
||||
#include "CreatureEventAIMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "GridDefines.h"
|
||||
#include "ConditionMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(CreatureEventAIMgr);
|
||||
|
||||
// -------------------
|
||||
void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
|
||||
{
|
||||
@@ -362,11 +359,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
}
|
||||
if (temp.receive_emote.condition)
|
||||
{
|
||||
Condition* cond = new Condition();
|
||||
cond->mConditionType = ConditionType(temp.receive_emote.condition);
|
||||
cond->mConditionValue1 = temp.receive_emote.conditionValue1;
|
||||
cond->mConditionValue2 = temp.receive_emote.conditionValue2;
|
||||
if (!sConditionMgr.isConditionTypeValid(cond))
|
||||
Condition cond;
|
||||
cond.mConditionType = ConditionType(temp.receive_emote.condition);
|
||||
cond.mConditionValue1 = temp.receive_emote.conditionValue1;
|
||||
cond.mConditionValue2 = temp.receive_emote.conditionValue2;
|
||||
if (!sConditionMgr.isConditionTypeValid(&cond))
|
||||
{
|
||||
sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition);
|
||||
continue;
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
|
||||
class CreatureEventAIMgr
|
||||
{
|
||||
friend class ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>;
|
||||
CreatureEventAIMgr(){};
|
||||
public:
|
||||
CreatureEventAIMgr(){};
|
||||
~CreatureEventAIMgr(){};
|
||||
|
||||
void LoadCreatureEventAI_Texts();
|
||||
@@ -42,5 +43,5 @@ class CreatureEventAIMgr
|
||||
CreatureEventAI_TextMap m_CreatureEventAI_TextMap;
|
||||
};
|
||||
|
||||
#define CreatureEAI_Mgr Trinity::Singleton<CreatureEventAIMgr>::Instance()
|
||||
#define CreatureEAI_Mgr (*ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "ScriptPCH.h"
|
||||
#include "Item.h"
|
||||
#include "Spell.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -153,7 +153,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId)
|
||||
|
||||
if (!GetSoundEntriesStore()->LookupEntry(uiSoundId))
|
||||
{
|
||||
error_log("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow());
|
||||
sLog.outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ void ScriptedAI::DoResetThreat()
|
||||
{
|
||||
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
|
||||
{
|
||||
error_log("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
|
||||
sLog.outError("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, flo
|
||||
if (!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
if (pUnit)
|
||||
error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
|
||||
sLog.outError("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", me->GetEntry());
|
||||
sLog.outError("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", me->GetEntry());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ SDComment:
|
||||
SDCategory: Npc
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
|
||||
enum ePoints
|
||||
@@ -104,7 +104,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho)
|
||||
{
|
||||
if (!me->getVictim())
|
||||
{
|
||||
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
|
||||
pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
||||
AttackStart(pWho);
|
||||
}
|
||||
else if (me->GetMap()->IsDungeon())
|
||||
@@ -177,7 +177,7 @@ void npc_escortAI::EnterEvadeMode()
|
||||
{
|
||||
AddEscortState(STATE_ESCORT_RETURNING);
|
||||
ReturnToLastPoint();
|
||||
debug_log("TSCR: EscortAI has left combat and is now returning to last point");
|
||||
sLog.outDebug("TSCR: EscortAI has left combat and is now returning to last point");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -224,7 +224,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
if (DespawnAtEnd)
|
||||
{
|
||||
debug_log("TSCR: EscortAI reached end of waypoints");
|
||||
sLog.outDebug("TSCR: EscortAI reached end of waypoints");
|
||||
|
||||
if (m_bCanReturnToStart)
|
||||
{
|
||||
@@ -235,7 +235,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
|
||||
|
||||
m_uiWPWaitTimer = 0;
|
||||
|
||||
debug_log("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
|
||||
sLog.outDebug("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_log("TSCR: EscortAI reached end of waypoints with Despawn off");
|
||||
sLog.outDebug("TSCR: EscortAI reached end of waypoints with Despawn off");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
|
||||
if (!HasEscortState(STATE_ESCORT_PAUSED))
|
||||
{
|
||||
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
|
||||
debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
|
||||
sLog.outDebug("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
|
||||
|
||||
WaypointStart(CurrentWP->id);
|
||||
|
||||
@@ -278,7 +278,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
if (DespawnAtFar && !IsPlayerOrGroupInRange())
|
||||
{
|
||||
debug_log("TSCR: EscortAI failed because player/group was to far away or not found");
|
||||
sLog.outDebug("TSCR: EscortAI failed because player/group was to far away or not found");
|
||||
|
||||
if (m_bCanInstantRespawn)
|
||||
{
|
||||
@@ -316,7 +316,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
|
||||
//Combat start position reached, continue waypoint movement
|
||||
if (uiPointId == POINT_LAST_POINT)
|
||||
{
|
||||
debug_log("TSCR: EscortAI has returned to original position before combat");
|
||||
sLog.outDebug("TSCR: EscortAI has returned to original position before combat");
|
||||
|
||||
if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
|
||||
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||
@@ -330,7 +330,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
|
||||
}
|
||||
else if (uiPointId == POINT_HOME)
|
||||
{
|
||||
debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
|
||||
sLog.outDebug("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
|
||||
|
||||
CurrentWP = WaypointList.begin();
|
||||
m_uiWPWaitTimer = 1;
|
||||
@@ -340,11 +340,11 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
|
||||
//Make sure that we are still on the right waypoint
|
||||
if (CurrentWP->id != uiPointId)
|
||||
{
|
||||
error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, me->GetEntry());
|
||||
sLog.outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, me->GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
debug_log("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
|
||||
sLog.outDebug("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
|
||||
|
||||
//Call WP function
|
||||
WaypointReached(CurrentWP->id);
|
||||
@@ -415,14 +415,14 @@ void npc_escortAI::SetRun(bool bRun)
|
||||
if (!m_bIsRunning)
|
||||
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||
else
|
||||
debug_log("TSCR: EscortAI attempt to set run mode, but is already running.");
|
||||
sLog.outDebug("TSCR: EscortAI attempt to set run mode, but is already running.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bIsRunning)
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||
else
|
||||
debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking.");
|
||||
sLog.outDebug("TSCR: EscortAI attempt to set walk mode, but is already walking.");
|
||||
}
|
||||
m_bIsRunning = bRun;
|
||||
}
|
||||
@@ -432,13 +432,13 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
|
||||
{
|
||||
if (me->getVictim())
|
||||
{
|
||||
error_log("TSCR ERROR: EscortAI attempt to Start while in combat. Scriptname: %s, creature entry: %u", me->GetScriptName().c_str(), me->GetEntry());
|
||||
sLog.outError("TSCR ERROR: EscortAI attempt to Start while in combat. Scriptname: %s, creature entry: %u", me->GetScriptName().c_str(), me->GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
||||
{
|
||||
error_log("TSCR: EscortAI attempt to Start while already escorting.");
|
||||
sLog.outError("TSCR: EscortAI attempt to Start while already escorting.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
|
||||
|
||||
if (WaypointList.empty())
|
||||
{
|
||||
error_db_log("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", pQuest ? pQuest->GetQuestId() : 0);
|
||||
sLog.outErrorDb("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", pQuest ? pQuest->GetQuestId() : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -469,19 +469,19 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
|
||||
m_bCanReturnToStart = bCanLoopPath;
|
||||
|
||||
if (m_bCanReturnToStart && m_bCanInstantRespawn)
|
||||
debug_log("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
|
||||
sLog.outDebug("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
|
||||
|
||||
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
{
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
|
||||
sLog.outDebug("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
|
||||
}
|
||||
|
||||
//disable npcflags
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
debug_log("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
|
||||
sLog.outDebug("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
|
||||
|
||||
CurrentWP = WaypointList.begin();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ SDComment: This AI is under development
|
||||
SDCategory: Npc
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptedFollowerAI.h"
|
||||
|
||||
const float MAX_PLAYER_DISTANCE = 100.0f;
|
||||
@@ -102,7 +102,7 @@ void FollowerAI::MoveInLineOfSight(Unit* pWho)
|
||||
{
|
||||
if (!me->getVictim())
|
||||
{
|
||||
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
|
||||
pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
||||
AttackStart(pWho);
|
||||
}
|
||||
else if (me->GetMap()->IsDungeon())
|
||||
@@ -164,7 +164,7 @@ void FollowerAI::EnterEvadeMode()
|
||||
|
||||
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
|
||||
{
|
||||
debug_log("TSCR: FollowerAI left combat, returning to CombatStartPosition.");
|
||||
sLog.outDebug("TSCR: FollowerAI left combat, returning to CombatStartPosition.");
|
||||
|
||||
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
|
||||
{
|
||||
debug_log("TSCR: FollowerAI is set completed, despawns.");
|
||||
sLog.outDebug("TSCR: FollowerAI is set completed, despawns.");
|
||||
me->ForcedDespawn();
|
||||
return;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
if (HasFollowState(STATE_FOLLOW_RETURNING))
|
||||
{
|
||||
debug_log("TSCR: FollowerAI is returning to leader.");
|
||||
sLog.outDebug("TSCR: FollowerAI is returning to leader.");
|
||||
|
||||
RemoveFollowState(STATE_FOLLOW_RETURNING);
|
||||
me->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
@@ -230,7 +230,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
|
||||
|
||||
if (bIsMaxRangeExceeded)
|
||||
{
|
||||
debug_log("TSCR: FollowerAI failed because player/group was to far away or not found");
|
||||
sLog.outDebug("TSCR: FollowerAI failed because player/group was to far away or not found");
|
||||
me->ForcedDespawn();
|
||||
return;
|
||||
}
|
||||
@@ -273,13 +273,13 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
|
||||
{
|
||||
if (me->getVictim())
|
||||
{
|
||||
debug_log("TSCR: FollowerAI attempt to StartFollow while in combat.");
|
||||
sLog.outDebug("TSCR: FollowerAI attempt to StartFollow while in combat.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
|
||||
{
|
||||
error_log("TSCR: FollowerAI attempt to StartFollow while already following.");
|
||||
sLog.outError("TSCR: FollowerAI attempt to StartFollow while already following.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
|
||||
{
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
debug_log("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
|
||||
sLog.outDebug("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
|
||||
}
|
||||
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
@@ -304,7 +304,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
|
||||
debug_log("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID);
|
||||
sLog.outDebug("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID);
|
||||
}
|
||||
|
||||
Player* FollowerAI::GetLeaderForFollower()
|
||||
@@ -323,7 +323,7 @@ Player* FollowerAI::GetLeaderForFollower()
|
||||
|
||||
if (pMember && pMember->isAlive() && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
|
||||
{
|
||||
debug_log("TSCR: FollowerAI GetLeader changed and returned new leader.");
|
||||
sLog.outDebug("TSCR: FollowerAI GetLeader changed and returned new leader.");
|
||||
m_uiLeaderGUID = pMember->GetGUID();
|
||||
return pMember;
|
||||
break;
|
||||
@@ -333,7 +333,7 @@ Player* FollowerAI::GetLeaderForFollower()
|
||||
}
|
||||
}
|
||||
|
||||
debug_log("TSCR: FollowerAI GetLeader can not find suitable leader.");
|
||||
sLog.outDebug("TSCR: FollowerAI GetLeader can not find suitable leader.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ SDComment:
|
||||
SDCategory: Guards
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptedGuardAI.h"
|
||||
|
||||
// **** This script is for use within every single guard to save coding time ****
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "InstanceData.h"
|
||||
#include "Map.h"
|
||||
|
||||
#define OUT_SAVE_INST_DATA debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_SAVE_INST_DATA_COMPLETE debug_log("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA(a) debug_log("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
|
||||
#define OUT_LOAD_INST_DATA_COMPLETE debug_log("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA_FAIL error_log("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_SAVE_INST_DATA sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_SAVE_INST_DATA_COMPLETE sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA(a) sLog.outDebug("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
|
||||
#define OUT_LOAD_INST_DATA_COMPLETE sLog.outDebug("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA_FAIL sLog.outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
|
||||
#define ScriptedInstance InstanceData
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ SDComment: Base Class for SimpleAI creatures
|
||||
SDCategory: Creatures
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "ScriptPCH.h"
|
||||
#include "ScriptedSimpleAI.h"
|
||||
|
||||
SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c)
|
||||
|
||||
@@ -18,19 +18,17 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "Auth/Sha1.h"
|
||||
#include "SHA1.h"
|
||||
|
||||
extern DatabaseType LoginDatabase;
|
||||
|
||||
INSTANTIATE_SINGLETON_1(AccountMgr);
|
||||
|
||||
AccountMgr::AccountMgr()
|
||||
{}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
|
||||
enum AccountOpResult
|
||||
{
|
||||
@@ -59,6 +58,6 @@ class AccountMgr
|
||||
static bool normalizeString(std::string& utf8str);
|
||||
};
|
||||
|
||||
#define accmgr Trinity::Singleton<AccountMgr>::Instance()
|
||||
#define accmgr (*ACE_Singleton<AccountMgr, ACE_Null_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
|
||||
#include "AchievementMgr.h"
|
||||
#include "ArenaTeam.h"
|
||||
@@ -41,8 +41,6 @@
|
||||
#include "Map.h"
|
||||
#include "InstanceData.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(AchievementGlobalMgr);
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
class AchievementChatBuilder
|
||||
@@ -873,6 +871,36 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||
SetCriteriaProgress(achievementCriteria, counter);
|
||||
break;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
|
||||
{
|
||||
time_t nextDailyResetTime = sWorld.GetNextDailyQuestsResetTime();
|
||||
CriteriaProgress *progress = GetCriteriaProgress(achievementCriteria);
|
||||
|
||||
if (!miscvalue1) // Login case.
|
||||
{
|
||||
// reset if player missed one day.
|
||||
if (progress && progress->date < (nextDailyResetTime - 2 * DAY))
|
||||
SetCriteriaProgress(achievementCriteria, 0, PROGRESS_SET);
|
||||
continue;
|
||||
}
|
||||
|
||||
ProgressType progressType;
|
||||
if (!progress)
|
||||
// 1st time. Start count.
|
||||
progressType = PROGRESS_SET;
|
||||
else if (progress->date < (nextDailyResetTime - 2 * DAY))
|
||||
// last progress is older than 2 days. Player missed 1 day => Retart count.
|
||||
progressType = PROGRESS_SET;
|
||||
else if (progress->date < (nextDailyResetTime - DAY))
|
||||
// last progress is between 1 and 2 days. => 1st time of the day.
|
||||
progressType = PROGRESS_ACCUMULATE;
|
||||
else
|
||||
// last progress is within the day before the reset => Already counted today.
|
||||
continue;
|
||||
|
||||
SetCriteriaProgress(achievementCriteria, 1, progressType);
|
||||
break;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
|
||||
{
|
||||
// speedup for non-login case
|
||||
@@ -935,7 +963,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||
if (!miscvalue1)
|
||||
continue;
|
||||
|
||||
Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId());
|
||||
Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : sMapMgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId());
|
||||
if (!map || !map->IsDungeon())
|
||||
continue;
|
||||
|
||||
@@ -1428,7 +1456,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING:
|
||||
break;
|
||||
// FIXME: not triggered in code as result, need to implement
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
|
||||
@@ -1483,11 +1510,10 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
|
||||
return false;
|
||||
}
|
||||
|
||||
CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID);
|
||||
if (itr == m_criteriaProgress.end())
|
||||
CriteriaProgress const* progress = GetCriteriaProgress(achievementCriteria);
|
||||
if (!progress)
|
||||
return false;
|
||||
|
||||
CriteriaProgress const* progress = &itr->second;
|
||||
|
||||
switch(achievementCriteria->requiredType)
|
||||
{
|
||||
@@ -1516,6 +1542,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
|
||||
return progress->counter >= 1;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
|
||||
return progress->counter >= achievementCriteria->complete_quest_count.totalQuestCount;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY:
|
||||
return progress->counter >= achievementCriteria->complete_daily_quest_daily.numberOfDays;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
|
||||
return progress->counter >= achievementCriteria->complete_quests_in_zone.questCount;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE:
|
||||
@@ -1661,11 +1689,10 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
|
||||
{
|
||||
AchievementCriteriaEntry const* criteria = *itr;
|
||||
|
||||
CriteriaProgressMap::const_iterator itrProgress = m_criteriaProgress.find(criteria->ID);
|
||||
if (itrProgress == m_criteriaProgress.end())
|
||||
CriteriaProgress const* progress = GetCriteriaProgress(criteria);
|
||||
if (!progress)
|
||||
continue;
|
||||
|
||||
CriteriaProgress const* progress = &itrProgress->second;
|
||||
count += progress->counter;
|
||||
|
||||
// for counters, field4 contains the main count requirement
|
||||
@@ -1701,6 +1728,16 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
|
||||
return false;
|
||||
}
|
||||
|
||||
CriteriaProgress* AchievementMgr::GetCriteriaProgress(AchievementCriteriaEntry const* entry)
|
||||
{
|
||||
CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID);
|
||||
|
||||
if (iter == m_criteriaProgress.end())
|
||||
return NULL;
|
||||
|
||||
return &(iter->second);
|
||||
}
|
||||
|
||||
void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype)
|
||||
{
|
||||
// Don't allow to cheat - doing timed achievements without timer active
|
||||
@@ -1711,11 +1748,8 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES) == 0)
|
||||
sLog.outDetail("AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow());
|
||||
|
||||
CriteriaProgress *progress = NULL;
|
||||
|
||||
CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID);
|
||||
|
||||
if (iter == m_criteriaProgress.end())
|
||||
CriteriaProgress* progress = GetCriteriaProgress(entry);
|
||||
if (!progress)
|
||||
{
|
||||
// not create record for 0 counter but allow it for timed achievements
|
||||
// we will need to send 0 progress to client to start the timer
|
||||
@@ -1724,12 +1758,9 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
|
||||
|
||||
progress = &m_criteriaProgress[entry->ID];
|
||||
progress->counter = changeValue;
|
||||
progress->date = time(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
progress = &iter->second;
|
||||
|
||||
uint32 newValue = 0;
|
||||
switch(ptype)
|
||||
{
|
||||
@@ -1756,6 +1787,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
|
||||
}
|
||||
|
||||
progress->changed = true;
|
||||
progress->date = time(NULL); // set the date to the latest update.
|
||||
|
||||
uint32 timeElapsed = 0;
|
||||
bool timedCompleted = false;
|
||||
@@ -1765,7 +1797,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
|
||||
//has to exist else we wouldn't be here
|
||||
timedCompleted = IsCompletedCriteria(entry, sAchievementStore.LookupEntry(entry->referredAchievement));
|
||||
// Client expects this in packet
|
||||
timeElapsed = entry->timeLimit - (timedIter->second/IN_MILISECONDS);
|
||||
timeElapsed = entry->timeLimit - (timedIter->second/IN_MILLISECONDS);
|
||||
|
||||
// Remove the timer, we wont need it anymore
|
||||
if (timedCompleted)
|
||||
@@ -1809,7 +1841,7 @@ void AchievementMgr::StartTimedAchievement(AchievementCriteriaTimedTypes type, u
|
||||
if (m_timedAchievements.find((*i)->ID) == m_timedAchievements.end() && !IsCompletedCriteria(*i, achievement))
|
||||
{
|
||||
// Start the timer
|
||||
m_timedAchievements[(*i)->ID] = (*i)->timeLimit * IN_MILISECONDS;
|
||||
m_timedAchievements[(*i)->ID] = (*i)->timeLimit * IN_MILLISECONDS;
|
||||
|
||||
// and at client too
|
||||
SetCriteriaProgress(*i, 0, PROGRESS_SET);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "ace/Singleton.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef std::map<uint32,AchievementEntryList> AchievementListByReference
|
||||
struct CriteriaProgress
|
||||
{
|
||||
uint32 counter;
|
||||
time_t date;
|
||||
time_t date; // latest update time.
|
||||
bool changed;
|
||||
};
|
||||
|
||||
@@ -258,6 +258,7 @@ class AchievementMgr
|
||||
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST };
|
||||
void SendAchievementEarned(AchievementEntry const* achievement);
|
||||
void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted);
|
||||
CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry);
|
||||
void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET);
|
||||
void CompletedCriteriaFor(AchievementEntry const* achievement);
|
||||
bool IsCompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement);
|
||||
@@ -341,6 +342,6 @@ class AchievementGlobalMgr
|
||||
AchievementRewardLocales m_achievementRewardLocales;
|
||||
};
|
||||
|
||||
#define achievementmgr Trinity::Singleton<AchievementGlobalMgr>::Instance()
|
||||
#define achievementmgr (*ACE_Singleton<AchievementGlobalMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -18,20 +17,18 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
|
||||
#include "AddonMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "Auth/Sha1.h"
|
||||
#include "SHA1.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
extern DatabaseType LoginDatabase;
|
||||
|
||||
INSTANTIATE_SINGLETON_1(AddonMgr);
|
||||
|
||||
AddonMgr::AddonMgr()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -22,7 +21,7 @@
|
||||
#define _ADDONMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -68,9 +67,10 @@ typedef std::list<SavedAddon> SavedAddonsList;
|
||||
|
||||
class AddonMgr
|
||||
{
|
||||
friend class ACE_Singleton<AddonMgr, ACE_Null_Mutex>;
|
||||
AddonMgr();
|
||||
public:
|
||||
|
||||
AddonMgr();
|
||||
~AddonMgr();
|
||||
|
||||
void LoadFromDB();
|
||||
@@ -83,7 +83,7 @@ class AddonMgr
|
||||
SavedAddonsList m_knownAddons; // Known addons.
|
||||
};
|
||||
|
||||
#define sAddonMgr Trinity::Singleton<AddonMgr>::Instance()
|
||||
#define sAddonMgr (*ACE_Singleton<AddonMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
#include <vector>
|
||||
|
||||
#include "Policies/SingletonImp.h"
|
||||
INSTANTIATE_SINGLETON_1(AuctionHouseBot);
|
||||
|
||||
using namespace std;
|
||||
vector<uint32> npcItems;
|
||||
vector<uint32> lootItems;
|
||||
@@ -23,6 +39,7 @@ vector<uint32> blueItemsBin;
|
||||
vector<uint32> purpleItemsBin;
|
||||
vector<uint32> orangeItemsBin;
|
||||
vector<uint32> yellowItemsBin;
|
||||
|
||||
AuctionHouseBot::AuctionHouseBot()
|
||||
{
|
||||
debug_Out = false;
|
||||
@@ -693,7 +710,7 @@ void AuctionHouseBot::Update()
|
||||
WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS);
|
||||
Player _AHBplayer(&_session);
|
||||
_AHBplayer.Initialize(AHBplayerGUID);
|
||||
ObjectAccessor::Instance().AddObject(&_AHBplayer);
|
||||
sObjectAccessor.AddObject(&_AHBplayer);
|
||||
|
||||
// Add New Bids
|
||||
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
@@ -725,7 +742,7 @@ void AuctionHouseBot::Update()
|
||||
addNewAuctionBuyerBotBid(&_AHBplayer, &NeutralConfig, &_session);
|
||||
_lastrun_n = _newrun;
|
||||
}
|
||||
ObjectAccessor::Instance().RemoveObject(&_AHBplayer);
|
||||
sObjectAccessor.RemoveObject(&_AHBplayer);
|
||||
}
|
||||
|
||||
void AuctionHouseBot::Initialize()
|
||||
@@ -1510,6 +1527,7 @@ void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char*
|
||||
uint32 maxItems = (uint32) strtoul(param1, NULL, 0);
|
||||
CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID);
|
||||
config->SetMaxItems(maxItems);
|
||||
config->CalculatePercents();
|
||||
}
|
||||
break;
|
||||
case 3: //min time Deprecated (Place holder for future commands)
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef AUCTION_HOUSE_BOT_H
|
||||
#define AUCTION_HOUSE_BOT_H
|
||||
|
||||
#include "World.h"
|
||||
#include "Config/ConfigEnv.h"
|
||||
#include "ConfigEnv.h"
|
||||
#include "ItemPrototype.h"
|
||||
|
||||
#define AHB_GREY 0
|
||||
@@ -173,7 +192,8 @@ public:
|
||||
void SetMaxItems(uint32 value)
|
||||
{
|
||||
maxItems = value;
|
||||
CalculatePercents();
|
||||
// CalculatePercents() needs to be called, but only if
|
||||
// SetPercentages() has been called at least once already.
|
||||
}
|
||||
uint32 GetMaxItems()
|
||||
{
|
||||
@@ -1207,9 +1227,11 @@ private:
|
||||
inline uint32 minValue(uint32 a, uint32 b) { return a <= b ? a : b; };
|
||||
void addNewAuctions(Player *AHBplayer, AHBConfig *config);
|
||||
void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session);
|
||||
|
||||
friend class ACE_Singleton<AuctionHouseBot, ACE_Null_Mutex>;
|
||||
AuctionHouseBot();
|
||||
|
||||
public:
|
||||
AuctionHouseBot();
|
||||
~AuctionHouseBot();
|
||||
void Update();
|
||||
void Initialize();
|
||||
@@ -1220,6 +1242,6 @@ public:
|
||||
uint32 GetAHBplayerGUID() { return AHBplayerGUID; };
|
||||
};
|
||||
|
||||
#define auctionbot Trinity::Singleton<AuctionHouseBot>::Instance()
|
||||
#define auctionbot (*ACE_Singleton<AuctionHouseBot, ACE_Null_Mutex>::instance())
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
@@ -22,21 +22,19 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "SQLStorage.h"
|
||||
|
||||
#include "DBCStores.h"
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "Item.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Logging/Log.h"
|
||||
#include "ProgressBar.h"
|
||||
#include <vector>
|
||||
|
||||
INSTANTIATE_SINGLETON_1(AuctionHouseMgr);
|
||||
|
||||
using namespace std;
|
||||
|
||||
AuctionHouseMgr::AuctionHouseMgr()
|
||||
@@ -483,7 +481,11 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
|
||||
bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 item_template)
|
||||
{
|
||||
auctionbot.DecrementItemCounts(auction, item_template);
|
||||
return AuctionsMap.erase(auction->Id) ? true : false;
|
||||
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
|
||||
|
||||
// we need to delete the entry, it is not referenced any more
|
||||
delete auction;
|
||||
return wasInMap;
|
||||
}
|
||||
|
||||
void AuctionHouseObject::Update()
|
||||
@@ -711,7 +713,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const
|
||||
data << uint32(bid ? GetAuctionOutBid() : 0);
|
||||
//minimal outbid
|
||||
data << uint32(buyout); //auction->buyout
|
||||
data << uint32((expire_time-time(NULL))*IN_MILISECONDS);//time left
|
||||
data << uint32((expire_time-time(NULL))*IN_MILLISECONDS);//time left
|
||||
data << uint64(bidder) ; //auction->bidder current
|
||||
data << uint32(bid); //current bid
|
||||
return true;
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _AUCTION_HOUSE_MGR_H
|
||||
#define _AUCTION_HOUSE_MGR_H
|
||||
|
||||
#include "Policies/Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#include "SharedDefines.h"
|
||||
|
||||
@@ -121,51 +119,53 @@ class AuctionHouseObject
|
||||
|
||||
class AuctionHouseMgr
|
||||
{
|
||||
public:
|
||||
friend class ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>;
|
||||
AuctionHouseMgr();
|
||||
~AuctionHouseMgr();
|
||||
|
||||
public:
|
||||
~AuctionHouseMgr();
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
||||
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
||||
|
||||
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
|
||||
|
||||
Item* GetAItem(uint32 id)
|
||||
{
|
||||
ItemMap::const_iterator itr = mAitems.find(id);
|
||||
if (itr != mAitems.end())
|
||||
Item* GetAItem(uint32 id)
|
||||
{
|
||||
return itr->second;
|
||||
ItemMap::const_iterator itr = mAitems.find(id);
|
||||
if (itr != mAitems.end())
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//auction messages
|
||||
void SendAuctionWonMail(AuctionEntry * auction);
|
||||
void SendAuctionSalePendingMail(AuctionEntry * auction);
|
||||
void SendAuctionSuccessfulMail(AuctionEntry * auction);
|
||||
void SendAuctionExpiredMail(AuctionEntry * auction);
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
//auction messages
|
||||
void SendAuctionWonMail(AuctionEntry * auction);
|
||||
void SendAuctionSalePendingMail(AuctionEntry * auction);
|
||||
void SendAuctionSuccessfulMail(AuctionEntry * auction);
|
||||
void SendAuctionExpiredMail(AuctionEntry * auction);
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
|
||||
public:
|
||||
public:
|
||||
//load first auction items, because of check if item exists, when loading
|
||||
void LoadAuctionItems();
|
||||
void LoadAuctions();
|
||||
void LoadAuctionItems();
|
||||
void LoadAuctions();
|
||||
|
||||
void AddAItem(Item* it);
|
||||
bool RemoveAItem(uint32 id);
|
||||
void AddAItem(Item* it);
|
||||
bool RemoveAItem(uint32 id);
|
||||
|
||||
void Update();
|
||||
void Update();
|
||||
|
||||
private:
|
||||
AuctionHouseObject mHordeAuctions;
|
||||
AuctionHouseObject mAllianceAuctions;
|
||||
AuctionHouseObject mNeutralAuctions;
|
||||
private:
|
||||
AuctionHouseObject mHordeAuctions;
|
||||
AuctionHouseObject mAllianceAuctions;
|
||||
AuctionHouseObject mNeutralAuctions;
|
||||
|
||||
ItemMap mAitems;
|
||||
ItemMap mAitems;
|
||||
};
|
||||
|
||||
#define auctionmgr Trinity::Singleton<AuctionHouseMgr>::Instance()
|
||||
#define auctionmgr (*ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
#endif
|
||||
|
||||
@@ -323,7 +323,7 @@ void BattleGround::Update(uint32 diff)
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->CastSpell(plr, 6962, true);
|
||||
plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
|
||||
ObjectAccessor::Instance().ConvertCorpseForPlayer(*itr);
|
||||
sObjectAccessor.ConvertCorpseForPlayer(*itr);
|
||||
}
|
||||
m_ResurrectQueue.clear();
|
||||
}
|
||||
@@ -356,16 +356,16 @@ void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
uint32 newtime = m_PrematureCountDownTimer - diff;
|
||||
// announce every minute
|
||||
if (newtime > (MINUTE * IN_MILISECONDS))
|
||||
if (newtime > (MINUTE * IN_MILLISECONDS))
|
||||
{
|
||||
if (newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS)));
|
||||
if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//announce every 15 seconds
|
||||
if (newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILISECONDS));
|
||||
if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS));
|
||||
}
|
||||
m_PrematureCountDownTimer = newtime;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ void BattleGround::Update(uint32 diff)
|
||||
AuraApplication * aurApp = iter->second;
|
||||
Aura * aura = aurApp->GetBase();
|
||||
if (!aura->IsPermanent()
|
||||
&& aura->GetDuration() <= 30*IN_MILISECONDS
|
||||
&& aura->GetDuration() <= 30*IN_MILLISECONDS
|
||||
&& aurApp->IsPositive()
|
||||
&& (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
|
||||
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
|
||||
@@ -856,7 +856,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const
|
||||
{
|
||||
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
|
||||
uint32 maxLevel = (GetMaxLevel()<80)?GetMaxLevel():80;
|
||||
uint32 maxLevel = (GetMaxLevel() < 80) ? GetMaxLevel() : 80;
|
||||
return Trinity::Honor::hk_honor_at_level(maxLevel, kills);
|
||||
}
|
||||
|
||||
@@ -1525,7 +1525,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
||||
/*
|
||||
void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceId());
|
||||
Map * map = sMapMgr.FindMap(GetMapId(),GetInstanceId());
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
@@ -1962,4 +1962,4 @@ void BattleGround::RewardXPAtKill(Player* plr, Player* victim)
|
||||
if (Pet* pet = plr->GetPet())
|
||||
pet->GivePetXP(xp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
@@ -49,8 +49,6 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Formulas.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(BattleGroundMgr);
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
/*********************************************************/
|
||||
@@ -1271,8 +1269,8 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
||||
*data << uint32(bg->GetTypeID());
|
||||
*data << uint16(0x1F90);
|
||||
// End of uint64 segment, decomposed this way for simplicity
|
||||
*data << uint8(0); // 3.3.0
|
||||
*data << uint8(0); // 3.3.0
|
||||
*data << uint8(0); // 3.3.0, some level, only saw 80...
|
||||
*data << uint8(0); // 3.3.0, some level, only saw 80...
|
||||
*data << uint32(bg->GetClientInstanceID());
|
||||
// alliance/horde for BG and skirmish/rated for Arenas
|
||||
// following displays the minimap-icon 0 = faction icon 1 = arenaicon
|
||||
@@ -1287,10 +1285,12 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
|
||||
break;
|
||||
case STATUS_WAIT_JOIN: // status_invite
|
||||
*data << uint32(bg->GetMapId()); // map id
|
||||
*data << uint64(0); // 3.3.5, unknown
|
||||
*data << uint32(Time1); // time to remove from queue, milliseconds
|
||||
break;
|
||||
case STATUS_IN_PROGRESS: // status_in_progress
|
||||
*data << uint32(bg->GetMapId()); // map id
|
||||
*data << uint64(0); // 3.3.5, unknown
|
||||
*data << uint32(Time1); // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
|
||||
*data << uint32(Time2); // time from bg start, milliseconds
|
||||
*data << uint8(/*bg->isArena() ? 0 :*/ 1); // unk, possibly 0 == preparation phase, 1 == battle
|
||||
@@ -1629,8 +1629,11 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
||||
return 0;
|
||||
}
|
||||
|
||||
// set battelground difficulty before initialization
|
||||
bg->SetBracket(bracketEntry);
|
||||
|
||||
// generate a new instance id
|
||||
bg->SetInstanceID(MapManager::Instance().GenerateInstanceId()); // set instance id
|
||||
bg->SetInstanceID(sMapMgr.GenerateInstanceId()); // set instance id
|
||||
bg->SetClientInstanceID(CreateClientVisibleInstanceId(isRandom ? BATTLEGROUND_RB : bgTypeId, bracketEntry->GetBracketId()));
|
||||
|
||||
// reset the new bg (set status to status_wait_queue from status_none)
|
||||
@@ -1638,7 +1641,6 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
|
||||
|
||||
// start the joining of the bg
|
||||
bg->SetStatus(STATUS_WAIT_JOIN);
|
||||
bg->SetBracket(bracketEntry);
|
||||
bg->SetArenaType(arenaType);
|
||||
bg->SetRated(isRated);
|
||||
bg->SetRandom(isRandom);
|
||||
@@ -1893,8 +1895,8 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
|
||||
uint32 win_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
|
||||
uint32 loos_kills = plr->GetRandomWinner() ? BG_REWARD_LOOSER_HONOR_LAST : BG_REWARD_LOOSER_HONOR_FIRST;
|
||||
|
||||
win_kills = (uint32)Trinity::Honor::hk_honor_at_level(plr->getLevel(), win_kills);
|
||||
loos_kills = (uint32)Trinity::Honor::hk_honor_at_level(plr->getLevel(), loos_kills);
|
||||
win_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), win_kills);
|
||||
loos_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), loos_kills);
|
||||
|
||||
data->Initialize(SMSG_BATTLEFIELD_LIST);
|
||||
*data << uint64(guid); // battlemaster guid
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define __BATTLEGROUNDMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#include "DBCEnums.h"
|
||||
#include "BattleGround.h"
|
||||
@@ -180,9 +180,12 @@ class BGQueueRemoveEvent : public BasicEvent
|
||||
|
||||
class BattleGroundMgr
|
||||
{
|
||||
/// Todo: Thread safety?
|
||||
/* Construction */
|
||||
friend class ACE_Singleton<BattleGroundMgr, ACE_Null_Mutex>;
|
||||
BattleGroundMgr();
|
||||
|
||||
public:
|
||||
/* Construction */
|
||||
BattleGroundMgr();
|
||||
~BattleGroundMgr();
|
||||
void Update(uint32 diff);
|
||||
|
||||
@@ -271,6 +274,6 @@ class BattleGroundMgr
|
||||
bool m_Testing;
|
||||
};
|
||||
|
||||
#define sBattleGroundMgr Trinity::Singleton<BattleGroundMgr>::Instance()
|
||||
#define sBattleGroundMgr (*ACE_Singleton<BattleGroundMgr, ACE_Null_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundAV.h"
|
||||
#include "Formulas.h"
|
||||
#include "Miscellaneous/Formulas.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "Miscellaneous/Language.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuras.h"
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
class BattleGround;
|
||||
|
||||
#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILISECONDS) //8 seconds
|
||||
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILISECONDS) //2 seconds
|
||||
#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILLISECONDS) //8 seconds
|
||||
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILLISECONDS) //2 seconds
|
||||
|
||||
enum BG_EY_WorldStates
|
||||
{
|
||||
|
||||
@@ -197,7 +197,7 @@ const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
|
||||
{ 1431.3413f, -219.437f, 30.893f, 0.9736f },
|
||||
{ 1227.667f, -212.555f, 55.372f, 0.5023f },
|
||||
{ 1214.681f, 81.21f, 53.413f, 5.745f },
|
||||
{ 878.555f, -108.989f, 119.835f, 0.0565f },
|
||||
{ 878.555f, -108.2f, 117.845f, 0.0f },
|
||||
{ 836.5f, -108.8f, 120.219f, 0.0f },
|
||||
//Ships
|
||||
{ 2679.696777, -826.891235, 3.712860, 5.78367f}, //rot2 1 rot3 0.0002
|
||||
|
||||
@@ -70,7 +70,7 @@ void BattleGroundWS::Update(uint32 diff)
|
||||
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if (GetStartTime() >= 25*MINUTE*IN_MILISECONDS) // Òàéìåð òèêàòü íà÷èíàåò ïîñëå 25 ìèíóò
|
||||
if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS)
|
||||
{
|
||||
if (GetTeamScore(ALLIANCE) == 0)
|
||||
{
|
||||
@@ -83,15 +83,15 @@ void BattleGroundWS::Update(uint32 diff)
|
||||
else if (GetTeamScore(HORDE) == 0)
|
||||
EndBattleGround(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
|
||||
|
||||
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the first flag
|
||||
EndBattleGround(m_FirstFlagCaptureTeam);
|
||||
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
|
||||
EndBattleGround(m_LastFlagCaptureTeam);
|
||||
|
||||
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
|
||||
EndBattleGround(HORDE);
|
||||
else
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILISECONDS)
|
||||
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS)
|
||||
{
|
||||
++m_minutesElapsed;
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25-m_minutesElapsed);
|
||||
@@ -325,8 +325,8 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
if (!m_FirstFlagCaptureTeam)
|
||||
SetFirstFlagCapture(Source->GetTeam());
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(Source->GetTeam());
|
||||
|
||||
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
@@ -720,7 +720,7 @@ void BattleGroundWS::Reset()
|
||||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
// For WorldState
|
||||
m_minutesElapsed = 0;
|
||||
m_FirstFlagCaptureTeam = 0;
|
||||
m_LastFlagCaptureTeam = 0;
|
||||
|
||||
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
|
||||
@@ -191,7 +191,7 @@ class BattleGroundWS : public BattleGround
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
void UpdateFlagState(uint32 team, uint32 value);
|
||||
void SetFirstFlagCapture(uint32 team) { m_FirstFlagCaptureTeam = team; }
|
||||
void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; }
|
||||
void UpdateTeamScore(uint32 team);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
|
||||
@@ -209,7 +209,7 @@ class BattleGroundWS : public BattleGround
|
||||
uint8 m_FlagState[2]; // for checking flag state
|
||||
int32 m_FlagsTimer[2];
|
||||
int32 m_FlagsDropTimer[2];
|
||||
uint32 m_FirstFlagCaptureTeam; // Winner is based on this if score is equal
|
||||
uint32 m_LastFlagCaptureTeam; // Winner is based on this if score is equal
|
||||
|
||||
uint32 m_ReputationCapture;
|
||||
uint32 m_HonorWinKills;
|
||||
|
||||
+245
-351
@@ -1,373 +1,263 @@
|
||||
# Enable precompiled headers when using the GCC compiler.
|
||||
IF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
ENDIF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
SET(game_STAT_SRCS
|
||||
Account/AccountMgr.cpp
|
||||
Account/AccountMgr.h
|
||||
Achievements/AchievementMgr.h
|
||||
Achievements/AchievementMgr.cpp
|
||||
Addons/AddonMgr.cpp
|
||||
Addons/AddonMgr.h
|
||||
Addons/AddonHandler.cpp
|
||||
Addons/AddonHandler.h
|
||||
AI/AuctionHouseBot/AuctionHouseBot.cpp
|
||||
AI/AuctionHouseBot/AuctionHouseBot.h
|
||||
AI/EventAI/CreatureEventAI.cpp
|
||||
AI/EventAI/CreatureEventAIMgr.cpp
|
||||
AI/ScriptedAI/ScriptedSmartAI.cpp
|
||||
AI/ScriptedAI/ScriptedSmartAI.h
|
||||
AI/CombatAI.cpp
|
||||
AI/CombatAI.h
|
||||
AI/CreatureAI.cpp
|
||||
AI/CreatureAI.h
|
||||
AI/CreatureAIFactory.h
|
||||
AI/CreatureAIImpl.h
|
||||
AI/CreatureAIRegistry.cpp
|
||||
AI/CreatureAIRegistry.h
|
||||
AI/CreatureAISelector.cpp
|
||||
AI/CreatureAISelector.h
|
||||
AI/GuardAI.cpp
|
||||
AI/GuardAI.h
|
||||
AI/PassiveAI.cpp
|
||||
AI/PassiveAI.h
|
||||
AI/PetAI.cpp
|
||||
AI/PetAI.h
|
||||
AI/ReactorAI.cpp
|
||||
AI/ReactorAI.h
|
||||
AI/TotemAI.cpp
|
||||
AI/TotemAI.h
|
||||
AI/UnitAI.cpp
|
||||
AI/UnitAI.h
|
||||
AuctionHouse/AuctionHouseHandler.cpp
|
||||
AuctionHouse/AuctionHouseMgr.cpp
|
||||
AuctionHouse/AuctionHouseMgr.h
|
||||
BattleGrounds/ArenaTeam.cpp
|
||||
BattleGrounds/ArenaTeam.h
|
||||
BattleGrounds/ArenaTeamHandler.cpp
|
||||
BattleGrounds/BattleGround.cpp
|
||||
BattleGrounds/BattleGroundAA.cpp
|
||||
BattleGrounds/BattleGroundAB.cpp
|
||||
BattleGrounds/BattleGroundRB.cpp
|
||||
BattleGrounds/BattleGroundAV.cpp
|
||||
BattleGrounds/BattleGroundBE.cpp
|
||||
BattleGrounds/BattleGroundDS.cpp
|
||||
BattleGrounds/BattleGroundEY.cpp
|
||||
BattleGrounds/BattleGroundIC.cpp
|
||||
BattleGrounds/BattleGroundNA.cpp
|
||||
BattleGrounds/BattleGroundRL.cpp
|
||||
BattleGrounds/BattleGroundRV.cpp
|
||||
BattleGrounds/BattleGroundSA.cpp
|
||||
BattleGrounds/BattleGroundWS.cpp
|
||||
BattleGrounds/BattleGround.h
|
||||
BattleGrounds/BattleGroundAA.h
|
||||
BattleGrounds/BattleGroundAB.h
|
||||
BattleGrounds/BattleGroundRB.h
|
||||
BattleGrounds/BattleGroundAV.h
|
||||
BattleGrounds/BattleGroundBE.h
|
||||
BattleGrounds/BattleGroundDS.h
|
||||
BattleGrounds/BattleGroundEY.h
|
||||
BattleGrounds/BattleGroundIC.h
|
||||
BattleGrounds/BattleGroundNA.h
|
||||
BattleGrounds/BattleGroundRL.h
|
||||
BattleGrounds/BattleGroundRV.h
|
||||
BattleGrounds/BattleGroundSA.h
|
||||
BattleGrounds/BattleGroundWS.h
|
||||
BattleGrounds/BattleGroundHandler.cpp
|
||||
BattleGrounds/BattleGroundMgr.cpp
|
||||
BattleGrounds/BattleGroundMgr.h
|
||||
Calendar/Calendar.cpp
|
||||
Calendar/Calendar.h
|
||||
Calendar/CalendarHandler.cpp
|
||||
Chat/Channel.cpp
|
||||
Chat/Channel.h
|
||||
Chat/ChannelHandler.cpp
|
||||
Chat/ChannelMgr.h
|
||||
Chat/ChannelMgr.cpp
|
||||
Chat/Chat.cpp
|
||||
Chat/Chat.h
|
||||
Chat/ChatHandler.cpp
|
||||
Chat/Debugcmds.cpp
|
||||
Chat/Level0.cpp
|
||||
Chat/Level1.cpp
|
||||
Chat/Level2.cpp
|
||||
Chat/Level3.cpp
|
||||
Combat/CombatHandler.cpp
|
||||
Combat/HostileRefManager.cpp
|
||||
Combat/HostileRefManager.h
|
||||
Combat/ThreatManager.cpp
|
||||
Combat/ThreatManager.h
|
||||
ConditionMgr/ConditionMgr.cpp
|
||||
ConditionMgr/ConditionMgr.h
|
||||
DataStores/DBCEnums.h
|
||||
DataStores/DBCStores.cpp
|
||||
DataStores/DBCStores.h
|
||||
DataStores/DBCStructure.h
|
||||
DataStores/DBCfmt.h
|
||||
Entities/Creature/Creature.cpp
|
||||
Entities/Creature/Creature.h
|
||||
Entities/Creature/CreatureGroups.cpp
|
||||
Entities/Creature/CreatureGroups.h
|
||||
Entities/Creature/GossipDef.cpp
|
||||
Entities/Creature/GossipDef.h
|
||||
Entities/Creature/NPCHandler.cpp
|
||||
Entities/Creature/NPCHandler.h
|
||||
Entities/Creature/TemporarySummon.cpp
|
||||
Entities/Creature/TemporarySummon.h
|
||||
Entities/GameObject/GameObject.cpp
|
||||
Entities/GameObject/GameObject.h
|
||||
Entities/Item/Bag.cpp
|
||||
Entities/Item/Bag.h
|
||||
Entities/Item/Item.cpp
|
||||
Entities/Item/Item.h
|
||||
Entities/Item/ItemEnchantmentMgr.cpp
|
||||
Entities/Item/ItemEnchantmentMgr.h
|
||||
Entities/Item/ItemHandler.cpp
|
||||
Entities/Item/ItemPrototype.h
|
||||
Entities/Object/Corpse.cpp
|
||||
Entities/Object/Corpse.h
|
||||
Entities/Object/DynamicObject.cpp
|
||||
Entities/Object/DynamicObject.h
|
||||
Entities/Object/ObjectAccessor.cpp
|
||||
Entities/Object/ObjectAccessor.h
|
||||
Entities/Object/Object.cpp
|
||||
Entities/Object/ObjectDefines.h
|
||||
Entities/Object/Object.h
|
||||
Entities/Object/ObjectMgr.cpp
|
||||
Entities/Object/ObjectMgr.h
|
||||
Entities/Object/UpdateData.cpp
|
||||
Entities/Object/UpdateData.h
|
||||
Entities/Object/UpdateFields.h
|
||||
Entities/Object/UpdateMask.h
|
||||
Entities/Pet/Pet.cpp
|
||||
Entities/Pet/Pet.h
|
||||
Entities/Pet/PetHandler.cpp
|
||||
Entities/Player/DuelHandler.cpp
|
||||
Entities/Player/MiscHandler.cpp
|
||||
Entities/Player/PetitionsHandler.cpp
|
||||
Entities/Player/Player.cpp
|
||||
Entities/Player/Player.h
|
||||
Entities/Player/SocialMgr.cpp
|
||||
Entities/Player/SocialMgr.h
|
||||
Entities/Player/TicketHandler.cpp
|
||||
Entities/Player/TradeHandler.cpp
|
||||
Entities/Player/VoiceChatHandler.cpp
|
||||
Entities/Player/CharacterHandler.cpp
|
||||
Entities/Unit/StatSystem.cpp
|
||||
Entities/Unit/Unit.cpp
|
||||
Entities/Unit/Unit.h
|
||||
Entities/Totem/Totem.cpp
|
||||
Entities/Totem/Totem.h
|
||||
Entities/Vehicle/Vehicle.cpp
|
||||
Entities/Vehicle/Vehicle.h
|
||||
Events/GameEventMgr.cpp
|
||||
Events/GameEventMgr.h
|
||||
Events/GlobalEvents.cpp
|
||||
Events/GlobalEvents.h
|
||||
Events/UnitEvents.h
|
||||
Globals/Formulas.h
|
||||
Globals/Language.h
|
||||
Globals/SharedDefines.h
|
||||
Groups/Group.cpp
|
||||
Groups/Group.h
|
||||
Groups/GroupHandler.cpp
|
||||
Groups/GroupReference.cpp
|
||||
Groups/GroupReference.h
|
||||
Groups/GroupRefManager.h
|
||||
Guilds/Guild.cpp
|
||||
Guilds/Guild.h
|
||||
Guilds/GuildHandler.cpp
|
||||
Instances/InstanceData.cpp
|
||||
Instances/InstanceData.h
|
||||
Instances/InstanceSaveMgr.cpp
|
||||
Instances/InstanceSaveMgr.h
|
||||
LookingForGroup/LFG.h
|
||||
LookingForGroup/LFGHandler.cpp
|
||||
LookingForGroup/LFGMgr.cpp
|
||||
LookingForGroup/LFGMgr.h
|
||||
Loot/LootHandler.cpp
|
||||
Loot/LootMgr.cpp
|
||||
Loot/LootMgr.h
|
||||
Mails/Mail.cpp
|
||||
Mails/Mail.h
|
||||
Map/Cell/Cell.h
|
||||
Map/Cell/CellImpl.h
|
||||
Map/Grid/GridDefines.h
|
||||
Map/Grid/GridNotifiers.cpp
|
||||
Map/Grid/GridNotifiers.h
|
||||
Map/Grid/GridNotifiersImpl.h
|
||||
Map/Grid/GridStates.cpp
|
||||
Map/Grid/GridStates.h
|
||||
Map/Grid/ObjectGridLoader.cpp
|
||||
Map/Grid/ObjectGridLoader.h
|
||||
Map/Map.cpp
|
||||
Map/Map.h
|
||||
Map/MapInstanced.cpp
|
||||
Map/MapInstanced.h
|
||||
Map/MapManager.cpp
|
||||
Map/MapManager.h
|
||||
Map/MapUpdater.cpp
|
||||
Map/MapUpdater.h
|
||||
Map/MapReference.h
|
||||
Map/MapRefManager.h
|
||||
Map/ObjectPosSelector.cpp
|
||||
Map/ObjectPosSelector.h
|
||||
Map/ZoneScript.h
|
||||
Movement/MovementGenerators/ConfusedMovementGenerator.cpp
|
||||
Movement/MovementGenerators/ConfusedMovementGenerator.h
|
||||
Movement/MovementGenerators/FleeingMovementGenerator.cpp
|
||||
Movement/MovementGenerators/FleeingMovementGenerator.h
|
||||
Movement/MovementGenerators/HomeMovementGenerator.cpp
|
||||
Movement/MovementGenerators/HomeMovementGenerator.h
|
||||
Movement/MovementGenerators/IdleMovementGenerator.cpp
|
||||
Movement/MovementGenerators/IdleMovementGenerator.h
|
||||
Movement/MovementGenerators/MovementGenerator.cpp
|
||||
Movement/MovementGenerators/MovementGenerator.h
|
||||
Movement/MovementGenerators/MovementGeneratorImpl.h
|
||||
Movement/MovementGenerators/PointMovementGenerator.cpp
|
||||
Movement/MovementGenerators/PointMovementGenerator.h
|
||||
Movement/MovementGenerators/RandomMovementGenerator.cpp
|
||||
Movement/MovementGenerators/RandomMovementGenerator.h
|
||||
Movement/MovementGenerators/TargetedMovementGenerator.cpp
|
||||
Movement/MovementGenerators/TargetedMovementGenerator.h
|
||||
Movement/MovementGenerators/WaypointMovementGenerator.cpp
|
||||
Movement/MovementGenerators/WaypointMovementGenerator.h
|
||||
Movement/DestinationHolder.cpp
|
||||
Movement/DestinationHolder.h
|
||||
Movement/DestinationHolderImp.h
|
||||
Movement/FollowerReference.cpp
|
||||
Movement/FollowerReference.h
|
||||
Movement/FollowerRefManager.h
|
||||
Movement/MotionMaster.cpp
|
||||
Movement/MotionMaster.h
|
||||
Movement/MovementHandler.cpp
|
||||
Movement/Path.h
|
||||
Movement/TaxiHandler.cpp
|
||||
Movement/Transports.cpp
|
||||
Movement/Transports.h
|
||||
Movement/Traveller.h
|
||||
Movement/WaypointManager.cpp
|
||||
Movement/WaypointManager.h
|
||||
Opcodes/Opcodes.cpp
|
||||
Opcodes/Opcodes.h
|
||||
OutdoorPvP/OutdoorPvP.cpp
|
||||
OutdoorPvP/OutdoorPvP.h
|
||||
OutdoorPvP/OutdoorPvPEP.cpp
|
||||
OutdoorPvP/OutdoorPvPEP.h
|
||||
OutdoorPvP/OutdoorPvPHP.cpp
|
||||
OutdoorPvP/OutdoorPvPHP.h
|
||||
OutdoorPvP/OutdoorPvPImpl.h
|
||||
OutdoorPvP/OutdoorPvPMgr.cpp
|
||||
OutdoorPvP/OutdoorPvPMgr.h
|
||||
OutdoorPvP/OutdoorPvPNA.cpp
|
||||
OutdoorPvP/OutdoorPvPNA.h
|
||||
OutdoorPvP/OutdoorPvPSI.cpp
|
||||
OutdoorPvP/OutdoorPvPSI.h
|
||||
OutdoorPvP/OutdoorPvPTF.cpp
|
||||
OutdoorPvP/OutdoorPvPTF.h
|
||||
OutdoorPvP/OutdoorPvPZM.cpp
|
||||
OutdoorPvP/OutdoorPvPZM.h
|
||||
Pools/PoolHandler.cpp
|
||||
Pools/PoolHandler.h
|
||||
Quests/QueryHandler.cpp
|
||||
Quests/QuestDef.cpp
|
||||
Quests/QuestDef.h
|
||||
Quests/QuestHandler.cpp
|
||||
Reputation/ReputationMgr.cpp
|
||||
Reputation/ReputationMgr.h
|
||||
ScriptMgr/ScriptLoader.cpp
|
||||
ScriptMgr/ScriptLoader.h
|
||||
ScriptMgr/ScriptMgr.cpp
|
||||
ScriptMgr/ScriptMgr.h
|
||||
ScriptMgr/ScriptSystem.cpp
|
||||
ScriptMgr/ScriptSystem.h
|
||||
Skills/SkillHandler.cpp
|
||||
Skills/SkillDiscovery.cpp
|
||||
Skills/SkillDiscovery.h
|
||||
Skills/SkillExtraItems.cpp
|
||||
Skills/SkillExtraItems.h
|
||||
Spells/Auras/SpellAuraDefines.h
|
||||
Spells/Auras/SpellAuras.cpp
|
||||
Spells/Auras/SpellAuras.h
|
||||
Spells/Auras/SpellAuraEffects.cpp
|
||||
Spells/Auras/SpellAuraEffects.h
|
||||
Spells/Auras/SpellEffects.cpp
|
||||
Spells/Spell.cpp
|
||||
Spells/Spell.h
|
||||
Spells/SpellHandler.cpp
|
||||
Spells/SpellMgr.cpp
|
||||
Spells/SpellMgr.h
|
||||
Tools/PlayerDump.cpp
|
||||
Tools/PlayerDump.h
|
||||
Tools/Tools.cpp
|
||||
Tools/Tools.h
|
||||
Weather/Weather.cpp
|
||||
Weather/Weather.h
|
||||
World/World.cpp
|
||||
World/World.h
|
||||
World/WorldLog.cpp
|
||||
World/WorldLog.h
|
||||
World/WorldSession.cpp
|
||||
World/WorldSession.h
|
||||
World/WorldSocket.cpp
|
||||
World/WorldSocket.h
|
||||
World/WorldSocketMgr.cpp
|
||||
World/WorldSocketMgr.h
|
||||
######## game ########
|
||||
|
||||
# Enable precompiled headers when using the GCC compiler.
|
||||
if(DO_PCH)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
# Create game-libary
|
||||
set(game_STAT_SRCS
|
||||
Accounts/AccountMgr.cpp
|
||||
Achievements/AchievementMgr.cpp
|
||||
Addons/AddonMgr.cpp
|
||||
AI/CoreAI/CombatAI.cpp
|
||||
AI/CoreAI/GuardAI.cpp
|
||||
AI/CoreAI/PassiveAI.cpp
|
||||
AI/CoreAI/PetAI.cpp
|
||||
AI/CoreAI/ReactorAI.cpp
|
||||
AI/CoreAI/TotemAI.cpp
|
||||
AI/CoreAI/UnitAI.cpp
|
||||
AI/EventAI/CreatureEventAI.cpp
|
||||
AI/EventAI/CreatureEventAIMgr.cpp
|
||||
AI/ScriptedAI/ScriptedSmartAI.cpp
|
||||
AI/CreatureAIRegistry.cpp
|
||||
AI/CreatureAISelector.cpp
|
||||
AI/CreatureAI.cpp
|
||||
AuctionHouse/AuctionHouseMgr.cpp
|
||||
AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp
|
||||
BattleGrounds/ArenaTeam.cpp
|
||||
BattleGrounds/Zones/BattleGroundAA.cpp
|
||||
BattleGrounds/Zones/BattleGroundAB.cpp
|
||||
BattleGrounds/Zones/BattleGroundRB.cpp
|
||||
BattleGrounds/Zones/BattleGroundAV.cpp
|
||||
BattleGrounds/Zones/BattleGroundBE.cpp
|
||||
BattleGrounds/Zones/BattleGroundDS.cpp
|
||||
BattleGrounds/Zones/BattleGroundEY.cpp
|
||||
BattleGrounds/Zones/BattleGroundIC.cpp
|
||||
BattleGrounds/Zones/BattleGroundNA.cpp
|
||||
BattleGrounds/Zones/BattleGroundRL.cpp
|
||||
BattleGrounds/Zones/BattleGroundRV.cpp
|
||||
BattleGrounds/Zones/BattleGroundSA.cpp
|
||||
BattleGrounds/Zones/BattleGroundWS.cpp
|
||||
BattleGrounds/BattleGround.cpp
|
||||
BattleGrounds/BattleGroundMgr.cpp
|
||||
Calendar/Calendar.cpp
|
||||
Chat/Channels/Channel.cpp
|
||||
Chat/Channels/ChannelMgr.cpp
|
||||
Chat/Commands/Debugcmds.cpp
|
||||
Chat/Commands/Level0.cpp
|
||||
Chat/Commands/Level1.cpp
|
||||
Chat/Commands/Level2.cpp
|
||||
Chat/Commands/Level3.cpp
|
||||
Chat/Chat.cpp
|
||||
Combat/HostileRefManager.cpp
|
||||
Combat/ThreatManager.cpp
|
||||
Conditions/ConditionMgr.cpp
|
||||
DataStores/DBCStores.cpp
|
||||
DungeonFinding/LFGMgr.cpp
|
||||
Entities/Corpse/Corpse.cpp
|
||||
Entities/Creature/Creature.cpp
|
||||
Entities/Creature/CreatureGroups.cpp
|
||||
Entities/Creature/GossipDef.cpp
|
||||
Entities/Creature/TemporarySummon.cpp
|
||||
Entities/DynamicObject/DynamicObject.cpp
|
||||
Entities/GameObject/GameObject.cpp
|
||||
Entities/Item/Container/Bag.cpp
|
||||
Entities/Item/Item.cpp
|
||||
Entities/Item/ItemEnchantmentMgr.cpp
|
||||
Entities/Object/Updates/UpdateData.cpp
|
||||
Entities/Object/Object.cpp
|
||||
Entities/Object/ObjectPosSelector.cpp
|
||||
Entities/Pet/Pet.cpp
|
||||
Entities/Player/Player.cpp
|
||||
Entities/Player/SocialMgr.cpp
|
||||
Entities/Unit/StatSystem.cpp
|
||||
Entities/Unit/Unit.cpp
|
||||
Entities/Totem/Totem.cpp
|
||||
Entities/Transport/Transport.cpp
|
||||
Entities/Vehicle/Vehicle.cpp
|
||||
Events/GameEventMgr.cpp
|
||||
Globals/GlobalEvents.cpp
|
||||
Globals/ObjectAccessor.cpp
|
||||
Globals/ObjectMgr.cpp
|
||||
Grids/Notifiers/GridNotifiers.cpp
|
||||
Grids/GridStates.cpp
|
||||
Grids/ObjectGridLoader.cpp
|
||||
Groups/Group.cpp
|
||||
Groups/GroupReference.cpp
|
||||
Guilds/Guild.cpp
|
||||
Instances/InstanceData.cpp
|
||||
Instances/InstanceSaveMgr.cpp
|
||||
Loot/LootMgr.cpp
|
||||
Mails/Mail.cpp
|
||||
Maps/Map.cpp
|
||||
Maps/MapInstanced.cpp
|
||||
Maps/MapManager.cpp
|
||||
Maps/MapUpdater.cpp
|
||||
Movement/MovementGenerators/ConfusedMovementGenerator.cpp
|
||||
Movement/MovementGenerators/FleeingMovementGenerator.cpp
|
||||
Movement/MovementGenerators/HomeMovementGenerator.cpp
|
||||
Movement/MovementGenerators/IdleMovementGenerator.cpp
|
||||
Movement/MovementGenerators/PointMovementGenerator.cpp
|
||||
Movement/MovementGenerators/RandomMovementGenerator.cpp
|
||||
Movement/MovementGenerators/TargetedMovementGenerator.cpp
|
||||
Movement/MovementGenerators/WaypointMovementGenerator.cpp
|
||||
Movement/Waypoints/WaypointManager.cpp
|
||||
Movement/DestinationHolder.cpp
|
||||
Movement/FollowerReference.cpp
|
||||
Movement/MotionMaster.cpp
|
||||
Movement/MovementGenerator.cpp
|
||||
OutdoorPvP/Zones/OutdoorPvPEP.cpp
|
||||
OutdoorPvP/Zones/OutdoorPvPHP.cpp
|
||||
OutdoorPvP/Zones/OutdoorPvPNA.cpp
|
||||
OutdoorPvP/Zones/OutdoorPvPSI.cpp
|
||||
OutdoorPvP/Zones/OutdoorPvPTF.cpp
|
||||
OutdoorPvP/Zones/OutdoorPvPZM.cpp
|
||||
OutdoorPvP/OutdoorPvP.cpp
|
||||
OutdoorPvP/OutdoorPvPMgr.cpp
|
||||
Pools/PoolMgr.cpp
|
||||
Quests/QuestDef.cpp
|
||||
Reputation/ReputationMgr.cpp
|
||||
Scripting/ScriptLoader.cpp
|
||||
Scripting/ScriptMgr.cpp
|
||||
Scripting/ScriptSystem.cpp
|
||||
Server/Protocol/Handlers/AddonHandler.cpp
|
||||
Server/Protocol/Handlers/ArenaTeamHandler.cpp
|
||||
Server/Protocol/Handlers/AuctionHouseHandler.cpp
|
||||
Server/Protocol/Handlers/BattleGroundHandler.cpp
|
||||
Server/Protocol/Handlers/CalendarHandler.cpp
|
||||
Server/Protocol/Handlers/ChannelHandler.cpp
|
||||
Server/Protocol/Handlers/CharacterHandler.cpp
|
||||
Server/Protocol/Handlers/ChatHandler.cpp
|
||||
Server/Protocol/Handlers/CombatHandler.cpp
|
||||
Server/Protocol/Handlers/DuelHandler.cpp
|
||||
Server/Protocol/Handlers/GroupHandler.cpp
|
||||
Server/Protocol/Handlers/GuildHandler.cpp
|
||||
Server/Protocol/Handlers/ItemHandler.cpp
|
||||
Server/Protocol/Handlers/LFGHandler.cpp
|
||||
Server/Protocol/Handlers/LootHandler.cpp
|
||||
Server/Protocol/Handlers/MiscHandler.cpp
|
||||
Server/Protocol/Handlers/MovementHandler.cpp
|
||||
Server/Protocol/Handlers/NPCHandler.cpp
|
||||
Server/Protocol/Handlers/PetHandler.cpp
|
||||
Server/Protocol/Handlers/PetitionsHandler.cpp
|
||||
Server/Protocol/Handlers/QueryHandler.cpp
|
||||
Server/Protocol/Handlers/QuestHandler.cpp
|
||||
Server/Protocol/Handlers/SkillHandler.cpp
|
||||
Server/Protocol/Handlers/SpellHandler.cpp
|
||||
Server/Protocol/Handlers/TaxiHandler.cpp
|
||||
Server/Protocol/Handlers/TicketHandler.cpp
|
||||
Server/Protocol/Handlers/TradeHandler.cpp
|
||||
Server/Protocol/Handlers/VoiceChatHandler.cpp
|
||||
Server/Protocol/Opcodes.cpp
|
||||
Server/Protocol/WorldLog.cpp
|
||||
Server/WorldSession.cpp
|
||||
Server/WorldSocket.cpp
|
||||
Server/WorldSocketMgr.cpp
|
||||
Skills/SkillDiscovery.cpp
|
||||
Skills/SkillExtraItems.cpp
|
||||
Spells/Auras/SpellAuras.cpp
|
||||
Spells/Auras/SpellAuraEffects.cpp
|
||||
Spells/Auras/SpellEffects.cpp
|
||||
Spells/Spell.cpp
|
||||
Spells/SpellMgr.cpp
|
||||
Tools/PlayerDump.cpp
|
||||
Tools/Tools.cpp
|
||||
Weather/Weather.cpp
|
||||
World/World.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${ACE_INCLUDE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/dep/include
|
||||
${CMAKE_SOURCE_DIR}/src/server/framework
|
||||
${CMAKE_SOURCE_DIR}/externals/mersennetwister
|
||||
${CMAKE_SOURCE_DIR}/externals/zlib
|
||||
${CMAKE_SOURCE_DIR}/src/server/collision
|
||||
${CMAKE_SOURCE_DIR}/src/server/collision/Management
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/vmap
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Database
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/DataStores
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/CountedReference
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Packets
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Policies
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Threading
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
|
||||
${CMAKE_SOURCE_DIR}/src/server/game
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Account
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Accounts
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Achievements
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Addons
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/AuctionHouseBot
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds/Zones
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Chat
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Combat
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/ConditionMgr
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Events
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Globals
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Grids
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Groups
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Guilds
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Instances
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/LookingForGroup
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Loot
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Mails
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Map
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Map/Cell
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Map/Grid
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Maps
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Movement
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Opcodes
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP/Zones
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Pools
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Quests
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Reputation
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/ScriptMgr
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Scripting
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol/Handlers
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Server
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Skills
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Spells
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
|
||||
@@ -375,33 +265,37 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Weather
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/World
|
||||
${MYSQL_INCLUDE_DIR}
|
||||
${ACE_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if(NOT DO_SCRIPTS)
|
||||
SET(game_STAT_SRCS ${game_STAT_SRCS}
|
||||
AI/ScriptedAI/ScriptedEscortAI.cpp
|
||||
AI/ScriptedAI/ScriptedEscortAI.h
|
||||
ScriptMgr/ScriptedPch.cpp
|
||||
ScriptMgr/ScriptedPch.h
|
||||
AI/ScriptedAI/ScriptedCreature.cpp
|
||||
AI/ScriptedAI/ScriptedCreature.h
|
||||
AI/ScriptedAI/ScriptedFollowerAI.cpp
|
||||
AI/ScriptedAI/ScriptedFollowerAI.h
|
||||
AI/ScriptedAI/ScriptedGossip.h
|
||||
AI/ScriptedAI/ScriptedGuardAI.cpp
|
||||
AI/ScriptedAI/ScriptedGuardAI.h
|
||||
AI/ScriptedAI/ScriptedInstance.h
|
||||
AI/ScriptedAI/ScriptedSimpleAI.cpp
|
||||
AI/ScriptedAI/ScriptedSimpleAI.h
|
||||
)
|
||||
message("-- Added Script Engine to GAME lib")
|
||||
endif(NOT DO_SCRIPTS)
|
||||
set(game_STAT_SRCS
|
||||
${game_STAT_SRCS}
|
||||
AI/ScriptedAI/ScriptedEscortAI.cpp
|
||||
AI/ScriptedAI/ScriptedCreature.cpp
|
||||
AI/ScriptedAI/ScriptedFollowerAI.cpp
|
||||
AI/ScriptedAI/ScriptedGuardAI.cpp
|
||||
AI/ScriptedAI/ScriptedSimpleAI.cpp
|
||||
)
|
||||
message("-- Added basic scriptAI-engines to GAME library")
|
||||
endif()
|
||||
|
||||
# Add gamePCH.cpp to project on Windows
|
||||
if(MSVC)
|
||||
set(game_STAT_SRCS
|
||||
PrecompiledHeaders/gamePCH.cpp
|
||||
${game_STAT_SRCS})
|
||||
endif()
|
||||
|
||||
add_library(game STATIC ${game_STAT_SRCS})
|
||||
ADD_DEPENDENCIES(game revision.h)
|
||||
|
||||
add_dependencies(game revision.h)
|
||||
|
||||
# Generate precompiled header
|
||||
IF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
ADD_PRECOMPILED_HEADER(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/pchlinux.h)
|
||||
ENDIF(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(DO_PCH)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH.h)
|
||||
elseif(MSVC)
|
||||
add_native_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -707,6 +707,14 @@ void Channel::Invite(uint64 p, const char *newname)
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsBanned(newp->GetGUID()))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakePlayerInviteBanned(&data, newname);
|
||||
SendToOne(&data, p);
|
||||
return;
|
||||
}
|
||||
|
||||
Player *plr = objmgr.GetPlayer(p);
|
||||
if (!plr)
|
||||
return;
|
||||
@@ -983,10 +991,10 @@ void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good)
|
||||
}
|
||||
|
||||
// done 0x16
|
||||
void Channel::MakePlayerNotBanned(WorldPacket *data, uint64 guid)
|
||||
void Channel::MakePlayerNotBanned(WorldPacket *data, const std::string &name)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << name;
|
||||
}
|
||||
|
||||
// done 0x17
|
||||
@@ -1035,10 +1043,10 @@ void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name)
|
||||
}
|
||||
|
||||
// done 0x1E
|
||||
void Channel::MakePlayerInviteBanned(WorldPacket *data, uint64 guid)
|
||||
void Channel::MakePlayerInviteBanned(WorldPacket *data, const std::string& name)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
|
||||
*data << uint64(guid);
|
||||
*data << name;
|
||||
}
|
||||
|
||||
// done 0x1F
|
||||
|
||||
@@ -187,7 +187,7 @@ class Channel
|
||||
void MakeBanned(WorldPacket *data); //? 0x13
|
||||
void MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x14
|
||||
void MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x15
|
||||
void MakePlayerNotBanned(WorldPacket *data, uint64 guid); //? 0x16
|
||||
void MakePlayerNotBanned(WorldPacket *data, const std::string& name); //? 0x16
|
||||
void MakePlayerAlreadyMember(WorldPacket *data, uint64 guid); //+ 0x17
|
||||
void MakeInvite(WorldPacket *data, uint64 guid); //? 0x18
|
||||
void MakeInviteWrongFaction(WorldPacket *data); //? 0x19
|
||||
@@ -195,7 +195,7 @@ class Channel
|
||||
void MakeInvalidName(WorldPacket *data); //? 0x1B
|
||||
void MakeNotModerated(WorldPacket *data); //? 0x1C
|
||||
void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D
|
||||
void MakePlayerInviteBanned(WorldPacket *data, uint64 guid); //? 0x1E
|
||||
void MakePlayerInviteBanned(WorldPacket *data, const std::string &name);//? 0x1E
|
||||
void MakeThrottled(WorldPacket *data); //? 0x1F
|
||||
void MakeNotInArea(WorldPacket *data); //? 0x20
|
||||
void MakeNotInLfg(WorldPacket *data); //? 0x21
|
||||
|
||||
@@ -17,21 +17,18 @@
|
||||
*/
|
||||
|
||||
#include "ChannelMgr.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "World.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(AllianceChannelMgr);
|
||||
INSTANTIATE_SINGLETON_1(HordeChannelMgr);
|
||||
#include "World.h"
|
||||
|
||||
ChannelMgr* channelMgr(uint32 team)
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
return &Trinity::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
|
||||
|
||||
if (team == ALLIANCE)
|
||||
return &Trinity::Singleton<AllianceChannelMgr>::Instance();
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
|
||||
if (team == HORDE)
|
||||
return &Trinity::Singleton<HordeChannelMgr>::Instance();
|
||||
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -22,14 +22,11 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Channel.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "Policies/Singleton.h"
|
||||
|
||||
#include "Channel.h"
|
||||
#include "World.h"
|
||||
|
||||
class ChannelMgr
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "CellImpl.h"
|
||||
@@ -133,11 +133,13 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
static ChatCommand channelSetCommandTable[] =
|
||||
{
|
||||
{ "public", SEC_ADMINISTRATOR, true, &ChatHandler::HandleChannelSetPublic, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand channelCommandTable[] =
|
||||
{
|
||||
{ "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand debugPlayCommandTable[] =
|
||||
@@ -460,6 +462,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "creature_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand,"",NULL },
|
||||
{ "creature_linked_respawn", SEC_GAMEMASTER, true, &ChatHandler::HandleReloadCreatureLinkedRespawnCommand, "", NULL },
|
||||
{ "creature_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL },
|
||||
{ "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadOnKillReputationCommand, "", NULL },
|
||||
{ "creature_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL },
|
||||
{ "creature_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureTemplateCommand, "", NULL },
|
||||
//{ "db_script_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDbScriptStringCommand, "", NULL },
|
||||
@@ -476,10 +479,12 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuOptionCommand, "", NULL },
|
||||
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL },
|
||||
{ "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
|
||||
{ "item_set_names", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemSetNamesCommand, "", NULL },
|
||||
{ "locales_achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesAchievementRewardCommand,"", NULL },
|
||||
{ "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL },
|
||||
{ "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL },
|
||||
{ "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL },
|
||||
{ "locales_item_set_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemSetNameCommand, "", NULL },
|
||||
{ "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL },
|
||||
{ "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL },
|
||||
{ "locales_points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPointsOfInterestCommand, "", NULL },
|
||||
|
||||
@@ -364,6 +364,7 @@ class ChatHandler
|
||||
bool HandleReloadEventAISummonsCommand(const char* args);
|
||||
bool HandleReloadEventAIScriptsCommand(const char* args);
|
||||
bool HandleReloadCommandCommand(const char* args);
|
||||
bool HandleReloadOnKillReputationCommand(const char* args);
|
||||
bool HandleReloadCreatureTemplateCommand(const char* args);
|
||||
bool HandleReloadCreatureQuestRelationsCommand(const char* args);
|
||||
bool HandleReloadCreatureQuestInvRelationsCommand(const char* args);
|
||||
@@ -377,10 +378,12 @@ class ChatHandler
|
||||
bool HandleReloadGOQuestRelationsCommand(const char* args);
|
||||
bool HandleReloadGOQuestInvRelationsCommand(const char* args);
|
||||
bool HandleReloadItemEnchantementsCommand(const char* args);
|
||||
bool HandleReloadItemSetNamesCommand(const char* args);
|
||||
bool HandleReloadLocalesAchievementRewardCommand(const char* args);
|
||||
bool HandleReloadLocalesCreatureCommand(const char* args);
|
||||
bool HandleReloadLocalesGameobjectCommand(const char* args);
|
||||
bool HandleReloadLocalesItemCommand(const char* args);
|
||||
bool HandleReloadLocalesItemSetNameCommand(const char* args);
|
||||
bool HandleReloadLocalesNpcTextCommand(const char* args);
|
||||
bool HandleReloadLocalesPageTextCommand(const char* args);
|
||||
bool HandleReloadLocalesPointsOfInterestCommand(const char* args);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Player.h"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "World.h"
|
||||
#include "Player.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -87,7 +87,7 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
|
||||
}
|
||||
|
||||
// cast spell Stuck
|
||||
chr->CastSpell(chr,7355,false);
|
||||
chr->CastSpell(chr, 7355, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -103,14 +103,6 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
||||
uint32 updateTime = sWorld.GetUpdateTime();
|
||||
|
||||
PSendSysMessage(_FULLVERSION);
|
||||
//if (m_session)
|
||||
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
|
||||
//else
|
||||
// full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID);
|
||||
|
||||
//SendSysMessage(full);
|
||||
//PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
|
||||
//PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion());
|
||||
PSendSysMessage(LANG_CONNECTED_PLAYERS, PlayersNum, MaxPlayersNum);
|
||||
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||
PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
||||
@@ -143,9 +135,9 @@ bool ChatHandler::HandleDismountCommand(const char* /*args*/)
|
||||
|
||||
bool ChatHandler::HandleSaveCommand(const char* /*args*/)
|
||||
{
|
||||
Player *player=m_session->GetPlayer();
|
||||
Player *player = m_session->GetPlayer();
|
||||
|
||||
// save GM account without delay and output message (testing, etc)
|
||||
// save GM account without delay and output message
|
||||
if (m_session->GetSecurity() > SEC_PLAYER)
|
||||
{
|
||||
player->SaveToDB();
|
||||
@@ -153,9 +145,9 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
// save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning
|
||||
// save if the player has last been saved over 20 seconds ago
|
||||
uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
|
||||
if ((save_interval == 0 || save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS))
|
||||
if ((save_interval == 0 || save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
|
||||
player->SaveToDB();
|
||||
|
||||
return true;
|
||||
@@ -165,8 +157,8 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
|
||||
{
|
||||
bool first = true;
|
||||
|
||||
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType &m = ObjectAccessor::Instance().GetPlayers();
|
||||
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
|
||||
HashMapHolder<Player>::MapType &m = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
|
||||
@@ -192,35 +184,42 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_CMD_SYNTAX);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char *old_pass = strtok ((char*)args, " ");
|
||||
char *new_pass = strtok (NULL, " ");
|
||||
char *new_pass_c = strtok (NULL, " ");
|
||||
char *old_pass = strtok((char*)args, " ");
|
||||
char *new_pass = strtok(NULL, " ");
|
||||
char *new_pass_c = strtok(NULL, " ");
|
||||
|
||||
if (!old_pass || !new_pass || !new_pass_c)
|
||||
{
|
||||
SendSysMessage(LANG_CMD_SYNTAX);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string password_old = old_pass;
|
||||
std::string password_new = new_pass;
|
||||
std::string password_new_c = new_pass_c;
|
||||
|
||||
if (strcmp(new_pass, new_pass_c) != 0)
|
||||
if (!accmgr.CheckPassword(m_session->GetAccountId(), password_old))
|
||||
{
|
||||
SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!accmgr.CheckPassword (m_session->GetAccountId(), password_old))
|
||||
if (strcmp(new_pass, new_pass_c) != 0)
|
||||
{
|
||||
SendSysMessage (LANG_COMMAND_WRONGOLDPASSWORD);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = accmgr.ChangePassword(m_session->GetAccountId(), password_new);
|
||||
|
||||
switch(result)
|
||||
{
|
||||
case AOR_OK:
|
||||
@@ -230,7 +229,6 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
||||
SendSysMessage(LANG_PASSWORD_TOO_LONG);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
case AOR_NAME_NOT_EXIST: // not possible case, don't want get account name for output
|
||||
default:
|
||||
SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -243,15 +241,23 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
||||
bool ChatHandler::HandleAccountAddonCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_CMD_SYNTAX);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char *szExp = strtok((char*)args," ");
|
||||
char *szExp = strtok((char*)args, " ");
|
||||
|
||||
uint32 account_id = m_session->GetAccountId();
|
||||
|
||||
int expansion=atoi(szExp); //get int anyway (0 if error)
|
||||
int expansion = atoi(szExp); //get int anyway (0 if error)
|
||||
if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
{
|
||||
SendSysMessage(LANG_IMPROPER_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// No SQL injection
|
||||
LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id);
|
||||
@@ -264,7 +270,8 @@ bool ChatHandler::HandleAccountLockCommand(const char* args)
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
return true;
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string argstr = (char*)args;
|
||||
@@ -283,7 +290,8 @@ bool ChatHandler::HandleAccountLockCommand(const char* args)
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
return true;
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Display the 'Message of the day' for the realm
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "World.h"
|
||||
@@ -817,7 +817,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||
if (pMap->IsBattleGroundOrArena())
|
||||
{
|
||||
// only allow if gm mode is on
|
||||
if (!target->isGameMaster())
|
||||
if (!_player->isGameMaster())
|
||||
{
|
||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
@@ -2381,7 +2381,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args)
|
||||
//Save all players in the world
|
||||
bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
|
||||
{
|
||||
ObjectAccessor::Instance().SaveAllPlayers();
|
||||
sObjectAccessor.SaveAllPlayers();
|
||||
SendSysMessage(LANG_PLAYERS_SAVED);
|
||||
return true;
|
||||
}
|
||||
@@ -2502,7 +2502,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
|
||||
|
||||
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetTrinityString(LANG_OFFLINE), tele->name.c_str());
|
||||
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
|
||||
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
|
||||
sMapMgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2768,7 +2768,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
|
||||
else
|
||||
_player->SaveRecallPosition();
|
||||
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid);
|
||||
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
||||
|
||||
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
||||
@@ -2861,7 +2861,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
|
||||
// update to parent zone if exist (client map show only zones without parents)
|
||||
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
|
||||
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
|
||||
Map const *map = sMapMgr.CreateBaseMap(zoneEntry->mapid);
|
||||
|
||||
if (map->Instanceable())
|
||||
{
|
||||
@@ -2936,7 +2936,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
|
||||
else
|
||||
_player->SaveRecallPosition();
|
||||
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid);
|
||||
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
||||
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "World.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "PoolHandler.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "WaypointManager.h"
|
||||
#include "Util.h"
|
||||
@@ -1672,7 +1672,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
|
||||
if (/*creature->GetMotionMaster()->empty() ||*/
|
||||
creature->GetMotionMaster()->GetCurrentMovementGeneratorType () != TARGETED_MOTION_TYPE)
|
||||
{
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -1682,7 +1682,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
|
||||
|
||||
if (mgen->GetTarget() != player)
|
||||
{
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -2844,7 +2844,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||
wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map);
|
||||
map->Add(wpCreature2);
|
||||
//MapManager::Instance().GetMap(npcCreature->GetMapId())->Add(wpCreature2);
|
||||
//sMapMgr.GetMap(npcCreature->GetMapId())->Add(wpCreature2);
|
||||
}
|
||||
|
||||
WorldDatabase.PExecuteLog("UPDATE waypoint_data SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'",
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "World.h"
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SkillExtraItems.h"
|
||||
#include "SystemConfig.h"
|
||||
#include "Config/ConfigEnv.h"
|
||||
#include "ConfigEnv.h"
|
||||
#include "Util.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
@@ -689,7 +689,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)
|
||||
{
|
||||
sLog.outString("Re-Loading config settings...");
|
||||
sWorld.LoadConfigSettings(true);
|
||||
MapManager::Instance().InitializeVisibilityDistanceInfo();
|
||||
sMapMgr.InitializeVisibilityDistanceInfo();
|
||||
SendGlobalGMSysMessage("World config settings reloaded.");
|
||||
return true;
|
||||
}
|
||||
@@ -749,6 +749,14 @@ bool ChatHandler::HandleReloadCommandCommand(const char*)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadOnKillReputationCommand(const char*)
|
||||
{
|
||||
sLog.outString("Re-Loading creature award reputation definitions...");
|
||||
objmgr.LoadReputationOnKill();
|
||||
SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
@@ -787,24 +795,21 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
|
||||
size_t len = 0;
|
||||
if (const char* temp = fields[9].GetString())
|
||||
{
|
||||
if (cInfo->Name)
|
||||
delete cInfo->Name;
|
||||
delete[] cInfo->Name;
|
||||
len = strlen(temp)+1;
|
||||
const_cast<CreatureInfo*>(cInfo)->Name = new char[len];
|
||||
strncpy(cInfo->Name, temp, len);
|
||||
}
|
||||
if (const char* temp = fields[10].GetString())
|
||||
{
|
||||
if (cInfo->SubName)
|
||||
delete cInfo->SubName;
|
||||
delete[] cInfo->SubName;
|
||||
len = strlen(temp)+1;
|
||||
const_cast<CreatureInfo*>(cInfo)->SubName = new char[len];
|
||||
strncpy(cInfo->SubName, temp, len);
|
||||
}
|
||||
if (const char* temp = fields[11].GetString())
|
||||
{
|
||||
if (cInfo->IconName)
|
||||
delete cInfo->IconName;
|
||||
delete[] cInfo->IconName;
|
||||
len = strlen(temp)+1;
|
||||
const_cast<CreatureInfo*>(cInfo)->IconName = new char[len];
|
||||
strncpy(cInfo->IconName, temp, len);
|
||||
@@ -863,8 +868,7 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
|
||||
const_cast<CreatureInfo*>(cInfo)->maxgold = fields[63].GetUInt32();
|
||||
if (const char* temp = fields[64].GetString())
|
||||
{
|
||||
if (cInfo->AIName)
|
||||
delete cInfo->AIName;
|
||||
delete[] cInfo->AIName;
|
||||
len = strlen(temp)+1;
|
||||
const_cast<CreatureInfo*>(cInfo)->AIName = new char[len];
|
||||
strncpy(const_cast<char*>(cInfo->AIName), temp, len);
|
||||
@@ -1276,6 +1280,14 @@ bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadItemSetNamesCommand(const char*)
|
||||
{
|
||||
sLog.outString("Re-Loading Item set names...");
|
||||
LoadRandomEnchantmentsTable();
|
||||
SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg)
|
||||
{
|
||||
if (sWorld.IsScriptScheduled())
|
||||
@@ -1494,6 +1506,14 @@ bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadLocalesItemSetNameCommand(const char* /*arg*/)
|
||||
{
|
||||
sLog.outString("Re-Loading Locales Item set name... ");
|
||||
objmgr.LoadItemSetNameLocales();
|
||||
SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/)
|
||||
{
|
||||
sLog.outString("Re-Loading Locales NPC Text ... ");
|
||||
@@ -4493,7 +4513,7 @@ bool ChatHandler::HandleReviveCommand(const char *args)
|
||||
}
|
||||
else
|
||||
// will resurrected at login without corpse
|
||||
ObjectAccessor::Instance().ConvertCorpseForPlayer(target_guid);
|
||||
sObjectAccessor.ConvertCorpseForPlayer(target_guid);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -5513,8 +5533,8 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin);
|
||||
|
||||
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& plist = ObjectAccessor::Instance().GetPlayers();
|
||||
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
|
||||
HashMapHolder<Player>::MapType const& plist = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
|
||||
itr->second->SetAtLoginFlag(atLogin);
|
||||
|
||||
@@ -7000,8 +7020,8 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
|
||||
|
||||
bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
|
||||
{
|
||||
PSendSysMessage("instances loaded: %d", MapManager::Instance().GetNumInstances());
|
||||
PSendSysMessage("players in instances: %d", MapManager::Instance().GetNumPlayersInInstances());
|
||||
PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances());
|
||||
PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances());
|
||||
PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves());
|
||||
PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal());
|
||||
PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal());
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define _HOSTILEREFMANAGER
|
||||
|
||||
#include "Common.h"
|
||||
#include "Utilities/LinkedReference/RefManager.h"
|
||||
#include "RefManager.h"
|
||||
|
||||
class Unit;
|
||||
class ThreatManager;
|
||||
|
||||
@@ -36,8 +36,13 @@
|
||||
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
|
||||
{
|
||||
if (pThreatSpell)
|
||||
{
|
||||
if (pThreatSpell->AttributesEx & SPELL_ATTR_EX_NO_THREAT)
|
||||
return 0.0f;
|
||||
|
||||
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, fThreat);
|
||||
}
|
||||
|
||||
return pHatedUnit->ApplyTotalThreatModifier(fThreat, schoolMask);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Utilities/LinkedReference/Reference.h"
|
||||
#include "LinkedReference/Reference.h"
|
||||
#include "UnitEvents.h"
|
||||
|
||||
#include <list>
|
||||
@@ -35,7 +35,7 @@ class Creature;
|
||||
class ThreatManager;
|
||||
struct SpellEntry;
|
||||
|
||||
#define THREAT_UPDATE_INTERVAL 1 * IN_MILISECONDS // Server should send threat update to client periodically each second
|
||||
#define THREAT_UPDATE_INTERVAL 1 * IN_MILLISECONDS // Server should send threat update to client periodically each second
|
||||
|
||||
//==============================================================
|
||||
// Class to calculate the real threat based
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
#include "Player.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -29,12 +29,10 @@
|
||||
#include "InstanceData.h"
|
||||
#include "ConditionMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(ConditionMgr);
|
||||
|
||||
// Checks if player meets the condition
|
||||
// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI)
|
||||
bool Condition::Meets(Player * player, Unit* targetOverride)
|
||||
{
|
||||
{
|
||||
if (!player)
|
||||
{
|
||||
sLog.outDebug("Condition player not found");
|
||||
@@ -126,7 +124,7 @@ bool Condition::Meets(Player * player, Unit* targetOverride)
|
||||
break;
|
||||
}
|
||||
case CONDITION_SPELL_SCRIPT_TARGET:
|
||||
condMeets = true;//spell target condition is handled in spellsystem, here it is always true
|
||||
condMeets = true;//spell target condition is handled in spellsystem, here it is always true
|
||||
refId = 0;//cant have references! use CONDITION_SOURCE_TYPE_SPELL for it
|
||||
break;
|
||||
case CONDITION_CREATURE_TARGET:
|
||||
@@ -165,7 +163,7 @@ bool Condition::Meets(Player * player, Unit* targetOverride)
|
||||
break;
|
||||
case CONDITION_ITEM_TARGET:
|
||||
{
|
||||
condMeets = true;//handled in Item::IsTargetValidForItemUse
|
||||
condMeets = true;//handled in Item::IsTargetValidForItemUse
|
||||
refId = 0;//cant have references for now
|
||||
break;
|
||||
}
|
||||
@@ -201,6 +199,7 @@ ConditionMgr::ConditionMgr()
|
||||
|
||||
ConditionMgr::~ConditionMgr()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
ConditionList ConditionMgr::GetConditionReferences(uint32 refId)
|
||||
@@ -236,12 +235,12 @@ bool ConditionMgr::IsPlayerMeetToConditionList(Player* player,const ConditionLis
|
||||
}else{
|
||||
sLog.outDebug("IsPlayerMeetToConditionList: Reference template -%u not found", (*i)->mReferenceId);//checked at loading, should never happen
|
||||
}
|
||||
|
||||
|
||||
} else//handle normal condition
|
||||
{
|
||||
if (!(*i)->Meets(player, targetOverride))
|
||||
ElseGroupMap[(*i)->mElseGroup] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std::map<uint32, bool>::const_iterator i = ElseGroupMap.begin(); i != ElseGroupMap.end(); ++i)
|
||||
@@ -273,7 +272,7 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
|
||||
{
|
||||
ConditionMap::const_iterator itr = m_ConditionMap.find(sType);
|
||||
if (itr != m_ConditionMap.end())
|
||||
{
|
||||
{
|
||||
ConditionTypeMap::const_iterator i = (*itr).second.find(uEntry);
|
||||
if (i != (*itr).second.end())
|
||||
{
|
||||
@@ -287,8 +286,8 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
|
||||
|
||||
void ConditionMgr::LoadConditions(bool isReload)
|
||||
{
|
||||
m_ConditionMap.clear(); // for reload case
|
||||
m_ConditionReferenceMap.clear(); // for reload case
|
||||
Clean();
|
||||
|
||||
//must clear all custom handled cases (groupped types) before reload
|
||||
if (isReload)
|
||||
{
|
||||
@@ -336,11 +335,11 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
Condition* cond = new Condition();
|
||||
int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
|
||||
int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
|
||||
cond->mSourceGroup = fields[1].GetUInt32();
|
||||
cond->mSourceEntry = fields[2].GetUInt32();
|
||||
cond->mElseGroup = fields[3].GetUInt32();
|
||||
int32 iConditionTypeOrReference = fields[4].GetInt32();
|
||||
int32 iConditionTypeOrReference = fields[4].GetInt32();
|
||||
cond->mConditionValue1 = fields[5].GetUInt32();
|
||||
cond->mConditionValue2 = fields[6].GetUInt32();
|
||||
cond->mConditionValue3 = fields[7].GetUInt32();
|
||||
@@ -351,9 +350,10 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
|
||||
if (iConditionTypeOrReference < 0)//it has a reference
|
||||
{
|
||||
if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skipp
|
||||
if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip
|
||||
{
|
||||
sLog.outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId);
|
||||
delete cond;
|
||||
continue;
|
||||
}
|
||||
cond->mReferenceId = uint32(abs(iConditionTypeOrReference));
|
||||
@@ -373,8 +373,10 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
if (cond->mSourceEntry && iSourceTypeOrReferenceId < 0)
|
||||
sLog.outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->mSourceEntry);
|
||||
}else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType
|
||||
continue;
|
||||
|
||||
{
|
||||
delete cond;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (iSourceTypeOrReferenceId < 0)//it is a reference template
|
||||
{
|
||||
@@ -390,15 +392,19 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
}//end of reference templates
|
||||
|
||||
cond->mSourceType = ConditionSourceType(iSourceTypeOrReferenceId);
|
||||
|
||||
|
||||
//if not a reference and SourceType is invalid, skip
|
||||
if (iConditionTypeOrReference >= 0 && !isSourceTypeValid(cond))
|
||||
{
|
||||
delete cond;
|
||||
continue;
|
||||
}
|
||||
|
||||
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
|
||||
if (cond->mSourceGroup && !isGroupable(cond->mSourceType))
|
||||
{
|
||||
sLog.outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->mSourceType), cond->mSourceGroup);
|
||||
delete cond;
|
||||
continue;
|
||||
}else if (cond->mSourceGroup)
|
||||
{
|
||||
@@ -450,9 +456,15 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
break;
|
||||
}
|
||||
if (!bIsDone)
|
||||
{
|
||||
sLog.outErrorDb("Not handled grouped condition, SourceGroup %u", cond->mSourceGroup);
|
||||
delete cond;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AllocatedMemory.push_back(cond);
|
||||
++count;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -505,11 +517,10 @@ bool ConditionMgr::addToGossipMenus(Condition* cond)
|
||||
if ((*itr).second.entry == cond->mSourceGroup && (*itr).second.text_id == cond->mSourceEntry)
|
||||
{
|
||||
(*itr).second.conditions.push_back(cond);
|
||||
sLog.outDebug("addToGossipMenus: entry %u textId %u", cond->mSourceGroup, cond->mSourceEntry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sLog.outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->mSourceGroup);
|
||||
return false;
|
||||
}
|
||||
@@ -524,12 +535,11 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
|
||||
if ((*itr).second.menu_id == cond->mSourceGroup && (*itr).second.id == cond->mSourceEntry)
|
||||
{
|
||||
(*itr).second.conditions.push_back(cond);
|
||||
//sLog.outDebug("addToGossipMenuItems: menuId %u id %u", cond->mSourceGroup, cond->mSourceEntry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
sLog.outErrorDb("addToGossipMenuItems: GossipMenuIt %u Item %u not found", cond->mSourceGroup, cond->mSourceEntry);
|
||||
sLog.outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->mSourceGroup, cond->mSourceEntry);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -591,7 +601,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
break;
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE:
|
||||
{
|
||||
{
|
||||
if (!LootTemplates_Gameobject.HaveLootFor(cond->mSourceGroup))
|
||||
{
|
||||
sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->mSourceGroup);
|
||||
@@ -607,7 +617,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
break;
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE:
|
||||
{
|
||||
{
|
||||
if (!LootTemplates_Item.HaveLootFor(cond->mSourceGroup))
|
||||
{
|
||||
sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->mSourceGroup);
|
||||
@@ -776,7 +786,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE:
|
||||
{
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mSourceEntry))
|
||||
@@ -1043,10 +1053,10 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
|
||||
{
|
||||
sLog.outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->mConditionValue1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
switch(cond->mConditionValue1)
|
||||
{
|
||||
case SPELL_TARGET_TYPE_GAMEOBJECT:
|
||||
case SPELL_TARGET_TYPE_GAMEOBJECT:
|
||||
{
|
||||
if (cond->mConditionValue2 && !sGOStorage.LookupEntry<GameObjectInfo>(cond->mConditionValue2))
|
||||
{
|
||||
@@ -1143,3 +1153,31 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConditionMgr::Clean()
|
||||
{
|
||||
for (ConditionReferenceMap::iterator itr = m_ConditionReferenceMap.begin(); itr != m_ConditionReferenceMap.end(); ++itr)
|
||||
{
|
||||
for (ConditionList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
|
||||
delete *it;
|
||||
itr->second.clear();
|
||||
}
|
||||
m_ConditionReferenceMap.clear();
|
||||
|
||||
for (ConditionMap::iterator itr = m_ConditionMap.begin(); itr != m_ConditionMap.end(); ++itr)
|
||||
{
|
||||
for (ConditionTypeMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
|
||||
{
|
||||
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
|
||||
delete *i;
|
||||
it->second.clear();
|
||||
}
|
||||
itr->second.clear();
|
||||
}
|
||||
m_ConditionMap.clear();
|
||||
|
||||
// this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;)
|
||||
for (std::list<Condition*>::const_iterator itr = m_AllocatedMemory.begin(); itr != m_AllocatedMemory.end(); ++itr)
|
||||
delete *itr;
|
||||
m_AllocatedMemory.clear();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ enum ConditionType
|
||||
CONDITION_CLASS = 15, // class 0 +referenceID true if player's class is equal to class
|
||||
CONDITION_RACE = 16, // race 0 +referenceID true if player's race is equal to race
|
||||
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 +referenceID true if achievement is complete
|
||||
CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0
|
||||
CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0
|
||||
CONDITION_CREATURE_TARGET = 19, // creature entry 0 +referenceID true if current target is creature with value1 entry
|
||||
CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 +referenceID true if target's health is below value1 percent, false if over or no target
|
||||
CONDITION_TARGET_RANGE = 21, // minDistance maxDist +referenceID true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit
|
||||
@@ -84,7 +84,7 @@ enum ConditionSourceType
|
||||
#define MAX_CONDITIONSOURCETYPE 19
|
||||
|
||||
struct Condition
|
||||
{
|
||||
{
|
||||
ConditionSourceType mSourceType; //SourceTypeOrReferenceId
|
||||
uint32 mSourceGroup;
|
||||
uint32 mSourceEntry;
|
||||
@@ -121,14 +121,16 @@ typedef std::map<uint32, ConditionList > ConditionReferenceMap;//only used for r
|
||||
|
||||
class ConditionMgr
|
||||
{
|
||||
friend class ACE_Singleton<ConditionMgr, ACE_Null_Mutex>;
|
||||
ConditionMgr();
|
||||
|
||||
public:
|
||||
ConditionMgr();
|
||||
~ConditionMgr();
|
||||
|
||||
void LoadConditions(bool isReload = false);
|
||||
bool isConditionTypeValid(Condition* cond);
|
||||
ConditionList GetConditionReferences(uint32 refId);
|
||||
|
||||
|
||||
bool IsPlayerMeetToConditions(Player* player, ConditionList conditions, Unit* targetOverride = NULL);
|
||||
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sType, uint32 uEntry);
|
||||
|
||||
@@ -160,8 +162,11 @@ class ConditionMgr
|
||||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU ||
|
||||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION);
|
||||
}
|
||||
|
||||
void Clean(); // free up resources
|
||||
std::list<Condition*> m_AllocatedMemory; // some garbage collection :)
|
||||
};
|
||||
|
||||
#define sConditionMgr Trinity::Singleton<ConditionMgr>::Instance()
|
||||
#define sConditionMgr (*ACE_Singleton<ConditionMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
#include "DBCStores.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include "Logging/Log.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -235,15 +235,15 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
|
||||
else
|
||||
errlist.push_back(dbc_filename);
|
||||
}
|
||||
if (sql)
|
||||
delete sql;
|
||||
|
||||
delete sql;
|
||||
}
|
||||
|
||||
void LoadDBCStores(const std::string& dataPath)
|
||||
{
|
||||
std::string dbcPath = dataPath+"dbc/";
|
||||
|
||||
const uint32 DBCFilesCount = 87;
|
||||
const uint32 DBCFilesCount = 89;
|
||||
|
||||
barGoLink bar(DBCFilesCount);
|
||||
|
||||
@@ -506,8 +506,7 @@ void LoadDBCStores(const std::string& dataPath)
|
||||
// fill data
|
||||
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
|
||||
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
||||
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
|
||||
sTaxiPathNodeStore.Clear();
|
||||
sTaxiPathNodesByPath[entry->path].set(entry->index, entry);
|
||||
|
||||
// Initialize global taxinodes mask
|
||||
// include existed nodes that have at least single not spell base (scripted) path
|
||||
@@ -579,7 +578,7 @@ void LoadDBCStores(const std::string& dataPath)
|
||||
// error checks
|
||||
if (bad_dbc_files.size() >= DBCFilesCount)
|
||||
{
|
||||
sLog.outError("\nIncorrect DataDir value in Trinityd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
|
||||
sLog.outError("\nIncorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
|
||||
exit(1);
|
||||
}
|
||||
else if (!bad_dbc_files.empty())
|
||||
@@ -593,13 +592,13 @@ void LoadDBCStores(const std::string& dataPath)
|
||||
}
|
||||
|
||||
// Check loaded DBC files proper version
|
||||
if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.3a
|
||||
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.3a
|
||||
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.3a
|
||||
!sItemStore.LookupEntry(54860) || // last gem property added in 3.3.3a
|
||||
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.3a
|
||||
!sMapStore.LookupEntry(724) || // last map added in 3.3.3a
|
||||
!sSpellStore.LookupEntry(76567) ) // last client known item added in 3.3.3a
|
||||
if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.5a
|
||||
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
|
||||
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
|
||||
!sItemStore.LookupEntry(56806) || // last gem property added in 3.3.5a
|
||||
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
|
||||
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
|
||||
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
|
||||
{
|
||||
sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client.");
|
||||
exit(1);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#define TRINITY_DBCSTORES_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DBCStore.h"
|
||||
#include "DBCStore.h"
|
||||
#include "DBCStructure.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
#ifndef TRINITY_DBCSTRUCTURE_H
|
||||
#define TRINITY_DBCSTRUCTURE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "Platform/Define.h"
|
||||
#include "Define.h"
|
||||
#include "Path.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include <map>
|
||||
@@ -1080,12 +1082,14 @@ struct ItemRandomSuffixEntry
|
||||
uint32 prefix[5]; // 22-24 m_allocationPct
|
||||
};
|
||||
|
||||
#define MAX_ITEM_SET_ITEMS 10
|
||||
struct ItemSetEntry
|
||||
{
|
||||
//uint32 id // 0 m_ID
|
||||
char* name[16]; // 1-16 m_name_lang
|
||||
// 17 string flags, unused
|
||||
//uint32 itemId[17]; // 18-34 m_itemID
|
||||
uint32 itemId[MAX_ITEM_SET_ITEMS]; // 18-27 m_itemID
|
||||
//uint32 unknown[7]; // 28-34 unk, all 0
|
||||
uint32 spells[8]; // 35-42 m_setSpellID
|
||||
uint32 items_to_triggerspell[8]; // 43-50 m_setThreshold
|
||||
uint32 required_skill_id; // 51 m_requiredSkill
|
||||
@@ -1509,9 +1513,6 @@ struct SpellEntry
|
||||
//uint32 spellDescriptionVariableID; // 232 3.2.0
|
||||
//uint32 SpellDifficultyId; // 233 3.3.0
|
||||
|
||||
// helpers
|
||||
int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(1); }
|
||||
|
||||
private:
|
||||
// prevent creating custom entries (copy data from original in fact)
|
||||
SpellEntry(SpellEntry const&); // DON'T must have implementation
|
||||
@@ -1712,8 +1713,8 @@ struct TaxiPathNodeEntry
|
||||
float z; // 6 m_LocZ
|
||||
uint32 actionFlag; // 7 m_flags
|
||||
uint32 delay; // 8 m_delay
|
||||
// 9 m_arrivalEventID
|
||||
// 10 m_departureEventID
|
||||
uint32 arrivalEventID; // 9 m_arrivalEventID
|
||||
uint32 departureEventID; // 10 m_departureEventID
|
||||
};
|
||||
|
||||
struct TotemCategoryEntry
|
||||
@@ -1909,19 +1910,15 @@ struct TaxiPathBySourceAndDestination
|
||||
typedef std::map<uint32,TaxiPathBySourceAndDestination> TaxiPathSetForSource;
|
||||
typedef std::map<uint32,TaxiPathSetForSource> TaxiPathSetBySource;
|
||||
|
||||
struct TaxiPathNode
|
||||
struct TaxiPathNodePtr
|
||||
{
|
||||
TaxiPathNode() : mapid(0), x(0),y(0),z(0),actionFlag(0),delay(0) {}
|
||||
TaxiPathNode(uint32 _mapid, float _x, float _y, float _z, uint32 _actionFlag, uint32 _delay) : mapid(_mapid), x(_x),y(_y),z(_z),actionFlag(_actionFlag),delay(_delay) {}
|
||||
|
||||
uint32 mapid;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
uint32 actionFlag;
|
||||
uint32 delay;
|
||||
TaxiPathNodePtr() : i_ptr(NULL) {}
|
||||
TaxiPathNodePtr(TaxiPathNodeEntry const* ptr) : i_ptr(ptr) {}
|
||||
TaxiPathNodeEntry const* i_ptr;
|
||||
operator TaxiPathNodeEntry const& () const { return *i_ptr; }
|
||||
};
|
||||
typedef std::vector<TaxiPathNode> TaxiPathNodeList;
|
||||
|
||||
typedef Path<TaxiPathNodePtr,TaxiPathNodeEntry const> TaxiPathNodeList;
|
||||
typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath;
|
||||
|
||||
#define TaxiMaskSize 12
|
||||
|
||||
@@ -72,7 +72,7 @@ const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiix";
|
||||
const char ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxix";
|
||||
const char ItemRandomPropertiesfmt[]="nxiiiiissssssssssssssssx";
|
||||
const char ItemRandomSuffixfmt[]="nssssssssssssssssxxiiiiiiiiii";
|
||||
const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
|
||||
const char ItemSetEntryfmt[]="dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
|
||||
const char LFGDungeonEntryfmt[]="nxxxxxxxxxxxxxxxxxiiiiiiixixxixixxxxxxxxxxxxxxxxx";
|
||||
const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
|
||||
const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxssssssssssssssssx";
|
||||
@@ -95,7 +95,7 @@ const std::string CustomSpellDifficultyfmt="ppppp";
|
||||
const std::string CustomSpellDifficultyIndex="id";
|
||||
const char SpellDurationfmt[]="niii";
|
||||
const char SpellEntryfmt[]="niiiiiiiiiiiixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxxxxxx";
|
||||
const std::string CustomSpellEntryfmt="pappppppppaaaaaapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaaaaapppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa";
|
||||
const std::string CustomSpellEntryfmt="pappppppppaapapapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaaaaapppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa";
|
||||
const std::string CustomSpellEntryIndex = "Id";
|
||||
const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
|
||||
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiii";
|
||||
@@ -110,7 +110,7 @@ const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
|
||||
const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
|
||||
const char TaxiNodesEntryfmt[]="nifffssssssssssssssssxii";
|
||||
const char TaxiPathEntryfmt[]="niii";
|
||||
const char TaxiPathNodeEntryfmt[]="diiifffiixx";
|
||||
const char TaxiPathNodeEntryfmt[]="diiifffiiii";
|
||||
const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
|
||||
const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
|
||||
const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef _LFG_H
|
||||
#define _LFG_H
|
||||
|
||||
#include "Platform/Define.h"
|
||||
#include "Define.h"
|
||||
#include "Object.h"
|
||||
|
||||
enum LfgRoles
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Group.h"
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(LFGMgr);
|
||||
|
||||
/*********************************************************/
|
||||
/*** LFG QUEUES ***/
|
||||
/*********************************************************/
|
||||
@@ -46,8 +44,7 @@ LFGQueue::~LFGQueue()
|
||||
|
||||
void LFGQueue::AddToQueue(uint64 guid, LfgQueueInfo* pqInfo)
|
||||
{
|
||||
if (LfgQueueInfo* qInfo = m_LfgQueue[guid])
|
||||
delete qInfo;
|
||||
delete m_LfgQueue[guid];
|
||||
m_LfgQueue[guid] = pqInfo;
|
||||
// ATM will only add it to the queue... No find group implementation... yet (on purpose)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#define _LFGMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
#include "Group.h"
|
||||
#include "LFG.h"
|
||||
|
||||
@@ -237,43 +237,44 @@ typedef std::map<uint8, LFGQueue *> LFGQueueMap;
|
||||
|
||||
class LFGMgr
|
||||
{
|
||||
public:
|
||||
friend class ACE_Singleton<LFGMgr, ACE_Null_Mutex>;
|
||||
LFGMgr();
|
||||
~LFGMgr();
|
||||
public:
|
||||
~LFGMgr();
|
||||
|
||||
void InitLFG();
|
||||
void SendLfgPlayerInfo(Player *plr);
|
||||
void SendLfgPartyInfo(Player *plr);
|
||||
void Join(Player *plr);
|
||||
void Leave(Player *plr, Group *grp = NULL);
|
||||
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
|
||||
void Update(uint32 diff);
|
||||
void InitLFG();
|
||||
void SendLfgPlayerInfo(Player *plr);
|
||||
void SendLfgPartyInfo(Player *plr);
|
||||
void Join(Player *plr);
|
||||
void Leave(Player *plr, Group *grp = NULL);
|
||||
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
|
||||
void Update(uint32 diff);
|
||||
|
||||
private:
|
||||
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
|
||||
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
|
||||
void BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr);
|
||||
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
|
||||
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
|
||||
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||
private:
|
||||
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
|
||||
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
|
||||
void BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr);
|
||||
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
|
||||
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
|
||||
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||
|
||||
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
|
||||
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
|
||||
LfgDungeonSet* GetAllDungeons();
|
||||
LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level);
|
||||
uint8 GetDungeonGroupType(uint32 dungeon);
|
||||
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
|
||||
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
|
||||
LfgDungeonSet* GetAllDungeons();
|
||||
LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level);
|
||||
uint8 GetDungeonGroupType(uint32 dungeon);
|
||||
|
||||
LfgRewardList m_RewardList;
|
||||
LfgRewardList m_RewardDoneList;
|
||||
LfgDungeonMap m_DungeonsMap;
|
||||
LfgRewardList m_RewardList;
|
||||
LfgRewardList m_RewardDoneList;
|
||||
LfgDungeonMap m_DungeonsMap;
|
||||
|
||||
LFGQueueMap m_Queues;
|
||||
LfgRoleCheckMap m_RoleChecks;
|
||||
uint32 m_QueueTimer;
|
||||
bool m_update;
|
||||
LFGQueueMap m_Queues;
|
||||
LfgRoleCheckMap m_RoleChecks;
|
||||
uint32 m_QueueTimer;
|
||||
bool m_update;
|
||||
};
|
||||
|
||||
#define sLFGMgr Trinity::Singleton<LFGMgr>::Instance()
|
||||
#define sLFGMgr (*ACE_Singleton<LFGMgr, ACE_Null_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Opcodes.h"
|
||||
#include "GossipDef.h"
|
||||
#include "World.h"
|
||||
@@ -54,7 +54,7 @@ void Corpse::AddToWorld()
|
||||
{
|
||||
///- Register the corpse for guid lookup
|
||||
if (!IsInWorld())
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
sObjectAccessor.AddObject(this);
|
||||
|
||||
Object::AddToWorld();
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void Corpse::RemoveFromWorld()
|
||||
{
|
||||
///- Remove the corpse from the accessor
|
||||
if (IsInWorld())
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
sObjectAccessor.RemoveObject(this);
|
||||
|
||||
Object::RemoveFromWorld();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define TRINITYCORE_CORPSE_H
|
||||
|
||||
#include "Object.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridDefines.h"
|
||||
#include "LootMgr.h"
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "QuestDef.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Player.h"
|
||||
#include "PoolHandler.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "Vehicle.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
// apply implementation of the singletons
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
|
||||
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
|
||||
{
|
||||
@@ -171,11 +171,8 @@ Creature::~Creature()
|
||||
{
|
||||
m_vendorItemCounts.clear();
|
||||
|
||||
if (i_AI)
|
||||
{
|
||||
delete i_AI;
|
||||
i_AI = NULL;
|
||||
}
|
||||
delete i_AI;
|
||||
i_AI = NULL;
|
||||
|
||||
//if (m_uint32Values)
|
||||
// sLog.outError("Deconstruct Creature Entry = %u", GetEntry());
|
||||
@@ -188,7 +185,7 @@ void Creature::AddToWorld()
|
||||
{
|
||||
if (m_zoneScript)
|
||||
m_zoneScript->OnCreatureCreate(this, true);
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
sObjectAccessor.AddObject(this);
|
||||
Unit::AddToWorld();
|
||||
SearchFormation();
|
||||
AIM_Initialize();
|
||||
@@ -206,7 +203,7 @@ void Creature::RemoveFromWorld()
|
||||
if (m_formation)
|
||||
formation_mgr.RemoveCreatureFromGroup(m_formation, this);
|
||||
Unit::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
sObjectAccessor.RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,13 +410,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data)
|
||||
if (isTrigger())
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
if (isTotem() || isTrigger()
|
||||
|| GetCreatureType() == CREATURE_TYPE_CRITTER)
|
||||
SetReactState(REACT_PASSIVE);
|
||||
/*else if (isCivilian())
|
||||
SetReactState(REACT_DEFENSIVE);*/
|
||||
else
|
||||
SetReactState(REACT_AGGRESSIVE);
|
||||
InitializeReactState();
|
||||
|
||||
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT)
|
||||
{
|
||||
@@ -629,7 +620,7 @@ void Creature::RegenerateMana()
|
||||
if ((*i)->GetMiscValue() == POWER_MANA)
|
||||
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
||||
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILISECONDS);
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
|
||||
|
||||
ModifyPower(POWER_MANA, addvalue);
|
||||
}
|
||||
@@ -666,7 +657,7 @@ void Creature::RegenerateHealth()
|
||||
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
||||
|
||||
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILISECONDS);
|
||||
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
|
||||
|
||||
ModifyHealth(addvalue);
|
||||
}
|
||||
@@ -721,7 +712,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
|
||||
Motion_Initialize();
|
||||
|
||||
i_AI = ai ? ai : FactorySelector::selectAI(this);
|
||||
if (oldAI) delete oldAI;
|
||||
delete oldAI;
|
||||
IsAIEnabled = true;
|
||||
i_AI->InitializeAI();
|
||||
return true;
|
||||
@@ -1271,16 +1262,26 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 curhealth = data->curhealth;
|
||||
if (curhealth)
|
||||
uint32 curhealth;
|
||||
|
||||
if (!m_regenHealth)
|
||||
{
|
||||
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
|
||||
if (curhealth < 1)
|
||||
curhealth = 1;
|
||||
curhealth = data->curhealth;
|
||||
if (curhealth)
|
||||
{
|
||||
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
|
||||
if (curhealth < 1)
|
||||
curhealth = 1;
|
||||
}
|
||||
SetPower(POWER_MANA,data->curmana);
|
||||
}
|
||||
else
|
||||
{
|
||||
curhealth = GetMaxHealth();
|
||||
SetPower(POWER_MANA,GetMaxPower(POWER_MANA));
|
||||
}
|
||||
|
||||
SetHealth(m_deathState == ALIVE ? curhealth : 0);
|
||||
SetPower(POWER_MANA,data->curmana);
|
||||
|
||||
// checked at creature_template loading
|
||||
m_defaultMovementType = MovementGeneratorType(data->movementType);
|
||||
@@ -1472,7 +1473,7 @@ void Creature::setDeathState(DeathState s)
|
||||
{
|
||||
if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
|
||||
{
|
||||
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
|
||||
m_deathTimer = m_corpseDelay*IN_MILLISECONDS;
|
||||
|
||||
// always save boss respawn time at death to prevent crash cheating
|
||||
if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
|
||||
@@ -1605,6 +1606,9 @@ void Creature::Respawn(bool force)
|
||||
uint16 poolid = GetDBTableGUIDLow() ? poolhandler.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
|
||||
if (poolid)
|
||||
poolhandler.UpdatePool<Creature>(poolid, GetDBTableGUIDLow());
|
||||
|
||||
//Re-initialize reactstate that could be altered by movementgenerators
|
||||
InitializeReactState();
|
||||
}
|
||||
|
||||
UpdateObjectVisibility();
|
||||
@@ -1983,7 +1987,7 @@ void Creature::SaveRespawnTime()
|
||||
if (m_respawnTime > time(NULL)) // dead (no corpse)
|
||||
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
|
||||
else if (m_deathTimer > 0) // dead (corpse)
|
||||
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS);
|
||||
objmgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
// this should not be called by petAI or
|
||||
@@ -2166,7 +2170,7 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
|
||||
modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
|
||||
|
||||
if (cooldown)
|
||||
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILISECONDS);
|
||||
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILLISECONDS);
|
||||
|
||||
if (spellInfo->Category)
|
||||
_AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
|
||||
@@ -2185,7 +2189,7 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||
return true;
|
||||
|
||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
|
||||
return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILISECONDS)) > time(NULL));
|
||||
return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILLISECONDS)) > time(NULL));
|
||||
}
|
||||
|
||||
bool Creature::HasSpellCooldown(uint32 spell_id) const
|
||||
@@ -2209,7 +2213,7 @@ time_t Creature::GetRespawnTimeEx() const
|
||||
if (m_respawnTime > now) // dead (no corpse)
|
||||
return m_respawnTime;
|
||||
else if (m_deathTimer > 0) // dead (corpse)
|
||||
return now+m_respawnDelay+m_deathTimer/IN_MILISECONDS;
|
||||
return now+m_respawnDelay+m_deathTimer/IN_MILLISECONDS;
|
||||
else
|
||||
return now;
|
||||
}
|
||||
@@ -2251,7 +2255,7 @@ void Creature::AllLootRemovedFromCorpse()
|
||||
|
||||
// corpse was not skinnable -> apply corpse looted timer
|
||||
if (!cinfo || !cinfo->SkinLootId)
|
||||
nDeathTimer = (uint32)((m_corpseDelay * IN_MILISECONDS) * sWorld.getRate(RATE_CORPSE_DECAY_LOOTED));
|
||||
nDeathTimer = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getRate(RATE_CORPSE_DECAY_LOOTED));
|
||||
// corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
|
||||
else
|
||||
nDeathTimer = 0;
|
||||
@@ -2413,7 +2417,7 @@ time_t Creature::GetLinkedCreatureRespawnTime() const
|
||||
if (data->mapid == GetMapId()) // look up on the same map
|
||||
targetMap = GetMap();
|
||||
else // it shouldn't be instanceable map here
|
||||
targetMap = MapManager::Instance().FindMap(data->mapid);
|
||||
targetMap = sMapMgr.FindMap(data->mapid);
|
||||
}
|
||||
if (targetMap)
|
||||
return objmgr.GetCreatureRespawnTime(targetGuid,targetMap->GetInstanceId());
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "UpdateMask.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Cell.h"
|
||||
|
||||
#include <list>
|
||||
@@ -66,7 +66,7 @@ enum CreatureFlagsExtra
|
||||
#endif
|
||||
|
||||
#define MAX_KILL_CREDIT 2
|
||||
#define CREATURE_REGEN_INTERVAL 2 * IN_MILISECONDS
|
||||
#define CREATURE_REGEN_INTERVAL 2 * IN_MILLISECONDS
|
||||
|
||||
// from `creature_template` table
|
||||
struct CreatureInfo
|
||||
@@ -314,6 +314,9 @@ struct VendorItem
|
||||
int32 maxcount; // 0 for infinity item amount
|
||||
uint32 incrtime; // time for restore items amount if maxcount != 0
|
||||
uint32 ExtendedCost;
|
||||
|
||||
//helpers
|
||||
bool IsGoldRequired(ItemPrototype const* pProto) const { return pProto->Flags2 & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
|
||||
};
|
||||
typedef std::vector<VendorItem*> VendorItemList;
|
||||
|
||||
@@ -424,9 +427,20 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
|
||||
bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
|
||||
//bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
|
||||
|
||||
void SetReactState(ReactStates st) { m_reactState = st; }
|
||||
ReactStates GetReactState() { return m_reactState; }
|
||||
bool HasReactState(ReactStates state) const { return (m_reactState == state); }
|
||||
void InitializeReactState()
|
||||
{
|
||||
if (isTotem() || isTrigger() || GetCreatureType() == CREATURE_TYPE_CRITTER)
|
||||
SetReactState(REACT_PASSIVE);
|
||||
else
|
||||
SetReactState(REACT_AGGRESSIVE);
|
||||
/*else if (isCivilian())
|
||||
SetReactState(REACT_DEFENSIVE);*/;
|
||||
}
|
||||
|
||||
///// TODO RENAME THIS!!!!!
|
||||
bool isCanTrainingOf(Player* player, bool msg) const;
|
||||
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
|
||||
@@ -607,10 +621,10 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
bool hasInvolvedQuest(uint32 quest_id) const;
|
||||
|
||||
bool isRegeneratingHealth() { return m_regenHealth; }
|
||||
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
|
||||
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
|
||||
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
|
||||
{
|
||||
if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
|
||||
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
|
||||
return 0;
|
||||
else
|
||||
return m_charmInfo->GetCharmSpell(pos)->GetAction();
|
||||
@@ -696,7 +710,7 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
|
||||
bool DisableReputationGain;
|
||||
|
||||
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
||||
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from objmgr.::GetCreatureTemplate(GetEntry())
|
||||
CreatureData const* m_creatureData;
|
||||
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
|
||||
@@ -22,13 +22,11 @@
|
||||
#include "CreatureGroups.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
#include "CreatureAI.h"
|
||||
|
||||
#define MAX_DESYNC 5.0f
|
||||
|
||||
INSTANTIATE_SINGLETON_1(CreatureGroupManager);
|
||||
|
||||
CreatureGroupInfoType CreatureGroupMap;
|
||||
|
||||
void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member)
|
||||
|
||||
@@ -35,12 +35,15 @@ struct FormationInfo
|
||||
|
||||
class CreatureGroupManager
|
||||
{
|
||||
friend class ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>;
|
||||
public:
|
||||
void AddCreatureToGroup(uint32 group_id, Creature *creature);
|
||||
void RemoveCreatureFromGroup(CreatureGroup *group, Creature *creature);
|
||||
void LoadCreatureFormations();
|
||||
};
|
||||
|
||||
#define formation_mgr (*ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>::instance())
|
||||
|
||||
typedef UNORDERED_MAP<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
|
||||
|
||||
extern CreatureGroupInfoType CreatureGroupMap;
|
||||
@@ -73,6 +76,4 @@ class CreatureGroup
|
||||
void MemberAttackStart(Creature* member, Unit *target);
|
||||
};
|
||||
|
||||
#define formation_mgr Trinity::Singleton<CreatureGroupManager>::Instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -522,7 +522,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
|
||||
}
|
||||
|
||||
// rewarded honor points. Multiply with 10 to satisfy client
|
||||
data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
|
||||
data << 10 * Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills());
|
||||
data << float(0); // new 3.3.0, honor multiplier?
|
||||
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
|
||||
data << int32(pQuest->GetRewSpellCast()); // casted spell
|
||||
@@ -616,7 +616,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const *pQuest)
|
||||
data << int32(pQuest->GetRewSpellCast()); // casted spell
|
||||
|
||||
// rewarded honor points
|
||||
data << uint32(Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
|
||||
data << Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills());
|
||||
data << float(0); // new reward honor (multipled by ~62 at client side)
|
||||
data << uint32(pQuest->GetSrcItemId()); // source item id
|
||||
data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags
|
||||
@@ -775,7 +775,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID,
|
||||
data << uint32(pQuest->XPValue(pSession->GetPlayer())*sWorld.getRate(RATE_XP_QUEST));
|
||||
|
||||
// rewarded honor points. Multiply with 10 to satisfy client
|
||||
data << uint32(10*Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
|
||||
data << 10 * Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills());
|
||||
data << float(0); // unk, honor multiplier?
|
||||
data << uint32(0x08); // unused by client?
|
||||
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "Opcodes.h"
|
||||
#include "World.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
@@ -46,7 +46,7 @@ void DynamicObject::AddToWorld()
|
||||
///- Register the dynamicObject for guid lookup
|
||||
if (!IsInWorld())
|
||||
{
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
sObjectAccessor.AddObject(this);
|
||||
WorldObject::AddToWorld();
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void DynamicObject::RemoveFromWorld()
|
||||
}
|
||||
}
|
||||
WorldObject::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
sObjectAccessor.RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
#include "QuestDef.h"
|
||||
#include "GameObject.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PoolHandler.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Spell.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Opcodes.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "World.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "LootMgr.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
@@ -117,7 +117,7 @@ void GameObject::AddToWorld()
|
||||
if (m_zoneScript)
|
||||
m_zoneScript->OnGameObjectCreate(this, true);
|
||||
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
sObjectAccessor.AddObject(this);
|
||||
WorldObject::AddToWorld();
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ void GameObject::RemoveFromWorld()
|
||||
sLog.outError("Delete GameObject (GUID: %u Entry: %u) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
|
||||
}
|
||||
WorldObject::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
sObjectAccessor.RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,7 +1626,7 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
|
||||
if (m_goValue->building.health <= m_goInfo->building.damagedNumHits)
|
||||
{
|
||||
if (!m_goInfo->building.destroyedDisplayId)
|
||||
m_goValue->building.health = 0;
|
||||
m_goValue->building.health = m_goInfo->building.damagedNumHits;
|
||||
else if (!m_goValue->building.health)
|
||||
m_goValue->building.health = 1;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Object.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
@@ -479,7 +479,7 @@ struct GameObjectInfo
|
||||
case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break;
|
||||
default: break;
|
||||
}
|
||||
return autoCloseTime / IN_MILISECONDS; // prior to 3.0.3, conversion was / 0x10000;
|
||||
return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000;
|
||||
}
|
||||
|
||||
uint32 GetLootId() const
|
||||
@@ -500,6 +500,16 @@ struct GameObjectInfo
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
uint32 GetEventScriptId() const
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.eventId;
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.eventId;
|
||||
case GAMEOBJECT_TYPE_CAMERA: return camera.eventID;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class OPvPCapturePoint;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
#include "Bag.h"
|
||||
#include "Log.h"
|
||||
@@ -117,11 +117,8 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result)
|
||||
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
|
||||
if (m_bagslot[i])
|
||||
{
|
||||
delete m_bagslot[i];
|
||||
m_bagslot[i] = NULL;
|
||||
}
|
||||
delete m_bagslot[i];
|
||||
m_bagslot[i] = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <ace/Auto_Ptr.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Item.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -633,7 +635,7 @@ void Item::SetState(ItemUpdateState state, Player *forplayer)
|
||||
{
|
||||
// pretend the item never existed
|
||||
RemoveFromUpdateQueueOf(forplayer);
|
||||
forplayer->DeleteRefundReference(GetGUID());
|
||||
forplayer->DeleteRefundReference(GetGUIDLow());
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
@@ -834,7 +836,7 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
|
||||
|
||||
for (ConditionList::const_iterator itr = conditions.begin(); itr != conditions.end(); ++itr)
|
||||
{
|
||||
ItemRequiredTarget *irt = new ItemRequiredTarget((ItemRequiredTargetType)(*itr)->mConditionValue1, (*itr)->mConditionValue2);
|
||||
ACE_Auto_Ptr<ItemRequiredTarget> irt(new ItemRequiredTarget((ItemRequiredTargetType)(*itr)->mConditionValue1, (*itr)->mConditionValue2));
|
||||
if (irt->IsFitToRequirements(pUnitTarget))
|
||||
return true;
|
||||
}
|
||||
@@ -1035,20 +1037,11 @@ bool Item::IsBindedNotWith(Player const* player) const
|
||||
if (GetOwnerGUID() == player->GetGUID())
|
||||
return false;
|
||||
|
||||
// not BOA item case
|
||||
if (!IsBoundAccountWide())
|
||||
return true;
|
||||
|
||||
// online
|
||||
if (Player* owner = objmgr.GetPlayer(GetOwnerGUID()))
|
||||
{
|
||||
return owner->GetSession()->GetAccountId() != player->GetSession()->GetAccountId();
|
||||
}
|
||||
// offline slow case
|
||||
else
|
||||
{
|
||||
return objmgr.GetPlayerAccountIdByGUID(GetOwnerGUID()) != player->GetSession()->GetAccountId();
|
||||
}
|
||||
// BOA item case
|
||||
if (IsBoundAccountWide())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const
|
||||
@@ -1106,7 +1099,7 @@ void Item::SetNotRefundable(Player *owner, bool changestate)
|
||||
SetPaidExtendedCost(0);
|
||||
DeleteRefundDataFromDB();
|
||||
|
||||
owner->DeleteRefundReference(GetGUID());
|
||||
owner->DeleteRefundReference(GetGUIDLow());
|
||||
}
|
||||
|
||||
void Item::UpdatePlayedTime(Player *owner)
|
||||
@@ -1147,4 +1140,4 @@ uint32 Item::GetPlayedTime()
|
||||
bool Item::IsRefundExpired()
|
||||
{
|
||||
return (GetPlayedTime() > 2*HOUR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <functional>
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ProgressBar.h"
|
||||
@@ -91,18 +91,10 @@ uint32 GetItemEnchantMod(int32 entry)
|
||||
if (!entry)
|
||||
return 0;
|
||||
|
||||
EnchantmentStore::const_iterator tab;
|
||||
|
||||
if (entry == -1)
|
||||
{
|
||||
tab = RandomItemEnch.begin();
|
||||
entry = urand(1, RandomItemEnch.size()) - 1;
|
||||
for (uint32 i = 0; i < entry; ++i)
|
||||
++tab;
|
||||
}
|
||||
else
|
||||
tab = RandomItemEnch.find(entry);
|
||||
|
||||
return 0;
|
||||
|
||||
EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry);
|
||||
if (tab == RandomItemEnch.end())
|
||||
{
|
||||
sLog.outErrorDb("Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.",entry);
|
||||
|
||||
@@ -111,8 +111,9 @@ enum ITEM_FLAGS
|
||||
ITEM_FLAGS_OPENABLE = 0x00000004,
|
||||
ITEM_FLAGS_WRAPPED = 0x00000008,
|
||||
ITEM_FLAGS_BROKEN = 0x00000010, // appears red icon (like when item durability == 0)
|
||||
ITEM_FLAGS_TOTEM = 0x00000020, // ?
|
||||
ITEM_FLAGS_INDESTRUCTIBLE = 0x00000020, // Item can not be destroyed, except by using spell (item can be reagent for spell and then allowed)
|
||||
ITEM_FLAGS_USABLE = 0x00000040, // ?
|
||||
ITEM_FLAGS_NO_EQUIP_COOLDOWN = 0x00000080, // ?
|
||||
ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper
|
||||
ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not
|
||||
ITEM_FLAGS_REFUNDABLE = 0x00001000, // item cost can be refunded within 2 hours after purchase
|
||||
@@ -135,7 +136,7 @@ enum ItemFlagsExtra
|
||||
{
|
||||
ITEM_FLAGS_EXTRA_HORDE_ONLY = 0x00000001,
|
||||
ITEM_FLAGS_EXTRA_ALLIANCE_ONLY = 0x00000002,
|
||||
ITEM_FLAGS_EXTRA_REFUNDABLE = 0x00000004,
|
||||
ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD = 0x00000004, // when item uses extended cost, gold is also required
|
||||
ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED = 0x00000100
|
||||
};
|
||||
|
||||
@@ -623,7 +624,7 @@ struct ItemPrototype
|
||||
|
||||
uint32 GetMaxStackSize() const
|
||||
{
|
||||
return (Stackable == 2147483647 || Stackable <= 0 || Stackable == 1000) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
|
||||
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
|
||||
}
|
||||
|
||||
float getDPS() const
|
||||
@@ -661,6 +662,17 @@ struct ItemLocale
|
||||
std::vector<std::string> Description;
|
||||
};
|
||||
|
||||
struct ItemSetNameEntry
|
||||
{
|
||||
std::string name;
|
||||
uint32 InventoryType;
|
||||
};
|
||||
|
||||
struct ItemSetNameLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Log.h"
|
||||
#include "Transports.h"
|
||||
#include "Transport.h"
|
||||
#include "TargetedMovementGenerator.h"
|
||||
#include "WaypointMovementGenerator.h"
|
||||
#include "VMapFactory.h"
|
||||
@@ -110,16 +110,12 @@ Object::~Object()
|
||||
{
|
||||
sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
|
||||
assert(false);
|
||||
ObjectAccessor::Instance().RemoveUpdateObject(this);
|
||||
sObjectAccessor.RemoveUpdateObject(this);
|
||||
}
|
||||
|
||||
if (m_uint32Values)
|
||||
{
|
||||
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
|
||||
delete [] m_uint32Values;
|
||||
delete [] m_uint32Values_mirror;
|
||||
//DEBUG_LOG("Object desctr 2 check (%p)",(void*)this);
|
||||
}
|
||||
delete [] m_uint32Values;
|
||||
delete [] m_uint32Values_mirror;
|
||||
|
||||
}
|
||||
|
||||
void Object::_InitValues()
|
||||
@@ -299,7 +295,11 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
{
|
||||
//WPAssert(this->ToPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||
|
||||
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(const_cast<Player*>(this->ToPlayer())->GetMotionMaster()->top());
|
||||
Player *player = const_cast<Object*>(this)->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(player->GetMotionMaster()->top());
|
||||
|
||||
uint32 flags3 = MOVEFLAG_GLIDE;
|
||||
|
||||
@@ -324,10 +324,10 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
}
|
||||
}
|
||||
|
||||
Path &path = fmg->GetPath();
|
||||
TaxiPathNodeList& path = const_cast<TaxiPathNodeList&>(fmg->GetPath());
|
||||
|
||||
float x, y, z;
|
||||
this->ToPlayer()->GetPosition(x, y, z);
|
||||
player->GetPosition(x, y, z);
|
||||
|
||||
uint32 inflighttime = uint32(path.GetPassedLength(fmg->GetCurrentNode(), x, y, z) * 32);
|
||||
uint32 traveltime = uint32(path.GetTotalLength() * 32);
|
||||
@@ -342,21 +342,21 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
|
||||
*data << uint32(0); // added in 3.1
|
||||
|
||||
uint32 poscount = uint32(path.Size());
|
||||
uint32 poscount = uint32(path.size());
|
||||
*data << uint32(poscount); // points count
|
||||
|
||||
for (uint32 i = 0; i < poscount; ++i)
|
||||
{
|
||||
*data << path.GetNodes()[i].x;
|
||||
*data << path.GetNodes()[i].y;
|
||||
*data << path.GetNodes()[i].z;
|
||||
*data << float(path[i].x);
|
||||
*data << float(path[i].y);
|
||||
*data << float(path[i].z);
|
||||
}
|
||||
|
||||
*data << uint8(0); // added in 3.0.8
|
||||
|
||||
*data << path.GetNodes()[poscount-1].x;
|
||||
*data << path.GetNodes()[poscount-1].y;
|
||||
*data << path.GetNodes()[poscount-1].z;
|
||||
*data << float(path[poscount-1].x);
|
||||
*data << float(path[poscount-1].y);
|
||||
*data << float(path[poscount-1].z);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -731,7 +731,7 @@ void Object::ClearUpdateMask(bool remove)
|
||||
if (m_objectUpdated)
|
||||
{
|
||||
if (remove)
|
||||
ObjectAccessor::Instance().RemoveUpdateObject(this);
|
||||
sObjectAccessor.RemoveUpdateObject(this);
|
||||
m_objectUpdated = false;
|
||||
}
|
||||
}
|
||||
@@ -804,7 +804,7 @@ void Object::SetInt32Value(uint16 index, int32 value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -823,7 +823,7 @@ void Object::SetUInt32Value(uint16 index, uint32 value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -849,7 +849,7 @@ void Object::SetUInt64Value(uint16 index, const uint64 &value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -868,7 +868,7 @@ bool Object::AddUInt64Value(uint16 index, const uint64 &value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -889,7 +889,7 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 &value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -910,7 +910,7 @@ void Object::SetFloatValue(uint16 index, float value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -936,7 +936,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -962,7 +962,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ void Object::SetFlag(uint16 index, uint32 newFlag)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -1052,7 +1052,7 @@ void Object::RemoveFlag(uint16 index, uint32 oldFlag)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -1379,28 +1379,15 @@ bool Position::HasInArc(float arc, const Position *obj) const
|
||||
return true;
|
||||
|
||||
// move arc to range 0.. 2*pi
|
||||
while (arc >= 2.0f * M_PI)
|
||||
arc -= 2.0f * M_PI;
|
||||
while (arc < 0)
|
||||
arc += 2.0f * M_PI;
|
||||
arc = MapManager::NormalizeOrientation(arc);
|
||||
|
||||
float angle = GetAngle(obj);
|
||||
angle -= m_orientation;
|
||||
|
||||
//if (angle > 100 || angle < -100)
|
||||
//{
|
||||
// sLog.outCrash("Invalid Angle %f: this %u %u %f %f %f %f, that %u %u %f %f %f %f", angle,
|
||||
// GetEntry(), GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(),
|
||||
// obj->GetEntry(), obj->GetGUIDLow(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation());
|
||||
// assert(false);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// move angle to range -pi ... +pi
|
||||
while (angle > M_PI)
|
||||
angle -= 2.0f * M_PI;
|
||||
while (angle < -M_PI)
|
||||
angle += 2.0f * M_PI;
|
||||
angle = MapManager::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
|
||||
@@ -1515,7 +1502,7 @@ void Object::ForceValuesUpdateAtIndex(uint32 i)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
ObjectAccessor::Instance().AddUpdateObject(this);
|
||||
sObjectAccessor.AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "Common.h"
|
||||
#include "UpdateFields.h"
|
||||
#include "UpdateData.h"
|
||||
#include "GameSystem/GridReference.h"
|
||||
#include "GridReference.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "GridDefines.h"
|
||||
#include "Map.h"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef TRINITY_OBJECTDEFINES_H
|
||||
#define TRINITY_OBJECTDEFINES_H
|
||||
|
||||
#include "Platform/Define.h"
|
||||
#include "Define.h"
|
||||
|
||||
// used for creating values for respawn for example
|
||||
#define MAKE_PAIR64(l, h) uint64(uint32(l) | (uint64(h) << 32))
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "World.h"
|
||||
#include <zlib/zlib.h>
|
||||
#include "zlib.h"
|
||||
|
||||
UpdateData::UpdateData() : m_blockCount(0)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef _UPDATEFIELDS_AUTO_H
|
||||
#define _UPDATEFIELDS_AUTO_H
|
||||
|
||||
// Auto generated for version 3, 3, 3, 11723
|
||||
// Auto generated for version 3, 3, 5, 12340
|
||||
|
||||
enum EObjectFields
|
||||
{
|
||||
|
||||
@@ -32,8 +32,7 @@ class UpdateMask
|
||||
|
||||
~UpdateMask()
|
||||
{
|
||||
if (mUpdateMask)
|
||||
delete [] mUpdateMask;
|
||||
delete [] mUpdateMask;
|
||||
}
|
||||
|
||||
void SetBit (uint32 index)
|
||||
@@ -58,8 +57,7 @@ class UpdateMask
|
||||
|
||||
void SetCount (uint32 valuesCount)
|
||||
{
|
||||
if (mUpdateMask)
|
||||
delete [] mUpdateMask;
|
||||
delete [] mUpdateMask;
|
||||
|
||||
mCount = valuesCount;
|
||||
mBlocks = (valuesCount + 31) / 32;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -74,7 +74,7 @@ void Pet::AddToWorld()
|
||||
if (!IsInWorld())
|
||||
{
|
||||
///- Register the pet for guid lookup
|
||||
ObjectAccessor::Instance().AddObject(this);
|
||||
sObjectAccessor.AddObject(this);
|
||||
Unit::AddToWorld();
|
||||
AIM_Initialize();
|
||||
}
|
||||
@@ -98,7 +98,7 @@ void Pet::RemoveFromWorld()
|
||||
{
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
sObjectAccessor.RemoveObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,9 +324,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
|
||||
if (result)
|
||||
{
|
||||
if (m_declinedname)
|
||||
delete m_declinedname;
|
||||
|
||||
delete m_declinedname;
|
||||
m_declinedname = new DeclinedName;
|
||||
Field *fields2 = result->Fetch();
|
||||
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
|
||||
@@ -621,7 +619,7 @@ void Creature::Regenerate(Powers power)
|
||||
if ((*i)->GetMiscValue() == power)
|
||||
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
|
||||
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILISECONDS);
|
||||
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
|
||||
|
||||
ModifyPower(power, (int32)addvalue);
|
||||
}
|
||||
@@ -1114,7 +1112,7 @@ void Pet::_LoadSpellCooldowns()
|
||||
continue;
|
||||
|
||||
data << uint32(spell_id);
|
||||
data << uint32(uint32(db_time-curTime)*IN_MILISECONDS);
|
||||
data << uint32(uint32(db_time-curTime)*IN_MILLISECONDS);
|
||||
|
||||
_AddCreatureSpellCooldown(spell_id,db_time);
|
||||
|
||||
@@ -1231,10 +1229,10 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||
// negative effects should continue counting down after logout
|
||||
if (remaintime != -1 && !IsPositiveSpell(spellid))
|
||||
{
|
||||
if (remaintime/IN_MILISECONDS <= int32(timediff))
|
||||
if (remaintime/IN_MILLISECONDS <= int32(timediff))
|
||||
continue;
|
||||
|
||||
remaintime -= timediff*IN_MILISECONDS;
|
||||
remaintime -= timediff*IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
// prevent wrong values of remaincharges
|
||||
|
||||
@@ -118,7 +118,7 @@ typedef std::vector<uint32> AutoSpellList;
|
||||
|
||||
#define PET_FOLLOW_DIST 1
|
||||
#define PET_FOLLOW_ANGLE (M_PI/2)
|
||||
#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILISECONDS
|
||||
#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS
|
||||
|
||||
class Player;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@
|
||||
#include "Unit.h"
|
||||
#include "Item.h"
|
||||
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "NPCHandler.h"
|
||||
#include "QuestDef.h"
|
||||
#include "Group.h"
|
||||
@@ -920,6 +920,55 @@ struct BGData
|
||||
bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
|
||||
};
|
||||
|
||||
class TradeData
|
||||
{
|
||||
public: // constructors
|
||||
TradeData(Player* player, Player* trader) :
|
||||
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
|
||||
m_money(0), m_spell(0) {}
|
||||
|
||||
Player* GetTrader() const { return m_trader; }
|
||||
TradeData* GetTraderData() const;
|
||||
|
||||
Item* GetItem(TradeSlots slot) const;
|
||||
bool HasItem(uint64 item_guid) const;
|
||||
void SetItem(TradeSlots slot, Item* item);
|
||||
|
||||
uint32 GetSpell() const { return m_spell; }
|
||||
void SetSpell(uint32 spell_id, Item* castItem = NULL);
|
||||
|
||||
Item* GetSpellCastItem() const;
|
||||
bool HasSpellCastItem() const { return m_spellCastItem != 0; }
|
||||
|
||||
uint32 GetMoney() const { return m_money; }
|
||||
void SetMoney(uint32 money);
|
||||
|
||||
bool IsAccepted() const { return m_accepted; }
|
||||
void SetAccepted(bool state, bool crosssend = false);
|
||||
|
||||
bool IsInAcceptProcess() const { return m_acceptProccess; }
|
||||
void SetInAcceptProcess(bool state) { m_acceptProccess = state; }
|
||||
|
||||
private: // internal functions
|
||||
|
||||
void Update(bool for_trader = true);
|
||||
|
||||
private: // fields
|
||||
|
||||
Player* m_player; // Player who own of this TradeData
|
||||
Player* m_trader; // Player who trade with m_player
|
||||
|
||||
bool m_accepted; // m_player press accept for trade list
|
||||
bool m_acceptProccess; // one from player/trader press accept and this processed
|
||||
|
||||
uint32 m_money; // m_player place money to trade
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class Player : public Unit, public GridObject<Player>
|
||||
{
|
||||
friend class WorldSession;
|
||||
@@ -1137,8 +1186,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
||||
uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
||||
|
||||
void AddRefundReference(uint64 it);
|
||||
void DeleteRefundReference(uint64 it);
|
||||
void AddRefundReference(uint32 it);
|
||||
void DeleteRefundReference(uint32 it);
|
||||
|
||||
void ApplyEquipCooldown(Item * pItem);
|
||||
void SetAmmo(uint32 item);
|
||||
@@ -1191,15 +1240,10 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
|
||||
|
||||
float GetReputationPriceDiscount(Creature const* pCreature) const;
|
||||
Player* GetTrader() const { return pTrader; }
|
||||
void ClearTrade();
|
||||
|
||||
Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : NULL; }
|
||||
TradeData* GetTradeData() const { return m_trade; }
|
||||
void TradeCancel(bool sendback);
|
||||
Item *GetItemByTradeSlot(uint8 slot) const
|
||||
{
|
||||
if (slot < TRADE_SLOT_COUNT && tradeItems[slot])
|
||||
return GetItemByGuid(tradeItems[slot]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void UpdateEnchantTime(uint32 time);
|
||||
void UpdateItemDuration(uint32 time, bool realtimeonly=false);
|
||||
@@ -1395,11 +1439,19 @@ class Player : public Unit, public GridObject<Player>
|
||||
if (d < 0)
|
||||
SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
|
||||
else
|
||||
SetMoney (GetMoney() < uint32(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
|
||||
|
||||
// "At Gold Limit"
|
||||
if (GetMoney() >= MAX_MONEY_AMOUNT)
|
||||
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD,NULL,NULL);
|
||||
{
|
||||
uint32 newAmount = 0;
|
||||
if (GetMoney() < uint32(MAX_MONEY_AMOUNT - d))
|
||||
newAmount = GetMoney() + d;
|
||||
else
|
||||
{
|
||||
// "At Gold Limit"
|
||||
newAmount = MAX_MONEY_AMOUNT;
|
||||
if (d)
|
||||
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||
}
|
||||
SetMoney (newAmount);
|
||||
}
|
||||
}
|
||||
void SetMoney(uint32 value)
|
||||
{
|
||||
@@ -1874,7 +1926,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
/*** PVP SYSTEM ***/
|
||||
/*********************************************************/
|
||||
void UpdateHonorFields();
|
||||
bool RewardHonor(Unit *pVictim, uint32 groupsize, float honor = -1, bool pvptoken = false);
|
||||
bool RewardHonor(Unit *pVictim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
|
||||
uint32 GetHonorPoints() { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); }
|
||||
uint32 GetArenaPoints() { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); }
|
||||
void ModifyHonorPoints(int32 value);
|
||||
@@ -2074,7 +2126,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
/*** REST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
bool isRested() const { return GetRestTime() >= 10*IN_MILISECONDS; }
|
||||
bool isRested() const { return GetRestTime() >= 10*IN_MILLISECONDS; }
|
||||
uint32 GetXPRestBonus(uint32 xp);
|
||||
uint32 GetRestTime() const { return m_restTime;}
|
||||
void SetRestTime(uint32 v) { m_restTime = v;}
|
||||
@@ -2460,10 +2512,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
int m_cinematic;
|
||||
|
||||
Player *pTrader;
|
||||
bool acceptTrade;
|
||||
uint64 tradeItems[TRADE_SLOT_COUNT];
|
||||
uint32 tradeGold;
|
||||
TradeData* m_trade;
|
||||
|
||||
bool m_DailyQuestChanged;
|
||||
bool m_WeeklyQuestChanged;
|
||||
@@ -2535,7 +2584,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update);
|
||||
|
||||
std::set<uint64> m_refundableItems;
|
||||
std::set<uint32> m_refundableItems;
|
||||
void SendRefundInfo(Item* item);
|
||||
void RefundItem(Item* item);
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
#include "SocialMgr.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Opcodes.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Player.h"
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "World.h"
|
||||
#include "Util.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(SocialMgr);
|
||||
|
||||
PlayerSocial::PlayerSocial()
|
||||
{
|
||||
m_playerGUID = 0;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#ifndef __TRINITY_SOCIALMGR_H
|
||||
#define __TRINITY_SOCIALMGR_H
|
||||
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "ace/Singleton.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Common.h"
|
||||
|
||||
class SocialMgr;
|
||||
@@ -43,7 +43,8 @@ enum SocialFlag
|
||||
{
|
||||
SOCIAL_FLAG_FRIEND = 0x01,
|
||||
SOCIAL_FLAG_IGNORED = 0x02,
|
||||
SOCIAL_FLAG_MUTED = 0x04 // guessed
|
||||
SOCIAL_FLAG_MUTED = 0x04, // guessed
|
||||
SOCIAL_FLAG_RAF = 0x08 // Recruit A Friend
|
||||
};
|
||||
|
||||
struct FriendInfo
|
||||
@@ -112,7 +113,7 @@ enum FriendsResult
|
||||
};
|
||||
|
||||
#define SOCIALMGR_FRIEND_LIMIT 50
|
||||
#define SOCIALMGR_IGNORE_LIMIT 25
|
||||
#define SOCIALMGR_IGNORE_LIMIT 50
|
||||
|
||||
class PlayerSocial
|
||||
{
|
||||
@@ -139,8 +140,9 @@ class PlayerSocial
|
||||
|
||||
class SocialMgr
|
||||
{
|
||||
friend class ACE_Singleton<SocialMgr, ACE_Null_Mutex>;
|
||||
SocialMgr();
|
||||
public:
|
||||
SocialMgr();
|
||||
~SocialMgr();
|
||||
// Misc
|
||||
void RemovePlayerSocial(uint32 guid) { m_socialMap.erase(guid); }
|
||||
@@ -156,6 +158,6 @@ class SocialMgr
|
||||
SocialMap m_socialMap;
|
||||
};
|
||||
|
||||
#define sSocialMgr Trinity::Singleton<SocialMgr>::Instance()
|
||||
#define sSocialMgr (*ACE_Singleton<SocialMgr, ACE_Null_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include "Transports.h"
|
||||
#include "Transport.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Path.h"
|
||||
@@ -106,7 +106,7 @@ void MapManager::LoadTransports()
|
||||
m_TransportsByMap[*i].insert(t);
|
||||
|
||||
//If we someday decide to use the grid to track transports, here:
|
||||
t->SetMap(MapManager::Instance().CreateMap(mapid, t, 0));
|
||||
t->SetMap(sMapMgr.CreateMap(mapid, t, 0));
|
||||
|
||||
//t->GetMap()->Add<GameObject>((GameObject *)t);
|
||||
++count;
|
||||
@@ -185,18 +185,13 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
|
||||
|
||||
struct keyFrame
|
||||
{
|
||||
keyFrame(float _x, float _y, float _z, uint32 _mapid, int _actionflag, int _delay)
|
||||
{
|
||||
x = _x; y = _y; z = _z; mapid = _mapid; actionflag = _actionflag; delay = _delay; distFromPrev = -1; distSinceStop = -1; distUntilStop = -1;
|
||||
tFrom = 0; tTo = 0;
|
||||
}
|
||||
explicit keyFrame(TaxiPathNodeEntry const& _node) : node(&_node),
|
||||
distSinceStop(-1.0f), distUntilStop(-1.0f), distFromPrev(-1.0f), tFrom(0.0f), tTo(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
TaxiPathNodeEntry const* node;
|
||||
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
uint32 mapid;
|
||||
int actionflag;
|
||||
int delay;
|
||||
float distSinceStop;
|
||||
float distUntilStop;
|
||||
float distFromPrev;
|
||||
@@ -205,24 +200,24 @@ struct keyFrame
|
||||
|
||||
bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
{
|
||||
TransportPath path;
|
||||
objmgr.GetTransportPathNodes(pathid, path);
|
||||
|
||||
if (path.Empty())
|
||||
if (pathid >= sTaxiPathNodesByPath.size())
|
||||
return false;
|
||||
|
||||
TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathid];
|
||||
|
||||
std::vector<keyFrame> keyFrames;
|
||||
int mapChange = 0;
|
||||
mapids.clear();
|
||||
for (size_t i = 1; i < path.Size() - 1; ++i)
|
||||
for (size_t i = 1; i < path.size() - 1; ++i)
|
||||
{
|
||||
if (mapChange == 0)
|
||||
{
|
||||
if ((path[i].mapid == path[i+1].mapid))
|
||||
TaxiPathNodeEntry const& node_i = path[i];
|
||||
if (node_i.mapid == path[i+1].mapid)
|
||||
{
|
||||
keyFrame k(path[i].x, path[i].y, path[i].z, path[i].mapid, path[i].actionFlag, path[i].delay);
|
||||
keyFrame k(node_i);
|
||||
keyFrames.push_back(k);
|
||||
mapids.insert(k.mapid);
|
||||
mapids.insert(k.node->mapid);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -240,7 +235,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
|
||||
// first cell is arrived at by teleportation :S
|
||||
keyFrames[0].distFromPrev = 0;
|
||||
if (keyFrames[0].actionflag == 2)
|
||||
if (keyFrames[0].node->actionFlag == 2)
|
||||
{
|
||||
lastStop = 0;
|
||||
}
|
||||
@@ -248,18 +243,18 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
// find the rest of the distances between key points
|
||||
for (size_t i = 1; i < keyFrames.size(); ++i)
|
||||
{
|
||||
if ((keyFrames[i].actionflag == 1) || (keyFrames[i].mapid != keyFrames[i-1].mapid))
|
||||
if ((keyFrames[i].node->actionFlag == 1) || (keyFrames[i].node->mapid != keyFrames[i-1].node->mapid))
|
||||
{
|
||||
keyFrames[i].distFromPrev = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyFrames[i].distFromPrev =
|
||||
sqrt(pow(keyFrames[i].x - keyFrames[i - 1].x, 2) +
|
||||
pow(keyFrames[i].y - keyFrames[i - 1].y, 2) +
|
||||
pow(keyFrames[i].z - keyFrames[i - 1].z, 2));
|
||||
sqrt(pow(keyFrames[i].node->x - keyFrames[i - 1].node->x, 2) +
|
||||
pow(keyFrames[i].node->y - keyFrames[i - 1].node->y, 2) +
|
||||
pow(keyFrames[i].node->z - keyFrames[i - 1].node->z, 2));
|
||||
}
|
||||
if (keyFrames[i].actionflag == 2)
|
||||
if (keyFrames[i].node->actionFlag == 2)
|
||||
{
|
||||
// remember first stop frame
|
||||
if (firstStop == -1)
|
||||
@@ -272,7 +267,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
for (size_t i = 0; i < keyFrames.size(); ++i)
|
||||
{
|
||||
int j = (i + lastStop) % keyFrames.size();
|
||||
if (keyFrames[j].actionflag == 2)
|
||||
if (keyFrames[j].node->actionFlag == 2)
|
||||
tmpDist = 0;
|
||||
else
|
||||
tmpDist += keyFrames[j].distFromPrev;
|
||||
@@ -284,7 +279,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
int j = (i + (firstStop+1)) % keyFrames.size();
|
||||
tmpDist += keyFrames[(j + 1) % keyFrames.size()].distFromPrev;
|
||||
keyFrames[j].distUntilStop = tmpDist;
|
||||
if (keyFrames[j].actionflag == 2)
|
||||
if (keyFrames[j].node->actionFlag == 2)
|
||||
tmpDist = 0;
|
||||
}
|
||||
|
||||
@@ -312,14 +307,15 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
// speed = max(30, t) (remember x = 0.5s^2, and when accelerating, a = 1 unit/s^2
|
||||
int t = 0;
|
||||
bool teleport = false;
|
||||
if (keyFrames[keyFrames.size() - 1].mapid != keyFrames[0].mapid)
|
||||
if (keyFrames[keyFrames.size() - 1].node->mapid != keyFrames[0].node->mapid)
|
||||
teleport = true;
|
||||
|
||||
WayPoint pos(keyFrames[0].mapid, keyFrames[0].x, keyFrames[0].y, keyFrames[0].z, teleport, 0);
|
||||
WayPoint pos(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
|
||||
keyFrames[0].node->arrivalEventID, keyFrames[0].node->departureEventID);
|
||||
m_WayPoints[0] = pos;
|
||||
t += keyFrames[0].delay * 1000;
|
||||
t += keyFrames[0].node->delay * 1000;
|
||||
|
||||
uint32 cM = keyFrames[0].mapid;
|
||||
uint32 cM = keyFrames[0].node->mapid;
|
||||
for (size_t i = 0; i < keyFrames.size() - 1; ++i)
|
||||
{
|
||||
float d = 0;
|
||||
@@ -337,19 +333,19 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
if (d > 0)
|
||||
{
|
||||
float newX, newY, newZ;
|
||||
newX = keyFrames[i].x + (keyFrames[i + 1].x - keyFrames[i].x) * d / keyFrames[i + 1].distFromPrev;
|
||||
newY = keyFrames[i].y + (keyFrames[i + 1].y - keyFrames[i].y) * d / keyFrames[i + 1].distFromPrev;
|
||||
newZ = keyFrames[i].z + (keyFrames[i + 1].z - keyFrames[i].z) * d / keyFrames[i + 1].distFromPrev;
|
||||
newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
|
||||
newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
|
||||
newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
|
||||
|
||||
bool teleport = false;
|
||||
if (keyFrames[i].mapid != cM)
|
||||
if (keyFrames[i].node->mapid != cM)
|
||||
{
|
||||
teleport = true;
|
||||
cM = keyFrames[i].mapid;
|
||||
cM = keyFrames[i].node->mapid;
|
||||
}
|
||||
|
||||
// sLog.outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
|
||||
WayPoint pos(keyFrames[i].mapid, newX, newY, newZ, teleport, i);
|
||||
WayPoint pos(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
|
||||
if (teleport)
|
||||
m_WayPoints[t] = pos;
|
||||
}
|
||||
@@ -389,14 +385,14 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
t += (long)keyFrames[i + 1].tTo % 100;
|
||||
|
||||
bool teleport = false;
|
||||
if ((keyFrames[i + 1].actionflag == 1) || (keyFrames[i + 1].mapid != keyFrames[i].mapid))
|
||||
if ((keyFrames[i + 1].node->actionFlag == 1) || (keyFrames[i + 1].node->mapid != keyFrames[i].node->mapid))
|
||||
{
|
||||
teleport = true;
|
||||
cM = keyFrames[i + 1].mapid;
|
||||
cM = keyFrames[i + 1].node->mapid;
|
||||
}
|
||||
|
||||
WayPoint pos(keyFrames[i + 1].mapid, keyFrames[i + 1].x, keyFrames[i + 1].y, keyFrames[i + 1].z, teleport, i);
|
||||
|
||||
WayPoint pos(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
|
||||
0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID);
|
||||
// sLog.outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
|
||||
/*
|
||||
if (keyFrames[i+1].delay > 5)
|
||||
@@ -405,7 +401,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
//if (teleport)
|
||||
m_WayPoints[t] = pos;
|
||||
|
||||
t += keyFrames[i + 1].delay * 1000;
|
||||
t += keyFrames[i + 1].node->delay * 1000;
|
||||
// sLog.outString("------");
|
||||
}
|
||||
|
||||
@@ -459,7 +455,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
|
||||
//yes, you're right
|
||||
|
||||
ResetMap();
|
||||
Map * newMap = MapManager::Instance().CreateMap(newMapid, this, 0);
|
||||
Map * newMap = sMapMgr.CreateMap(newMapid, this, 0);
|
||||
SetMap(newMap);
|
||||
assert (GetMap());
|
||||
|
||||
@@ -484,13 +480,6 @@ bool Transport::RemovePassenger(Player* passenger)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Transport::CheckForEvent(uint32 entry, uint32 wp_id)
|
||||
{
|
||||
uint32 key = entry*100+wp_id;
|
||||
if (objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end())
|
||||
GetMap()->ScriptsStart(sEventScripts, objmgr.TransportEventMap[key], this, NULL);
|
||||
}
|
||||
|
||||
void Transport::Update(uint32 /*p_time*/)
|
||||
{
|
||||
if (m_WayPoints.size() <= 1)
|
||||
@@ -499,9 +488,13 @@ void Transport::Update(uint32 /*p_time*/)
|
||||
m_timer = getMSTime() % m_period;
|
||||
while (((m_timer - m_curr->first) % m_pathTime) > ((m_next->first - m_curr->first) % m_pathTime))
|
||||
{
|
||||
DoEventIfAny(*m_curr, true);
|
||||
|
||||
m_curr = GetNextWayPoint();
|
||||
m_next = GetNextWayPoint();
|
||||
|
||||
DoEventIfAny(*m_curr,false);
|
||||
|
||||
// first check help in case client-server transport coordinates de-synchronization
|
||||
if (m_curr->second.mapid != GetMapId() || m_curr->second.teleport)
|
||||
{
|
||||
@@ -548,9 +541,6 @@ void Transport::Update(uint32 /*p_time*/)
|
||||
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0)
|
||||
sLog.outDetail("%s moved to %d %f %f %f %d", this->m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
|
||||
|
||||
//Transport Event System
|
||||
CheckForEvent(this->GetEntry(), m_curr->second.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,3 +577,11 @@ void Transport::UpdateForMap(Map const* targetMap)
|
||||
}
|
||||
}
|
||||
|
||||
void Transport::DoEventIfAny(WayPointMap::value_type const& node, bool departure)
|
||||
{
|
||||
if (uint32 eventid = departure ? node.second.departureEventID : node.second.arrivalEventID)
|
||||
{
|
||||
sLog.outDebug("Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.first, GetName());
|
||||
GetMap()->ScriptsStart(sEventScripts, eventid, this, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,35 +27,6 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
class TransportPath
|
||||
{
|
||||
public:
|
||||
struct PathNode
|
||||
{
|
||||
uint32 mapid;
|
||||
float x,y,z;
|
||||
uint32 actionFlag;
|
||||
uint32 delay;
|
||||
};
|
||||
|
||||
void SetLength(const unsigned int sz)
|
||||
{
|
||||
i_nodes.resize(sz);
|
||||
}
|
||||
|
||||
unsigned int Size(void) const { return i_nodes.size(); }
|
||||
bool Empty(void) const { return i_nodes.empty(); }
|
||||
void Resize(unsigned int sz) { i_nodes.resize(sz); }
|
||||
void Clear(void) { i_nodes.clear(); }
|
||||
PathNode* GetNodes(void) { return static_cast<PathNode *>(&i_nodes[0]); }
|
||||
|
||||
PathNode& operator[](const unsigned int idx) { return i_nodes[idx]; }
|
||||
const PathNode& operator()(const unsigned int idx) const { return i_nodes[idx]; }
|
||||
|
||||
protected:
|
||||
std::vector<PathNode> i_nodes;
|
||||
};
|
||||
|
||||
class Transport : public GameObject
|
||||
{
|
||||
public:
|
||||
@@ -66,7 +37,6 @@ class Transport : public GameObject
|
||||
void Update(uint32 p_time);
|
||||
bool AddPassenger(Player* passenger);
|
||||
bool RemovePassenger(Player* passenger);
|
||||
void CheckForEvent(uint32 entry, uint32 wp_id);
|
||||
|
||||
typedef std::set<Player*> PlayerSet;
|
||||
PlayerSet const& GetPassengers() const { return m_passengers; }
|
||||
@@ -75,14 +45,20 @@ class Transport : public GameObject
|
||||
struct WayPoint
|
||||
{
|
||||
WayPoint() : mapid(0), x(0), y(0), z(0), teleport(false), id(0) {}
|
||||
WayPoint(uint32 _mapid, float _x, float _y, float _z, bool _teleport, uint32 _id) :
|
||||
mapid(_mapid), x(_x), y(_y), z(_z), teleport(_teleport), id(_id) {}
|
||||
WayPoint(uint32 _mapid, float _x, float _y, float _z, bool _teleport, uint32 _id = 0,
|
||||
uint32 _arrivalEventID = 0, uint32 _departureEventID = 0)
|
||||
: mapid(_mapid), x(_x), y(_y), z(_z), teleport(_teleport), id(_id),
|
||||
arrivalEventID(_arrivalEventID), departureEventID(_departureEventID)
|
||||
{
|
||||
}
|
||||
uint32 mapid;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
bool teleport;
|
||||
uint32 id;
|
||||
uint32 arrivalEventID;
|
||||
uint32 departureEventID;
|
||||
};
|
||||
|
||||
typedef std::map<uint32, WayPoint> WayPointMap;
|
||||
@@ -102,6 +78,7 @@ class Transport : public GameObject
|
||||
private:
|
||||
void TeleportTransport(uint32 newMapid, float x, float y, float z);
|
||||
void UpdateForMap(Map const* map);
|
||||
void DoEventIfAny(WayPointMap::value_type const& node, bool departure);
|
||||
WayPointMap::const_iterator GetNextWayPoint();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#include "Traveller.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Transports.h"
|
||||
#include "Transport.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -201,10 +201,8 @@ Unit::~Unit()
|
||||
RemoveAllDynObjects();
|
||||
_DeleteRemovedAuras();
|
||||
|
||||
if (m_charmInfo)
|
||||
delete m_charmInfo;
|
||||
if (m_vehicleKit)
|
||||
delete m_vehicleKit;
|
||||
delete m_charmInfo;
|
||||
delete m_vehicleKit;
|
||||
|
||||
assert(!m_attacking);
|
||||
assert(m_attackers.empty());
|
||||
@@ -437,29 +435,6 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 M
|
||||
SendMessageToSet(&data, true);
|
||||
}*/
|
||||
|
||||
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
|
||||
{
|
||||
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
|
||||
|
||||
uint32 pathSize = end - start;
|
||||
|
||||
WorldPacket data(SMSG_MONSTER_MOVE, (GetPackGUID().size()+1+4+4+4+4+1+4+4+4+pathSize*4*3));
|
||||
data.append(GetPackGUID());
|
||||
data << uint8(0);
|
||||
data << GetPositionX();
|
||||
data << GetPositionY();
|
||||
data << GetPositionZ();
|
||||
data << uint32(getMSTime());
|
||||
data << uint8(0);
|
||||
data << uint32(((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) || isInFlight())? (MOVEFLAG_FLY|MOVEFLAG_WALK) : MOVEFLAG_WALK);
|
||||
data << uint32(traveltime);
|
||||
data << uint32(pathSize);
|
||||
data.append((char*)path.GetNodes(start), pathSize * 4 * 3);
|
||||
SendMessageToSet(&data, true);
|
||||
//MONSTER_MOVE_SPLINE_FLY
|
||||
addUnitState(UNIT_STAT_MOVE);
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMoveTransport(Unit *vehicleOwner)
|
||||
{
|
||||
WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, GetPackGUID().size()+vehicleOwner->GetPackGUID().size());
|
||||
@@ -587,23 +562,6 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
||||
|
||||
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
|
||||
{
|
||||
// if attacker is a player and spell is not empty/fail
|
||||
if (GetTypeId() == TYPEID_PLAYER && spellProto)
|
||||
{
|
||||
// on divine storm dealed damage - heal
|
||||
if (spellProto->SpellFamilyName == SPELLFAMILY_PALADIN && spellProto->SpellFamilyFlags[1] & 0x20000)
|
||||
{
|
||||
Unit *pRaidGrpMember = GetNextRandomRaidMemberOrPet(30.0f);
|
||||
|
||||
int32 divineDmg = damage * (25 + (HasAura(63220) ? 15 : 0)) / 100; //25%, if has Glyph of Divine Storm -> 40%
|
||||
|
||||
if (!pRaidGrpMember)
|
||||
pRaidGrpMember = this;
|
||||
|
||||
CastCustomSpell(pRaidGrpMember, 54172, &divineDmg, 0, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
|
||||
pVictim->ToCreature()->AI()->DamageTaken(this, damage);
|
||||
|
||||
@@ -611,8 +569,26 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
{
|
||||
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
|
||||
pVictim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TAKE_DAMAGE, spellProto ? spellProto->Id : 0);
|
||||
}
|
||||
|
||||
// copy damage to casters of this aura
|
||||
AuraEffectList const& vCopyDamage = pVictim->GetAuraEffectsByType(SPELL_AURA_SHARE_DAMAGE_PCT);
|
||||
for (AuraEffectList::const_iterator i = vCopyDamage.begin(); i != vCopyDamage.end(); ++i)
|
||||
{
|
||||
// check damage school mask
|
||||
if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
|
||||
continue;
|
||||
|
||||
Unit * shareDamageTarget = (*i)->GetCaster();
|
||||
if (!shareDamageTarget)
|
||||
continue;
|
||||
SpellEntry const * spell = (*i)->GetSpellProto();
|
||||
|
||||
uint32 share = damage * (float((*i)->GetAmount()) / 100.0f);
|
||||
// TODO: check packets if damage is done by pVictim, or by attacker of pVicitm
|
||||
DealDamageMods(shareDamageTarget, share, NULL);
|
||||
DealDamage(shareDamageTarget, share, NULL, NODAMAGE, GetSpellSchoolMask(spell), spell, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Rage from Damage made (only from direct weapon damage)
|
||||
if (cleanDamage && damagetype == DIRECT_DAMAGE && this != pVictim && getPowerType() == POWER_RAGE)
|
||||
@@ -1816,14 +1792,20 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
||||
if (spellProto->SpellIconID == 2253)
|
||||
{
|
||||
//reduces all damage taken while Stunned
|
||||
if (unitflag & UNIT_FLAG_STUNNED)
|
||||
if (pVictim->m_form == FORM_CAT && (unitflag & UNIT_FLAG_STUNNED))
|
||||
RemainingDamage -= RemainingDamage * currentAbsorb / 100;
|
||||
continue;
|
||||
}
|
||||
// Savage Defense (amount store original percent of attack power applied)
|
||||
if (spellProto->SpellIconID == 50) // only spell with this aura fit
|
||||
// Savage Defense
|
||||
if (spellProto->SpellIconID == 146)
|
||||
{
|
||||
RemainingDamage -= int32(currentAbsorb * pVictim->GetTotalAttackPowerValue(BASE_ATTACK) / 100);
|
||||
if (RemainingDamage < currentAbsorb)
|
||||
currentAbsorb = RemainingDamage;
|
||||
|
||||
(*i)->SetAmount(0); // guarantee removal
|
||||
existExpired = true; // maybe hacky but not crashy
|
||||
|
||||
RemainingDamage -= currentAbsorb;
|
||||
continue;
|
||||
}
|
||||
// Moonkin Form passive
|
||||
@@ -2211,6 +2193,71 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::CalcHealAbsorb(Unit *pVictim, const SpellEntry *healSpell, uint32 &healAmount, uint32 &absorb)
|
||||
{
|
||||
if (!healAmount)
|
||||
return;
|
||||
|
||||
int32 RemainingHeal = healAmount;
|
||||
// Get unit state (need for some absorb check)
|
||||
uint32 unitflag = pVictim->GetUInt32Value(UNIT_FIELD_FLAGS);
|
||||
// Need remove expired auras after
|
||||
bool existExpired = false;
|
||||
|
||||
// absorb without mana cost
|
||||
AuraEffectList const& vHealAbsorb = pVictim->GetAuraEffectsByType(SPELL_AURA_SCHOOL_HEAL_ABSORB);
|
||||
for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end() && RemainingHeal > 0; ++i)
|
||||
{
|
||||
if (!((*i)->GetMiscValue() & healSpell->SchoolMask))
|
||||
continue;
|
||||
|
||||
SpellEntry const* spellProto = (*i)->GetSpellProto();
|
||||
|
||||
// Max Amount can be absorbed by this aura
|
||||
int32 currentAbsorb = (*i)->GetAmount();
|
||||
|
||||
// Found empty aura (impossible but..)
|
||||
if (currentAbsorb <= 0)
|
||||
{
|
||||
existExpired = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// currentAbsorb - damage can be absorbed by shield
|
||||
// If need absorb less damage
|
||||
if (RemainingHeal < currentAbsorb)
|
||||
currentAbsorb = RemainingHeal;
|
||||
|
||||
RemainingHeal -= currentAbsorb;
|
||||
|
||||
// Reduce shield amount
|
||||
(*i)->SetAmount((*i)->GetAmount() - currentAbsorb);
|
||||
// Need remove it later
|
||||
if ((*i)->GetAmount() <= 0)
|
||||
existExpired = true;
|
||||
}
|
||||
|
||||
// Remove all expired absorb auras
|
||||
if (existExpired)
|
||||
{
|
||||
for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end();)
|
||||
{
|
||||
AuraEffect *auraEff = *i;
|
||||
++i;
|
||||
if (auraEff->GetAmount() <= 0)
|
||||
{
|
||||
uint32 removedAuras = pVictim->m_removedAurasCount;
|
||||
auraEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
if (removedAuras+1 < pVictim->m_removedAurasCount)
|
||||
i = vHealAbsorb.begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
absorb = RemainingHeal > 0 ? (healAmount - RemainingHeal) : healAmount;
|
||||
healAmount = RemainingHeal;
|
||||
}
|
||||
|
||||
void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool /*extra*/)
|
||||
{
|
||||
if (hasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
|
||||
@@ -2846,11 +2893,12 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
return SPELL_MISS_MISS;
|
||||
|
||||
// Chance resist mechanic (select max value from every mechanic spell effect)
|
||||
int32 resist_chance = pVictim->GetMechanicResistChance(spell);
|
||||
int32 resist_chance = pVictim->GetMechanicResistChance(spell)*100;
|
||||
tmp += resist_chance;
|
||||
|
||||
// Chance resist debuff
|
||||
tmp -= pVictim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->Dispel));
|
||||
tmp += pVictim->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->Dispel)) * 100;
|
||||
tmp += pVictim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->Dispel)) * 100;
|
||||
|
||||
// Roll chance
|
||||
if (rand < tmp)
|
||||
@@ -3270,8 +3318,8 @@ void Unit::_UpdateAutoRepeatSpell()
|
||||
return;
|
||||
}
|
||||
|
||||
//apply delay
|
||||
if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500)
|
||||
//apply delay (Auto Shot (spellID 75) not affected)
|
||||
if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500 && m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
|
||||
setAttackTimer(RANGED_ATTACK,500);
|
||||
m_AutoRepeatFirstCast = false;
|
||||
|
||||
@@ -3521,7 +3569,18 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
|
||||
if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura))
|
||||
{
|
||||
if (aura->GetSpellProto()->StackAmount)
|
||||
{
|
||||
aura->ModStackAmount(foundAura->GetStackAmount());
|
||||
}
|
||||
// Update periodic timers from the previous aura
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
AuraEffect *existingEff = foundAura->GetEffect(i);
|
||||
AuraEffect *newEff = aura->GetEffect(i);
|
||||
if (!existingEff || !newEff)
|
||||
continue;
|
||||
newEff->SetPeriodicTimer(existingEff->GetPeriodicTimer());
|
||||
}
|
||||
|
||||
// Use the new one to replace the old one
|
||||
// This is the only place where AURA_REMOVE_BY_STACK should be used
|
||||
@@ -4118,7 +4177,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 dur = 2*MINUTE*IN_MILISECONDS < aura->GetDuration() ? 2*MINUTE*IN_MILISECONDS : aura->GetDuration();
|
||||
int32 dur = 2*MINUTE*IN_MILLISECONDS < aura->GetDuration() ? 2*MINUTE*IN_MILLISECONDS : aura->GetDuration();
|
||||
|
||||
newAura = Aura::TryCreate(aura->GetSpellProto(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID());
|
||||
if (!newAura)
|
||||
@@ -4335,16 +4394,14 @@ void Unit::RemoveAreaAurasDueToLeaveWorld()
|
||||
|
||||
void Unit::RemoveAllAuras()
|
||||
{
|
||||
while (!m_appliedAuras.empty() || !m_ownedAuras.empty())
|
||||
{
|
||||
AuraApplicationMap::iterator aurAppIter = m_appliedAuras.begin();
|
||||
while (!m_appliedAuras.empty())
|
||||
_UnapplyAura(aurAppIter, AURA_REMOVE_BY_DEFAULT);
|
||||
AuraApplicationMap::iterator aurAppIter;
|
||||
for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
|
||||
_UnapplyAura(aurAppIter, AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
AuraMap::iterator aurIter;
|
||||
for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
|
||||
RemoveOwnedAura(aurIter);
|
||||
|
||||
AuraMap::iterator aurIter = m_ownedAuras.begin();
|
||||
while (!m_ownedAuras.empty())
|
||||
RemoveOwnedAura(aurIter);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveArenaAuras(bool onleave)
|
||||
@@ -6561,11 +6618,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
||||
return false;
|
||||
|
||||
// mana cost save
|
||||
int32 mana = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
|
||||
basepoints0 = mana * 40/100;
|
||||
basepoints0 = CalculatePowerCost(procSpell, this, SpellSchoolMask(procSpell->SchoolMask)) * 4/10;
|
||||
if (basepoints0 <= 0)
|
||||
return false;
|
||||
|
||||
basepoints0 += 1; // standard basepoint increase for CastCustomSpell
|
||||
target = this;
|
||||
triggered_spell_id = 34720;
|
||||
break;
|
||||
@@ -7285,27 +7342,25 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
||||
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
|
||||
return false;
|
||||
}
|
||||
// No thread generated mod
|
||||
// TODO: exist special flag in spell attributes for this, need found and use!
|
||||
SpellModifier *mod = new SpellModifier;
|
||||
mod->op = SPELLMOD_THREAT;
|
||||
mod->value = -100;
|
||||
mod->type = SPELLMOD_PCT;
|
||||
mod->spellId = dummySpell->Id;
|
||||
mod->mask[0] = 0x02;
|
||||
mod->mask[2] = 0x00;
|
||||
this->ToPlayer()->AddSpellMod(mod, true);
|
||||
|
||||
// Remove cooldown (Chain Lightning - have Category Recovery time)
|
||||
// Chain Lightning
|
||||
if (procSpell->SpellFamilyFlags[0] & 0x2)
|
||||
{
|
||||
// Chain lightning has [LightOverload_Proc_Chance] / [Max_Number_of_Targets] chance to proc of each individual target hit.
|
||||
// A maxed LO would have a 33% / 3 = 11% chance to proc of each target.
|
||||
// LO chance was already "accounted" at the proc chance roll, now need to divide the chance by [Max_Number_of_Targets]
|
||||
float chance = 100.0f / procSpell->EffectChainTarget[effIndex];
|
||||
if (!roll_chance_f(chance))
|
||||
return false;
|
||||
|
||||
// Remove cooldown (Chain Lightning - have Category Recovery time)
|
||||
ToPlayer()->RemoveSpellCooldown(spellId);
|
||||
}
|
||||
|
||||
CastSpell(pVictim, spellId, true, castItem, triggeredByAura);
|
||||
|
||||
this->ToPlayer()->AddSpellMod(mod, false);
|
||||
|
||||
if (cooldown && GetTypeId() == TYPEID_PLAYER)
|
||||
ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
|
||||
ToPlayer()->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -7744,12 +7799,35 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 /*damage*/, Aur
|
||||
|
||||
// Used in case when access to whole aura is needed
|
||||
// All procs should be handled like this...
|
||||
bool Unit::HandleAuraProc(Unit * /*pVictim*/, uint32 damage, Aura * triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 /*cooldown*/, bool * handled)
|
||||
bool Unit::HandleAuraProc(Unit * pVictim, uint32 damage, Aura * triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 procEx, uint32 /*cooldown*/, bool * handled)
|
||||
{
|
||||
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto();
|
||||
|
||||
switch(dummySpell->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_PALADIN:
|
||||
{
|
||||
// Infusion of Light
|
||||
if (dummySpell->SpellIconID == 3021)
|
||||
{
|
||||
// Flash of Light HoT on Flash of Light when Sacred Shield active
|
||||
if (procSpell->SpellFamilyFlags[0] & 0x40000000 && procSpell->SpellIconID == 242)
|
||||
{
|
||||
*handled = true;
|
||||
if (pVictim->HasAura(53601))
|
||||
{
|
||||
int32 bp0 = (damage/12) * SpellMgr::CalculateSpellEffectAmount(dummySpell, 2)/100;
|
||||
CastCustomSpell(pVictim, 66922, &bp0, NULL, NULL, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// but should not proc on non-critical Holy Shocks
|
||||
else if ((procSpell->SpellFamilyFlags[0] & 0x200000 || procSpell->SpellFamilyFlags[1] & 0x10000) && !(procEx & PROC_EX_CRITICAL_HIT))
|
||||
*handled = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_MAGE:
|
||||
{
|
||||
// Combustion
|
||||
@@ -7783,7 +7861,7 @@ bool Unit::HandleAuraProc(Unit * /*pVictim*/, uint32 damage, Aura * triggeredByA
|
||||
if (!spInfo)
|
||||
return false;
|
||||
|
||||
int32 bp0 = this->GetCreateMana() * spInfo->CalculateSimpleValue(0) / 100;
|
||||
int32 bp0 = this->GetCreateMana() * SpellMgr::CalculateSpellEffectAmount(spInfo, 0) / 100;
|
||||
this->CastCustomSpell(this, 67545, &bp0, NULL, NULL, true, NULL, triggeredByAura->GetEffect(0), this->GetGUID());
|
||||
return true;
|
||||
}
|
||||
@@ -8137,6 +8215,24 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
|
||||
target = pVictim;
|
||||
break;
|
||||
}
|
||||
//Item - Coliseum 25 Heroic Caster Trinket
|
||||
case 67758:
|
||||
{
|
||||
if(!pVictim || !pVictim->isAlive())
|
||||
return false;
|
||||
// stacking
|
||||
CastSpell(this, 67759, true, NULL, triggeredByAura);
|
||||
|
||||
Aura * dummy = GetAura(67759);
|
||||
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
|
||||
if(!dummy || dummy->GetStackAmount() < triggerAmount)
|
||||
return false;
|
||||
|
||||
RemoveAurasDueToSpell(67759);
|
||||
trigger_spell_id = 67760;
|
||||
target = pVictim;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Illumination
|
||||
if (auraSpellInfo->SpellIconID == 241)
|
||||
@@ -8170,7 +8266,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
|
||||
}
|
||||
// percent stored in effect 1 (class scripts) base points
|
||||
int32 cost = originalSpell->manaCost + originalSpell->ManaCostPercentage * GetCreateMana() / 100;
|
||||
basepoints0 = cost*auraSpellInfo->CalculateSimpleValue(1)/100;
|
||||
basepoints0 = cost*SpellMgr::CalculateSpellEffectAmount(auraSpellInfo, 1)/100;
|
||||
trigger_spell_id = 20272;
|
||||
target = this;
|
||||
}
|
||||
@@ -9608,7 +9704,13 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
|
||||
int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical)
|
||||
{
|
||||
int32 gain = pVictim->ModifyHealth(int32(addhealth));
|
||||
uint32 absorb = 0;
|
||||
// calculate heal absorb and reduce healing
|
||||
CalcHealAbsorb(pVictim, spellProto, addhealth, absorb);
|
||||
int32 gain = 0;
|
||||
|
||||
if (addhealth)
|
||||
gain = pVictim->ModifyHealth(int32(addhealth));
|
||||
|
||||
Unit* unit = this;
|
||||
|
||||
@@ -9618,7 +9720,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// overheal = addhealth - gain
|
||||
unit->SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth - gain, critical);
|
||||
unit->SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth - gain, absorb, critical);
|
||||
|
||||
if (BattleGround *bg = unit->ToPlayer()->GetBattleGround())
|
||||
bg->UpdatePlayerScore((Player*)unit, SCORE_HEALING_DONE, gain);
|
||||
@@ -9823,7 +9925,7 @@ void Unit::UnsummonAllTotems()
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, bool critical)
|
||||
void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical)
|
||||
{
|
||||
// we guess size
|
||||
WorldPacket data(SMSG_SPELLHEALLOG, (8+8+4+4+4+4+1));
|
||||
@@ -9832,7 +9934,7 @@ void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32
|
||||
data << uint32(SpellID);
|
||||
data << uint32(Damage);
|
||||
data << uint32(OverHeal);
|
||||
data << uint32(0); // Absorb amount
|
||||
data << uint32(Absorb); // Absorb amount
|
||||
data << uint8(critical ? 1 : 0);
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
@@ -9955,7 +10057,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
case 5142: // Increased Lightning Damage
|
||||
case 5147: // Improved Consecration / Libram of Resurgence
|
||||
case 5148: // Idol of the Shooting Star
|
||||
case 6008: // Increased Lightning Damage / Totem of Hex
|
||||
case 6008: // Increased Lightning Damage
|
||||
case 8627: // Totem of Hex
|
||||
{
|
||||
DoneTotal += (*i)->GetAmount();
|
||||
break;
|
||||
@@ -10122,7 +10225,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
case 49638:
|
||||
{
|
||||
if (const SpellEntry *proto=sSpellStore.LookupEntry(itr->first))
|
||||
ApCoeffMod *= (100.0f + proto->CalculateSimpleValue(0)) / 100.0f;
|
||||
ApCoeffMod *= (100.0f + SpellMgr::CalculateSpellEffectAmount(proto, 0)) / 100.0f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -10371,6 +10474,10 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic
|
||||
|
||||
bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) const
|
||||
{
|
||||
// Mobs can't crit with spells.
|
||||
if (IS_CREATURE_GUID(GetGUID()))
|
||||
return false;
|
||||
|
||||
// not critting spell
|
||||
if ((spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_CRIT))
|
||||
return false;
|
||||
@@ -10445,7 +10552,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
|
||||
}
|
||||
}
|
||||
// Custom crit by class
|
||||
switch(spellProto->SpellFamilyName)
|
||||
switch (spellProto->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_DRUID:
|
||||
// Starfire
|
||||
@@ -10458,6 +10565,11 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_ROGUE:
|
||||
// Shiv-applied poisons can't crit
|
||||
if (FindCurrentSpellBySpellId(5938))
|
||||
crit_chance = 0.0f;
|
||||
break;
|
||||
case SPELLFAMILY_PALADIN:
|
||||
// Flash of light
|
||||
if (spellProto->SpellFamilyFlags[0] & 0x40000000)
|
||||
@@ -10606,6 +10718,10 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
|
||||
if (Unit* owner = GetOwner())
|
||||
return owner->SpellHealingBonus(pVictim, spellProto, healamount, damagetype, stack);
|
||||
|
||||
// no bonus for heal potions/bandages
|
||||
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION /*|| spellProto->Mechanic == MECHANIC_BANDAGE*/ )
|
||||
return healamount;
|
||||
|
||||
// Healing Done
|
||||
// Taken/Done total percent damage auras
|
||||
float DoneTotalMod = 1.0f;
|
||||
@@ -10877,7 +10993,7 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
|
||||
|
||||
AuraEffectList const& mHealingDone = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE);
|
||||
for (AuraEffectList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i)
|
||||
if (((*i)->GetMiscValue() & schoolMask) != 0)
|
||||
if (!(*i)->GetMiscValue() || ((*i)->GetMiscValue() & schoolMask) != 0)
|
||||
AdvertisedBenefit += (*i)->GetAmount();
|
||||
|
||||
// Healing bonus of spirit, intellect and strength
|
||||
@@ -11094,17 +11210,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage, WeaponAttackType att
|
||||
// ..done (base at attack power for marked target and base at attack power for creature type)
|
||||
int32 APbonus = 0;
|
||||
|
||||
if (attType == RANGED_ATTACK && pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_RANGED_AP_ATTACKER_CREATURES_BONUS);
|
||||
|
||||
// ..done (base at attack power and creature type)
|
||||
AuraEffectList const& mCreatureAttackPower = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS);
|
||||
for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
|
||||
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
|
||||
APbonus += (*i)->GetAmount();
|
||||
}
|
||||
else if (attType == RANGED_ATTACK)
|
||||
if (attType == RANGED_ATTACK)
|
||||
{
|
||||
APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
|
||||
|
||||
@@ -12419,7 +12525,7 @@ Unit* Creature::SelectVictim()
|
||||
//======================================================================
|
||||
//======================================================================
|
||||
|
||||
int32 Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, int32 value)
|
||||
int32 Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, int32 value) const
|
||||
{
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
@@ -12440,57 +12546,10 @@ int32 Unit::ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_inde
|
||||
return value;
|
||||
}
|
||||
|
||||
int32 Unit::CalculateSpellDamage(Unit const* /*target*/, SpellEntry const* spellProto, uint8 effect_index, int32 const* effBasePoints)
|
||||
// function uses real base points (typically value - 1)
|
||||
int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints) const
|
||||
{
|
||||
int32 level = int32(getLevel());
|
||||
if (level > int32(spellProto->maxLevel) && spellProto->maxLevel > 0)
|
||||
level = int32(spellProto->maxLevel);
|
||||
else if (level < int32(spellProto->baseLevel))
|
||||
level = int32(spellProto->baseLevel);
|
||||
level -= int32(spellProto->spellLevel);
|
||||
|
||||
float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index];
|
||||
int32 basePoints = effBasePoints ? *effBasePoints - 1 : spellProto->EffectBasePoints[effect_index];
|
||||
basePoints += int32(level * basePointsPerLevel);
|
||||
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index]);
|
||||
|
||||
switch(randomPoints)
|
||||
{
|
||||
case 0: // not used
|
||||
case 1: basePoints += 1; break; // range 1..1
|
||||
default:
|
||||
// range can have positive (1..rand) and negative (rand..1) values, so order its for irand
|
||||
int32 randvalue = (randomPoints >= 1)
|
||||
? irand(1, randomPoints)
|
||||
: irand(randomPoints, 1);
|
||||
|
||||
basePoints += randvalue;
|
||||
break;
|
||||
}
|
||||
|
||||
int32 value = basePoints;
|
||||
|
||||
// random damage
|
||||
//if (comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/)
|
||||
if (m_movedPlayer)
|
||||
if (uint8 comboPoints = m_movedPlayer->GetComboPoints())
|
||||
if (float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index])
|
||||
value += int32(comboDamage * comboPoints);
|
||||
|
||||
value = ApplyEffectModifiers(spellProto, effect_index, value);
|
||||
|
||||
if (!basePointsPerLevel && (spellProto->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION && spellProto->spellLevel) &&
|
||||
spellProto->Effect[effect_index] != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
|
||||
spellProto->Effect[effect_index] != SPELL_EFFECT_KNOCK_BACK &&
|
||||
spellProto->EffectApplyAuraName[effect_index] != SPELL_AURA_MOD_SPEED_ALWAYS &&
|
||||
spellProto->EffectApplyAuraName[effect_index] != SPELL_AURA_MOD_SPEED_NOT_STACK &&
|
||||
spellProto->EffectApplyAuraName[effect_index] != SPELL_AURA_MOD_INCREASE_SPEED &&
|
||||
spellProto->EffectApplyAuraName[effect_index] != SPELL_AURA_MOD_DECREASE_SPEED)
|
||||
//there are many more: slow speed, -healing pct
|
||||
value = int32(value*0.25f*exp(getLevel()*(70-spellProto->spellLevel)/1000.0f));
|
||||
//value = int32(value * (int32)getLevel() / (int32)(spellProto->spellLevel ? spellProto->spellLevel : 1));
|
||||
|
||||
return value;
|
||||
return SpellMgr::CalculateSpellEffectAmount(spellProto, effect_index, this, basePoints, target);
|
||||
}
|
||||
|
||||
int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
|
||||
@@ -12575,7 +12634,7 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
|
||||
{
|
||||
// Glyph of Thorns
|
||||
if (AuraEffect * aurEff = GetAuraEffect(57862, 0))
|
||||
duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
|
||||
duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_PALADIN:
|
||||
@@ -12583,13 +12642,13 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i
|
||||
{
|
||||
// Glyph of Blessing of Might
|
||||
if (AuraEffect * aurEff = GetAuraEffect(57958, 0))
|
||||
duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
|
||||
duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
else if (spellProto->SpellFamilyFlags[0] & 0x00010000)
|
||||
{
|
||||
// Glyph of Blessing of Wisdom
|
||||
if (AuraEffect * aurEff = GetAuraEffect(57979, 0))
|
||||
duration += aurEff->GetAmount() * MINUTE * IN_MILISECONDS;
|
||||
duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -12607,11 +12666,10 @@ void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spel
|
||||
|
||||
if (!(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)) && spellProto->SpellFamilyName)
|
||||
castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
else
|
||||
{
|
||||
if (spellProto->Attributes & SPELL_ATTR_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG))
|
||||
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
|
||||
}
|
||||
else if (spellProto->Attributes & SPELL_ATTR_REQ_AMMO && !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG))
|
||||
castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
|
||||
else if (spellProto->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
|
||||
castTime = 500;
|
||||
}
|
||||
|
||||
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
|
||||
@@ -12654,10 +12712,10 @@ void Unit::IncrDiminishing(DiminishingGroup group)
|
||||
m_Diminishing.push_back(DiminishingReturn(group,getMSTime(),DIMINISHING_LEVEL_2));
|
||||
}
|
||||
|
||||
void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration)
|
||||
float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster,DiminishingLevels Level, int32 limitduration)
|
||||
{
|
||||
if (duration == -1 || group == DIMINISHING_NONE || caster->IsFriendlyTo(this))
|
||||
return;
|
||||
return 1.0f;
|
||||
|
||||
// test pet/charm masters instead pets/charmeds
|
||||
Unit const* targetOwner = GetCharmerOrOwner();
|
||||
@@ -12711,6 +12769,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un
|
||||
}
|
||||
|
||||
duration = int32(duration * mod);
|
||||
return mod;
|
||||
}
|
||||
|
||||
void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply)
|
||||
@@ -13277,8 +13336,7 @@ void Unit::UpdateCharmAI()
|
||||
{
|
||||
if (!isCharmed())
|
||||
{
|
||||
if (i_AI)
|
||||
delete i_AI;
|
||||
delete i_AI;
|
||||
i_AI = i_disabledAI;
|
||||
i_disabledAI = NULL;
|
||||
}
|
||||
@@ -13314,7 +13372,8 @@ void Unit::DeleteCharmInfo()
|
||||
}
|
||||
|
||||
CharmInfo::CharmInfo(Unit* unit)
|
||||
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false)
|
||||
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
|
||||
m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
|
||||
m_charmspells[i].SetActionAndType(0,ACT_DISABLED);
|
||||
@@ -13623,7 +13682,6 @@ bool InitTriggerAuraData()
|
||||
|
||||
isNonTriggerAura[SPELL_AURA_MOD_POWER_REGEN]=true;
|
||||
isNonTriggerAura[SPELL_AURA_REDUCE_PUSHBACK]=true;
|
||||
isTriggerAura[SPELL_AURA_RANGED_AP_ATTACKER_CREATURES_BONUS] = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -14064,7 +14122,7 @@ void Unit::StopMoving()
|
||||
|
||||
// send explicit stop packet
|
||||
// rely on vmaps here because for example stormwind is in air
|
||||
//float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true);
|
||||
//float z = sMapMgr.GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true);
|
||||
//if (fabs(GetPositionZ() - z) < 2.0f)
|
||||
// Relocate(GetPositionX(), GetPositionY(), z);
|
||||
//Relocate(GetPositionX(), GetPositionY(),GetPositionZ());
|
||||
@@ -15146,6 +15204,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
|
||||
if (!charmer)
|
||||
return false;
|
||||
|
||||
// unmount players when charmed
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
Unmount();
|
||||
|
||||
assert(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
|
||||
assert((type == CHARM_TYPE_VEHICLE) == IsVehicle());
|
||||
|
||||
@@ -16272,7 +16334,7 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas
|
||||
bool Unit::SetPosition(float x, float y, float z, float orientation, bool teleport)
|
||||
{
|
||||
// prevent crash when a bad coord is sent by the client
|
||||
if (!Trinity::IsValidMapCoord(x,y))
|
||||
if (!Trinity::IsValidMapCoord(x,y,z,orientation))
|
||||
{
|
||||
sLog.outDebug("Unit::SetPosition(%f, %f, %f) .. bad coordinates!",x,y,z);
|
||||
return false;
|
||||
|
||||
@@ -31,9 +31,12 @@
|
||||
#include "HostileRefManager.h"
|
||||
#include "FollowerReference.h"
|
||||
#include "FollowerRefManager.h"
|
||||
#include "Utilities/EventProcessor.h"
|
||||
#include "EventProcessor.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "Path.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Timer.h"
|
||||
#include <list>
|
||||
|
||||
#define WORLD_TRIGGER 12999
|
||||
@@ -324,7 +327,6 @@ class DynamicObject;
|
||||
class GameObject;
|
||||
class Item;
|
||||
class Pet;
|
||||
class Path;
|
||||
class PetAura;
|
||||
class Minion;
|
||||
class Guardian;
|
||||
@@ -1104,7 +1106,7 @@ class Unit : public WorldObject
|
||||
|
||||
DiminishingLevels GetDiminishing(DiminishingGroup group);
|
||||
void IncrDiminishing(DiminishingGroup group);
|
||||
void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration);
|
||||
float ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration);
|
||||
void ApplyDiminishingAura(DiminishingGroup group, bool apply);
|
||||
void ClearDiminishings() { m_Diminishing.clear(); }
|
||||
|
||||
@@ -1397,7 +1399,7 @@ class Unit : public WorldObject
|
||||
virtual bool IsUnderWater() const;
|
||||
bool isInAccessiblePlaceFor(Creature const* c) const;
|
||||
|
||||
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, bool critical = false);
|
||||
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false);
|
||||
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
|
||||
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
|
||||
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
|
||||
@@ -1436,12 +1438,14 @@ class Unit : public WorldObject
|
||||
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player = NULL);
|
||||
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL);
|
||||
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
||||
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end);
|
||||
void SendMonsterMoveTransport(Unit *vehicleOwner);
|
||||
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
|
||||
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
|
||||
void SendMovementFlagUpdate();
|
||||
|
||||
template<typename PathElem, typename PathNode>
|
||||
void SendMonsterMoveByPath(Path<PathElem,PathNode> const& path, uint32 start, uint32 end);
|
||||
|
||||
void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference);
|
||||
void SendClearThreatListOpcode();
|
||||
void SendRemoveFromThreatListOpcode(HostileReference* pHostileReference);
|
||||
@@ -1525,7 +1529,7 @@ class Unit : public WorldObject
|
||||
void DeleteCharmInfo();
|
||||
void UpdateCharmAI();
|
||||
//Player * GetMoverSource() const;
|
||||
Player *m_movedPlayer;
|
||||
Player * m_movedPlayer;
|
||||
SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
|
||||
void AddPlayerToVision(Player* plr);
|
||||
void RemovePlayerFromVision(Player* plr);
|
||||
@@ -1831,6 +1835,7 @@ class Unit : public WorldObject
|
||||
uint32 CalcNotIgnoreDamageRedunction(uint32 damage, SpellSchoolMask damageSchoolMask);
|
||||
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
|
||||
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo = NULL);
|
||||
void CalcHealAbsorb(Unit *pVictim, const SpellEntry *spellProto, uint32 &healAmount, uint32 &absorb);
|
||||
|
||||
void UpdateSpeed(UnitMoveType mtype, bool forced);
|
||||
float GetSpeed(UnitMoveType mtype) const;
|
||||
@@ -1841,8 +1846,8 @@ class Unit : public WorldObject
|
||||
void SetHover(bool on);
|
||||
bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
|
||||
|
||||
int32 ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, int32 value);
|
||||
int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints = NULL);
|
||||
int32 ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, int32 value) const;
|
||||
int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
|
||||
int32 CalcSpellDuration(SpellEntry const* spellProto);
|
||||
int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive);
|
||||
void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell * spell=NULL);
|
||||
@@ -2116,4 +2121,30 @@ namespace Trinity
|
||||
};
|
||||
}
|
||||
|
||||
template<typename Elem, typename Node>
|
||||
inline void Unit::SendMonsterMoveByPath(Path<Elem,Node> const& path, uint32 start, uint32 end)
|
||||
{
|
||||
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
|
||||
uint32 pathSize = end - start;
|
||||
WorldPacket data(SMSG_MONSTER_MOVE, (GetPackGUID().size()+1+4+4+4+4+1+4+4+4+pathSize*4*3));
|
||||
data.append(GetPackGUID());
|
||||
data << uint8(0);
|
||||
data << GetPositionX();
|
||||
data << GetPositionY();
|
||||
data << GetPositionZ();
|
||||
data << uint32(getMSTime());
|
||||
data << uint8(0);
|
||||
data << uint32(((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) || isInFlight()) ? (MOVEFLAG_FLY|MOVEFLAG_WALK) : MOVEFLAG_WALK);
|
||||
data << uint32(traveltime);
|
||||
data << uint32(pathSize);
|
||||
|
||||
for (uint32 i = start; i < end; ++i)
|
||||
{
|
||||
data << float(path[i].x);
|
||||
data << float(path[i].y);
|
||||
data << float(path[i].z);
|
||||
}
|
||||
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,27 @@ Vehicle::Vehicle(Unit *unit, VehicleEntry const *vehInfo) : me(unit), m_vehicleI
|
||||
++m_usableSeatNum;
|
||||
}
|
||||
}
|
||||
|
||||
// HACKY WAY, We must found a more generic way to handle this
|
||||
// Set inmunities since db ones are rewritten with player's ones
|
||||
switch (GetVehicleInfo()->m_ID)
|
||||
{
|
||||
case 160:
|
||||
me->SetControlled(true, UNIT_STAT_ROOT);
|
||||
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
|
||||
case 158:
|
||||
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_FEAR, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_HEAL, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STUN, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ROOT, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_CONFUSE, true);
|
||||
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip jump effect
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
assert(!m_Seats.empty());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,18 +22,15 @@
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "PoolHandler.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Player.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(GameEventMgr);
|
||||
|
||||
bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
{
|
||||
switch(mGameEvent[entry].state)
|
||||
@@ -1154,7 +1151,7 @@ uint32 GameEventMgr::Update() // return the next e
|
||||
for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
|
||||
StopEvent(*itr);
|
||||
sLog.outDetail("Next game event check in %u seconds.", nextEventDelay + 1);
|
||||
return (nextEventDelay + 1) * IN_MILISECONDS; // Add 1 second to be sure event has started/stopped at next call
|
||||
return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call
|
||||
}
|
||||
|
||||
void GameEventMgr::UnApplyEvent(uint16 event_id)
|
||||
@@ -1270,7 +1267,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||
objmgr.AddCreatureToGrid(*itr, data);
|
||||
|
||||
// Spawn if necessary (loaded grids only)
|
||||
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(data->mapid));
|
||||
// We use spawn coords to spawn
|
||||
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
||||
{
|
||||
@@ -1298,7 +1295,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||
objmgr.AddGameobjectToGrid(*itr, data);
|
||||
// Spawn if necessary (loaded grids only)
|
||||
// this base map checked as non-instanced and then only existed
|
||||
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(data->mapid));
|
||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
||||
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
||||
{
|
||||
@@ -1345,7 +1342,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
||||
{
|
||||
objmgr.RemoveCreatureFromGrid(*itr, data);
|
||||
|
||||
if (Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
|
||||
if (Creature* pCreature = sObjectAccessor.GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
|
||||
pCreature->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
@@ -1366,7 +1363,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
||||
{
|
||||
objmgr.RemoveGameobjectFromGrid(*itr, data);
|
||||
|
||||
if (GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
|
||||
if (GameObject* pGameobject = sObjectAccessor.GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
|
||||
pGameobject->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
@@ -1392,7 +1389,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
|
||||
continue;
|
||||
|
||||
// Update if spawned
|
||||
Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT), (Creature*)NULL);
|
||||
Creature* pCreature = sObjectAccessor.GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT), (Creature*)NULL);
|
||||
if (pCreature)
|
||||
{
|
||||
if (activate)
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Platform/Define.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Define.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#define max_ge_check_delay DAY // 1 day in seconds
|
||||
|
||||
@@ -92,9 +92,11 @@ class Creature;
|
||||
|
||||
class GameEventMgr
|
||||
{
|
||||
friend class ACE_Singleton<GameEventMgr, ACE_Null_Mutex>;
|
||||
GameEventMgr();
|
||||
public:
|
||||
GameEventMgr();
|
||||
~GameEventMgr() {};
|
||||
|
||||
typedef std::set<uint16> ActiveEvents;
|
||||
typedef std::vector<GameEventData> GameEventDataMap;
|
||||
ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
|
||||
@@ -172,7 +174,7 @@ class GameEventMgr
|
||||
GameEventGuidMap mGameEventGameobjectGuids;
|
||||
};
|
||||
|
||||
#define gameeventmgr Trinity::Singleton<GameEventMgr>::Instance()
|
||||
#define gameeventmgr (*ACE_Singleton<GameEventMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
bool IsHolidayActive(HolidayIds id);
|
||||
bool IsEventActive(uint16 event_id);
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
#include "Log.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Database/DatabaseImpl.h"
|
||||
#include "Platform/Define.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "Define.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "GlobalEvents.h"
|
||||
@@ -53,7 +53,7 @@ static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
|
||||
/// Resurrectable - convert corpses to bones
|
||||
if (!bones)
|
||||
{
|
||||
if (!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid))
|
||||
if (!sObjectAccessor.ConvertCorpseForPlayer(player_guid))
|
||||
{
|
||||
sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow);
|
||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
|
||||
@@ -62,7 +62,7 @@ static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
|
||||
else
|
||||
///- or delete bones
|
||||
{
|
||||
MapManager::Instance().RemoveBonesFromMap(mapid, guid, positionX, positionY);
|
||||
sMapMgr.RemoveBonesFromMap(mapid, guid, positionX, positionY);
|
||||
|
||||
///- remove bones from the database
|
||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
#include "Player.h"
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
@@ -41,10 +41,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#define CLASS_LOCK Trinity::ClassLevelLockable<ObjectAccessor, ACE_Thread_Mutex>
|
||||
INSTANTIATE_SINGLETON_2(ObjectAccessor, CLASS_LOCK);
|
||||
INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ACE_Thread_Mutex);
|
||||
|
||||
ObjectAccessor::ObjectAccessor()
|
||||
{
|
||||
}
|
||||
@@ -151,7 +147,7 @@ Player* ObjectAccessor::FindPlayer(uint64 guid)
|
||||
|
||||
Player* ObjectAccessor::FindPlayerByName(const char* name)
|
||||
{
|
||||
Guard guard(*HashMapHolder<Player>::GetLock());
|
||||
ACE_GUARD_RETURN(LockType, g, *HashMapHolder<Player>::GetLock(), NULL);
|
||||
HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer();
|
||||
for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
if (iter->second->IsInWorld() && strcmp(name, iter->second->GetName()) == 0)
|
||||
@@ -162,7 +158,7 @@ Player* ObjectAccessor::FindPlayerByName(const char* name)
|
||||
|
||||
void ObjectAccessor::SaveAllPlayers()
|
||||
{
|
||||
Guard guard(*HashMapHolder<Player>::GetLock());
|
||||
ACE_GUARD(LockType, g, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer();
|
||||
for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
itr->second->SaveToDB();
|
||||
@@ -175,7 +171,7 @@ Pet* ObjectAccessor::GetPet(uint64 guid)
|
||||
|
||||
Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid)
|
||||
{
|
||||
Guard guard(i_corpseGuard);
|
||||
ACE_GUARD_RETURN(LockType, guard, i_corpseGuard, NULL);
|
||||
|
||||
Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid);
|
||||
if (iter == i_player2corpse.end())
|
||||
@@ -197,7 +193,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse)
|
||||
|
||||
// Critical section
|
||||
{
|
||||
Guard guard(i_corpseGuard);
|
||||
ACE_GUARD(LockType, g, i_corpseGuard);
|
||||
|
||||
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID());
|
||||
if (iter == i_player2corpse.end()) // TODO: Fix this
|
||||
@@ -219,7 +215,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse)
|
||||
|
||||
// Critical section
|
||||
{
|
||||
Guard guard(i_corpseGuard);
|
||||
ACE_GUARD(LockType, g, i_corpseGuard);
|
||||
|
||||
assert(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end());
|
||||
i_player2corpse[corpse->GetOwnerGUID()] = corpse;
|
||||
@@ -234,7 +230,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse)
|
||||
|
||||
void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map)
|
||||
{
|
||||
Guard guard(i_corpseGuard);
|
||||
ACE_GUARD(LockType, g, i_corpseGuard);
|
||||
|
||||
for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter)
|
||||
{
|
||||
@@ -274,7 +270,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool /*insign
|
||||
// done in removecorpse
|
||||
// remove resurrectable corpse from grid object registry (loaded state checked into call)
|
||||
// do not load the map if it's not loaded
|
||||
//Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId());
|
||||
//Map *map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
|
||||
//if (map)
|
||||
// map->Remove(corpse, false);
|
||||
|
||||
@@ -333,7 +329,7 @@ void ObjectAccessor::Update(uint32 /*diff*/)
|
||||
|
||||
// Critical section
|
||||
{
|
||||
Guard guard(i_updateGuard);
|
||||
ACE_GUARD(LockType, g, i_updateGuard);
|
||||
|
||||
while (!i_objects.empty())
|
||||
{
|
||||
|
||||
@@ -21,11 +21,10 @@
|
||||
#ifndef TRINITY_OBJECTACCESSOR_H
|
||||
#define TRINITY_OBJECTACCESSOR_H
|
||||
|
||||
#include "Platform/Define.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include "Utilities/UnorderedMap.h"
|
||||
#include "Policies/ThreadingModel.h"
|
||||
#include "UnorderedMap.h"
|
||||
|
||||
#include "UpdateData.h"
|
||||
|
||||
@@ -50,23 +49,22 @@ class HashMapHolder
|
||||
|
||||
typedef UNORDERED_MAP<uint64, T*> MapType;
|
||||
typedef ACE_Thread_Mutex LockType;
|
||||
typedef Trinity::GeneralLock<LockType> Guard;
|
||||
|
||||
static void Insert(T* o)
|
||||
{
|
||||
Guard guard(i_lock);
|
||||
ACE_GUARD(LockType, Guard, i_lock);
|
||||
m_objectMap[o->GetGUID()] = o;
|
||||
}
|
||||
|
||||
static void Remove(T* o)
|
||||
{
|
||||
Guard guard(i_lock);
|
||||
ACE_GUARD(LockType, Guard, i_lock);
|
||||
m_objectMap.erase(o->GetGUID());
|
||||
}
|
||||
|
||||
static T* Find(uint64 guid)
|
||||
{
|
||||
Guard guard(i_lock);
|
||||
ACE_GUARD_RETURN(LockType, Guard, i_lock, NULL);
|
||||
typename MapType::iterator itr = m_objectMap.find(guid);
|
||||
return (itr != m_objectMap.end()) ? itr->second : NULL;
|
||||
}
|
||||
@@ -84,9 +82,9 @@ class HashMapHolder
|
||||
static MapType m_objectMap;
|
||||
};
|
||||
|
||||
class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassLevelLockable<ObjectAccessor, ACE_Thread_Mutex> >
|
||||
class ObjectAccessor
|
||||
{
|
||||
friend class Trinity::OperatorNew<ObjectAccessor>;
|
||||
friend class ACE_Singleton<ObjectAccessor, ACE_Thread_Mutex>;
|
||||
ObjectAccessor();
|
||||
~ObjectAccessor();
|
||||
ObjectAccessor(const ObjectAccessor&);
|
||||
@@ -220,13 +218,13 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
|
||||
|
||||
void AddUpdateObject(Object* obj)
|
||||
{
|
||||
Guard guard(i_updateGuard);
|
||||
ACE_GUARD(LockType, Guard, i_updateGuard);
|
||||
i_objects.insert(obj);
|
||||
}
|
||||
|
||||
void RemoveUpdateObject(Object* obj)
|
||||
{
|
||||
Guard guard(i_updateGuard);
|
||||
ACE_GUARD(LockType, Guard, i_updateGuard);
|
||||
i_objects.erase(obj);
|
||||
}
|
||||
|
||||
@@ -239,7 +237,6 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
|
||||
Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false);
|
||||
|
||||
typedef ACE_Thread_Mutex LockType;
|
||||
typedef Trinity::GeneralLock<LockType> Guard;
|
||||
|
||||
private:
|
||||
|
||||
@@ -254,4 +251,6 @@ class ObjectAccessor : public Trinity::Singleton<ObjectAccessor, Trinity::ClassL
|
||||
LockType i_updateGuard;
|
||||
LockType i_corpseGuard;
|
||||
};
|
||||
|
||||
#define sObjectAccessor (*ACE_Singleton<ObjectAccessor, ACE_Thread_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
#include "Database/SQLStorageImpl.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "SQLStorage.h"
|
||||
#include "SQLStorageImpl.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -33,7 +31,7 @@
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "Transports.h"
|
||||
#include "Transport.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Language.h"
|
||||
#include "GameEventMgr.h"
|
||||
@@ -48,8 +46,6 @@
|
||||
#include "Vehicle.h"
|
||||
#include "AchievementMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(ObjectMgr);
|
||||
|
||||
ScriptMapMap sQuestEndScripts;
|
||||
ScriptMapMap sQuestStartScripts;
|
||||
ScriptMapMap sSpellScripts;
|
||||
@@ -1177,14 +1173,14 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid)
|
||||
if (!linkedGuid) // we're removing the linking
|
||||
{
|
||||
mCreatureLinkedRespawnMap.erase(guid);
|
||||
WorldDatabase.DirectPExecute("DELETE FROM creature_linked_respawn WHERE guid = '%u'",guid);
|
||||
WorldDatabase.PExecute("DELETE FROM creature_linked_respawn WHERE guid = '%u'",guid);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CheckCreatureLinkedRespawn(guid,linkedGuid)) // we add/change linking
|
||||
{
|
||||
mCreatureLinkedRespawnMap[guid] = linkedGuid;
|
||||
WorldDatabase.DirectPExecute("REPLACE INTO creature_linked_respawn (guid,linkedGuid) VALUES ('%u','%u')",guid,linkedGuid);
|
||||
WorldDatabase.PExecute("REPLACE INTO creature_linked_respawn (guid,linkedGuid) VALUES ('%u','%u')",guid,linkedGuid);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1412,7 +1408,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
|
||||
if (!goinfo)
|
||||
return 0;
|
||||
|
||||
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId));
|
||||
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(mapId));
|
||||
if (!map)
|
||||
return 0;
|
||||
|
||||
@@ -1473,7 +1469,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
|
||||
AddCreatureToGrid(guid, &data);
|
||||
|
||||
// Spawn if necessary (loaded grids only)
|
||||
if (Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
|
||||
if (Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(mapId)))
|
||||
{
|
||||
// We use spawn coords to spawn
|
||||
if (!map->Instanceable() && map->IsLoaded(data.posX, data.posY))
|
||||
@@ -1524,7 +1520,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
|
||||
AddCreatureToGrid(guid, &data);
|
||||
|
||||
// Spawn if necessary (loaded grids only)
|
||||
if (Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
|
||||
if (Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(mapId)))
|
||||
{
|
||||
// We use spawn coords to spawn
|
||||
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||
@@ -2260,10 +2256,17 @@ void ObjectMgr::LoadItemPrototypes()
|
||||
const_cast<ItemPrototype*>(proto)->Sheath = SHEATHETYPE_NONE;
|
||||
}
|
||||
|
||||
if (proto->RandomProperty && !sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(proto->RandomProperty)))
|
||||
if (proto->RandomProperty)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)",i,proto->RandomProperty);
|
||||
const_cast<ItemPrototype*>(proto)->RandomProperty = 0;
|
||||
// To be implemented later
|
||||
if (proto->RandomProperty == -1)
|
||||
const_cast<ItemPrototype*>(proto)->RandomProperty = 0;
|
||||
|
||||
else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(proto->RandomProperty)))
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)",i,proto->RandomProperty);
|
||||
const_cast<ItemPrototype*>(proto)->RandomProperty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (proto->RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(proto->RandomSuffix)))
|
||||
@@ -2368,7 +2371,132 @@ void ObjectMgr::LoadItemPrototypes()
|
||||
}
|
||||
|
||||
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
|
||||
sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dnc`", *itr);
|
||||
sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dbc`", *itr);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadItemSetNameLocales()
|
||||
{
|
||||
mItemSetNameLocaleMap.clear(); // need for reload case
|
||||
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT `entry`,`name_loc1`,`name_loc2`,`name_loc3`,`name_loc4`,`name_loc5`,`name_loc6`,`name_loc7`,`name_loc8` FROM `locales_item_set_names`");
|
||||
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
barGoLink bar(result->GetRowCount());
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
ItemSetNameLocale& data = mItemSetNameLocaleMap[entry];
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetCppString();
|
||||
if (!str.empty())
|
||||
{
|
||||
int idx = GetOrNewIndexForLocale(LocaleConstant(i));
|
||||
if (idx >= 0)
|
||||
{
|
||||
if (data.Name.size() <= idx)
|
||||
data.Name.resize(idx+1);
|
||||
|
||||
data.Name[idx] = str;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %lu Item set name locale strings", (uint32)mItemSetNameLocaleMap.size());
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadItemSetNames()
|
||||
{
|
||||
mItemSetNameMap.clear(); // needed for reload case
|
||||
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT `entry`,`name`,`InventoryType` FROM `item_set_names`");
|
||||
|
||||
uint32 count = 0;
|
||||
std::set<uint32> itemSetItems;
|
||||
|
||||
// fill item set member ids
|
||||
for (uint32 entryId = 0; entryId < sItemSetStore.GetNumRows(); ++entryId)
|
||||
{
|
||||
ItemSetEntry const* setEntry = sItemSetStore.LookupEntry(entryId);
|
||||
if (!setEntry)
|
||||
continue;
|
||||
|
||||
for (uint32 i = 0; i < MAX_ITEM_SET_ITEMS; ++i)
|
||||
if (setEntry->itemId[i])
|
||||
itemSetItems.insert(setEntry->itemId[i]);
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
barGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
if (itemSetItems.find(entry) == itemSetItems.end())
|
||||
{
|
||||
sLog.outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemSetNameEntry &data = mItemSetNameMap[entry];
|
||||
data.name = fields[1].GetCppString();
|
||||
|
||||
uint32 invType = fields[2].GetUInt32();
|
||||
if (invType >= MAX_INVTYPE)
|
||||
{
|
||||
sLog.outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
|
||||
invType = INVTYPE_NON_EQUIP;
|
||||
}
|
||||
|
||||
data.InventoryType = invType;
|
||||
itemSetItems.erase(entry);
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
else
|
||||
{
|
||||
barGoLink bar(1);
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outErrorDb(">> Loaded 0 item set names. DB table `item_set_names` is empty.");
|
||||
}
|
||||
|
||||
if (!itemSetItems.empty())
|
||||
{
|
||||
ItemPrototype const* pProto;
|
||||
for (std::set<uint32>::iterator itr = itemSetItems.begin(); itr != itemSetItems.end(); ++itr)
|
||||
{
|
||||
uint32 entry = *itr;
|
||||
// add data from item_template if available
|
||||
if (pProto = GetItemPrototype(entry))
|
||||
{
|
||||
sLog.outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry);
|
||||
ItemSetNameEntry &data = mItemSetNameMap[entry];
|
||||
data.name = pProto->Name1;
|
||||
data.InventoryType = pProto->InventoryType;
|
||||
++count;
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry);
|
||||
}
|
||||
}
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u item set names", count);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadVehicleAccessories()
|
||||
@@ -2462,7 +2590,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
|
||||
else
|
||||
{
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `pet_levelstats` table, ignoring.",current_level);
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.",current_level);
|
||||
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
|
||||
}
|
||||
continue;
|
||||
@@ -2535,6 +2663,47 @@ PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level)
|
||||
return &itr->second[level-1]; // data for level 1 stored in [0] array element, ...
|
||||
}
|
||||
|
||||
void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count)
|
||||
{
|
||||
if (count > 0)
|
||||
playerInfo[race_][class_].item.push_back(PlayerCreateInfoItem(itemId, count));
|
||||
else
|
||||
{
|
||||
if (count < -1)
|
||||
sLog.outErrorDb("Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
|
||||
|
||||
uint32 RaceClass = (race_) | (class_ << 8);
|
||||
bool doneOne = false;
|
||||
for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i)
|
||||
{
|
||||
if (CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i))
|
||||
{
|
||||
if (entry->RaceClassGender == RaceClass || entry->RaceClassGender == (RaceClass | (1 << 16)))
|
||||
{
|
||||
bool found = false;
|
||||
for (uint8 x = 0; x < MAX_OUTFIT_ITEMS; ++x)
|
||||
{
|
||||
if (entry->ItemId[x] == itemId)
|
||||
{
|
||||
found = true;
|
||||
const_cast<CharStartOutfitEntry*>(entry)->ItemId[x] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
sLog.outErrorDb("Item %u specified to be removed from original create info not found in dbc!", itemId);
|
||||
|
||||
if (!doneOne)
|
||||
doneOne = true;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadPlayerInfo()
|
||||
{
|
||||
// Load playercreate
|
||||
@@ -2665,8 +2834,6 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
continue;
|
||||
}
|
||||
|
||||
PlayerInfo* pInfo = &playerInfo[current_race][current_class];
|
||||
|
||||
uint32 item_id = fields[2].GetUInt32();
|
||||
|
||||
if (!GetItemPrototype(item_id))
|
||||
@@ -2675,7 +2842,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 amount = fields[3].GetUInt32();
|
||||
int32 amount = fields[3].GetInt32();
|
||||
|
||||
if (!amount)
|
||||
{
|
||||
@@ -2683,7 +2850,18 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
continue;
|
||||
}
|
||||
|
||||
pInfo->item.push_back(PlayerCreateInfoItem(item_id, amount));
|
||||
if (!current_race || !current_class)
|
||||
{
|
||||
uint32 min_race = current_race ? current_race : 1;
|
||||
uint32 max_race = current_race ? current_race + 1 : MAX_RACES;
|
||||
uint32 min_class = current_class ? current_class : 1;
|
||||
uint32 max_class = current_class ? current_class + 1 : MAX_CLASSES;
|
||||
for (uint32 r = min_race; r < max_race; ++r)
|
||||
for (uint32 c = min_class; c < max_class; ++c)
|
||||
PlayerCreateInfoAddItemHelper(r, c, item_id, amount);
|
||||
}
|
||||
else
|
||||
PlayerCreateInfoAddItemHelper(current_race, current_class, item_id, amount);
|
||||
|
||||
bar.step();
|
||||
++count;
|
||||
@@ -2849,7 +3027,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `player_classlevelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
|
||||
else
|
||||
{
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level);
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.",current_level);
|
||||
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
|
||||
}
|
||||
continue;
|
||||
@@ -2946,7 +3124,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.",STRONG_MAX_LEVEL,current_level);
|
||||
else
|
||||
{
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_levelstats` table, ignoring.",current_level);
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.",current_level);
|
||||
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
|
||||
}
|
||||
continue;
|
||||
@@ -3056,7 +3234,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||
sLog.outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL,current_level);
|
||||
else
|
||||
{
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in TrinityCore.conf) level %u in `player_xp_for_levels` table, ignoring.",current_level);
|
||||
sLog.outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.",current_level);
|
||||
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
|
||||
}
|
||||
continue;
|
||||
@@ -3244,7 +3422,7 @@ void ObjectMgr::LoadGuilds()
|
||||
!newGuild->LoadMembersFromDB(guildMembersResult) ||
|
||||
!newGuild->LoadBankRightsFromDB(guildBankTabRightsResult) ||
|
||||
!newGuild->CheckGuildStructure()
|
||||
)
|
||||
)
|
||||
{
|
||||
newGuild->Disband();
|
||||
delete newGuild;
|
||||
@@ -4638,26 +4816,9 @@ void ObjectMgr::LoadEventScripts()
|
||||
// Load all possible script entries from gameobjects
|
||||
for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
|
||||
{
|
||||
GameObjectInfo const * goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i);
|
||||
if (goInfo)
|
||||
{
|
||||
switch(goInfo->type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_GOOBER:
|
||||
if (goInfo->goober.eventId)
|
||||
evt_scripts.insert(goInfo->goober.eventId);
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
if (goInfo->chest.eventId)
|
||||
evt_scripts.insert(goInfo->chest.eventId);
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_CAMERA:
|
||||
if (goInfo->camera.eventID)
|
||||
evt_scripts.insert(goInfo->camera.eventID);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (GameObjectInfo const * goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
||||
if (uint32 eventId = goInfo->GetEventScriptId())
|
||||
evt_scripts.insert(eventId);
|
||||
}
|
||||
// Load all possible script entries from spells
|
||||
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
|
||||
@@ -4676,6 +4837,20 @@ void ObjectMgr::LoadEventScripts()
|
||||
}
|
||||
}
|
||||
|
||||
for(size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx)
|
||||
{
|
||||
for(size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx)
|
||||
{
|
||||
TaxiPathNodeEntry const& node = sTaxiPathNodesByPath[path_idx][node_idx];
|
||||
|
||||
if (node.arrivalEventID)
|
||||
evt_scripts.insert(node.arrivalEventID);
|
||||
|
||||
if (node.departureEventID)
|
||||
evt_scripts.insert(node.departureEventID);
|
||||
}
|
||||
}
|
||||
|
||||
// Then check if all scripts are in above list of possible script entries
|
||||
for (ScriptMapMap::const_iterator itr = sEventScripts.begin(); itr != sEventScripts.end(); ++itr)
|
||||
{
|
||||
@@ -4693,7 +4868,7 @@ void ObjectMgr::LoadWaypointScripts()
|
||||
|
||||
for (ScriptMapMap::const_iterator itr = sWaypointScripts.begin(); itr != sWaypointScripts.end(); ++itr)
|
||||
{
|
||||
QueryResult_AutoPtr query = WorldDatabase.PQuery("SELECT * FROM waypoint_scripts WHERE id = %u", itr->first);
|
||||
QueryResult_AutoPtr query = WorldDatabase.PQuery("SELECT * FROM waypoint_data WHERE action = %u", itr->first);
|
||||
if (!query || !query->GetRowCount())
|
||||
sLog.outErrorDb("There is no waypoint which links to the waypoint script %u", itr->first);
|
||||
}
|
||||
@@ -5307,46 +5482,6 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
|
||||
return mount_id;
|
||||
}
|
||||
|
||||
void ObjectMgr::GetTaxiPathNodes(uint32 path, Path &pathnodes, std::vector<uint32>& mapIds)
|
||||
{
|
||||
if (path >= sTaxiPathNodesByPath.size())
|
||||
return;
|
||||
|
||||
TaxiPathNodeList& nodeList = sTaxiPathNodesByPath[path];
|
||||
|
||||
pathnodes.Resize(nodeList.size());
|
||||
mapIds.resize(nodeList.size());
|
||||
|
||||
for (size_t i = 0; i < nodeList.size(); ++i)
|
||||
{
|
||||
pathnodes[ i ].x = nodeList[i].x;
|
||||
pathnodes[ i ].y = nodeList[i].y;
|
||||
pathnodes[ i ].z = nodeList[i].z;
|
||||
|
||||
mapIds[i] = nodeList[i].mapid;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::GetTransportPathNodes(uint32 path, TransportPath &pathnodes)
|
||||
{
|
||||
if (path >= sTaxiPathNodesByPath.size())
|
||||
return;
|
||||
|
||||
TaxiPathNodeList& nodeList = sTaxiPathNodesByPath[path];
|
||||
|
||||
pathnodes.Resize(nodeList.size());
|
||||
|
||||
for (size_t i = 0; i < nodeList.size(); ++i)
|
||||
{
|
||||
pathnodes[ i ].mapid = nodeList[i].mapid;
|
||||
pathnodes[ i ].x = nodeList[i].x;
|
||||
pathnodes[ i ].y = nodeList[i].y;
|
||||
pathnodes[ i ].z = nodeList[i].z;
|
||||
pathnodes[ i ].actionFlag = nodeList[i].actionFlag;
|
||||
pathnodes[ i ].delay = nodeList[i].delay;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGraveyardZones()
|
||||
{
|
||||
mGraveYardMap.clear(); // need for reload case
|
||||
@@ -5415,7 +5550,7 @@ void ObjectMgr::LoadGraveyardZones()
|
||||
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team)
|
||||
{
|
||||
// search for zone associated closest graveyard
|
||||
uint32 zoneId = MapManager::Instance().GetZoneId(MapId,x,y,z);
|
||||
uint32 zoneId = sMapMgr.GetZoneId(MapId,x,y,z);
|
||||
|
||||
// Simulate std. algorithm:
|
||||
// found some graveyard associated to (ghost_zone,ghost_map)
|
||||
@@ -6476,7 +6611,7 @@ void ObjectMgr::LoadCorpses()
|
||||
continue;
|
||||
}
|
||||
|
||||
ObjectAccessor::Instance().AddCorpse(corpse);
|
||||
sObjectAccessor.AddCorpse(corpse);
|
||||
|
||||
++count;
|
||||
}
|
||||
@@ -6488,6 +6623,9 @@ void ObjectMgr::LoadCorpses()
|
||||
|
||||
void ObjectMgr::LoadReputationOnKill()
|
||||
{
|
||||
// For reload case
|
||||
mRepOnKill.clear();
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2
|
||||
@@ -6529,7 +6667,7 @@ void ObjectMgr::LoadReputationOnKill()
|
||||
|
||||
if (!GetCreatureTemplate(creature_id))
|
||||
{
|
||||
sLog.outErrorDb("Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped",creature_id);
|
||||
sLog.outErrorDb("Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -6538,7 +6676,7 @@ void ObjectMgr::LoadReputationOnKill()
|
||||
FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1);
|
||||
if (!factionEntry1)
|
||||
{
|
||||
sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`",repOnKill.repfaction1);
|
||||
sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -6548,7 +6686,7 @@ void ObjectMgr::LoadReputationOnKill()
|
||||
FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2);
|
||||
if (!factionEntry2)
|
||||
{
|
||||
sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`",repOnKill.repfaction2);
|
||||
sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -7953,12 +8091,12 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
|
||||
uint32 incrtime = fields[2].GetUInt32();
|
||||
uint32 ExtendedCost = fields[3].GetUInt32();
|
||||
|
||||
if (!IsVendorItemValid(vendor,item_id,maxcount,incrtime,ExtendedCost,NULL,skip_vendors))
|
||||
if (!IsVendorItemValid(vendor, item_id, maxcount, incrtime, ExtendedCost, NULL, skip_vendors))
|
||||
continue;
|
||||
|
||||
VendorItemData& vList = m_mCacheVendorItemMap[vendor];
|
||||
|
||||
vList.AddItem(item_id,maxcount,incrtime,ExtendedCost);
|
||||
vList.AddItem(item_id, maxcount, incrtime, ExtendedCost);
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -8008,12 +8146,12 @@ void ObjectMgr::LoadVendors()
|
||||
uint32 incrtime = fields[3].GetUInt32();
|
||||
uint32 ExtendedCost = fields[4].GetUInt32();
|
||||
|
||||
if (!IsVendorItemValid(entry,item_id,maxcount,incrtime,ExtendedCost,NULL,&skip_vendors))
|
||||
if (!IsVendorItemValid(entry, item_id, maxcount, incrtime, ExtendedCost, NULL, &skip_vendors))
|
||||
continue;
|
||||
|
||||
VendorItemData& vList = m_mCacheVendorItemMap[entry];
|
||||
|
||||
vList.AddItem(item_id,maxcount,incrtime,ExtendedCost);
|
||||
vList.AddItem(item_id, maxcount, incrtime, ExtendedCost);
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -8128,7 +8266,7 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query(
|
||||
"SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, "
|
||||
"action_menu_id, action_poi_id, action_script_id, box_coded, box_money, box_text "
|
||||
"FROM gossip_menu_option");
|
||||
"FROM gossip_menu_option ORDER BY menu_id, id");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -8223,9 +8361,10 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
void ObjectMgr::AddVendorItem(uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb)
|
||||
{
|
||||
VendorItemData& vList = m_mCacheVendorItemMap[entry];
|
||||
vList.AddItem(item,maxcount,incrtime,extendedcost);
|
||||
vList.AddItem(item, maxcount, incrtime, extendedcost);
|
||||
|
||||
if (savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost);
|
||||
if (savetodb)
|
||||
WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')", entry, item, maxcount, incrtime, extendedcost);
|
||||
}
|
||||
|
||||
bool ObjectMgr::RemoveVendorItem(uint32 entry,uint32 item, bool savetodb)
|
||||
@@ -8273,16 +8412,16 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
||||
else
|
||||
sLog.outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id);
|
||||
sLog.outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost);
|
||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||
else
|
||||
sLog.outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry);
|
||||
sLog.outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8307,7 +8446,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||
if (!vItems)
|
||||
return true; // later checks for non-empty lists
|
||||
|
||||
if(vItems->FindItemCostPair(item_id,ExtendedCost))
|
||||
if (vItems->FindItemCostPair(item_id, ExtendedCost))
|
||||
{
|
||||
if (pl)
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
|
||||
@@ -8462,40 +8601,6 @@ CreatureInfo const *GetCreatureInfo(uint32 id)
|
||||
return objmgr.GetCreatureTemplate(id);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadTransportEvents()
|
||||
{
|
||||
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, waypoint_id, event_id FROM transport_events");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar1(1);
|
||||
bar1.step();
|
||||
sLog.outString("\n>> Transport events table is empty \n");
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar1(result->GetRowCount());
|
||||
|
||||
do
|
||||
{
|
||||
bar1.step();
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
//Load event values
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
uint32 waypoint_id = fields[1].GetUInt32();
|
||||
uint32 event_id = fields[2].GetUInt32();
|
||||
|
||||
uint32 event_count = (entry*100)+waypoint_id;
|
||||
TransportEventMap[event_count] = event_id;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog.outString("\n>> Loaded %u transport events \n", result->GetRowCount());
|
||||
}
|
||||
|
||||
CreatureInfo const* GetCreatureTemplateStore(uint32 entry)
|
||||
{
|
||||
return sCreatureStorage.LookupEntry<CreatureInfo>(entry);
|
||||
|
||||
@@ -30,16 +30,15 @@
|
||||
#include "GameObject.h"
|
||||
#include "Corpse.h"
|
||||
#include "QuestDef.h"
|
||||
#include "Path.h"
|
||||
#include "ItemPrototype.h"
|
||||
#include "NPCHandler.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Mail.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
#include "ace/Singleton.h"
|
||||
#include "SQLStorage.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include <string>
|
||||
@@ -60,8 +59,6 @@ extern SQLStorage sInstanceTemplate;
|
||||
class Group;
|
||||
class Guild;
|
||||
class ArenaTeam;
|
||||
class Path;
|
||||
class TransportPath;
|
||||
class Item;
|
||||
|
||||
struct GameTele
|
||||
@@ -164,6 +161,7 @@ typedef UNORDERED_MAP<uint32,GameObjectData> GameObjectDataMap;
|
||||
typedef UNORDERED_MAP<uint32,CreatureLocale> CreatureLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,GameObjectLocale> GameObjectLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,ItemLocale> ItemLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,ItemSetNameLocale> ItemSetNameLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap;
|
||||
@@ -356,11 +354,11 @@ class PlayerDumpReader;
|
||||
class ObjectMgr
|
||||
{
|
||||
friend class PlayerDumpReader;
|
||||
|
||||
friend class ACE_Singleton<ObjectMgr, ACE_Null_Mutex>;
|
||||
ObjectMgr();
|
||||
~ObjectMgr();
|
||||
|
||||
public:
|
||||
ObjectMgr();
|
||||
~ObjectMgr();
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
||||
|
||||
typedef std::set< Group * > GroupSet;
|
||||
@@ -384,9 +382,7 @@ class ObjectMgr
|
||||
|
||||
typedef std::vector<std::string> ScriptNameMap;
|
||||
|
||||
UNORDERED_MAP<uint32, uint32> TransportEventMap;
|
||||
|
||||
Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);}
|
||||
Player* GetPlayer(const char* name) const { return sObjectAccessor.FindPlayerByName(name);}
|
||||
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
|
||||
|
||||
static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); }
|
||||
@@ -431,6 +427,14 @@ class ObjectMgr
|
||||
|
||||
static ItemPrototype const* GetItemPrototype(uint32 id) { return sItemStorage.LookupEntry<ItemPrototype>(id); }
|
||||
|
||||
ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId)
|
||||
{
|
||||
ItemSetNameMap::iterator itr = mItemSetNameMap.find(itemId);
|
||||
if(itr != mItemSetNameMap.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static InstanceTemplate const* GetInstanceTemplate(uint32 map)
|
||||
{
|
||||
return sInstanceTemplate.LookupEntry<InstanceTemplate>(map);
|
||||
@@ -464,8 +468,6 @@ class ObjectMgr
|
||||
uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team);
|
||||
void GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost);
|
||||
uint32 GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt_team = false);
|
||||
void GetTaxiPathNodes(uint32 path, Path &pathnodes, std::vector<uint32>& mapIds);
|
||||
void GetTransportPathNodes(uint32 path, TransportPath &pathnodes);
|
||||
|
||||
Quest const* GetQuestTemplate(uint32 quest_id) const
|
||||
{
|
||||
@@ -585,8 +587,6 @@ class ObjectMgr
|
||||
void LoadGossipScripts();
|
||||
void LoadWaypointScripts();
|
||||
|
||||
void LoadTransportEvents();
|
||||
|
||||
bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value);
|
||||
bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); }
|
||||
void LoadDbScriptStrings();
|
||||
@@ -607,6 +607,8 @@ class ObjectMgr
|
||||
void LoadGameobjectRespawnTimes();
|
||||
void LoadItemPrototypes();
|
||||
void LoadItemLocales();
|
||||
void LoadItemSetNames();
|
||||
void LoadItemSetNameLocales();
|
||||
void LoadQuestLocales();
|
||||
void LoadNpcTextLocales();
|
||||
void LoadPageTextLocales();
|
||||
@@ -740,6 +742,12 @@ class ObjectMgr
|
||||
if (itr == mItemLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
ItemSetNameLocale const* GetItemSetNameLocale(uint32 entry) const
|
||||
{
|
||||
ItemSetNameLocaleMap::const_iterator itr = mItemSetNameLocaleMap.find(entry);
|
||||
if (itr == mItemSetNameLocaleMap.end())return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
QuestLocale const* GetQuestLocale(uint32 entry) const
|
||||
{
|
||||
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
||||
@@ -875,7 +883,7 @@ class ObjectMgr
|
||||
return &iter->second;
|
||||
}
|
||||
void AddVendorItem(uint32 entry,uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event
|
||||
bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); // for event
|
||||
bool RemoveVendorItem(uint32 entry, uint32 item, bool savetodb = true); // for event
|
||||
bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
|
||||
|
||||
void LoadScriptNames();
|
||||
@@ -1018,6 +1026,7 @@ class ObjectMgr
|
||||
void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
|
||||
void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
|
||||
void LoadQuestRelationsHelper(QuestRelations& map,char const* table);
|
||||
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count);
|
||||
|
||||
MailLevelRewardMap m_mailLevelRewardMap;
|
||||
|
||||
@@ -1045,6 +1054,9 @@ class ObjectMgr
|
||||
HalfNameMap PetHalfName0;
|
||||
HalfNameMap PetHalfName1;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, ItemSetNameEntry> ItemSetNameMap;
|
||||
ItemSetNameMap mItemSetNameMap;
|
||||
|
||||
MapObjectGuids mMapObjectGuids;
|
||||
CreatureDataMap mCreatureDataMap;
|
||||
CreatureLinkedRespawnMap mCreatureLinkedRespawnMap;
|
||||
@@ -1052,6 +1064,7 @@ class ObjectMgr
|
||||
GameObjectDataMap mGameObjectDataMap;
|
||||
GameObjectLocaleMap mGameObjectLocaleMap;
|
||||
ItemLocaleMap mItemLocaleMap;
|
||||
ItemSetNameLocaleMap mItemSetNameLocaleMap;
|
||||
QuestLocaleMap mQuestLocaleMap;
|
||||
NpcTextLocaleMap mNpcTextLocaleMap;
|
||||
PageTextLocaleMap mPageTextLocaleMap;
|
||||
@@ -1070,7 +1083,7 @@ class ObjectMgr
|
||||
|
||||
};
|
||||
|
||||
#define objmgr Trinity::Singleton<ObjectMgr>::Instance()
|
||||
#define objmgr (*ACE_Singleton<ObjectMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
// scripting access functions
|
||||
bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = MAX_CREATURE_AI_TEXT_STRING_ID, int32 end_value = std::numeric_limits<int32>::min());
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "GameSystem/TypeContainer.h"
|
||||
#include "GameSystem/TypeContainerVisitor.h"
|
||||
#include "TypeContainer.h"
|
||||
#include "TypeContainerVisitor.h"
|
||||
|
||||
#include "GridDefines.h"
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
Grid's perspective, the loader meets its API requirement is suffice.
|
||||
*/
|
||||
|
||||
#include "Platform/Define.h"
|
||||
#include "Policies/ThreadingModel.h"
|
||||
#include "Define.h"
|
||||
#include "TypeContainer.h"
|
||||
#include "TypeContainerVisitor.h"
|
||||
|
||||
@@ -44,8 +43,7 @@ template
|
||||
<
|
||||
class ACTIVE_OBJECT,
|
||||
class WORLD_OBJECT_TYPES,
|
||||
class GRID_OBJECT_TYPES,
|
||||
class ThreadModel = Trinity::SingleThreaded<ACTIVE_OBJECT>
|
||||
class GRID_OBJECT_TYPES
|
||||
>
|
||||
class Grid
|
||||
{
|
||||
@@ -131,9 +129,6 @@ class Grid
|
||||
}*/
|
||||
private:
|
||||
|
||||
typedef typename ThreadModel::Lock Guard;
|
||||
typedef typename ThreadModel::VolatileType VolatileType;
|
||||
|
||||
TypeMapContainer<GRID_OBJECT_TYPES> i_container;
|
||||
TypeMapContainer<WORLD_OBJECT_TYPES> i_objects;
|
||||
//typedef std::set<void*> ActiveGridObjects;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define TRINITY_GRIDDEFINES_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "GameSystem/NGrid.h"
|
||||
#include "NGrid.h"
|
||||
#include <cmath>
|
||||
|
||||
// Forward class definitions
|
||||
@@ -42,7 +42,7 @@ class Player;
|
||||
|
||||
#define CENTER_GRID_OFFSET (SIZE_OF_GRIDS/2)
|
||||
|
||||
#define MIN_GRID_DELAY (MINUTE*IN_MILISECONDS)
|
||||
#define MIN_GRID_DELAY (MINUTE*IN_MILLISECONDS)
|
||||
#define MIN_MAP_UPDATE_DELAY 50
|
||||
|
||||
#define SIZE_OF_GRID_CELL (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
GridLoader manages the grid (both local and remote).
|
||||
*/
|
||||
|
||||
#include "Platform/Define.h"
|
||||
#include "Define.h"
|
||||
#include "Grid.h"
|
||||
#include "TypeContainerVisitor.h"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef _GRIDREFMANAGER
|
||||
#define _GRIDREFMANAGER
|
||||
|
||||
#include "Utilities/LinkedReference/RefManager.h"
|
||||
#include "RefManager.h"
|
||||
|
||||
template<class OBJECT>
|
||||
class GridReference;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user