*Merge
--HG-- branch : trunk
This commit is contained in:
@@ -84,12 +84,12 @@ EndScriptData */
|
|||||||
#define CREATURE_ENSLAVED_SOUL 23469
|
#define CREATURE_ENSLAVED_SOUL 23469
|
||||||
#define NUMBER_ENSLAVED_SOUL 8
|
#define NUMBER_ENSLAVED_SOUL 8
|
||||||
|
|
||||||
struct Position
|
struct Position2d
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Position Coords[]=
|
static Position2d Coords[]=
|
||||||
{
|
{
|
||||||
{450.4, 212.3},
|
{450.4, 212.3},
|
||||||
{542.1, 212.3},
|
{542.1, 212.3},
|
||||||
|
|||||||
@@ -38,9 +38,8 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
|
|||||||
x = unit.GetPositionX();
|
x = unit.GetPositionX();
|
||||||
y = unit.GetPositionY();
|
y = unit.GetPositionY();
|
||||||
z = unit.GetPositionZ();
|
z = unit.GetPositionZ();
|
||||||
uint32 mapid=unit.GetMapId();
|
|
||||||
|
|
||||||
Map const* map = MapManager::Instance().GetBaseMap(mapid);
|
Map const* map = unit.GetBaseMap();
|
||||||
|
|
||||||
i_nextMove = 1;
|
i_nextMove = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -263,8 +263,8 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
|||||||
CreatureInfo const *cinfo = normalInfo;
|
CreatureInfo const *cinfo = normalInfo;
|
||||||
if(normalInfo->HeroicEntry)
|
if(normalInfo->HeroicEntry)
|
||||||
{
|
{
|
||||||
Map *map = MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
|
//we already have valid Map pointer for current creature!
|
||||||
if(map && map->IsHeroic())
|
if(GetMap()->IsHeroic())
|
||||||
{
|
{
|
||||||
cinfo = objmgr.GetCreatureTemplate(normalInfo->HeroicEntry);
|
cinfo = objmgr.GetCreatureTemplate(normalInfo->HeroicEntry);
|
||||||
if(!cinfo)
|
if(!cinfo)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
class WorldObject;
|
class WorldObject;
|
||||||
|
class Map;
|
||||||
|
|
||||||
#define TRAVELLER_UPDATE_INTERVAL 300
|
#define TRAVELLER_UPDATE_INTERVAL 300
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ class TRINITY_DLL_DECL DestinationHolder
|
|||||||
bool HasArrived(void) const { return (i_totalTravelTime == 0 || i_timeElapsed >= i_totalTravelTime); }
|
bool HasArrived(void) const { return (i_totalTravelTime == 0 || i_timeElapsed >= i_totalTravelTime); }
|
||||||
bool UpdateTraveller(TRAVELLER &traveller, uint32 diff, bool micro_movement=false);
|
bool UpdateTraveller(TRAVELLER &traveller, uint32 diff, bool micro_movement=false);
|
||||||
uint32 StartTravel(TRAVELLER &traveller, bool sendMove = true);
|
uint32 StartTravel(TRAVELLER &traveller, bool sendMove = true);
|
||||||
void GetLocationNow(uint32 mapid, float &x, float &y, float &z, bool is3D = false) const;
|
void GetLocationNow(const Map * map, float &x, float &y, float &z, bool is3D = false) const;
|
||||||
void GetLocationNowNoMicroMovement(float &x, float &y, float &z) const; // For use without micro movement
|
void GetLocationNowNoMicroMovement(float &x, float &y, float &z) const; // For use without micro movement
|
||||||
float GetDistance2dFromDestSq(const WorldObject &obj) const;
|
float GetDistance2dFromDestSq(const WorldObject &obj) const;
|
||||||
|
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(traveller.GetTraveller().hasUnitState(UNIT_STAT_IN_FLIGHT))
|
if(traveller.GetTraveller().hasUnitState(UNIT_STAT_IN_FLIGHT))
|
||||||
GetLocationNow(traveller.GetTraveller().GetMapId() ,x, y, z, true); // Should repositione Object with right Coord, so I can bypass some Grid Relocation
|
GetLocationNow(traveller.GetTraveller().GetBaseMap() ,x, y, z, true); // Should reposition Object with right Coord, so I can bypass some Grid Relocation
|
||||||
else
|
else
|
||||||
GetLocationNow(traveller.GetTraveller().GetMapId(), x, y, z, false);
|
GetLocationNow(traveller.GetTraveller().GetBaseMap(), x, y, z, false);
|
||||||
|
|
||||||
if( x == -431602080 )
|
if( x == -431602080 )
|
||||||
return false;
|
return false;
|
||||||
@@ -153,7 +153,7 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff,
|
|||||||
|
|
||||||
template<typename TRAVELLER>
|
template<typename TRAVELLER>
|
||||||
void
|
void
|
||||||
DestinationHolder<TRAVELLER>::GetLocationNow(uint32 mapid, float &x, float &y, float &z, bool is3D) const
|
DestinationHolder<TRAVELLER>::GetLocationNow(const Map * map, float &x, float &y, float &z, bool is3D) const
|
||||||
{
|
{
|
||||||
if( HasArrived() )
|
if( HasArrived() )
|
||||||
{
|
{
|
||||||
@@ -175,8 +175,8 @@ DestinationHolder<TRAVELLER>::GetLocationNow(uint32 mapid, float &x, float &y, f
|
|||||||
z = z2;
|
z = z2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//That part is good for mob Walking on the floor. But the floor is not allways what we thought.
|
//That part is good for mob Walking on the floor. But the floor is not always what we thought.
|
||||||
z = MapManager::Instance().GetBaseMap(mapid)->GetHeight(x,y,i_fromZ,false); // Disable cave check
|
z = map->GetHeight(x,y,i_fromZ,false); // Disable cave check
|
||||||
const float groundDist = sqrt(distanceX*distanceX + distanceY*distanceY);
|
const float groundDist = sqrt(distanceX*distanceX + distanceY*distanceY);
|
||||||
const float zDist = fabs(i_fromZ - z) + 0.000001f;
|
const float zDist = fabs(i_fromZ - z) + 0.000001f;
|
||||||
const float slope = groundDist / zDist;
|
const float slope = groundDist / zDist;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
|||||||
z = owner.GetPositionZ();
|
z = owner.GetPositionZ();
|
||||||
|
|
||||||
float temp_x, temp_y, angle;
|
float temp_x, temp_y, angle;
|
||||||
const Map * _map = MapManager::Instance().GetBaseMap(owner.GetMapId());
|
const Map * _map = owner.GetBaseMap();
|
||||||
//primitive path-finding
|
//primitive path-finding
|
||||||
for(uint8 i = 0; i < 18; ++i)
|
for(uint8 i = 0; i < 18; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1228,7 +1228,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||||||
objmgr.AddCreatureToGrid(*itr, data);
|
objmgr.AddCreatureToGrid(*itr, data);
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
Map* map = const_cast<Map*>(MapManager::Instance().GetBaseMap(data->mapid));
|
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||||
// We use spawn coords to spawn
|
// We use spawn coords to spawn
|
||||||
if(!map->Instanceable() && !map->IsRemovalGrid(data->posX,data->posY))
|
if(!map->Instanceable() && !map->IsRemovalGrid(data->posX,data->posY))
|
||||||
{
|
{
|
||||||
@@ -1261,7 +1261,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||||||
objmgr.AddGameobjectToGrid(*itr, data);
|
objmgr.AddGameobjectToGrid(*itr, data);
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
// this base map checked as non-instanced and then only existed
|
// this base map checked as non-instanced and then only existed
|
||||||
Map* map = const_cast<Map*>(MapManager::Instance().GetBaseMap(data->mapid));
|
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
||||||
if(!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY))
|
if(!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY))
|
||||||
{
|
{
|
||||||
|
|||||||
+11
-2
@@ -74,8 +74,17 @@ GameObject::~GameObject()
|
|||||||
Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid);
|
Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid);
|
||||||
if(owner)
|
if(owner)
|
||||||
owner->RemoveGameObject(this,false);
|
owner->RemoveGameObject(this,false);
|
||||||
else if(!IS_PLAYER_GUID(owner_guid))
|
else
|
||||||
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));
|
{
|
||||||
|
char * ownerType = "creature";
|
||||||
|
if(IS_PLAYER_GUID(owner_guid))
|
||||||
|
ownerType = "player";
|
||||||
|
else if(IS_PET_GUID(owner_guid))
|
||||||
|
ownerType = "pet";
|
||||||
|
|
||||||
|
sLog.outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
|
||||||
|
GetGUIDLow(), GetGOInfo()->id, m_spellId, GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr)
|
|||||||
void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
||||||
{
|
{
|
||||||
sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
|
sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
|
||||||
Map *map = (MapInstanced*)MapManager::Instance().GetBaseMap(mapid);
|
Map *map = (MapInstanced*)MapManager::Instance().CreateBaseMap(mapid);
|
||||||
if(!map->Instanceable())
|
if(!map->Instanceable())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -597,7 +597,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
|
|||||||
{
|
{
|
||||||
// global reset for all instances of the given map
|
// global reset for all instances of the given map
|
||||||
// note: this isn't fast but it's meant to be executed very rarely
|
// note: this isn't fast but it's meant to be executed very rarely
|
||||||
Map const *map = MapManager::Instance().GetBaseMap(mapid);
|
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||||
if(!map->Instanceable())
|
if(!map->Instanceable())
|
||||||
return;
|
return;
|
||||||
uint64 now = (uint64)time(NULL);
|
uint64 now = (uint64)time(NULL);
|
||||||
|
|||||||
+3
-3
@@ -2757,7 +2757,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
|
|||||||
else
|
else
|
||||||
_player->SaveRecallPosition();
|
_player->SaveRecallPosition();
|
||||||
|
|
||||||
Map const *map = MapManager::Instance().GetBaseMap(mapid);
|
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||||
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
||||||
|
|
||||||
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
||||||
@@ -2850,7 +2850,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
|
|||||||
// update to parent zone if exist (client map show only zones without parents)
|
// update to parent zone if exist (client map show only zones without parents)
|
||||||
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
|
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
|
||||||
|
|
||||||
Map const *map = MapManager::Instance().GetBaseMap(zoneEntry->mapid);
|
Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
|
||||||
|
|
||||||
if(map->Instanceable())
|
if(map->Instanceable())
|
||||||
{
|
{
|
||||||
@@ -2925,7 +2925,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
|
|||||||
else
|
else
|
||||||
_player->SaveRecallPosition();
|
_player->SaveRecallPosition();
|
||||||
|
|
||||||
Map const *map = MapManager::Instance().GetBaseMap(mapid);
|
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||||
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
||||||
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
||||||
|
|
||||||
|
|||||||
+2
-5
@@ -127,7 +127,7 @@ void Map::LoadMap(int gx,int gy, bool reload)
|
|||||||
if(GridMaps[gx][gy])
|
if(GridMaps[gx][gy])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Map* baseMap = const_cast<Map*>(MapManager::Instance().GetBaseMap(i_id));
|
Map* baseMap = const_cast<Map*>(MapManager::Instance().CreateBaseMap(i_id));
|
||||||
|
|
||||||
// load grid map for base map
|
// load grid map for base map
|
||||||
if (!baseMap->GridMaps[gx][gy])
|
if (!baseMap->GridMaps[gx][gy])
|
||||||
@@ -498,9 +498,6 @@ void
|
|||||||
Map::Add(T *obj)
|
Map::Add(T *obj)
|
||||||
{
|
{
|
||||||
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
|
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
|
||||||
|
|
||||||
assert(obj);
|
|
||||||
|
|
||||||
if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
|
if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
|
||||||
{
|
{
|
||||||
sLog.outError("Map::Add: Object " UI64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
|
sLog.outError("Map::Add: Object " UI64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
|
||||||
@@ -1161,7 +1158,7 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool unloadAll)
|
|||||||
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gy, gx);
|
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gy, gx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
((MapInstanced*)(MapManager::Instance().GetBaseMap(i_id)))->RemoveGridMapReference(GridPair(gx, gy));
|
((MapInstanced*)(MapManager::Instance().CreateBaseMap(i_id)))->RemoveGridMapReference(GridPair(gx, gy));
|
||||||
GridMaps[gx][gy] = NULL;
|
GridMaps[gx][gy] = NULL;
|
||||||
}
|
}
|
||||||
DEBUG_LOG("Unloading grid[%u,%u] for map %u finished", x,y, i_id);
|
DEBUG_LOG("Unloading grid[%u,%u] for map %u finished", x,y, i_id);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class TRINITY_DLL_DECL MapInstanced : public Map
|
|||||||
bool CanEnter(Player* player);
|
bool CanEnter(Player* player);
|
||||||
|
|
||||||
Map* GetInstance(const WorldObject* obj);
|
Map* GetInstance(const WorldObject* obj);
|
||||||
Map* FindMap(uint32 InstanceId) { return _FindMap(InstanceId); }
|
Map* FindMap(uint32 InstanceId) const { return _FindMap(InstanceId); }
|
||||||
void DestroyInstance(uint32 InstanceId);
|
void DestroyInstance(uint32 InstanceId);
|
||||||
void DestroyInstance(InstancedMaps::iterator &itr);
|
void DestroyInstance(InstancedMaps::iterator &itr);
|
||||||
|
|
||||||
@@ -69,10 +69,9 @@ class TRINITY_DLL_DECL MapInstanced : public Map
|
|||||||
|
|
||||||
InstancedMaps m_InstancedMaps;
|
InstancedMaps m_InstancedMaps;
|
||||||
|
|
||||||
Map* _FindMap(uint32 InstanceId)
|
Map* _FindMap(uint32 InstanceId) const
|
||||||
{
|
{
|
||||||
InstancedMaps::iterator i = m_InstancedMaps.find(InstanceId);
|
InstancedMaps::const_iterator i = m_InstancedMaps.find(InstanceId);
|
||||||
|
|
||||||
return(i == m_InstancedMaps.end() ? NULL : i->second);
|
return(i == m_InstancedMaps.end() ? NULL : i->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-15
@@ -101,7 +101,7 @@ void MapManager::checkAndCorrectGridStatesArray()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map*
|
Map*
|
||||||
MapManager::_GetBaseMap(uint32 id)
|
MapManager::_createBaseMap(uint32 id)
|
||||||
{
|
{
|
||||||
Map *m = _findMap(id);
|
Map *m = _findMap(id);
|
||||||
|
|
||||||
@@ -127,19 +127,24 @@ MapManager::_GetBaseMap(uint32 id)
|
|||||||
|
|
||||||
Map* MapManager::GetMap(uint32 id, const WorldObject* obj)
|
Map* MapManager::GetMap(uint32 id, const WorldObject* obj)
|
||||||
{
|
{
|
||||||
|
ASSERT(obj);
|
||||||
//if(!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
|
//if(!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
|
||||||
Map *m = _GetBaseMap(id);
|
Map *m = _createBaseMap(id);
|
||||||
|
|
||||||
if (m && obj && m->Instanceable()) m = ((MapInstanced*)m)->GetInstance(obj);
|
if (m && obj && m->Instanceable()) m = ((MapInstanced*)m)->GetInstance(obj);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId)
|
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
||||||
{
|
{
|
||||||
Map *map = FindMap(mapid);
|
Map *map = _findMap(mapid);
|
||||||
if(!map) return NULL;
|
if(!map)
|
||||||
if(!map->Instanceable()) return instanceId == 0 ? map : NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if(!map->Instanceable())
|
||||||
|
return instanceId == 0 ? map : NULL;
|
||||||
|
|
||||||
return ((MapInstanced*)map)->FindMap(instanceId);
|
return ((MapInstanced*)map)->FindMap(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,14 +229,14 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
|
|
||||||
void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
|
void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
|
||||||
{
|
{
|
||||||
Map *m = _GetBaseMap(mapid);
|
Map *m = _createBaseMap(mapid);
|
||||||
if (m && m->Instanceable())
|
if (m && m->Instanceable())
|
||||||
((MapInstanced*)m)->DestroyInstance(instanceId);
|
((MapInstanced*)m)->DestroyInstance(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapManager::RemoveBonesFromMap(uint32 mapid, uint64 guid, float x, float y)
|
void MapManager::RemoveBonesFromMap(uint32 mapid, uint64 guid, float x, float y)
|
||||||
{
|
{
|
||||||
bool remove_result = _GetBaseMap(mapid)->RemoveBones(guid, x, y);
|
bool remove_result = _createBaseMap(mapid)->RemoveBones(guid, x, y);
|
||||||
|
|
||||||
if (!remove_result)
|
if (!remove_result)
|
||||||
{
|
{
|
||||||
@@ -290,13 +295,6 @@ bool MapManager::IsValidMAP(uint32 mapid)
|
|||||||
// TODO: add check for battleground template
|
// TODO: add check for battleground template
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void MapManager::LoadGrid(int mapid, float x, float y, const WorldObject* obj, bool no_unload)
|
|
||||||
{
|
|
||||||
CellPair p = Trinity::ComputeCellPair(x,y);
|
|
||||||
Cell cell(p);
|
|
||||||
GetMap(mapid, obj)->LoadGrid(cell,no_unload);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void MapManager::UnloadAll()
|
void MapManager::UnloadAll()
|
||||||
{
|
{
|
||||||
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||||
|
|||||||
@@ -40,16 +40,15 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Map* GetMap(uint32, const WorldObject* obj);
|
Map* GetMap(uint32, const WorldObject* obj);
|
||||||
Map* FindMap(uint32 mapid) { return _findMap(mapid); }
|
Map const* CreateBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_createBaseMap(id); }
|
||||||
Map* FindMap(uint32 mapid, uint32 instanceId);
|
Map* FindMap(uint32 mapid, uint32 instanceId = 0) const;
|
||||||
|
|
||||||
// only const version for outer users
|
// only const version for outer users
|
||||||
Map const* GetBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_GetBaseMap(id); }
|
|
||||||
void DeleteInstance(uint32 mapid, uint32 instanceId);
|
void DeleteInstance(uint32 mapid, uint32 instanceId);
|
||||||
|
|
||||||
uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const
|
uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const
|
||||||
{
|
{
|
||||||
Map const* m = GetBaseMap(mapid);
|
Map const* m = CreateBaseMap(mapid);
|
||||||
return m->GetAreaFlag(x, y, z);
|
return m->GetAreaFlag(x, y, z);
|
||||||
}
|
}
|
||||||
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
|
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
|
||||||
@@ -85,7 +84,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||||||
i_timer.Reset();
|
i_timer.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void LoadGrid(int mapid, float x, float y, const WorldObject* obj, bool no_unload = false);
|
//void LoadGrid(int mapid, int instId, float x, float y, const WorldObject* obj, bool no_unload = false);
|
||||||
void UnloadAll();
|
void UnloadAll();
|
||||||
|
|
||||||
static bool ExistMapAndVMap(uint32 mapid, float x, float y);
|
static bool ExistMapAndVMap(uint32 mapid, float x, float y);
|
||||||
@@ -108,7 +107,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||||||
|
|
||||||
static bool IsValidMapCoord(WorldLocation const& loc)
|
static bool IsValidMapCoord(WorldLocation const& loc)
|
||||||
{
|
{
|
||||||
return IsValidMapCoord(loc.mapid,loc.x,loc.y,loc.z,loc.o);
|
return IsValidMapCoord(loc.mapid,loc.coord_x,loc.coord_y,loc.coord_z,loc.orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoDelayedMovesAndRemoves();
|
void DoDelayedMovesAndRemoves();
|
||||||
@@ -142,7 +141,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||||||
MapManager(const MapManager &);
|
MapManager(const MapManager &);
|
||||||
MapManager& operator=(const MapManager &);
|
MapManager& operator=(const MapManager &);
|
||||||
|
|
||||||
Map* _GetBaseMap(uint32 id);
|
Map* _createBaseMap(uint32 id);
|
||||||
Map* _findMap(uint32 id) const
|
Map* _findMap(uint32 id) const
|
||||||
{
|
{
|
||||||
MapMapType::const_iterator iter = i_maps.find(id);
|
MapMapType::const_iterator iter = i_maps.find(id);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||||||
WorldLocation &loc = GetPlayer()->GetTeleportDest();
|
WorldLocation &loc = GetPlayer()->GetTeleportDest();
|
||||||
|
|
||||||
// possible errors in the coordinate validity check
|
// possible errors in the coordinate validity check
|
||||||
if(!MapManager::IsValidMapCoord(loc.mapid, loc.x, loc.y, loc.z, loc.o))
|
if(!MapManager::IsValidMapCoord(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation))
|
||||||
{
|
{
|
||||||
LogoutPlayer(false);
|
LogoutPlayer(false);
|
||||||
return;
|
return;
|
||||||
@@ -68,7 +68,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||||||
|
|
||||||
// relocate the player to the teleport destination
|
// relocate the player to the teleport destination
|
||||||
GetPlayer()->SetMapId(loc.mapid);
|
GetPlayer()->SetMapId(loc.mapid);
|
||||||
GetPlayer()->Relocate(loc.x, loc.y, loc.z, loc.o);
|
GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
|
||||||
|
|
||||||
// since the MapId is set before the GetInstance call, the InstanceId must be set to 0
|
// since the MapId is set before the GetInstance call, the InstanceId must be set to 0
|
||||||
// to let GetInstance() determine the proper InstanceId based on the player's binds
|
// to let GetInstance() determine the proper InstanceId based on the player's binds
|
||||||
@@ -79,7 +79,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||||||
// while the player is in transit, for example the map may get full
|
// while the player is in transit, for example the map may get full
|
||||||
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
|
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: teleport of player %s (%d) to location %d, %f, %f, %f, %f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.x, loc.y, loc.z, loc.o);
|
sLog.outDebug("WORLD: teleport of player %s (%d) to location %d, %f, %f, %f, %f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
|
||||||
// teleport the player home
|
// teleport the player home
|
||||||
if(!GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()))
|
if(!GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()))
|
||||||
{
|
{
|
||||||
@@ -186,7 +186,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
|
|||||||
|
|
||||||
WorldLocation const& dest = plMover->GetTeleportDest();
|
WorldLocation const& dest = plMover->GetTeleportDest();
|
||||||
|
|
||||||
plMover->SetPosition(dest.x, dest.y, dest.z, dest.o, true);
|
plMover->SetPosition(dest.coord_x, dest.coord_y, dest.coord_z, dest.orientation, true);
|
||||||
|
|
||||||
uint32 newzone, newarea;
|
uint32 newzone, newarea;
|
||||||
plMover->GetZoneAndAreaId(newzone, newarea);
|
plMover->GetZoneAndAreaId(newzone, newarea);
|
||||||
|
|||||||
+5
-5
@@ -1101,17 +1101,17 @@ void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint
|
|||||||
|
|
||||||
uint32 WorldObject::GetZoneId() const
|
uint32 WorldObject::GetZoneId() const
|
||||||
{
|
{
|
||||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX, m_positionY, m_positionZ);
|
return GetBaseMap()->GetZoneId(m_positionX, m_positionY, m_positionZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 WorldObject::GetAreaId() const
|
uint32 WorldObject::GetAreaId() const
|
||||||
{
|
{
|
||||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX, m_positionY, m_positionZ);
|
return GetBaseMap()->GetAreaId(m_positionX, m_positionY, m_positionZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const
|
void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const
|
||||||
{
|
{
|
||||||
MapManager::Instance().GetBaseMap(m_mapId)->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ);
|
GetBaseMap()->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceData* WorldObject::GetInstanceData()
|
InstanceData* WorldObject::GetInstanceData()
|
||||||
@@ -1448,7 +1448,7 @@ void WorldObject::GetRandomPoint( float x, float y, float z, float distance, flo
|
|||||||
|
|
||||||
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
|
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
|
||||||
{
|
{
|
||||||
float new_z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(x,y,z,true);
|
float new_z = GetBaseMap()->GetHeight(x,y,z,true);
|
||||||
if(new_z > INVALID_HEIGHT)
|
if(new_z > INVALID_HEIGHT)
|
||||||
z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface
|
z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface
|
||||||
}
|
}
|
||||||
@@ -1679,7 +1679,7 @@ Map* WorldObject::_findMap()
|
|||||||
|
|
||||||
Map const* WorldObject::GetBaseMap() const
|
Map const* WorldObject::GetBaseMap() const
|
||||||
{
|
{
|
||||||
return MapManager::Instance().GetBaseMap(GetMapId());
|
return MapManager::Instance().CreateBaseMap(GetMapId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::AddObjectToRemoveList()
|
void WorldObject::AddObjectToRemoveList()
|
||||||
|
|||||||
+13
-12
@@ -111,16 +111,18 @@ typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
|
|||||||
struct WorldLocation
|
struct WorldLocation
|
||||||
{
|
{
|
||||||
uint32 mapid;
|
uint32 mapid;
|
||||||
float x;
|
float coord_x;
|
||||||
float y;
|
float coord_y;
|
||||||
float z;
|
float coord_z;
|
||||||
float o;
|
float orientation;
|
||||||
explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0)
|
explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0)
|
||||||
: mapid(_mapid), x(_x), y(_y), z(_z), o(_o) {}
|
: mapid(_mapid), coord_x(_x), coord_y(_y), coord_z(_z), orientation(_o) {}
|
||||||
WorldLocation(WorldLocation const &loc)
|
WorldLocation(WorldLocation const &loc)
|
||||||
: mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {}
|
: mapid(loc.mapid), coord_x(loc.coord_x), coord_y(loc.coord_y), coord_z(loc.coord_z), orientation(loc.orientation) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef float Position[4];
|
||||||
|
|
||||||
class TRINITY_DLL_SPEC Object
|
class TRINITY_DLL_SPEC Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -394,11 +396,8 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
|||||||
m_positionZ = z;
|
m_positionZ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Relocate(WorldLocation const & loc)
|
void Relocate(Position pos)
|
||||||
{
|
{ m_positionX = pos[0]; m_positionY = pos[1]; m_positionZ = pos[2]; m_orientation = pos[3]; }
|
||||||
SetMapId(loc.mapid);
|
|
||||||
Relocate(loc.x, loc.y, loc.z, loc.o);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetOrientation(float orientation) { m_orientation = orientation; }
|
void SetOrientation(float orientation) { m_orientation = orientation; }
|
||||||
|
|
||||||
@@ -408,7 +407,9 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
|||||||
void GetPosition( float &x, float &y, float &z ) const
|
void GetPosition( float &x, float &y, float &z ) const
|
||||||
{ x = m_positionX; y = m_positionY; z = m_positionZ; }
|
{ x = m_positionX; y = m_positionY; z = m_positionZ; }
|
||||||
void GetPosition( WorldLocation &loc ) const
|
void GetPosition( WorldLocation &loc ) const
|
||||||
{ loc.mapid = GetMapId(); GetPosition(loc.x, loc.y, loc.z); loc.o = GetOrientation(); }
|
{ loc.mapid = m_mapId; GetPosition(loc.coord_x, loc.coord_y, loc.coord_z); loc.orientation = GetOrientation(); }
|
||||||
|
void GetPosition(Position pos) const
|
||||||
|
{ pos[0] = m_positionX; pos[1] = m_positionY; pos[2] = m_positionZ; pos[3] = m_orientation; }
|
||||||
float GetOrientation( ) const { return m_orientation; }
|
float GetOrientation( ) const { return m_orientation; }
|
||||||
void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const;
|
void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const;
|
||||||
void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const;
|
void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const;
|
||||||
|
|||||||
@@ -1405,7 +1405,7 @@ uint32 ObjectMgr::AddGameObject(uint32 entry, uint32 mapId, float x, float y, fl
|
|||||||
AddGameobjectToGrid(guid, &data);
|
AddGameobjectToGrid(guid, &data);
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
if(Map* map = const_cast<Map*>(MapManager::Instance().GetBaseMap(mapId)))
|
if(Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
|
||||||
{
|
{
|
||||||
// We use spawn coords to spawn
|
// We use spawn coords to spawn
|
||||||
if(!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
if(!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||||
@@ -1454,7 +1454,7 @@ uint32 ObjectMgr::AddCreature(uint32 entry, uint32 team, uint32 mapId, float x,
|
|||||||
AddCreatureToGrid(guid, &data);
|
AddCreatureToGrid(guid, &data);
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
if(Map* map = const_cast<Map*>(MapManager::Instance().GetBaseMap(mapId)))
|
if(Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(mapId)))
|
||||||
{
|
{
|
||||||
// We use spawn coords to spawn
|
// We use spawn coords to spawn
|
||||||
if(!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
if(!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||||
|
|||||||
+17
-15
@@ -1703,11 +1703,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||||||
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
|
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
|
||||||
if(!GetSession()->PlayerLogout())
|
if(!GetSession()->PlayerLogout())
|
||||||
{
|
{
|
||||||
WorldLocation oldLoc;
|
Position oldPos;
|
||||||
GetPosition(oldLoc);
|
GetPosition(oldPos);
|
||||||
Relocate(x, y, z, orientation);
|
Relocate(x, y, z, orientation);
|
||||||
SendTeleportAckMsg();
|
SendTeleportAckMsg();
|
||||||
Relocate(oldLoc);
|
Relocate(oldPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2124,7 +2124,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes
|
|||||||
bool Player::IsUnderWater() const
|
bool Player::IsUnderWater() const
|
||||||
{
|
{
|
||||||
return IsInWater() &&
|
return IsInWater() &&
|
||||||
GetPositionZ() < (MapManager::Instance().GetBaseMap(GetMapId())->GetWaterLevel(GetPositionX(),GetPositionY())-2);
|
GetPositionZ() < (GetBaseMap()->GetWaterLevel(GetPositionX(),GetPositionY())-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SetInWater(bool apply)
|
void Player::SetInWater(bool apply)
|
||||||
@@ -5747,7 +5747,7 @@ void Player::CheckExploreSystem()
|
|||||||
if (isInFlight())
|
if (isInFlight())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint16 areaFlag=MapManager::Instance().GetBaseMap(GetMapId())->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ());
|
uint16 areaFlag = GetBaseMap()->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ());
|
||||||
if(areaFlag==0xffff)
|
if(areaFlag==0xffff)
|
||||||
return;
|
return;
|
||||||
int offset = areaFlag / 32;
|
int offset = areaFlag / 32;
|
||||||
@@ -14457,7 +14457,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Relocate(GetBattleGroundEntryPoint());
|
const WorldLocation& _loc = GetBattleGroundEntryPoint();
|
||||||
|
SetMapId(_loc.mapid);
|
||||||
|
Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation);
|
||||||
//RemoveArenaAuras(true);
|
//RemoveArenaAuras(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14604,7 +14606,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||||||
if(at)
|
if(at)
|
||||||
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
|
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
|
||||||
else
|
else
|
||||||
sLog.outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no aretrigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), GetMapId());
|
sLog.outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), GetMapId());
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveRecallPosition();
|
SaveRecallPosition();
|
||||||
@@ -15929,10 +15931,10 @@ void Player::SaveToDB()
|
|||||||
ss << GetTeleportDest().mapid << ", "
|
ss << GetTeleportDest().mapid << ", "
|
||||||
<< (uint32)0 << ", "
|
<< (uint32)0 << ", "
|
||||||
<< (uint32)GetDifficulty() << ", "
|
<< (uint32)GetDifficulty() << ", "
|
||||||
<< finiteAlways(GetTeleportDest().x) << ", "
|
<< finiteAlways(GetTeleportDest().coord_x) << ", "
|
||||||
<< finiteAlways(GetTeleportDest().y) << ", "
|
<< finiteAlways(GetTeleportDest().coord_y) << ", "
|
||||||
<< finiteAlways(GetTeleportDest().z) << ", "
|
<< finiteAlways(GetTeleportDest().coord_z) << ", "
|
||||||
<< finiteAlways(GetTeleportDest().o) << ", '";
|
<< finiteAlways(GetTeleportDest().orientation) << ", '";
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 i;
|
uint16 i;
|
||||||
@@ -16007,10 +16009,10 @@ void Player::SaveToDB()
|
|||||||
ss << GetBGTeam();
|
ss << GetBGTeam();
|
||||||
ss << ", ";
|
ss << ", ";
|
||||||
ss << m_bgEntryPoint.mapid << ", "
|
ss << m_bgEntryPoint.mapid << ", "
|
||||||
<< finiteAlways(m_bgEntryPoint.x) << ", "
|
<< finiteAlways(m_bgEntryPoint.coord_x) << ", "
|
||||||
<< finiteAlways(m_bgEntryPoint.y) << ", "
|
<< finiteAlways(m_bgEntryPoint.coord_y) << ", "
|
||||||
<< finiteAlways(m_bgEntryPoint.z) << ", "
|
<< finiteAlways(m_bgEntryPoint.coord_z) << ", "
|
||||||
<< finiteAlways(m_bgEntryPoint.o);
|
<< finiteAlways(m_bgEntryPoint.orientation);
|
||||||
ss << ")";
|
ss << ")";
|
||||||
|
|
||||||
CharacterDatabase.Execute( ss.str().c_str() );
|
CharacterDatabase.Execute( ss.str().c_str() );
|
||||||
|
|||||||
+1
-1
@@ -856,7 +856,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
|||||||
|
|
||||||
bool TeleportTo(WorldLocation const &loc, uint32 options = 0)
|
bool TeleportTo(WorldLocation const &loc, uint32 options = 0)
|
||||||
{
|
{
|
||||||
return TeleportTo(loc.mapid, loc.x, loc.y, loc.z, options);
|
return TeleportTo(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSummonPoint(uint32 mapid, float x, float y, float z)
|
void SetSummonPoint(uint32 mapid, float x, float y, float z)
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ bool PoolGroup<Creature>::Spawn1Object(uint32 guid)
|
|||||||
objmgr.AddCreatureToGrid(guid, data);
|
objmgr.AddCreatureToGrid(guid, data);
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
Map* map = const_cast<Map*>(MapManager::Instance().GetBaseMap(data->mapid));
|
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||||
// We use spawn coords to spawn
|
// We use spawn coords to spawn
|
||||||
if (!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY))
|
if (!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY))
|
||||||
{
|
{
|
||||||
@@ -263,7 +263,7 @@ bool PoolGroup<GameObject>::Spawn1Object(uint32 guid)
|
|||||||
objmgr.AddGameobjectToGrid(guid, data);
|
objmgr.AddGameobjectToGrid(guid, data);
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
// this base map checked as non-instanced and then only existed
|
// this base map checked as non-instanced and then only existed
|
||||||
Map* map = const_cast<Map*>(MapManager::Instance().GetBaseMap(data->mapid));
|
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
||||||
if (!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY))
|
if (!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
|
|||||||
if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
|
if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
|
||||||
{
|
{
|
||||||
// if corpse map have entrance
|
// if corpse map have entrance
|
||||||
if(Map const* entranceMap = MapManager::Instance().GetBaseMap(corpseMapEntry->entrance_map))
|
if(Map const* entranceMap = MapManager::Instance().CreateBaseMap(corpseMapEntry->entrance_map))
|
||||||
{
|
{
|
||||||
mapid = corpseMapEntry->entrance_map;
|
mapid = corpseMapEntry->entrance_map;
|
||||||
x = corpseMapEntry->entrance_x;
|
x = corpseMapEntry->entrance_x;
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
|
|||||||
creature.GetHomePosition(X, Y, Z, ori);
|
creature.GetHomePosition(X, Y, Z, ori);
|
||||||
|
|
||||||
z = creature.GetPositionZ();
|
z = creature.GetPositionZ();
|
||||||
uint32 mapid=creature.GetMapId();
|
Map const* map = creature.GetBaseMap();
|
||||||
Map const* map = MapManager::Instance().GetBaseMap(mapid);
|
|
||||||
|
|
||||||
// For 2D/3D system selection
|
// For 2D/3D system selection
|
||||||
bool is_land_ok = creature.canWalk();
|
bool is_land_ok = creature.canWalk();
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ enum AuraType
|
|||||||
SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
|
SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
|
||||||
SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
|
SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
|
||||||
SPELL_AURA_LINKED = 284,
|
SPELL_AURA_LINKED = 284,
|
||||||
SPELL_AURA_MOD_AP_FROM_STAT,
|
SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
|
||||||
SPELL_AURA_286,
|
SPELL_AURA_286,
|
||||||
SPELL_AURA_DEFLECT_SPELLS,
|
SPELL_AURA_DEFLECT_SPELLS,
|
||||||
SPELL_AURA_288,
|
SPELL_AURA_288,
|
||||||
|
|||||||
+18
-23
@@ -338,7 +338,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||||||
&Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
|
&Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
|
||||||
&Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
|
&Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
|
||||||
&Aura::HandleUnused, //284 not used by any spells (3.08a)
|
&Aura::HandleUnused, //284 not used by any spells (3.08a)
|
||||||
&Aura::HandleUnused, //285 not used by any spells (3.08a)
|
&Aura::HandleAuraModAttackPowerOfArmor, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in Player::UpdateAttackPowerAndDamage
|
||||||
&Aura::HandleUnused, //286 not used by any spells (3.08a)
|
&Aura::HandleUnused, //286 not used by any spells (3.08a)
|
||||||
&Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
|
&Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
|
||||||
&Aura::HandleUnused, //288 not used by any spells (3.09) except 1 test spell.
|
&Aura::HandleUnused, //288 not used by any spells (3.09) except 1 test spell.
|
||||||
@@ -960,7 +960,7 @@ void Aura::SendAuraUpdate()
|
|||||||
data << uint32(GetId());
|
data << uint32(GetId());
|
||||||
data << uint8(m_auraFlags);
|
data << uint8(m_auraFlags);
|
||||||
data << uint8(m_auraLevel);
|
data << uint8(m_auraLevel);
|
||||||
data << uint8(m_stackAmount>1 ? m_stackAmount : m_procCharges);
|
data << uint8(m_stackAmount > 1 ? (m_procCharges > 1 ? m_stackAmount * m_procCharges : m_stackAmount) : m_procCharges);
|
||||||
|
|
||||||
if(!(m_auraFlags & AFLAG_CASTER))
|
if(!(m_auraFlags & AFLAG_CASTER))
|
||||||
{
|
{
|
||||||
@@ -5393,6 +5393,16 @@ void AuraEffect::HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real, bo
|
|||||||
((Player*)m_target)->UpdateAttackPowerAndDamage(false);
|
((Player*)m_target)->UpdateAttackPowerAndDamage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuraEffect::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real, bool /*changeAmount*/)
|
||||||
|
{
|
||||||
|
// spells required only Real aura add/remove
|
||||||
|
if(!Real)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Recalculate bonus
|
||||||
|
if(m_target->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
((Player*)m_target)->UpdateAttackPowerAndDamage(false);
|
||||||
|
}
|
||||||
/********************************/
|
/********************************/
|
||||||
/*** DAMAGE BONUS ***/
|
/*** DAMAGE BONUS ***/
|
||||||
/********************************/
|
/********************************/
|
||||||
@@ -6753,34 +6763,19 @@ void AuraEffect::PeriodicDummyTick()
|
|||||||
// return;
|
// return;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELLFAMILY_WARRIOR:
|
|
||||||
{
|
|
||||||
// Armored to the Teeth
|
|
||||||
if (spell->SpellIconID == 3516)
|
|
||||||
{
|
|
||||||
// Increases your attack power by $s1 for every $s2 armor value you have.
|
|
||||||
// Calculate AP bonus (from 1 efect of this spell)
|
|
||||||
int32 apBonus = m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target);
|
|
||||||
m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPELLFAMILY_WARLOCK:
|
case SPELLFAMILY_WARLOCK:
|
||||||
|
{
|
||||||
switch (spell->Id)
|
switch (spell->Id)
|
||||||
{
|
{
|
||||||
// Demonic Circle
|
// Demonic Circle
|
||||||
case 48018:
|
case 48018:
|
||||||
GameObject* obj = m_target->GetGameObject(spell->Id);
|
if(GameObject* obj = m_target->GetGameObject(spell->Id))
|
||||||
if (!obj) return;
|
// We must take a range of teleport spell, not summon.
|
||||||
// We must take a range of teleport spell, not summon.
|
m_target->SendAuraVisualForSelf(m_target->IsWithinDist(obj, GetSpellMaxRange(48020, true)), 62388, 1);
|
||||||
const SpellEntry* goToCircleSpell = sSpellStore.LookupEntry(48020);
|
return;
|
||||||
if (m_target->IsWithinDist(obj,GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(goToCircleSpell->rangeIndex))))
|
|
||||||
m_target->SendAuraVisualForSelf(true,62388, 1);
|
|
||||||
else
|
|
||||||
m_target->SendAuraVisualForSelf(false,62388);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SPELLFAMILY_DRUID:
|
case SPELLFAMILY_DRUID:
|
||||||
{
|
{
|
||||||
switch (spell->Id)
|
switch (spell->Id)
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ class TRINITY_DLL_SPEC AuraEffect
|
|||||||
void HandleAuraModAttackPowerPercent(bool apply, bool Real, bool changeAmount);
|
void HandleAuraModAttackPowerPercent(bool apply, bool Real, bool changeAmount);
|
||||||
void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real, bool changeAmount);
|
void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real, bool changeAmount);
|
||||||
void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount);
|
void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount);
|
||||||
|
void HandleAuraModAttackPowerOfArmor(bool apply, bool Real, bool changeAmount);
|
||||||
void HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount);
|
void HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount);
|
||||||
void HandleSpiritOfRedemption(bool apply, bool Real, bool changeAmount);
|
void HandleSpiritOfRedemption(bool apply, bool Real, bool changeAmount);
|
||||||
void HandleModManaRegen(bool apply, bool Real, bool changeAmount);
|
void HandleModManaRegen(bool apply, bool Real, bool changeAmount);
|
||||||
|
|||||||
@@ -144,9 +144,9 @@ bool Player::UpdateAllStats()
|
|||||||
SetStat(Stats(i), (int32)value);
|
SetStat(Stats(i), (int32)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAttackPowerAndDamage();
|
|
||||||
UpdateAttackPowerAndDamage(true);
|
|
||||||
UpdateArmor();
|
UpdateArmor();
|
||||||
|
// calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
|
||||||
|
UpdateAttackPowerAndDamage(true);
|
||||||
UpdateMaxHealth();
|
UpdateMaxHealth();
|
||||||
|
|
||||||
for(int i = POWER_MANA; i < MAX_POWERS; ++i)
|
for(int i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||||
@@ -207,6 +207,8 @@ void Player::UpdateArmor()
|
|||||||
Pet *pet = GetPet();
|
Pet *pet = GetPet();
|
||||||
if(pet)
|
if(pet)
|
||||||
pet->UpdateArmor();
|
pet->UpdateArmor();
|
||||||
|
|
||||||
|
UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
|
||||||
}
|
}
|
||||||
|
|
||||||
float Player::GetHealthBonusFromStamina()
|
float Player::GetHealthBonusFromStamina()
|
||||||
@@ -372,6 +374,11 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
|
|||||||
AuraEffectList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
|
AuraEffectList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
|
||||||
for(AuraEffectList::const_iterator i = mAPbyStat.begin();i != mAPbyStat.end(); ++i)
|
for(AuraEffectList::const_iterator i = mAPbyStat.begin();i != mAPbyStat.end(); ++i)
|
||||||
attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f);
|
attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f);
|
||||||
|
|
||||||
|
AuraEffectList const& mAPbyArmor = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
|
||||||
|
for(AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
|
||||||
|
// always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)
|
||||||
|
attPowerMod += int32(GetArmor() / (*iter)->GetMiscValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
|
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void MapManager::LoadTransports()
|
|||||||
uint32 mapid;
|
uint32 mapid;
|
||||||
x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1;
|
x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1;
|
||||||
|
|
||||||
// creates the Gameobject
|
// creates the Gameobject
|
||||||
if(!t->Create(entry, mapid, x, y, z, o, 100, 0))
|
if(!t->Create(entry, mapid, x, y, z, o, 100, 0))
|
||||||
{
|
{
|
||||||
delete t;
|
delete t;
|
||||||
|
|||||||
+6
-2
@@ -3582,12 +3582,12 @@ bool Unit::isInAccessiblePlaceFor(Creature const* c) const
|
|||||||
|
|
||||||
bool Unit::IsInWater() const
|
bool Unit::IsInWater() const
|
||||||
{
|
{
|
||||||
return MapManager::Instance().GetBaseMap(GetMapId())->IsInWater(GetPositionX(),GetPositionY(), GetPositionZ());
|
return GetBaseMap()->IsInWater(GetPositionX(),GetPositionY(), GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::IsUnderWater() const
|
bool Unit::IsUnderWater() const
|
||||||
{
|
{
|
||||||
return MapManager::Instance().GetBaseMap(GetMapId())->IsUnderWater(GetPositionX(),GetPositionY(),GetPositionZ());
|
return GetBaseMap()->IsUnderWater(GetPositionX(),GetPositionY(),GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::DeMorph()
|
void Unit::DeMorph()
|
||||||
@@ -12731,6 +12731,10 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
|||||||
if (triggeredByAura->GetCasterGUID() != pTarget->GetGUID())
|
if (triggeredByAura->GetCasterGUID() != pTarget->GetGUID())
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
case SPELL_AURA_MOD_SPELL_CRIT_CHANCE:
|
||||||
|
if (!procSpell)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
/*case SPELL_AURA_ADD_FLAT_MODIFIER:
|
/*case SPELL_AURA_ADD_FLAT_MODIFIER:
|
||||||
case SPELL_AURA_ADD_PCT_MODIFIER:
|
case SPELL_AURA_ADD_PCT_MODIFIER:
|
||||||
// HandleSpellModAuraProc
|
// HandleSpellModAuraProc
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ void FlightPathMovementGenerator::Finalize(Player & player)
|
|||||||
player.clearUnitState(UNIT_STAT_IN_FLIGHT);
|
player.clearUnitState(UNIT_STAT_IN_FLIGHT);
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
i_destinationHolder.GetLocationNow(player.GetMapId(), x, y, z);
|
i_destinationHolder.GetLocationNow(player.GetBaseMap(), x, y, z);
|
||||||
player.SetPosition(x, y, z, player.GetOrientation());
|
player.SetPosition(x, y, z, player.GetOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "BattleGroundMgr.h"
|
#include "BattleGroundMgr.h"
|
||||||
#include "OutdoorPvPMgr.h"
|
#include "OutdoorPvPMgr.h"
|
||||||
//#include "Language.h" // for CMSG_CANCEL_MOUNT_AURA handler
|
#include "MapManager.h"
|
||||||
#include "SocialMgr.h"
|
#include "SocialMgr.h"
|
||||||
#include "zlib/zlib.h"
|
#include "zlib/zlib.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user