Merge remote-tracking branch 'tc/3.3.5' into 4.3.4

Conflicts:
	sql/base/characters_database.sql
	sql/updates/world/2016_01_26_00_world.sql
	sql/updates/world/2016_01_31_00_world.sql
	sql/updates/world/2016_02_07_00_world.sql
	src/server/authserver/Server/AuthSession.cpp
	src/server/database/Database/Implementation/LoginDatabase.cpp
	src/server/database/Database/Implementation/LoginDatabase.h
	src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
	src/server/game/AI/ScriptedAI/ScriptedCreature.h
	src/server/game/Achievements/AchievementMgr.cpp
	src/server/game/Chat/Chat.cpp
	src/server/game/DataStores/DBCStores.cpp
	src/server/game/DataStores/DBCStructure.h
	src/server/game/DataStores/DBCfmt.h
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Globals/ObjectMgr.cpp
	src/server/game/Handlers/AuctionHouseHandler.cpp
	src/server/game/Handlers/MailHandler.cpp
	src/server/game/Handlers/MovementHandler.cpp
	src/server/game/Server/WorldSocket.cpp
	src/server/game/Server/WorldSocket.h
	src/server/game/Spells/Auras/SpellAuraEffects.cpp
	src/server/game/Spells/SpellEffects.cpp
	src/server/game/Spells/SpellMgr.cpp
	src/server/scripts/Spells/spell_druid.cpp
	src/server/scripts/Spells/spell_generic.cpp
	src/server/scripts/Spells/spell_hunter.cpp
	src/server/scripts/Spells/spell_rogue.cpp
	src/server/scripts/Spells/spell_shaman.cpp
	src/server/shared/Networking/AsyncAcceptor.h
	src/tools/map_extractor/CMakeLists.txt
	src/tools/map_extractor/System.cpp
	src/tools/map_extractor/adt.h
	src/tools/mmaps_generator/MapBuilder.cpp
This commit is contained in:
ariel- committed 2016-02-21 07:02:53 -03:00
commit 8bc477a2de
161 files changed
+3548 -2022

No files matched your search

+80 -61
View File
@@ -1640,13 +1640,13 @@ GridMap::GridMap()
_flags = 0;
// Area data
_gridArea = 0;
_areaMap = NULL;
_areaMap = nullptr;
// Height level data
_gridHeight = INVALID_HEIGHT;
_gridGetHeight = &GridMap::getHeightFromFlat;
_gridIntHeightMultiplier = 0;
m_V9 = NULL;
m_V8 = NULL;
m_V9 = nullptr;
m_V8 = nullptr;
// Liquid data
_liquidType = 0;
_liquidOffX = 0;
@@ -1654,9 +1654,9 @@ GridMap::GridMap()
_liquidWidth = 0;
_liquidHeight = 0;
_liquidLevel = INVALID_HEIGHT;
_liquidEntry = NULL;
_liquidFlags = NULL;
_liquidMap = NULL;
_liquidEntry = nullptr;
_liquidFlags = nullptr;
_liquidMap = nullptr;
}
GridMap::~GridMap()
@@ -1722,12 +1722,12 @@ void GridMap::unloadData()
delete[] _liquidEntry;
delete[] _liquidFlags;
delete[] _liquidMap;
_areaMap = NULL;
m_V9 = NULL;
m_V8 = NULL;
_liquidEntry = NULL;
_liquidFlags = NULL;
_liquidMap = NULL;
_areaMap = nullptr;
m_V9 = nullptr;
m_V8 = nullptr;
_liquidEntry = nullptr;
_liquidFlags = nullptr;
_liquidMap = nullptr;
_gridGetHeight = &GridMap::getHeightFromFlat;
}
@@ -1742,7 +1742,7 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
_gridArea = header.gridArea;
if (!(header.flags & MAP_AREA_NO_AREA))
{
_areaMap = new uint16 [16*16];
_areaMap = new uint16[16 * 16];
if (fread(_areaMap, sizeof(uint16), 16*16, in) != 16*16)
return false;
}
@@ -1792,6 +1792,7 @@ bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
}
else
_gridGetHeight = &GridMap::getHeightFromFlat;
return true;
}
@@ -2121,12 +2122,12 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
uint32 liqTypeIdx = liquidEntry->Type;
if (entry < 21)
{
if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(getArea(x, y), MAPID_INVALID))
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(getArea(x, y)))
{
uint32 overrideLiquid = area->LiquidTypeOverride[liquidEntry->Type];
if (!overrideLiquid && area->zone)
{
area = GetAreaEntryByAreaID(area->zone);
area = sAreaTableStore.LookupEntry(area->zone);
if (area)
overrideLiquid = area->LiquidTypeOverride[liquidEntry->Type];
}
@@ -2300,7 +2301,7 @@ bool Map::IsOutdoors(float x, float y, float z) const
if (wmoEntry)
{
TC_LOG_DEBUG("maps", "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
atEntry = GetAreaEntryByAreaID(wmoEntry->areaId);
atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
}
return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
}
@@ -2324,7 +2325,7 @@ bool Map::GetAreaInfo(float x, float y, float z, uint32 &flags, int32 &adtId, in
return false;
}
uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const
uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const
{
uint32 mogpFlags;
int32 adtId, rootId, groupId;
@@ -2337,20 +2338,21 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const
haveAreaInfo = true;
wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
if (wmoEntry)
atEntry = GetAreaEntryByAreaID(wmoEntry->areaId);
atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
}
uint16 areaflag;
uint32 areaId = 0;
if (atEntry)
areaflag = atEntry->exploreFlag;
areaId = atEntry->ID;
else
{
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
areaflag = gmap->getArea(x, y);
areaId = gmap->getArea(x, y);
// this used while not all *.map files generated (instances)
else
areaflag = GetAreaFlagByMapId(i_mapEntry->MapID);
if (!areaId)
areaId = i_mapEntry->linked_zone;
}
if (isOutdoors)
@@ -2360,8 +2362,31 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const
else
*isOutdoors = true;
}
return areaflag;
}
return areaId;
}
uint32 Map::GetAreaId(float x, float y, float z) const
{
return GetAreaId(x, y, z, nullptr);
}
uint32 Map::GetZoneId(float x, float y, float z) const
{
uint32 areaId = GetAreaId(x, y, z);
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId))
if (area->zone)
return area->zone;
return areaId;
}
void Map::GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const
{
areaid = zoneid = GetAreaId(x, y, z);
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaid))
if (area->zone)
zoneid = area->zone;
}
uint8 Map::GetTerrainType(float x, float y) const
{
@@ -2397,12 +2422,12 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp
if (liquid_type && liquid_type < 21)
{
if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(GetAreaFlag(x, y, z), GetId()))
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(GetAreaId(x, y, z)))
{
uint32 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];
if (!overrideLiquid && area->zone)
{
area = GetAreaEntryByAreaID(area->zone);
area = sAreaTableStore.LookupEntry(area->zone);
if (area)
overrideLiquid = area->LiquidTypeOverride[liquidFlagType];
}
@@ -2464,34 +2489,6 @@ float Map::GetWaterLevel(float x, float y) const
return 0;
}
uint32 Map::GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id)
{
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
if (entry)
return entry->ID;
else
return 0;
}
uint32 Map::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id)
{
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
if (entry)
return (entry->zone != 0) ? entry->zone : entry->ID;
else
return 0;
}
void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag, uint32 map_id)
{
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
areaid = entry ? entry->ID : 0;
zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0;
}
bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const
{
return VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2)
@@ -3200,22 +3197,37 @@ bool InstanceMap::Reset(uint8 method)
}
else
{
bool doUnload = true;
if (method == INSTANCE_RESET_GLOBAL)
{
// set the homebind timer for players inside (1 minute)
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
itr->GetSource()->m_InstanceValid = false;
{
InstancePlayerBind* bind = itr->GetSource()->GetBoundInstance(GetId(), GetDifficulty());
if (bind && bind->extendState && bind->save->GetInstanceId() == GetInstanceId())
doUnload = false;
else
itr->GetSource()->m_InstanceValid = false;
}
// the unload timer is not started
// instead the map will unload immediately after the players have left
m_unloadWhenEmpty = true;
m_resetAfterUnload = true;
if (doUnload && HasPermBoundPlayers()) // check if any unloaded players have a nonexpired save to this
doUnload = false;
}
if (doUnload)
{
// the unload timer is not started
// instead the map will unload immediately after the players have left
m_unloadWhenEmpty = true;
m_resetAfterUnload = true;
}
}
}
else
{
// unloaded at next update
m_unloadTimer = MIN_UNLOAD_DELAY;
m_resetAfterUnload = true;
m_resetAfterUnload = !(method == INSTANCE_RESET_GLOBAL && HasPermBoundPlayers());
}
return m_mapRefManager.isEmpty();
@@ -3296,6 +3308,13 @@ MapDifficulty const* Map::GetMapDifficulty() const
return GetMapDifficultyData(GetId(), GetDifficulty());
}
bool InstanceMap::HasPermBoundPlayers() const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PERM_BIND_BY_INSTANCE);
stmt->setUInt16(0,GetInstanceId());
return !!CharacterDatabase.Query(stmt);
}
uint32 InstanceMap::GetMaxPlayers() const
{
MapDifficulty const* mapDiff = GetMapDifficulty();