Core/Maps: Changed the way area data is stored in maps, it now uses ID field from AreaTable.dbc instead AreaBit used for exploration marker (and is not unique anymore on top of simply being stupidly confusing)
Note: Extracting maps is required
This commit is contained in:
@@ -469,7 +469,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
|
||||
return false;
|
||||
}
|
||||
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area))
|
||||
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !sAreaTableStore.LookupEntry(e.event.respawn.area))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
|
||||
return false;
|
||||
|
||||
@@ -2275,17 +2275,18 @@ bool AchievementMgr<T>::RequirementsSatisfied(AchievementCriteria const* achieve
|
||||
bool matchFound = false;
|
||||
for (int j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j)
|
||||
{
|
||||
uint32 area_id = worldOverlayEntry->AreaID[j];
|
||||
if (!area_id) // array have 0 only in empty tail
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(worldOverlayEntry->AreaID[j]);
|
||||
if (!area)
|
||||
break;
|
||||
|
||||
int32 exploreFlag = GetAreaFlagByAreaID(area_id);
|
||||
if (exploreFlag < 0)
|
||||
if (area->AreaBit < 0)
|
||||
continue;
|
||||
|
||||
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
|
||||
uint32 mask = 1 << (uint32(exploreFlag) % 32);
|
||||
uint32 playerIndexOffset = uint32(area->AreaBit) / 32;
|
||||
if (playerIndexOffset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
continue;
|
||||
|
||||
uint32 mask = 1 << (uint32(area->AreaBit) % 32);
|
||||
if (referencePlayer->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
|
||||
{
|
||||
matchFound = true;
|
||||
|
||||
@@ -297,10 +297,10 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
||||
uint32 areaId = player->GetAreaId();
|
||||
std::string areaName = "Unknown";
|
||||
std::string zoneName = "Unknown";
|
||||
if (AreaTableEntry const* area = GetAreaEntryByAreaID(areaId))
|
||||
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId))
|
||||
{
|
||||
areaName = area->AreaName_lang;
|
||||
if (AreaTableEntry const* zone = GetAreaEntryByAreaID(area->ParentAreaID))
|
||||
if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID))
|
||||
zoneName = zone->AreaName_lang;
|
||||
}
|
||||
|
||||
|
||||
@@ -1768,7 +1768,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) const
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_PHASE:
|
||||
{
|
||||
if (cond->SourceEntry && !GetAreaEntryByAreaID(cond->SourceEntry))
|
||||
if (cond->SourceEntry && !sAreaTableStore.LookupEntry(cond->SourceEntry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "%s SourceEntry in `condition` table, does not exist in AreaTable.dbc, ignoring.", cond->ToString().c_str());
|
||||
return false;
|
||||
@@ -1845,7 +1845,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
|
||||
}
|
||||
case CONDITION_ZONEID:
|
||||
{
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->ConditionValue1);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(cond->ConditionValue1);
|
||||
if (!areaEntry)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "%s Area (%u) does not exist, skipped.", cond->ToString(true).c_str(), cond->ConditionValue1);
|
||||
@@ -2592,12 +2592,9 @@ bool ConditionMgr::IsPlayerMeetingCondition(Player* player, PlayerConditionEntry
|
||||
|
||||
for (std::size_t i = 0; i < ExploredCount::value; ++i)
|
||||
{
|
||||
if (condition->Explored[i])
|
||||
{
|
||||
int32 exploreFlag = GetAreaFlagByAreaID(condition->Explored[i]);
|
||||
if (exploreFlag != -1 && !(player->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + exploreFlag / 32) & (1 << (uint32(exploreFlag) % 32))))
|
||||
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(condition->Explored[i]))
|
||||
if (area->AreaBit != -1 && !(player->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + area->AreaBit / 32) & (1 << (uint32(area->AreaBit) % 32))))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,16 +44,12 @@ struct WMOAreaTableTripple
|
||||
int32 adtId;
|
||||
};
|
||||
|
||||
typedef std::map<uint16, uint32> AreaFlagByAreaID;
|
||||
typedef std::map<uint32, uint32> AreaFlagByMapID;
|
||||
typedef std::multimap<uint32, CharSectionsEntry const*> CharSectionsMap;
|
||||
typedef std::map<uint32, std::vector<uint32>> FactionTeamMap;
|
||||
typedef std::map<WMOAreaTableTripple, WMOAreaTableEntry const*> WMOAreaInfoByTripple;
|
||||
|
||||
DBCStorage<AnimKitEntry> sAnimKitStore(AnimKitfmt);
|
||||
DBCStorage<AreaTableEntry> sAreaStore(AreaTablefmt);
|
||||
static AreaFlagByAreaID sAreaFlagByAreaID;
|
||||
static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files
|
||||
DBCStorage<AreaTableEntry> sAreaTableStore(AreaTablefmt);
|
||||
DBCStorage<AreaTriggerEntry> sAreaTriggerStore(AreaTriggerfmt);
|
||||
DBCStorage<ArmorLocationEntry> sArmorLocationStore(ArmorLocationfmt);
|
||||
|
||||
@@ -298,7 +294,7 @@ void LoadDBCStores(const std::string& dataPath, uint32 defaultLocale)
|
||||
#define LOAD_DBC(store, file) LoadDBC(availableDbcLocales, bad_dbc_files, store, dbcPath, file, defaultLocale)
|
||||
|
||||
LOAD_DBC(sAnimKitStore, "AnimKit.dbc");//20444
|
||||
LOAD_DBC(sAreaStore, "AreaTable.dbc");//20444
|
||||
LOAD_DBC(sAreaTableStore, "AreaTable.dbc");//20444
|
||||
LOAD_DBC(sAreaTriggerStore, "AreaTrigger.dbc");//20444
|
||||
LOAD_DBC(sArmorLocationStore, "ArmorLocation.dbc");//20444
|
||||
LOAD_DBC(sBankBagSlotPricesStore, "BankBagSlotPrices.dbc");//20444
|
||||
@@ -382,20 +378,6 @@ void LoadDBCStores(const std::string& dataPath, uint32 defaultLocale)
|
||||
|
||||
#undef LOAD_DBC
|
||||
|
||||
// must be after sAreaStore loading
|
||||
for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0
|
||||
{
|
||||
if (AreaTableEntry const* area = sAreaStore.LookupEntry(i))
|
||||
{
|
||||
// fill AreaId->DBC records
|
||||
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID), area->AreaBit));
|
||||
|
||||
// fill MapId->DBC records (skip sub zones and continents)
|
||||
if (area->ParentAreaID == 0)
|
||||
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->MapID, area->AreaBit));
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < sCharSectionsStore.GetNumRows(); ++i)
|
||||
if (CharSectionsEntry const* entry = sCharSectionsStore.LookupEntry(i))
|
||||
if (entry->Race && ((1 << (entry->Race - 1)) & RACEMASK_ALL_PLAYABLE) != 0) //ignore Nonplayable races
|
||||
@@ -494,7 +476,7 @@ void LoadDBCStores(const std::string& dataPath, uint32 defaultLocale)
|
||||
}
|
||||
|
||||
// Check loaded DBC files proper version
|
||||
if (!sAreaStore.LookupEntry(6565) || // last area (areaflag) added in 6.2.2 (20444)
|
||||
if (!sAreaTableStore.LookupEntry(7941) || // last area added in 6.2.2 (20444)
|
||||
!sCharTitlesStore.LookupEntry(457) || // last char title added in 6.2.2 (20444)
|
||||
!sGemPropertiesStore.LookupEntry(2544) || // last gem property added in 6.2.2 (20444)
|
||||
!sMapStore.LookupEntry(1497) || // last map added in 6.2.2 (20444)
|
||||
@@ -580,41 +562,12 @@ char const* GetCreatureFamilyPetName(uint32 petfamily, uint32 /*locale*/)
|
||||
return pet_family->Name_lang ? pet_family->Name_lang : NULL;
|
||||
}
|
||||
|
||||
int32 GetAreaFlagByAreaID(uint32 area_id)
|
||||
{
|
||||
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
|
||||
if (i == sAreaFlagByAreaID.end())
|
||||
return -1;
|
||||
|
||||
return i->second;
|
||||
}
|
||||
|
||||
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
|
||||
{
|
||||
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
|
||||
if (i == sWMOAreaInfoByTripple.end())
|
||||
return NULL;
|
||||
return i->second;
|
||||
}
|
||||
|
||||
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
|
||||
{
|
||||
int32 areaflag = GetAreaFlagByAreaID(area_id);
|
||||
if (areaflag < 0)
|
||||
if (i == sWMOAreaInfoByTripple.end())
|
||||
return NULL;
|
||||
|
||||
return sAreaStore.LookupEntry(areaflag);
|
||||
}
|
||||
|
||||
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id)
|
||||
{
|
||||
if (area_flag)
|
||||
return sAreaStore.LookupEntry(area_flag);
|
||||
|
||||
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
|
||||
return GetAreaEntryByAreaID(mapEntry->AreaTableID);
|
||||
|
||||
return NULL;
|
||||
return i->second;
|
||||
}
|
||||
|
||||
char const* GetRaceName(uint8 race, uint8 /*locale*/)
|
||||
@@ -629,15 +582,6 @@ char const* GetClassName(uint8 class_, uint8 /*locale*/)
|
||||
return classEntry ? classEntry->Name_lang : NULL;
|
||||
}
|
||||
|
||||
uint32 GetAreaFlagByMapId(uint32 mapid)
|
||||
{
|
||||
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
|
||||
if (i == sAreaFlagByMapID.end())
|
||||
return 0;
|
||||
else
|
||||
return i->second;
|
||||
}
|
||||
|
||||
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
|
||||
{
|
||||
if (mapid != 530 && mapid != 571 && mapid != 732) // speed for most cases
|
||||
|
||||
@@ -24,12 +24,6 @@
|
||||
#include "DB2Structure.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
// AreaTable
|
||||
int32 GetAreaFlagByAreaID(uint32 area_id); // -1 if not found
|
||||
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id);
|
||||
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id);
|
||||
uint32 GetAreaFlagByMapId(uint32 mapid);
|
||||
|
||||
// CharSections
|
||||
CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color);
|
||||
|
||||
@@ -128,7 +122,7 @@ private:
|
||||
};
|
||||
|
||||
extern DBCStorage<AnimKitEntry> sAnimKitStore;
|
||||
extern DBCStorage<AreaTableEntry> sAreaStore;// recommend access using functions
|
||||
extern DBCStorage<AreaTableEntry> sAreaTableStore;
|
||||
extern DBCStorage<AreaTriggerEntry> sAreaTriggerStore;
|
||||
extern DBCStorage<ArmorLocationEntry> sArmorLocationStore;
|
||||
extern DBCStorage<BankBagSlotPricesEntry> sBankBagSlotPricesStore;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// n - index (included), l - uint64, p - field present in sql dbc, a - field absent in sql dbc
|
||||
|
||||
char const AnimKitfmt[] = "nxxx";
|
||||
char const AreaTablefmt[] = "iiiniixxxxxxisiiiiixxxxxxxxxx";
|
||||
char const AreaTablefmt[] = "niiiiixxxxxxisiiiiixxxxxxxxxx";
|
||||
char const AreaTriggerfmt[] = "nifffxxxfffffxxxx";
|
||||
char const ArmorLocationfmt[] = "nfffff";
|
||||
char const BankBagSlotPricesfmt[] = "ni";
|
||||
|
||||
@@ -4618,7 +4618,7 @@ void Player::RepopAtGraveyard()
|
||||
// note: this can be called also when the player is alive
|
||||
// for example from WorldSession::HandleMovementOpcodes
|
||||
|
||||
AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId());
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetAreaId());
|
||||
|
||||
// Such zones are considered unreachable as a ghost and the player must be automatically revived
|
||||
if ((!IsAlive() && zone && zone->Flags[0] & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < MAX_MAP_DEPTH)
|
||||
@@ -4702,7 +4702,7 @@ void Player::UpdateLocalChannels(uint32 newZone)
|
||||
if (GetSession()->PlayerLoading() && !IsBeingTeleportedFar())
|
||||
return; // The client handles it automatically after loading, but not after teleporting
|
||||
|
||||
AreaTableEntry const* current_zone = GetAreaEntryByAreaID(newZone);
|
||||
AreaTableEntry const* current_zone = sAreaTableStore.LookupEntry(newZone);
|
||||
if (!current_zone)
|
||||
return;
|
||||
|
||||
@@ -5900,23 +5900,32 @@ void Player::CheckAreaExploreAndOutdoor()
|
||||
return;
|
||||
|
||||
bool isOutdoor;
|
||||
uint16 areaFlag = GetBaseMap()->GetAreaFlag(GetPositionX(), GetPositionY(), GetPositionZ(), &isOutdoor);
|
||||
uint32 areaId = GetBaseMap()->GetAreaId(GetPositionX(), GetPositionY(), GetPositionZ(), &isOutdoor);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && !isOutdoor)
|
||||
RemoveAurasWithAttribute(SPELL_ATTR0_OUTDOORS_ONLY);
|
||||
|
||||
if (areaFlag == 0xffff)
|
||||
if (!areaId)
|
||||
return;
|
||||
int offset = areaFlag / 32;
|
||||
|
||||
if (!areaEntry)
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player '%s' (%s) discovered unknown area (x: %f y: %f z: %f map: %u)",
|
||||
GetName().c_str(), GetGUID().ToString().c_str(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 offset = areaEntry->AreaBit / 32;
|
||||
|
||||
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::CheckAreaExploreAndOutdoor: Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).",
|
||||
areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
areaId, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 val = (uint32)(1 << (areaFlag % 32));
|
||||
uint32 val = (uint32)(1 << (areaEntry->AreaBit % 32));
|
||||
uint32 currFields = GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
|
||||
|
||||
if (!(currFields & val))
|
||||
@@ -5925,20 +5934,11 @@ void Player::CheckAreaExploreAndOutdoor()
|
||||
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA);
|
||||
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId());
|
||||
if (!areaEntry)
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player '%s' (%s) discovered unknown area (x: %f y: %f z: %f map: %u)",
|
||||
GetName().c_str(), GetGUID().ToString().c_str(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (areaEntry->ExplorationLevel > 0)
|
||||
{
|
||||
uint32 area = areaEntry->ID;
|
||||
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
SendExplorationExperience(area, 0);
|
||||
SendExplorationExperience(areaId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5962,9 +5962,9 @@ void Player::CheckAreaExploreAndOutdoor()
|
||||
}
|
||||
|
||||
GiveXP(XP, nullptr);
|
||||
SendExplorationExperience(area, XP);
|
||||
SendExplorationExperience(areaId, XP);
|
||||
}
|
||||
TC_LOG_DEBUG("entities.player", "Player '%s' (%s) discovered a new area: %u", GetName().c_str(),GetGUID().ToString().c_str(), area);
|
||||
TC_LOG_DEBUG("entities.player", "Player '%s' (%s) discovered a new area: %u", GetName().c_str(),GetGUID().ToString().c_str(), areaId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6871,7 +6871,7 @@ void Player::UpdateArea(uint32 newArea)
|
||||
// so apply them accordingly
|
||||
m_areaUpdateId = newArea;
|
||||
|
||||
AreaTableEntry const* area = GetAreaEntryByAreaID(newArea);
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(newArea);
|
||||
pvpInfo.IsInFFAPvPArea = area && (area->Flags[0] & AREA_FLAG_ARENA);
|
||||
UpdatePvPState(true);
|
||||
|
||||
@@ -6923,7 +6923,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
// zone changed, so area changed as well, update it
|
||||
UpdateArea(newArea);
|
||||
|
||||
AreaTableEntry const* zone = GetAreaEntryByAreaID(newZone);
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(newZone);
|
||||
if (!zone)
|
||||
return;
|
||||
|
||||
@@ -25826,10 +25826,10 @@ std::string Player::GetMapAreaAndZoneString() const
|
||||
uint32 areaId = GetAreaId();
|
||||
std::string areaName = "Unknown";
|
||||
std::string zoneName = "Unknown";
|
||||
if (AreaTableEntry const* area = GetAreaEntryByAreaID(areaId))
|
||||
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId))
|
||||
{
|
||||
areaName = area->AreaName_lang;
|
||||
if (AreaTableEntry const* zone = GetAreaEntryByAreaID(area->ParentAreaID))
|
||||
if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID))
|
||||
zoneName = zone->AreaName_lang;
|
||||
}
|
||||
|
||||
|
||||
@@ -3928,7 +3928,7 @@ void ObjectMgr::LoadQuests()
|
||||
// client quest log visual (area case)
|
||||
if (qinfo->QuestSortID > 0)
|
||||
{
|
||||
if (!GetAreaEntryByAreaID(qinfo->QuestSortID))
|
||||
if (!sAreaTableStore.LookupEntry(qinfo->QuestSortID))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %u (zone case) but zone with this id does not exist.",
|
||||
qinfo->GetQuestId(), qinfo->QuestSortID);
|
||||
@@ -5857,7 +5857,7 @@ void ObjectMgr::LoadGraveyardZones()
|
||||
continue;
|
||||
}
|
||||
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
|
||||
if (!areaEntry)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for non-existing Zone (ID: %u), skipped.", zoneId);
|
||||
@@ -7753,7 +7753,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
int32 skill = fields[1].GetInt16();
|
||||
|
||||
AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry);
|
||||
AreaTableEntry const* fArea = sAreaTableStore.LookupEntry(entry);
|
||||
if (!fArea)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "AreaId %u defined in `skill_fishing_base_level` does not exist", entry);
|
||||
|
||||
@@ -688,7 +688,7 @@ void WorldSession::HandleHearthAndResurrect(WorldPackets::Battleground::HearthAn
|
||||
return;
|
||||
}
|
||||
|
||||
AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
|
||||
AreaTableEntry const* atEntry = sAreaTableStore.LookupEntry(_player->GetAreaId());
|
||||
if (!atEntry || !(atEntry->Flags[0] & AREA_FLAG_CAN_HEARTH_AND_RESURRECT))
|
||||
return;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId());
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetPlayer()->GetZoneId());
|
||||
if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ void WorldSession::HandleWhoOpcode(WorldPackets::Who::WhoRequestPkt& whoRequest)
|
||||
if (!wWords.empty())
|
||||
{
|
||||
std::string aName;
|
||||
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(target->GetZoneId()))
|
||||
if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(target->GetZoneId()))
|
||||
aName = areaEntry->AreaName_lang;
|
||||
|
||||
bool show = false;
|
||||
|
||||
@@ -1586,8 +1586,8 @@ void LoadLootTemplates_Fishing()
|
||||
uint32 count = LootTemplates_Fishing.LoadAndCollectLootIds(lootIdSet);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i)
|
||||
if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
||||
for (uint32 i = 1; i < sAreaTableStore.GetNumRows(); ++i)
|
||||
if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i))
|
||||
if (lootIdSet.find(areaEntry->ID) != lootIdSet.end())
|
||||
lootIdSet.erase(areaEntry->ID);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "Weather.h"
|
||||
|
||||
u_map_magic MapMagic = { {'M','A','P','S'} };
|
||||
u_map_magic MapVersionMagic = { {'v','1','.','5'} };
|
||||
u_map_magic MapVersionMagic = { {'v','1','.','6'} };
|
||||
u_map_magic MapAreaMagic = { {'A','R','E','A'} };
|
||||
u_map_magic MapHeightMagic = { {'M','H','G','T'} };
|
||||
u_map_magic MapLiquidMagic = { {'M','L','I','Q'} };
|
||||
@@ -1757,7 +1757,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;
|
||||
}
|
||||
@@ -2136,12 +2136,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->LiquidTypeID[liquidEntry->Type];
|
||||
if (!overrideLiquid && area->ParentAreaID)
|
||||
{
|
||||
area = GetAreaEntryByAreaID(area->ParentAreaID);
|
||||
area = sAreaTableStore.LookupEntry(area->ParentAreaID);
|
||||
if (area)
|
||||
overrideLiquid = area->LiquidTypeID[liquidEntry->Type];
|
||||
}
|
||||
@@ -2315,7 +2315,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->AreaTableID);
|
||||
atEntry = GetAreaEntryByAreaID(wmoEntry->AreaTableID);
|
||||
atEntry = sAreaTableStore.LookupEntry(wmoEntry->AreaTableID);
|
||||
}
|
||||
return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
|
||||
}
|
||||
@@ -2339,7 +2339,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;
|
||||
@@ -2352,20 +2352,20 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const
|
||||
haveAreaInfo = true;
|
||||
wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
||||
if (wmoEntry)
|
||||
atEntry = GetAreaEntryByAreaID(wmoEntry->AreaTableID);
|
||||
atEntry = sAreaTableStore.LookupEntry(wmoEntry->AreaTableID);
|
||||
}
|
||||
|
||||
uint16 areaflag;
|
||||
uint32 areaId;
|
||||
|
||||
if (atEntry)
|
||||
areaflag = atEntry->AreaBit;
|
||||
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->ID);
|
||||
areaId = i_mapEntry->AreaTableID;
|
||||
}
|
||||
|
||||
if (isOutdoors)
|
||||
@@ -2375,8 +2375,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->ParentAreaID)
|
||||
return area->ParentAreaID;
|
||||
|
||||
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->ParentAreaID)
|
||||
zoneid = area->ParentAreaID;
|
||||
}
|
||||
|
||||
uint8 Map::GetTerrainType(float x, float y) const
|
||||
{
|
||||
@@ -2412,12 +2435,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->LiquidTypeID[liquidFlagType];
|
||||
if (!overrideLiquid && area->ParentAreaID)
|
||||
{
|
||||
area = GetAreaEntryByAreaID(area->ParentAreaID);
|
||||
area = sAreaTableStore.LookupEntry(area->ParentAreaID);
|
||||
if (area)
|
||||
overrideLiquid = area->LiquidTypeID[liquidFlagType];
|
||||
}
|
||||
@@ -2479,34 +2502,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->ParentAreaID != 0) ? entry->ParentAreaID : 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->ParentAreaID != 0) ? entry->ParentAreaID : 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)
|
||||
|
||||
@@ -332,8 +332,11 @@ class Map : public GridRefManager<NGridType>
|
||||
|
||||
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = nullptr) const;
|
||||
|
||||
uint16 GetAreaFlag(float x, float y, float z, bool *isOutdoors=nullptr) const;
|
||||
bool GetAreaInfo(float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const;
|
||||
uint32 GetAreaId(float x, float y, float z, bool *isOutdoors) const;
|
||||
bool GetAreaInfo(float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const;
|
||||
uint32 GetAreaId(float x, float y, float z) const;
|
||||
uint32 GetZoneId(float x, float y, float z) const;
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const;
|
||||
|
||||
bool IsOutdoors(float x, float y, float z) const;
|
||||
|
||||
@@ -342,25 +345,6 @@ class Map : public GridRefManager<NGridType>
|
||||
bool IsInWater(float x, float y, float z, LiquidData* data = nullptr) const;
|
||||
bool IsUnderWater(float x, float y, float z) const;
|
||||
|
||||
static uint32 GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id);
|
||||
static uint32 GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id);
|
||||
static void GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag, uint32 map_id);
|
||||
|
||||
uint32 GetAreaId(float x, float y, float z) const
|
||||
{
|
||||
return GetAreaIdByAreaFlag(GetAreaFlag(x, y, z), GetId());
|
||||
}
|
||||
|
||||
uint32 GetZoneId(float x, float y, float z) const
|
||||
{
|
||||
return GetZoneIdByAreaFlag(GetAreaFlag(x, y, z), GetId());
|
||||
}
|
||||
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const
|
||||
{
|
||||
GetZoneAndAreaIdByAreaFlag(zoneid, areaid, GetAreaFlag(x, y, z), GetId());
|
||||
}
|
||||
|
||||
void MoveAllCreaturesInMoveList();
|
||||
void MoveAllGameObjectsInMoveList();
|
||||
void MoveAllDynamicObjectsInMoveList();
|
||||
|
||||
@@ -42,22 +42,20 @@ class MapManager
|
||||
Map* CreateMap(uint32 mapId, Player* player);
|
||||
Map* FindMap(uint32 mapId, uint32 instanceId) const;
|
||||
|
||||
uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
return m->GetAreaFlag(x, y, z);
|
||||
}
|
||||
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
return Map::GetAreaIdByAreaFlag(GetAreaFlag(mapid, x, y, z), mapid);
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
return m->GetAreaId(x, y, z);
|
||||
}
|
||||
uint32 GetZoneId(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
return Map::GetZoneIdByAreaFlag(GetAreaFlag(mapid, x, y, z), mapid);
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
return m->GetZoneId(x, y, z);
|
||||
}
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, uint32 mapid, float x, float y, float z)
|
||||
{
|
||||
Map::GetZoneAndAreaIdByAreaFlag(zoneid, areaid, GetAreaFlag(mapid, x, y, z), mapid);
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
m->GetZoneAndAreaId(zoneid, areaid, x, y, z);
|
||||
}
|
||||
|
||||
void Initialize(void);
|
||||
|
||||
@@ -650,7 +650,7 @@ void OutdoorPvP::BroadcastWorker(Worker& _worker, uint32 zoneId)
|
||||
|
||||
void OutdoorPvP::SetMapFromZone(uint32 zone)
|
||||
{
|
||||
AreaTableEntry const* areaTable = GetAreaEntryByAreaID(zone);
|
||||
AreaTableEntry const* areaTable = sAreaTableStore.LookupEntry(zone);
|
||||
ASSERT(areaTable);
|
||||
Map* map = sMapMgr->CreateBaseMap(areaTable->MapID);
|
||||
ASSERT(!map->Instanceable());
|
||||
|
||||
@@ -5501,7 +5501,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->IsAlive())
|
||||
{
|
||||
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
|
||||
if (AreaTableEntry const* area = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
|
||||
if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(m_originalCaster->GetAreaId()))
|
||||
if (area->Flags[0] & AREA_FLAG_NO_FLY_ZONE || (Bf && !Bf->CanFlyIn()))
|
||||
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
|
||||
}
|
||||
|
||||
@@ -3866,14 +3866,14 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
|
||||
return;
|
||||
|
||||
// Players can only fight a duel in zones with this flag
|
||||
AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetAreaId());
|
||||
AreaTableEntry const* casterAreaEntry = sAreaTableStore.LookupEntry(caster->GetAreaId());
|
||||
if (casterAreaEntry && !(casterAreaEntry->Flags[0] & AREA_FLAG_ALLOW_DUELS))
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
|
||||
return;
|
||||
}
|
||||
|
||||
AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetAreaId());
|
||||
AreaTableEntry const* targetAreaEntry = sAreaTableStore.LookupEntry(target->GetAreaId());
|
||||
if (targetAreaEntry && !(targetAreaEntry->Flags[0] & AREA_FLAG_ALLOW_DUELS))
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
|
||||
|
||||
@@ -2625,7 +2625,7 @@ void SpellMgr::LoadSpellAreas()
|
||||
}
|
||||
}
|
||||
|
||||
if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId))
|
||||
if (spellArea.areaId && !sAreaTableStore.LookupEntry(spellArea.areaId))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId);
|
||||
continue;
|
||||
|
||||
@@ -487,7 +487,7 @@ public:
|
||||
|
||||
uint32 areaId = id ? (uint32)atoi(id) : player->GetZoneId();
|
||||
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
|
||||
|
||||
if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
|
||||
{
|
||||
@@ -497,7 +497,7 @@ public:
|
||||
}
|
||||
|
||||
// update to parent zone if exist (client map show only zones without parents)
|
||||
AreaTableEntry const* zoneEntry = areaEntry->ParentAreaID ? GetAreaEntryByAreaID(areaEntry->ParentAreaID) : areaEntry;
|
||||
AreaTableEntry const* zoneEntry = areaEntry->ParentAreaID ? sAreaTableStore.LookupEntry(areaEntry->ParentAreaID) : areaEntry;
|
||||
ASSERT(zoneEntry);
|
||||
|
||||
Map const* map = sMapMgr->CreateBaseMap(zoneEntry->MapID);
|
||||
|
||||
@@ -347,10 +347,10 @@ public:
|
||||
onlineState = "online";
|
||||
phase = (!p->IsGameMaster() ? p->GetPhaseMask() : -1);
|
||||
|
||||
AreaTableEntry const* area = GetAreaEntryByAreaID(p->GetAreaId());
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(p->GetAreaId());
|
||||
if (area)
|
||||
{
|
||||
AreaTableEntry const* zone = GetAreaEntryByAreaID(area->ParentAreaID);
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
|
||||
if (zone)
|
||||
zoneName = zone->AreaName_lang;
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ public:
|
||||
wstrToLower(wNamePart);
|
||||
|
||||
// Search in AreaTable.dbc
|
||||
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
|
||||
for (uint32 i = 0; i < sAreaTableStore.GetNumRows(); ++i)
|
||||
{
|
||||
AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i);
|
||||
if (areaEntry)
|
||||
{
|
||||
std::string name = areaEntry->AreaName_lang;
|
||||
@@ -118,9 +118,9 @@ public:
|
||||
// send area in "id - [name]" format
|
||||
std::ostringstream ss;
|
||||
if (handler->GetSession())
|
||||
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name<< "]|h|r";
|
||||
ss << i << " - |cffffffff|Harea:" << i << "|h[" << name<< "]|h|r";
|
||||
else
|
||||
ss << areaEntry->ID << " - " << name;
|
||||
ss << i << " - " << name;
|
||||
|
||||
handler->SendSysMessage(ss.str().c_str());
|
||||
|
||||
|
||||
@@ -201,8 +201,8 @@ public:
|
||||
uint32 mapId = object->GetMapId();
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
|
||||
AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
|
||||
|
||||
float zoneX = object->GetPositionX();
|
||||
float zoneY = object->GetPositionY();
|
||||
@@ -988,7 +988,7 @@ public:
|
||||
|
||||
uint32 zoneId = player->GetZoneId();
|
||||
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
|
||||
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
|
||||
if (!areaEntry || areaEntry->ParentAreaID !=0)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
|
||||
@@ -1079,17 +1079,30 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 area = GetAreaFlagByAreaID(atoi((char*)args));
|
||||
int32 offset = area / 32;
|
||||
|
||||
if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(atoi(args));
|
||||
if (!area)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 val = uint32((1 << (area % 32)));
|
||||
if (area->AreaBit < 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 offset = area->AreaBit / 32;
|
||||
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 val = uint32((1 << (area->AreaBit % 32)));
|
||||
uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
|
||||
playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
|
||||
|
||||
@@ -1110,17 +1123,30 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 area = GetAreaFlagByAreaID(atoi((char*)args));
|
||||
int32 offset = area / 32;
|
||||
|
||||
if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(atoi(args));
|
||||
if (!area)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 val = uint32((1 << (area % 32)));
|
||||
if (area->AreaBit < 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 offset = area->AreaBit / 32;
|
||||
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 val = uint32((1 << (area->AreaBit % 32)));
|
||||
uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
|
||||
playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
|
||||
|
||||
@@ -1787,12 +1813,12 @@ public:
|
||||
|
||||
// Position data
|
||||
MapEntry const* map = sMapStore.LookupEntry(mapId);
|
||||
AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
|
||||
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
|
||||
if (area)
|
||||
{
|
||||
areaName = area->AreaName_lang;
|
||||
|
||||
AreaTableEntry const* zone = GetAreaEntryByAreaID(area->ParentAreaID);
|
||||
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID);
|
||||
if (zone)
|
||||
zoneName = zone->AreaName_lang;
|
||||
}
|
||||
|
||||
@@ -75,12 +75,10 @@ typedef struct
|
||||
} map_id;
|
||||
|
||||
map_id *map_ids;
|
||||
uint16 *areas;
|
||||
uint16 *LiqType;
|
||||
#define MAX_PATH_LENGTH 128
|
||||
char output_path[MAX_PATH_LENGTH];
|
||||
char input_path[MAX_PATH_LENGTH];
|
||||
uint32 maxAreaId = 0;
|
||||
|
||||
// **************************************************
|
||||
// Extractor options
|
||||
@@ -318,35 +316,6 @@ uint32 ReadMapDBC()
|
||||
return map_count;
|
||||
}
|
||||
|
||||
void ReadAreaTableDBC()
|
||||
{
|
||||
printf("Read AreaTable.dbc file...");
|
||||
HANDLE dbcFile;
|
||||
if (!CascOpenFile(CascStorage, "DBFilesClient\\AreaTable.dbc", CASC_LOCALE_NONE, 0, &dbcFile))
|
||||
{
|
||||
printf("Fatal error: Cannot find AreaTable.dbc in archive! %s\n", HumanReadableCASCError(GetLastError()));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
DBCFile dbc(dbcFile);
|
||||
if(!dbc.open())
|
||||
{
|
||||
printf("Fatal error: Invalid AreaTable.dbc file format!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
size_t area_count = dbc.getRecordCount();
|
||||
maxAreaId = dbc.getMaxId();
|
||||
areas = new uint16[maxAreaId + 1];
|
||||
memset(areas, 0xFF, sizeof(uint16) * (maxAreaId + 1));
|
||||
|
||||
for (uint32 x = 0; x < area_count; ++x)
|
||||
areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||
|
||||
CascCloseFile(dbcFile);
|
||||
printf("Done! (" SZFMTD " areas loaded)\n", area_count);
|
||||
}
|
||||
|
||||
void ReadLiquidTypeTableDBC()
|
||||
{
|
||||
printf("Read LiquidType.dbc file...");
|
||||
@@ -382,7 +351,7 @@ void ReadLiquidTypeTableDBC()
|
||||
|
||||
// Map file format data
|
||||
static char const* MAP_MAGIC = "MAPS";
|
||||
static char const* MAP_VERSION_MAGIC = "v1.5";
|
||||
static char const* MAP_VERSION_MAGIC = "v1.6";
|
||||
static char const* MAP_AREA_MAGIC = "AREA";
|
||||
static char const* MAP_HEIGHT_MAGIC = "MHGT";
|
||||
static char const* MAP_LIQUID_MAGIC = "MLIQ";
|
||||
@@ -458,7 +427,7 @@ float selectUInt16StepStore(float maxDiff)
|
||||
return 65535 / maxDiff;
|
||||
}
|
||||
// Temporary grid data store
|
||||
uint16 area_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
uint16 area_ids[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
|
||||
float V8[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
||||
float V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
||||
@@ -502,7 +471,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
map.buildMagic = build;
|
||||
|
||||
// Get area flags data
|
||||
memset(area_flags, 0xFF, sizeof(area_flags));
|
||||
memset(area_ids, 0, sizeof(area_ids));
|
||||
memset(V9, 0, sizeof(V9));
|
||||
memset(V8, 0, sizeof(V8));
|
||||
|
||||
@@ -519,8 +488,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
adt_MCNK* mcnk = itr->second->As<adt_MCNK>();
|
||||
|
||||
// Area data
|
||||
if (mcnk->areaid <= maxAreaId && areas[mcnk->areaid] != 0xFFFF)
|
||||
area_flags[mcnk->iy][mcnk->ix] = areas[mcnk->areaid];
|
||||
area_ids[mcnk->iy][mcnk->ix] = mcnk->areaid;
|
||||
|
||||
// Height
|
||||
// Height values for triangles stored in order:
|
||||
@@ -732,12 +700,12 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
// Try pack area data
|
||||
//============================================
|
||||
bool fullAreaData = false;
|
||||
uint32 areaflag = area_flags[0][0];
|
||||
for (int y=0;y<ADT_CELLS_PER_GRID;y++)
|
||||
uint32 areaId = area_ids[0][0];
|
||||
for (int y = 0; y < ADT_CELLS_PER_GRID; ++y)
|
||||
{
|
||||
for(int x=0;x<ADT_CELLS_PER_GRID;x++)
|
||||
for (int x = 0; x < ADT_CELLS_PER_GRID; ++x)
|
||||
{
|
||||
if(area_flags[y][x]!=areaflag)
|
||||
if (area_ids[y][x] != areaId)
|
||||
{
|
||||
fullAreaData = true;
|
||||
break;
|
||||
@@ -754,12 +722,12 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
if (fullAreaData)
|
||||
{
|
||||
areaHeader.gridArea = 0;
|
||||
map.areaMapSize+=sizeof(area_flags);
|
||||
map.areaMapSize += sizeof(area_ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
areaHeader.flags |= MAP_AREA_NO_AREA;
|
||||
areaHeader.gridArea = static_cast<uint16>(areaflag);
|
||||
areaHeader.gridArea = static_cast<uint16>(areaId);
|
||||
}
|
||||
|
||||
//============================================
|
||||
@@ -966,8 +934,8 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
outFile.write(reinterpret_cast<const char*>(&map), sizeof(map));
|
||||
// Store area data
|
||||
outFile.write(reinterpret_cast<const char*>(&areaHeader), sizeof(areaHeader));
|
||||
if (!(areaHeader.flags&MAP_AREA_NO_AREA))
|
||||
outFile.write(reinterpret_cast<const char*>(area_flags), sizeof(area_flags));
|
||||
if (!(areaHeader.flags & MAP_AREA_NO_AREA))
|
||||
outFile.write(reinterpret_cast<const char*>(area_ids), sizeof(area_ids));
|
||||
|
||||
// Store height data
|
||||
outFile.write(reinterpret_cast<const char*>(&heightHeader), sizeof(heightHeader));
|
||||
@@ -1042,7 +1010,6 @@ void ExtractMaps(uint32 build)
|
||||
|
||||
uint32 map_count = ReadMapDBC();
|
||||
|
||||
ReadAreaTableDBC();
|
||||
ReadLiquidTypeTableDBC();
|
||||
|
||||
std::string path = output_path;
|
||||
@@ -1098,7 +1065,6 @@ void ExtractMaps(uint32 build)
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
delete[] areas;
|
||||
delete[] map_ids;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ struct map_liquidHeader
|
||||
namespace MMAP
|
||||
{
|
||||
|
||||
char const* MAP_VERSION_MAGIC = "v1.5";
|
||||
char const* MAP_VERSION_MAGIC = "v1.6";
|
||||
|
||||
TerrainBuilder::TerrainBuilder(bool skipLiquid) : m_skipLiquid (skipLiquid){ }
|
||||
TerrainBuilder::~TerrainBuilder() { }
|
||||
|
||||
Reference in New Issue
Block a user