Merge pull request #100 from H0zen/develop21
Various external fixes - part 6
This commit is contained in:
commit
1f37bc0bc6
2
dep
2
dep
@ -1 +1 @@
|
|||||||
Subproject commit 389b4bce897402edc0bf2a9ec3f6b111dd42c06f
|
Subproject commit 93df4a0e5d9841ecf91427aff83849feaa278d81
|
@ -27,10 +27,6 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
# define ACE_UINT64_TYPE unsigned long long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ace/Basic_Types.h>
|
#include <ace/Basic_Types.h>
|
||||||
#include <ace/Default_Constants.h>
|
#include <ace/Default_Constants.h>
|
||||||
#include <ace/OS_NS_dlfcn.h>
|
#include <ace/OS_NS_dlfcn.h>
|
||||||
|
@ -383,7 +383,8 @@ bool Creature::InitEntry(uint32 Entry, Team team, CreatureData const* data /*=NU
|
|||||||
// check if we need to add swimming movement. TODO: i thing movement flags should be computed automatically at each movement of creature so we need a sort of UpdateMovementFlags() method
|
// check if we need to add swimming movement. TODO: i thing movement flags should be computed automatically at each movement of creature so we need a sort of UpdateMovementFlags() method
|
||||||
if (cinfo->InhabitType & INHABIT_WATER && // check inhabit type water
|
if (cinfo->InhabitType & INHABIT_WATER && // check inhabit type water
|
||||||
data && // check if there is data to get creature spawn pos
|
data && // check if there is data to get creature spawn pos
|
||||||
GetMap()->GetTerrain()->IsInWater(data->posX, data->posY, data->posZ)) // check if creature is in water
|
!(cinfo->ExtraFlags & CREATURE_EXTRA_FLAG_WALK_IN_WATER) && // check if creature is forced to walk (crabs, giant,...)
|
||||||
|
GetMap()->GetTerrain()->IsSwimable(data->posX, data->posY, data->posZ, minfo->bounding_radius)) // check if creature is in water and have enough space to swim
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_SWIMMING); // add swimming movement
|
m_movementInfo.AddMovementFlag(MOVEFLAG_SWIMMING); // add swimming movement
|
||||||
|
|
||||||
// checked at loading
|
// checked at loading
|
||||||
@ -422,6 +423,11 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
|||||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT))
|
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT))
|
||||||
{ unitFlags |= UNIT_FLAG_IN_COMBAT; }
|
{ unitFlags |= UNIT_FLAG_IN_COMBAT; }
|
||||||
|
|
||||||
|
if (m_movementInfo.HasMovementFlag(MOVEFLAG_SWIMMING) && (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_HAVE_NO_SWIM_ANIMATION) == 0)
|
||||||
|
unitFlags |= UNIT_FLAG_UNK_15;
|
||||||
|
else
|
||||||
|
unitFlags &= ~UNIT_FLAG_UNK_15;
|
||||||
|
|
||||||
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
|
SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags);
|
||||||
|
|
||||||
// preserve all current dynamic flags if exist
|
// preserve all current dynamic flags if exist
|
||||||
|
@ -49,21 +49,23 @@ struct GameEventCreatureData;
|
|||||||
|
|
||||||
enum CreatureFlagsExtra
|
enum CreatureFlagsExtra
|
||||||
{
|
{
|
||||||
CREATURE_EXTRA_FLAG_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
|
CREATURE_EXTRA_FLAG_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
|
||||||
CREATURE_EXTRA_FLAG_NO_AGGRO = 0x00000002, // not aggro (ignore faction/reputation hostility)
|
CREATURE_EXTRA_FLAG_NO_AGGRO = 0x00000002, // not aggro (ignore faction/reputation hostility)
|
||||||
CREATURE_EXTRA_FLAG_NO_PARRY = 0x00000004, // creature can't parry
|
CREATURE_EXTRA_FLAG_NO_PARRY = 0x00000004, // creature can't parry
|
||||||
CREATURE_EXTRA_FLAG_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
|
CREATURE_EXTRA_FLAG_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
|
||||||
CREATURE_EXTRA_FLAG_NO_BLOCK = 0x00000010, // creature can't block
|
CREATURE_EXTRA_FLAG_NO_BLOCK = 0x00000010, // creature can't block
|
||||||
CREATURE_EXTRA_FLAG_NO_CRUSH = 0x00000020, // creature can't do crush attacks
|
CREATURE_EXTRA_FLAG_NO_CRUSH = 0x00000020, // creature can't do crush attacks
|
||||||
CREATURE_EXTRA_FLAG_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
|
CREATURE_EXTRA_FLAG_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
|
||||||
CREATURE_EXTRA_FLAG_INVISIBLE = 0x00000080, // creature is always invisible for player (mostly trigger creatures)
|
CREATURE_EXTRA_FLAG_INVISIBLE = 0x00000080, // creature is always invisible for player (mostly trigger creatures)
|
||||||
CREATURE_EXTRA_FLAG_NOT_TAUNTABLE = 0x00000100, // creature is immune to taunt auras and effect attack me
|
CREATURE_EXTRA_FLAG_NOT_TAUNTABLE = 0x00000100, // creature is immune to taunt auras and effect attack me
|
||||||
CREATURE_EXTRA_FLAG_AGGRO_ZONE = 0x00000200, // creature sets itself in combat with zone on aggro
|
CREATURE_EXTRA_FLAG_AGGRO_ZONE = 0x00000200, // creature sets itself in combat with zone on aggro
|
||||||
CREATURE_EXTRA_FLAG_GUARD = 0x00000400, // creature is a guard
|
CREATURE_EXTRA_FLAG_GUARD = 0x00000400, // creature is a guard
|
||||||
CREATURE_EXTRA_FLAG_NO_CALL_ASSIST = 0x00000800, // creature shouldn't call for assistance on aggro
|
CREATURE_EXTRA_FLAG_NO_CALL_ASSIST = 0x00000800, // creature shouldn't call for assistance on aggro
|
||||||
CREATURE_EXTRA_FLAG_ACTIVE = 0x00001000, // creature is active object. Grid of this creature will be loaded and creature set as active
|
CREATURE_EXTRA_FLAG_ACTIVE = 0x00001000, // creature is active object. Grid of this creature will be loaded and creature set as active
|
||||||
CREATURE_EXTRA_FLAG_MMAP_FORCE_ENABLE = 0x00002000, // creature is forced to use MMaps
|
CREATURE_EXTRA_FLAG_MMAP_FORCE_ENABLE = 0x00002000, // creature is forced to use MMaps
|
||||||
CREATURE_EXTRA_FLAG_MMAP_FORCE_DISABLE = 0x00004000, // creature is forced to NOT use MMaps
|
CREATURE_EXTRA_FLAG_MMAP_FORCE_DISABLE = 0x00004000, // creature is forced to NOT use MMaps
|
||||||
|
CREATURE_EXTRA_FLAG_WALK_IN_WATER = 0x00008000, // creature is forced to walk in water even it can swim
|
||||||
|
CREATURE_EXTRA_FLAG_HAVE_NO_SWIM_ANIMATION = 0x00010000, // we have to not set "swim" animation or creature will have "no animation"
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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
|
// 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
|
||||||
|
@ -43,7 +43,10 @@
|
|||||||
INSTANTIATE_SINGLETON_2(ObjectAccessor, CLASS_LOCK);
|
INSTANTIATE_SINGLETON_2(ObjectAccessor, CLASS_LOCK);
|
||||||
INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ACE_Thread_Mutex);
|
INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ACE_Thread_Mutex);
|
||||||
|
|
||||||
ObjectAccessor::ObjectAccessor() {}
|
ObjectAccessor::ObjectAccessor() : i_playerGuard(), i_corpseGuard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
ObjectAccessor::~ObjectAccessor()
|
ObjectAccessor::~ObjectAccessor()
|
||||||
{
|
{
|
||||||
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
||||||
@ -284,7 +287,7 @@ void ObjectAccessor::RemoveOldCorpses()
|
|||||||
/// Define the static member of HashMapHolder
|
/// Define the static member of HashMapHolder
|
||||||
|
|
||||||
template <class T> typename HashMapHolder<T>::MapType HashMapHolder<T>::m_objectMap;
|
template <class T> typename HashMapHolder<T>::MapType HashMapHolder<T>::m_objectMap;
|
||||||
template <class T> ACE_RW_Thread_Mutex HashMapHolder<T>::i_lock;
|
template <class T> typename HashMapHolder<T>::LockType HashMapHolder<T>::i_lock;
|
||||||
|
|
||||||
/// Global definitions for the hashmap storage
|
/// Global definitions for the hashmap storage
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ class ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, MaNGOS::ClassLev
|
|||||||
typedef ACE_Thread_Mutex LockType;
|
typedef ACE_Thread_Mutex LockType;
|
||||||
|
|
||||||
LockType i_playerGuard;
|
LockType i_playerGuard;
|
||||||
|
char _cache_guard[1024];
|
||||||
LockType i_corpseGuard;
|
LockType i_corpseGuard;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -335,6 +335,15 @@ void TradeData::SetMoney(uint32 money)
|
|||||||
if (m_money == money)
|
if (m_money == money)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
if (money > m_player->GetMoney())
|
||||||
|
{
|
||||||
|
TradeStatusInfo info;
|
||||||
|
info.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||||
|
info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY;
|
||||||
|
m_player->GetSession()->SendTradeStatus(info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_money = money;
|
m_money = money;
|
||||||
|
|
||||||
SetAccepted(false);
|
SetAccepted(false);
|
||||||
@ -357,10 +366,12 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
|
|||||||
|
|
||||||
if (!state)
|
if (!state)
|
||||||
{
|
{
|
||||||
|
TradeStatusInfo info;
|
||||||
|
info.Status = TRADE_STATUS_BACK_TO_TRADE;
|
||||||
if (crosssend)
|
if (crosssend)
|
||||||
{ m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
|
m_trader->GetSession()->SendTradeStatus(info);
|
||||||
else
|
else
|
||||||
{ m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
|
m_player->GetSession()->SendTradeStatus(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9150,7 +9161,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
|
|||||||
|
|
||||||
// no free slot found?
|
// no free slot found?
|
||||||
if (!b_found)
|
if (!b_found)
|
||||||
{ return EQUIP_ERR_INVENTORY_FULL; }
|
{ return EQUIP_ERR_BAG_FULL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
@ -814,6 +814,19 @@ struct BGData
|
|||||||
bool m_needSave; ///< true, if saved to DB fields modified after prev. save (marked as "saved" above)
|
bool m_needSave; ///< true, if saved to DB fields modified after prev. save (marked as "saved" above)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TradeStatusInfo
|
||||||
|
{
|
||||||
|
TradeStatusInfo() : Status(TRADE_STATUS_BUSY), TraderGuid(), Result(EQUIP_ERR_OK),
|
||||||
|
IsTargetResult(false), ItemLimitCategoryId(0), Slot(0) { }
|
||||||
|
|
||||||
|
TradeStatus Status;
|
||||||
|
ObjectGuid TraderGuid;
|
||||||
|
InventoryResult Result;
|
||||||
|
bool IsTargetResult;
|
||||||
|
uint32 ItemLimitCategoryId;
|
||||||
|
uint8 Slot;
|
||||||
|
};
|
||||||
|
|
||||||
class TradeData
|
class TradeData
|
||||||
{
|
{
|
||||||
public: // constructors
|
public: // constructors
|
||||||
|
@ -2506,7 +2506,7 @@ enum TradeStatus
|
|||||||
TRADE_STATUS_NO_TARGET = 6,
|
TRADE_STATUS_NO_TARGET = 6,
|
||||||
TRADE_STATUS_BACK_TO_TRADE = 7,
|
TRADE_STATUS_BACK_TO_TRADE = 7,
|
||||||
TRADE_STATUS_TRADE_COMPLETE = 8,
|
TRADE_STATUS_TRADE_COMPLETE = 8,
|
||||||
// 9?
|
TRADE_STATUS_TRADE_REJECTED = 9,
|
||||||
TRADE_STATUS_TARGET_TO_FAR = 10,
|
TRADE_STATUS_TARGET_TO_FAR = 10,
|
||||||
TRADE_STATUS_WRONG_FACTION = 11,
|
TRADE_STATUS_WRONG_FACTION = 11,
|
||||||
TRADE_STATUS_CLOSE_WINDOW = 12,
|
TRADE_STATUS_CLOSE_WINDOW = 12,
|
||||||
@ -2519,7 +2519,8 @@ enum TradeStatus
|
|||||||
TRADE_STATUS_YOU_LOGOUT = 19,
|
TRADE_STATUS_YOU_LOGOUT = 19,
|
||||||
TRADE_STATUS_TARGET_LOGOUT = 20,
|
TRADE_STATUS_TARGET_LOGOUT = 20,
|
||||||
TRADE_STATUS_TRIAL_ACCOUNT = 21, // Trial accounts can not perform that action
|
TRADE_STATUS_TRIAL_ACCOUNT = 21, // Trial accounts can not perform that action
|
||||||
TRADE_STATUS_ONLY_CONJURED = 22 // You can only trade conjured items... (cross realm BG related).
|
TRADE_STATUS_WRONG_REALM = 22, // You can only trade conjured items... (cross realm BG related).
|
||||||
|
TRADE_STATUS_NOT_ON_TAPLIST = 23
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WorldStateType
|
enum WorldStateType
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
struct ItemPrototype;
|
struct ItemPrototype;
|
||||||
struct AuctionEntry;
|
struct AuctionEntry;
|
||||||
struct AuctionHouseEntry;
|
struct AuctionHouseEntry;
|
||||||
|
struct TradeStatusInfo;
|
||||||
|
|
||||||
class ObjectGuid;
|
class ObjectGuid;
|
||||||
class Creature;
|
class Creature;
|
||||||
@ -250,7 +251,7 @@ class WorldSession
|
|||||||
|
|
||||||
void SendBattlegGroundList(ObjectGuid guid, BattleGroundTypeId bgTypeId);
|
void SendBattlegGroundList(ObjectGuid guid, BattleGroundTypeId bgTypeId);
|
||||||
|
|
||||||
void SendTradeStatus(TradeStatus status);
|
void SendTradeStatus(const TradeStatusInfo& status);
|
||||||
void SendUpdateTrade(bool trader_state = true);
|
void SendUpdateTrade(bool trader_state = true);
|
||||||
void SendCancelTrade();
|
void SendCancelTrade();
|
||||||
|
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
#ifndef MANGOS_H_WORLDSOCKET
|
#ifndef MANGOS_H_WORLDSOCKET
|
||||||
#define MANGOS_H_WORLDSOCKET
|
#define MANGOS_H_WORLDSOCKET
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
# define ACE_UINT64_TYPE unsigned long long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ace/Basic_Types.h>
|
#include <ace/Basic_Types.h>
|
||||||
#include <ace/Synch_Traits.h>
|
#include <ace/Synch_Traits.h>
|
||||||
#include <ace/Svc_Handler.h>
|
#include <ace/Svc_Handler.h>
|
||||||
|
@ -730,7 +730,7 @@ bool GridMap::ExistVMap(uint32 mapid, int gx, int gy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
TerrainInfo::TerrainInfo(uint32 mapid) : m_mapId(mapid)
|
TerrainInfo::TerrainInfo(uint32 mapid) : m_mapId(mapid), m_refMutex(), m_mutex()
|
||||||
{
|
{
|
||||||
for (int k = 0; k < MAX_NUMBER_OF_GRIDS; ++k)
|
for (int k = 0; k < MAX_NUMBER_OF_GRIDS; ++k)
|
||||||
{
|
{
|
||||||
@ -831,7 +831,7 @@ int TerrainInfo::RefGrid(const uint32& x, const uint32& y)
|
|||||||
MANGOS_ASSERT(x < MAX_NUMBER_OF_GRIDS);
|
MANGOS_ASSERT(x < MAX_NUMBER_OF_GRIDS);
|
||||||
MANGOS_ASSERT(y < MAX_NUMBER_OF_GRIDS);
|
MANGOS_ASSERT(y < MAX_NUMBER_OF_GRIDS);
|
||||||
|
|
||||||
LOCK_GUARD _lock(m_refMutex);
|
ACE_GUARD_RETURN(LOCK_TYPE, _lock, m_refMutex, -1)
|
||||||
return (m_GridRef[x][y] += 1);
|
return (m_GridRef[x][y] += 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,7 +842,7 @@ int TerrainInfo::UnrefGrid(const uint32& x, const uint32& y)
|
|||||||
|
|
||||||
int16& iRef = m_GridRef[x][y];
|
int16& iRef = m_GridRef[x][y];
|
||||||
|
|
||||||
LOCK_GUARD _lock(m_refMutex);
|
ACE_GUARD_RETURN(LOCK_TYPE, _lock, m_refMutex, -1)
|
||||||
if (iRef > 0)
|
if (iRef > 0)
|
||||||
{ return (iRef -= 1); }
|
{ return (iRef -= 1); }
|
||||||
|
|
||||||
@ -1075,6 +1075,23 @@ bool TerrainInfo::IsInWater(float x, float y, float pZ, GridMapLiquidData* data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if creature is in water and have enough space to swim
|
||||||
|
bool TerrainInfo::IsSwimable(float x, float y, float pZ, float radius /*= 1.5f*/, GridMapLiquidData* data /*= 0*/) const
|
||||||
|
{
|
||||||
|
// Check surface in x, y point for liquid
|
||||||
|
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||||
|
{
|
||||||
|
GridMapLiquidData liquid_status;
|
||||||
|
GridMapLiquidData* liquid_ptr = data ? data : &liquid_status;
|
||||||
|
if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr))
|
||||||
|
{
|
||||||
|
if (liquid_ptr->level - liquid_ptr->depth_level > radius) // is unit have enough space to swim
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool TerrainInfo::IsUnderWater(float x, float y, float z) const
|
bool TerrainInfo::IsUnderWater(float x, float y, float z) const
|
||||||
{
|
{
|
||||||
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||||
@ -1134,7 +1151,7 @@ GridMap* TerrainInfo::LoadMapAndVMap(const uint32 x, const uint32 y)
|
|||||||
// double checked lock pattern
|
// double checked lock pattern
|
||||||
if (!m_GridMaps[x][y])
|
if (!m_GridMaps[x][y])
|
||||||
{
|
{
|
||||||
LOCK_GUARD lock(m_mutex);
|
ACE_GUARD_RETURN(LOCK_TYPE, lock, m_mutex, NULL)
|
||||||
|
|
||||||
if (!m_GridMaps[x][y])
|
if (!m_GridMaps[x][y])
|
||||||
{
|
{
|
||||||
@ -1208,7 +1225,7 @@ float TerrainInfo::GetWaterLevel(float x, float y, float z, float* pGround /*= N
|
|||||||
INSTANTIATE_SINGLETON_2(TerrainManager, CLASS_LOCK);
|
INSTANTIATE_SINGLETON_2(TerrainManager, CLASS_LOCK);
|
||||||
INSTANTIATE_CLASS_MUTEX(TerrainManager, ACE_Thread_Mutex);
|
INSTANTIATE_CLASS_MUTEX(TerrainManager, ACE_Thread_Mutex);
|
||||||
|
|
||||||
TerrainManager::TerrainManager()
|
TerrainManager::TerrainManager() : m_mutex()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1220,7 +1237,7 @@ TerrainManager::~TerrainManager()
|
|||||||
|
|
||||||
TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
|
TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
|
||||||
{
|
{
|
||||||
Guard _guard(*this);
|
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_mutex, NULL)
|
||||||
|
|
||||||
TerrainInfo* ptr = NULL;
|
TerrainInfo* ptr = NULL;
|
||||||
TerrainDataMap::const_iterator iter = i_TerrainMap.find(mapId);
|
TerrainDataMap::const_iterator iter = i_TerrainMap.find(mapId);
|
||||||
@ -1240,7 +1257,7 @@ void TerrainManager::UnloadTerrain(const uint32 mapId)
|
|||||||
if (sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
|
if (sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
Guard _guard(*this);
|
ACE_GUARD(LOCK_TYPE, _guard, m_mutex)
|
||||||
|
|
||||||
TerrainDataMap::iterator iter = i_TerrainMap.find(mapId);
|
TerrainDataMap::iterator iter = i_TerrainMap.find(mapId);
|
||||||
if (iter != i_TerrainMap.end())
|
if (iter != i_TerrainMap.end())
|
||||||
|
@ -234,6 +234,7 @@ class TerrainInfo : public Referencable<AtomicLong>
|
|||||||
float GetWaterLevel(float x, float y, float z, float* pGround = NULL) const;
|
float GetWaterLevel(float x, float y, float z, float* pGround = NULL) const;
|
||||||
float GetWaterOrGroundLevel(float x, float y, float z, float* pGround = NULL, bool swim = false) const;
|
float GetWaterOrGroundLevel(float x, float y, float z, float* pGround = NULL, bool swim = false) const;
|
||||||
bool IsInWater(float x, float y, float z, GridMapLiquidData* data = 0) const;
|
bool IsInWater(float x, float y, float z, GridMapLiquidData* data = 0) const;
|
||||||
|
bool IsSwimable(float x, float y, float pZ, float radius = 1.5f, GridMapLiquidData* data = 0) const;
|
||||||
bool IsUnderWater(float x, float y, float z) const;
|
bool IsUnderWater(float x, float y, float z) const;
|
||||||
|
|
||||||
GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data = 0) const;
|
GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data = 0) const;
|
||||||
@ -280,8 +281,8 @@ class TerrainInfo : public Referencable<AtomicLong>
|
|||||||
ShortIntervalTimer i_timer;
|
ShortIntervalTimer i_timer;
|
||||||
|
|
||||||
typedef ACE_Thread_Mutex LOCK_TYPE;
|
typedef ACE_Thread_Mutex LOCK_TYPE;
|
||||||
typedef ACE_Guard<LOCK_TYPE> LOCK_GUARD;
|
|
||||||
LOCK_TYPE m_mutex;
|
LOCK_TYPE m_mutex;
|
||||||
|
char _cache_guard[1024];
|
||||||
LOCK_TYPE m_refMutex;
|
LOCK_TYPE m_refMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -327,7 +328,8 @@ class TerrainManager : public MaNGOS::Singleton<TerrainManager, MaNGOS::ClassLev
|
|||||||
TerrainManager(const TerrainManager&);
|
TerrainManager(const TerrainManager&);
|
||||||
TerrainManager& operator=(const TerrainManager&);
|
TerrainManager& operator=(const TerrainManager&);
|
||||||
|
|
||||||
typedef MaNGOS::ClassLevelLockable<TerrainManager, ACE_Thread_Mutex>::Lock Guard;
|
typedef ACE_Thread_Mutex LOCK_TYPE;
|
||||||
|
LOCK_TYPE m_mutex;
|
||||||
TerrainDataMap i_TerrainMap;
|
TerrainDataMap i_TerrainMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
#include "GameSystem/Grid.h"
|
#include "GameSystem/Grid.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
|
GridState::~GridState()
|
||||||
|
{
|
||||||
|
DEBUG_LOG("GridState destroyed");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InvalidState::Update(Map&, NGridType&, GridInfo&, const uint32& /*x*/, const uint32& /*y*/, const uint32&) const
|
InvalidState::Update(Map&, NGridType&, GridInfo&, const uint32& /*x*/, const uint32& /*y*/, const uint32&) const
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,7 @@ class GridState
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const = 0;
|
virtual void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const = 0;
|
||||||
|
virtual ~GridState();
|
||||||
};
|
};
|
||||||
|
|
||||||
class InvalidState : public GridState
|
class InvalidState : public GridState
|
||||||
|
@ -39,7 +39,7 @@ INSTANTIATE_SINGLETON_2(MapManager, CLASS_LOCK);
|
|||||||
INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Recursive_Thread_Mutex);
|
INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Recursive_Thread_Mutex);
|
||||||
|
|
||||||
MapManager::MapManager()
|
MapManager::MapManager()
|
||||||
: i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN))
|
: i_gridCleanUpDelay(sWorld.getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN)), m_lock()
|
||||||
{
|
{
|
||||||
i_timer.SetInterval(sWorld.getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE));
|
i_timer.SetInterval(sWorld.getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE));
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ void MapManager::InitializeVisibilityDistanceInfo()
|
|||||||
/// @param id - MapId of the to be created map. @param obj WorldObject for which the map is to be created. Must be player for Instancable maps.
|
/// @param id - MapId of the to be created map. @param obj WorldObject for which the map is to be created. Must be player for Instancable maps.
|
||||||
Map* MapManager::CreateMap(uint32 id, const WorldObject* obj)
|
Map* MapManager::CreateMap(uint32 id, const WorldObject* obj)
|
||||||
{
|
{
|
||||||
Guard _guard(*this);
|
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, NULL)
|
||||||
|
|
||||||
Map* m = NULL;
|
Map* m = NULL;
|
||||||
|
|
||||||
@ -139,13 +139,13 @@ Map* MapManager::CreateBgMap(uint32 mapid, BattleGround* bg)
|
|||||||
{
|
{
|
||||||
sTerrainMgr.LoadTerrain(mapid);
|
sTerrainMgr.LoadTerrain(mapid);
|
||||||
|
|
||||||
Guard _guard(*this);
|
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, NULL)
|
||||||
return CreateBattleGroundMap(mapid, sMapMgr.GenerateInstanceId(), bg);
|
return CreateBattleGroundMap(mapid, sMapMgr.GenerateInstanceId(), bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
||||||
{
|
{
|
||||||
Guard guard(*this);
|
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, NULL)
|
||||||
|
|
||||||
MapMapType::const_iterator iter = i_maps.find(MapID(mapid, instanceId));
|
MapMapType::const_iterator iter = i_maps.find(MapID(mapid, instanceId));
|
||||||
if (iter == i_maps.end())
|
if (iter == i_maps.end())
|
||||||
@ -163,7 +163,7 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
|||||||
|
|
||||||
void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
|
void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
|
||||||
{
|
{
|
||||||
Guard _guard(*this);
|
ACE_GUARD(LOCK_TYPE, _guard, m_lock)
|
||||||
|
|
||||||
MapMapType::iterator iter = i_maps.find(MapID(mapid, instanceId));
|
MapMapType::iterator iter = i_maps.find(MapID(mapid, instanceId));
|
||||||
if (iter != i_maps.end())
|
if (iter != i_maps.end())
|
||||||
@ -276,9 +276,9 @@ void MapManager::InitMaxInstanceId()
|
|||||||
|
|
||||||
uint32 MapManager::GetNumInstances()
|
uint32 MapManager::GetNumInstances()
|
||||||
{
|
{
|
||||||
Guard guard(*this);
|
|
||||||
|
|
||||||
uint32 ret = 0;
|
uint32 ret = 0;
|
||||||
|
|
||||||
|
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, ret)
|
||||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||||
{
|
{
|
||||||
Map* map = itr->second;
|
Map* map = itr->second;
|
||||||
@ -290,9 +290,9 @@ uint32 MapManager::GetNumInstances()
|
|||||||
|
|
||||||
uint32 MapManager::GetNumPlayersInInstances()
|
uint32 MapManager::GetNumPlayersInInstances()
|
||||||
{
|
{
|
||||||
Guard guard(*this);
|
|
||||||
|
|
||||||
uint32 ret = 0;
|
uint32 ret = 0;
|
||||||
|
|
||||||
|
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, ret)
|
||||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||||
{
|
{
|
||||||
Map* map = itr->second;
|
Map* map = itr->second;
|
||||||
|
@ -59,10 +59,6 @@ class MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::ClassLevelLockab
|
|||||||
{
|
{
|
||||||
friend class MaNGOS::OperatorNew<MapManager>;
|
friend class MaNGOS::OperatorNew<MapManager>;
|
||||||
|
|
||||||
typedef ACE_Recursive_Thread_Mutex LOCK_TYPE;
|
|
||||||
typedef ACE_Guard<LOCK_TYPE> LOCK_TYPE_GUARD;
|
|
||||||
typedef MaNGOS::ClassLevelLockable<MapManager, ACE_Recursive_Thread_Mutex>::Lock Guard;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::map<MapID, Map* > MapMapType;
|
typedef std::map<MapID, Map* > MapMapType;
|
||||||
|
|
||||||
@ -185,8 +181,10 @@ class MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::ClassLevelLockab
|
|||||||
MapMapType i_maps;
|
MapMapType i_maps;
|
||||||
IntervalTimer i_timer;
|
IntervalTimer i_timer;
|
||||||
MapUpdater m_updater;
|
MapUpdater m_updater;
|
||||||
|
|
||||||
uint32 i_MaxInstanceId;
|
uint32 i_MaxInstanceId;
|
||||||
|
|
||||||
|
typedef ACE_Recursive_Thread_Mutex LOCK_TYPE;
|
||||||
|
mutable LOCK_TYPE m_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Do>
|
template<typename Do>
|
||||||
|
@ -36,36 +36,26 @@
|
|||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
|
|
||||||
void WorldSession::SendTradeStatus(TradeStatus status)
|
void WorldSession::SendTradeStatus(const TradeStatusInfo& info)
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data(SMSG_TRADE_STATUS, 13);
|
||||||
|
data << uint32(info.Status);
|
||||||
|
|
||||||
switch (status)
|
switch (info.Status)
|
||||||
{
|
{
|
||||||
case TRADE_STATUS_BEGIN_TRADE:
|
case TRADE_STATUS_BEGIN_TRADE:
|
||||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 8);
|
data << info.TraderGuid; // CGTradeInfo::m_tradingPlayer
|
||||||
data << uint32(status);
|
|
||||||
data << uint64(0);
|
|
||||||
break;
|
|
||||||
case TRADE_STATUS_OPEN_WINDOW:
|
|
||||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 4);
|
|
||||||
data << uint32(status);
|
|
||||||
break;
|
break;
|
||||||
case TRADE_STATUS_CLOSE_WINDOW:
|
case TRADE_STATUS_CLOSE_WINDOW:
|
||||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 4 + 1 + 4);
|
data << uint32(info.Result); // InventoryResult
|
||||||
data << uint32(status);
|
data << uint8(info.IsTargetResult); // bool isTargetError; used for: EQUIP_ERR_BAG_FULL, EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_MISSING_REAGENT, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED
|
||||||
data << uint32(0);
|
data << uint32(info.ItemLimitCategoryId); // ItemLimitCategory.dbc entry
|
||||||
data << uint8(0);
|
|
||||||
data << uint32(0);
|
|
||||||
break;
|
break;
|
||||||
case TRADE_STATUS_ONLY_CONJURED:
|
case TRADE_STATUS_WRONG_REALM:
|
||||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 1);
|
case TRADE_STATUS_NOT_ON_TAPLIST:
|
||||||
data << uint32(status);
|
data << uint8(info.Slot); // Trade slot; -1 here clears CGTradeInfo::m_tradeMoney
|
||||||
data << uint8(0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
data.Initialize(SMSG_TRADE_STATUS, 4);
|
|
||||||
data << uint32(status);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,26 +263,31 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
// set before checks to properly undo at problems (it already set in to client)
|
// set before checks to properly undo at problems (it already set in to client)
|
||||||
my_trade->SetAccepted(true);
|
my_trade->SetAccepted(true);
|
||||||
|
|
||||||
// not accept case incorrect money amount
|
TradeStatusInfo info;
|
||||||
if (my_trade->GetMoney() > _player->GetMoney())
|
|
||||||
{
|
|
||||||
SendNotification(LANG_NOT_ENOUGH_GOLD);
|
|
||||||
my_trade->SetAccepted(false, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_player->IsWithinDistInMap(trader, TRADE_DISTANCE, false))
|
if (!_player->IsWithinDistInMap(trader, TRADE_DISTANCE, false))
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR);
|
info.Status = TRADE_STATUS_TARGET_TO_FAR;
|
||||||
|
SendTradeStatus(info);
|
||||||
my_trade->SetAccepted(false);
|
my_trade->SetAccepted(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// not accept case incorrect money amount
|
||||||
|
if (my_trade->GetMoney() > _player->GetMoney())
|
||||||
|
{
|
||||||
|
info.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||||
|
info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY;
|
||||||
|
SendTradeStatus(info);
|
||||||
|
my_trade->SetAccepted(false, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// not accept case incorrect money amount
|
// not accept case incorrect money amount
|
||||||
if (his_trade->GetMoney() > trader->GetMoney())
|
if (his_trade->GetMoney() > trader->GetMoney())
|
||||||
{
|
{
|
||||||
trader->GetSession()->SendNotification(LANG_NOT_ENOUGH_GOLD);
|
info.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||||
|
info.Result = EQUIP_ERR_NOT_ENOUGH_MONEY;
|
||||||
|
trader->GetSession()->SendTradeStatus(info);
|
||||||
his_trade->SetAccepted(false, true);
|
his_trade->SetAccepted(false, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -304,7 +299,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
{
|
{
|
||||||
if (!item->CanBeTraded())
|
if (!item->CanBeTraded())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
info.Status = TRADE_STATUS_TRADE_CANCELED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +309,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
{
|
{
|
||||||
if (!item->CanBeTraded())
|
if (!item->CanBeTraded())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
info.Status = TRADE_STATUS_TRADE_CANCELED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,7 +333,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
Item* castItem = my_trade->GetSpellCastItem();
|
Item* castItem = my_trade->GetSpellCastItem();
|
||||||
|
|
||||||
if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
|
if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
|
||||||
(my_trade->HasSpellCastItem() && !castItem))
|
(my_trade->HasSpellCastItem() && !castItem))
|
||||||
{
|
{
|
||||||
clearAcceptTradeMode(my_trade, his_trade);
|
clearAcceptTradeMode(my_trade, his_trade);
|
||||||
clearAcceptTradeMode(myItems, hisItems);
|
clearAcceptTradeMode(myItems, hisItems);
|
||||||
@ -371,7 +368,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
Item* castItem = his_trade->GetSpellCastItem();
|
Item* castItem = his_trade->GetSpellCastItem();
|
||||||
|
|
||||||
if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) ||
|
if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) ||
|
||||||
(his_trade->HasSpellCastItem() && !castItem))
|
(his_trade->HasSpellCastItem() && !castItem))
|
||||||
{
|
{
|
||||||
delete my_spell;
|
delete my_spell;
|
||||||
his_trade->SetSpell(0);
|
his_trade->SetSpell(0);
|
||||||
@ -403,31 +400,37 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// inform partner client
|
// inform partner client
|
||||||
trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT);
|
info.Status = TRADE_STATUS_TRADE_ACCEPT;
|
||||||
|
trader->GetSession()->SendTradeStatus(info);
|
||||||
|
|
||||||
// test if item will fit in each inventory
|
// test if item will fit in each inventory
|
||||||
bool hisCanCompleteTrade = (trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
|
TradeStatusInfo myCanCompleteInfo, hisCanCompleteInfo;
|
||||||
bool myCanCompleteTrade = (_player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT) == EQUIP_ERR_OK);
|
hisCanCompleteInfo.Result = trader->CanStoreItems(myItems, TRADE_SLOT_TRADED_COUNT);
|
||||||
|
myCanCompleteInfo.Result = _player->CanStoreItems(hisItems, TRADE_SLOT_TRADED_COUNT);
|
||||||
|
|
||||||
clearAcceptTradeMode(myItems, hisItems);
|
clearAcceptTradeMode(myItems, hisItems);
|
||||||
|
|
||||||
// in case of missing space report error
|
// in case of missing space report error
|
||||||
if (!myCanCompleteTrade)
|
if (myCanCompleteInfo.Result != EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
clearAcceptTradeMode(my_trade, his_trade);
|
clearAcceptTradeMode(my_trade, his_trade);
|
||||||
|
|
||||||
SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
|
myCanCompleteInfo.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||||
trader->GetSession()->SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
|
trader->GetSession()->SendTradeStatus(myCanCompleteInfo);
|
||||||
|
myCanCompleteInfo.IsTargetResult = true;
|
||||||
|
SendTradeStatus(myCanCompleteInfo);
|
||||||
my_trade->SetAccepted(false);
|
my_trade->SetAccepted(false);
|
||||||
his_trade->SetAccepted(false);
|
his_trade->SetAccepted(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!hisCanCompleteTrade)
|
else if (hisCanCompleteInfo.Result != EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
clearAcceptTradeMode(my_trade, his_trade);
|
clearAcceptTradeMode(my_trade, his_trade);
|
||||||
|
|
||||||
SendNotification(LANG_NOT_PARTNER_FREE_TRADE_SLOTS);
|
hisCanCompleteInfo.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||||
trader->GetSession()->SendNotification(LANG_NOT_FREE_TRADE_SLOTS);
|
SendTradeStatus(hisCanCompleteInfo);
|
||||||
|
hisCanCompleteInfo.IsTargetResult = true;
|
||||||
|
trader->GetSession()->SendTradeStatus(hisCanCompleteInfo);
|
||||||
my_trade->SetAccepted(false);
|
my_trade->SetAccepted(false);
|
||||||
his_trade->SetAccepted(false);
|
his_trade->SetAccepted(false);
|
||||||
return;
|
return;
|
||||||
@ -477,10 +480,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
trader->ModifyMoney(my_trade->GetMoney());
|
trader->ModifyMoney(my_trade->GetMoney());
|
||||||
|
|
||||||
if (my_spell)
|
if (my_spell)
|
||||||
{ my_spell->prepare(&my_targets); }
|
my_spell->prepare(&my_targets);
|
||||||
|
|
||||||
if (his_spell)
|
if (his_spell)
|
||||||
{ his_spell->prepare(&his_targets); }
|
his_spell->prepare(&his_targets);
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
clearAcceptTradeMode(my_trade, his_trade);
|
clearAcceptTradeMode(my_trade, his_trade);
|
||||||
@ -495,12 +498,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket)
|
|||||||
trader->SaveInventoryAndGoldToDB();
|
trader->SaveInventoryAndGoldToDB();
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_COMPLETE);
|
info.Status = TRADE_STATUS_TRADE_COMPLETE;
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_COMPLETE);
|
trader->GetSession()->SendTradeStatus(info);
|
||||||
|
SendTradeStatus(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT);
|
info.Status = TRADE_STATUS_TRADE_ACCEPT;
|
||||||
|
trader->GetSession()->SendTradeStatus(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +524,10 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/)
|
|||||||
if (!my_trade)
|
if (!my_trade)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
my_trade->GetTrader()->GetSession()->SendTradeStatus(TRADE_STATUS_OPEN_WINDOW);
|
TradeStatusInfo info;
|
||||||
SendTradeStatus(TRADE_STATUS_OPEN_WINDOW);
|
info.Status = TRADE_STATUS_OPEN_WINDOW;
|
||||||
|
my_trade->GetTrader()->GetSession()->SendTradeStatus(info);
|
||||||
|
SendTradeStatus(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendCancelTrade()
|
void WorldSession::SendCancelTrade()
|
||||||
@ -528,7 +535,9 @@ void WorldSession::SendCancelTrade()
|
|||||||
if (m_playerRecentlyLogout)
|
if (m_playerRecentlyLogout)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
TradeStatusInfo info;
|
||||||
|
info.Status = TRADE_STATUS_TRADE_CANCELED;
|
||||||
|
SendTradeStatus(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
|
void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||||
@ -546,27 +555,32 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
|||||||
if (GetPlayer()->m_trade)
|
if (GetPlayer()->m_trade)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
TradeStatusInfo info;
|
||||||
if (!GetPlayer()->IsAlive())
|
if (!GetPlayer()->IsAlive())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_YOU_DEAD);
|
info.Status = TRADE_STATUS_YOU_DEAD;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPlayer()->hasUnitState(UNIT_STAT_STUNNED))
|
if (GetPlayer()->hasUnitState(UNIT_STAT_STUNNED))
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_YOU_STUNNED);
|
info.Status = TRADE_STATUS_YOU_STUNNED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLogingOut())
|
if (isLogingOut())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_YOU_LOGOUT);
|
info.Status = TRADE_STATUS_YOU_LOGOUT;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPlayer()->IsTaxiFlying())
|
if (GetPlayer()->IsTaxiFlying())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR);
|
info.Status = TRADE_STATUS_TARGET_TO_FAR;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,55 +588,64 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
if (!pOther)
|
if (!pOther)
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_NO_TARGET);
|
info.Status = TRADE_STATUS_NO_TARGET;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOther == GetPlayer() || pOther->m_trade)
|
if (pOther == GetPlayer() || pOther->m_trade)
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_BUSY);
|
info.Status = TRADE_STATUS_BUSY;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pOther->IsAlive())
|
if (!pOther->IsAlive())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_DEAD);
|
info.Status = TRADE_STATUS_TARGET_DEAD;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOther->IsTaxiFlying())
|
if (pOther->IsTaxiFlying())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR);
|
info.Status = TRADE_STATUS_TARGET_TO_FAR;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOther->hasUnitState(UNIT_STAT_STUNNED))
|
if (pOther->hasUnitState(UNIT_STAT_STUNNED))
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_STUNNED);
|
info.Status = TRADE_STATUS_TARGET_STUNNED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOther->GetSession()->isLogingOut())
|
if (pOther->GetSession()->isLogingOut())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_LOGOUT);
|
info.Status = TRADE_STATUS_TARGET_LOGOUT;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_IGNORE_YOU);
|
info.Status = TRADE_STATUS_IGNORE_YOU;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE) && pOther->GetTeam() != _player->GetTeam())
|
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE) && pOther->GetTeam() != _player->GetTeam())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
|
info.Status = TRADE_STATUS_WRONG_FACTION;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pOther->IsWithinDistInMap(_player, TRADE_DISTANCE, false))
|
if (!pOther->IsWithinDistInMap(_player, TRADE_DISTANCE, false))
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR);
|
info.Status = TRADE_STATUS_TARGET_TO_FAR;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,10 +653,9 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
|||||||
_player->m_trade = new TradeData(_player, pOther);
|
_player->m_trade = new TradeData(_player, pOther);
|
||||||
pOther->m_trade = new TradeData(pOther, _player);
|
pOther->m_trade = new TradeData(pOther, _player);
|
||||||
|
|
||||||
WorldPacket data(SMSG_TRADE_STATUS, 12);
|
info.Status = TRADE_STATUS_BEGIN_TRADE;
|
||||||
data << uint32(TRADE_STATUS_BEGIN_TRADE);
|
info.TraderGuid = _player->GetObjectGuid();
|
||||||
data << ObjectGuid(_player->GetObjectGuid());
|
pOther->GetSession()->SendTradeStatus(info);
|
||||||
pOther->GetSession()->SendPacket(&data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket)
|
||||||
@ -665,10 +687,12 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
|
|||||||
if (!my_trade)
|
if (!my_trade)
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
TradeStatusInfo info;
|
||||||
// invalid slot number
|
// invalid slot number
|
||||||
if (tradeSlot >= TRADE_SLOT_COUNT)
|
if (tradeSlot >= TRADE_SLOT_COUNT)
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
info.Status = TRADE_STATUS_TRADE_CANCELED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,7 +700,8 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
|
|||||||
Item* item = _player->GetItemByPos(bag, slot);
|
Item* item = _player->GetItemByPos(bag, slot);
|
||||||
if (!item || (tradeSlot != TRADE_SLOT_NONTRADED && !item->CanBeTraded()))
|
if (!item || (tradeSlot != TRADE_SLOT_NONTRADED && !item->CanBeTraded()))
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
info.Status = TRADE_STATUS_TRADE_CANCELED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +709,8 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
|
|||||||
if (my_trade->HasItem(item->GetObjectGuid()))
|
if (my_trade->HasItem(item->GetObjectGuid()))
|
||||||
{
|
{
|
||||||
// cheating attempt
|
// cheating attempt
|
||||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
info.Status = TRADE_STATUS_TRADE_CANCELED;
|
||||||
|
SendTradeStatus(info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,18 +25,18 @@
|
|||||||
#ifndef MANGOS_H_BIH
|
#ifndef MANGOS_H_BIH
|
||||||
#define MANGOS_H_BIH
|
#define MANGOS_H_BIH
|
||||||
|
|
||||||
#include <G3D/Vector3.h>
|
|
||||||
#include <G3D/Ray.h>
|
|
||||||
#include <G3D/AABox.h>
|
|
||||||
|
|
||||||
#include <Platform/Define.h>
|
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <Platform/Define.h>
|
||||||
|
|
||||||
|
#include <G3D/Vector3.h>
|
||||||
|
#include <G3D/Ray.h>
|
||||||
|
#include <G3D/AABox.h>
|
||||||
|
|
||||||
#define MAX_STACK_SIZE 64
|
#define MAX_STACK_SIZE 64
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "BIH.h"
|
||||||
#include <G3D/Table.h>
|
#include <G3D/Table.h>
|
||||||
#include <G3D/Array.h>
|
#include <G3D/Array.h>
|
||||||
#include <G3D/Set.h>
|
#include <G3D/Set.h>
|
||||||
#include "BIH.h"
|
|
||||||
|
|
||||||
template<class T, class BoundsFunc = BoundsTrait<T> >
|
template<class T, class BoundsFunc = BoundsTrait<T> >
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef MANGOSSERVER_GAMEOBJECTMODEL_H
|
#ifndef MANGOSSERVER_GAMEOBJECTMODEL_H
|
||||||
#define MANGOSSERVER_GAMEOBJECTMODEL_H
|
#define MANGOSSERVER_GAMEOBJECTMODEL_H
|
||||||
|
|
||||||
|
#include "Platform/Define.h"
|
||||||
|
|
||||||
#include <G3D/Matrix3.h>
|
#include <G3D/Matrix3.h>
|
||||||
#include <G3D/Vector3.h>
|
#include <G3D/Vector3.h>
|
||||||
#include <G3D/AABox.h>
|
#include <G3D/AABox.h>
|
||||||
@ -32,7 +34,6 @@
|
|||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "GameObject.h"
|
#include "GameObject.h"
|
||||||
|
|
||||||
#include "Platform/Define.h"
|
|
||||||
|
|
||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
|
@ -25,12 +25,13 @@
|
|||||||
#ifndef MANGOS_H_MODELINSTANCE
|
#ifndef MANGOS_H_MODELINSTANCE
|
||||||
#define MANGOS_H_MODELINSTANCE
|
#define MANGOS_H_MODELINSTANCE
|
||||||
|
|
||||||
|
#include "Platform/Define.h"
|
||||||
|
|
||||||
#include <G3D/Matrix3.h>
|
#include <G3D/Matrix3.h>
|
||||||
#include <G3D/Vector3.h>
|
#include <G3D/Vector3.h>
|
||||||
#include <G3D/AABox.h>
|
#include <G3D/AABox.h>
|
||||||
#include <G3D/Ray.h>
|
#include <G3D/Ray.h>
|
||||||
|
|
||||||
#include "Platform/Define.h"
|
|
||||||
|
|
||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
|
@ -22,15 +22,16 @@
|
|||||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
#include "TileAssembler.h"
|
#include "TileAssembler.h"
|
||||||
#include "MapTree.h"
|
#include "MapTree.h"
|
||||||
#include "BIH.h"
|
#include "BIH.h"
|
||||||
#include "VMapDefinitions.h"
|
#include "VMapDefinitions.h"
|
||||||
|
|
||||||
#include <set>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
using G3D::Vector3;
|
using G3D::Vector3;
|
||||||
using G3D::AABox;
|
using G3D::AABox;
|
||||||
|
@ -25,13 +25,13 @@
|
|||||||
#ifndef MANGOS_H_TILEASSEMBLER
|
#ifndef MANGOS_H_TILEASSEMBLER
|
||||||
#define MANGOS_H_TILEASSEMBLER
|
#define MANGOS_H_TILEASSEMBLER
|
||||||
|
|
||||||
#include <G3D/Vector3.h>
|
|
||||||
#include <G3D/Matrix3.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "ModelInstance.h"
|
#include "ModelInstance.h"
|
||||||
#include "WorldModel.h"
|
#include "WorldModel.h"
|
||||||
|
#include <G3D/Vector3.h>
|
||||||
|
#include <G3D/Matrix3.h>
|
||||||
|
|
||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
|
@ -25,13 +25,14 @@
|
|||||||
#ifndef MANGOS_H_WORLDMODEL
|
#ifndef MANGOS_H_WORLDMODEL
|
||||||
#define MANGOS_H_WORLDMODEL
|
#define MANGOS_H_WORLDMODEL
|
||||||
|
|
||||||
|
#include "Platform/Define.h"
|
||||||
|
|
||||||
#include <G3D/HashTrait.h>
|
#include <G3D/HashTrait.h>
|
||||||
#include <G3D/Vector3.h>
|
#include <G3D/Vector3.h>
|
||||||
#include <G3D/AABox.h>
|
#include <G3D/AABox.h>
|
||||||
#include <G3D/Ray.h>
|
#include <G3D/Ray.h>
|
||||||
#include "BIH.h"
|
#include "BIH.h"
|
||||||
|
|
||||||
#include "Platform/Define.h"
|
|
||||||
|
|
||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user