Core/DataStores: Fixed name consistency and improved coords handling

This commit is contained in:
Intel
2014-11-07 13:53:25 +02:00
parent 9246f7d335
commit 4123e27a66
8 changed files with 79 additions and 66 deletions

View File

@@ -2329,7 +2329,7 @@ bool AchievementMgr<T>::CanUpdateCriteria(AchievementCriteriaEntry const* criter
return false;
}
if (achievement->InstanceID != -1 && referencePlayer->GetMapId() != uint32(achievement->InstanceID))
if (achievement->MapID != -1 && referencePlayer->GetMapId() != uint32(achievement->MapID))
{
TC_LOG_TRACE("achievement", "CanUpdateCriteria: %s (Id: %u Type %s) Wrong map",
criteria->name, criteria->ID, AchievementGlobalMgr::GetCriteriaTypeString(criteria->type));
@@ -3190,7 +3190,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
// Once Bitten, Twice Shy (10 player) - Icecrown Citadel
if (AchievementEntry const* achievement = sAchievementMgr->GetAchievement(4539))
const_cast<AchievementEntry*>(achievement)->InstanceID = 631; // Correct map requirement (currently has Ulduar)
const_cast<AchievementEntry*>(achievement)->MapID = 631; // Correct map requirement (currently has Ulduar)
TC_LOG_INFO("server.loading", ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}

View File

@@ -510,9 +510,9 @@ bool BattlegroundEY::SetupBattleground()
TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
continue;
}
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->Pos[0], at->Pos[1], at->Pos[2], 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->Pos[0], at->Pos[1], at->Pos[2], 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->Pos[0], at->Pos[1], at->Pos[2], 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->Pos.X, at->Pos.Y, at->Pos.Z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->Pos.X, at->Pos.Y, at->Pos.Z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->Pos.X, at->Pos.Y, at->Pos.Z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
)
TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Cannot spawn buff");
}

View File

@@ -38,11 +38,24 @@
#pragma pack(push, 1)
#endif
struct DBCPosition2D
{
float X;
float Y;
};
struct DBCPosition3D
{
float X;
float Y;
float Z;
};
struct AchievementEntry
{
uint32 ID; // 0
int32 Faction; // 1 -1=all, 0=horde, 1=alliance
int32 InstanceID; // 2 MapID -1=none
int32 MapID; // 2 -1=none
//uint32 Supercedes; // 3 its Achievement parent (can`t start while parent uncomplete, use its Criteria if don`t have own, use its progress on begin)
char* Title_lang; // 4
//char* Description_lang; // 5
@@ -579,21 +592,21 @@ struct AreaGroupEntry
struct AreaTriggerEntry
{
uint32 ID; // 0
uint32 ContinentID; // 1 MapID
float Pos[3]; // 2-4
//uint32 PhaseUseFlags // 5
//uint32 PhaseID // 6
//uint32 PhaseGroupID // 7
float Radius; // 8
float BoxLength; // 9
float BoxWidth; // 10
float BoxHeight; // 11
float BoxYaw; // 12
//uint32 ShapeType // 13
//uint32 ShapeID // 14
//uint32 AreaTriggerActionSetID // 15
//uint32 Flags // 16
uint32 ID; // 0
uint32 MapID; // 1
DBCPosition3D Pos; // 2-4
//uint32 PhaseUseFlags // 5
//uint32 PhaseID // 6
//uint32 PhaseGroupID // 7
float Radius; // 8
float BoxLength; // 9
float BoxWidth; // 10
float BoxHeight; // 11
float BoxYaw; // 12
//uint32 ShapeType // 13
//uint32 ShapeID // 14
//uint32 AreaTriggerActionSetID // 15
//uint32 Flags // 16
};
struct ArmorLocationEntry
@@ -1473,27 +1486,27 @@ struct MailTemplateEntry
struct MapEntry
{
uint32 ID; // 0
//char* Directory; // 1
uint32 InstanceType; // 2
uint32 Flags; // 3
//uint32 MapType; // 4
//uint32 unk5; // 5
char* MapName_lang; // 6
uint32 AreaTableID; // 7
//char* MapDescription0_lang; // 8 Horde
//char* MapDescription1_lang; // 9 Alliance
uint32 LoadingScreenID; // 10 LoadingScreens.dbc
//float MinimapIconScale; // 11
int32 CorpseMapID; // 12 map_id of entrance map in ghost mode (continent always and in most cases = normal entrance)
float Corpse[2]; // 13 entrance coordinates in ghost mode (in most cases = normal entrance)
//uint32 TimeOfDayOverride; // 15
uint32 ExpansionID; // 16
uint32 RaidOffset; // 17
uint32 MaxPlayers; // 18
int32 ParentMapID; // 19 related to phasing
//uint32 CosmeticParentMapID // 20
//uint32 TimeOffset // 21
uint32 ID; // 0
//char* Directory; // 1
uint32 InstanceType; // 2
uint32 Flags; // 3
//uint32 MapType; // 4
//uint32 unk5; // 5
char* MapName_lang; // 6
uint32 AreaTableID; // 7
//char* MapDescription0_lang; // 8 Horde
//char* MapDescription1_lang; // 9 Alliance
uint32 LoadingScreenID; // 10 LoadingScreens.dbc
//float MinimapIconScale; // 11
int32 CorpseMapID; // 12 map_id of entrance map in ghost mode (continent always and in most cases = normal entrance)
DBCPosition2D CorpsePos; // 13 entrance coordinates in ghost mode (in most cases = normal entrance)
//uint32 TimeOfDayOverride; // 15
uint32 ExpansionID; // 16
uint32 RaidOffset; // 17
uint32 MaxPlayers; // 18
int32 ParentMapID; // 19 related to phasing
//uint32 CosmeticParentMapID // 20
//uint32 TimeOffset // 21
// Helpers
uint32 Expansion() const { return ExpansionID; }
@@ -1512,8 +1525,8 @@ struct MapEntry
if (CorpseMapID < 0)
return false;
mapid = CorpseMapID;
x = Corpse[0];
y = Corpse[1];
x = CorpsePos.X;
y = CorpsePos.Y;
return true;
}

View File

@@ -6000,7 +6000,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
if (!mapEntry
|| mapEntry->CorpseMapID < 0
|| uint32(mapEntry->CorpseMapID) != entry->map_id
|| (mapEntry->Corpse[0] == 0 && mapEntry->Corpse[1] == 0)) // Check X and Y
|| (mapEntry->CorpsePos.X == 0 && mapEntry->CorpsePos.Y == 0)) // Check X and Y
{
// not have any corrdinates for check distance anyway
entryFar = entry;
@@ -6008,8 +6008,8 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
}
// at entrance map calculate distance (2D);
float dist2 = (entry->x - mapEntry->Corpse[0])*(entry->x - mapEntry->Corpse[0])
+(entry->y - mapEntry->Corpse[1])*(entry->y - mapEntry->Corpse[1]);
float dist2 = (entry->x - mapEntry->CorpsePos.X)*(entry->x - mapEntry->CorpsePos.X)
+(entry->y - mapEntry->CorpsePos.Y)*(entry->y - mapEntry->CorpsePos.Y);
if (foundEntr)
{
if (dist2 < distEntr)
@@ -6320,7 +6320,7 @@ AreaTriggerStruct const* ObjectMgr::GetGoBackTrigger(uint32 Map) const
if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId))
{
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);
if (atEntry && atEntry->ContinentID == Map)
if (atEntry && atEntry->MapID == Map)
return &itr->second;
}
return NULL;

View File

@@ -867,10 +867,10 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
return;
}
if (player->GetMapId() != atEntry->ContinentID)
if (player->GetMapId() != atEntry->MapID)
{
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
player->GetName().c_str(), player->GetGUID().ToString().c_str(), atEntry->ContinentID, player->GetMapId(), triggerId);
player->GetName().c_str(), player->GetGUID().ToString().c_str(), atEntry->MapID, player->GetMapId(), triggerId);
return;
}
@@ -880,7 +880,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
if (atEntry->Radius > 0)
{
// if we have radius check it
float dist = player->GetDistance(atEntry->Pos[0], atEntry->Pos[1], atEntry->Pos[2]);
float dist = player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z);
if (dist > atEntry->Radius + delta)
{
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
@@ -900,16 +900,16 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
double sinVal = std::sin(rotation);
double cosVal = std::cos(rotation);
float playerBoxDistX = player->GetPositionX() - atEntry->Pos[0];
float playerBoxDistY = player->GetPositionY() - atEntry->Pos[1];
float playerBoxDistX = player->GetPositionX() - atEntry->Pos.X;
float playerBoxDistY = player->GetPositionY() - atEntry->Pos.Y;
float rotPlayerX = float(atEntry->Pos[0] + playerBoxDistX * cosVal - playerBoxDistY*sinVal);
float rotPlayerY = float(atEntry->Pos[1] + playerBoxDistY * cosVal + playerBoxDistX*sinVal);
float rotPlayerX = float(atEntry->Pos.X + playerBoxDistX * cosVal - playerBoxDistY*sinVal);
float rotPlayerY = float(atEntry->Pos.Y + playerBoxDistY * cosVal + playerBoxDistX*sinVal);
// box edges are parallel to coordiante axis, so we can treat every dimension independently :D
float dz = player->GetPositionZ() - atEntry->Pos[2];
float dx = rotPlayerX - atEntry->Pos[0];
float dy = rotPlayerY - atEntry->Pos[1];
float dz = player->GetPositionZ() - atEntry->Pos.Z;
float dx = rotPlayerX - atEntry->Pos.X;
float dy = rotPlayerY - atEntry->Pos.Y;
if ((std::fabs(dx) > atEntry->BoxLength / 2 + delta) ||
(std::fabs(dy) > atEntry->BoxWidth / 2 + delta) ||
(std::fabs(dz) > atEntry->BoxHeight / 2 + delta))
@@ -935,7 +935,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
{
// set resting flag we are in the inn
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
player->InnEnter(time(NULL), atEntry->ContinentID, atEntry->Pos[0], atEntry->Pos[1], atEntry->Pos[2]);
player->InnEnter(time(NULL), atEntry->MapID, atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z);
player->SetRestType(REST_TYPE_IN_TAVERN);
if (sWorld->IsFFAPvPRealm())

View File

@@ -258,8 +258,8 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->CorpseMapID))
{
mapid = corpseMapEntry->CorpseMapID;
x = corpseMapEntry->Corpse[0];
y = corpseMapEntry->Corpse[1];
x = corpseMapEntry->CorpsePos.X;
y = corpseMapEntry->CorpsePos.Y;
z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT);
}
}

View File

@@ -391,9 +391,9 @@ public:
return false;
}
if (!MapManager::IsValidMapCoord(at->ContinentID, at->Pos[0], at->Pos[1], at->Pos[2]))
if (!MapManager::IsValidMapCoord(at->MapID, at->Pos.X, at->Pos.Y, at->Pos.Z))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, at->Pos[0], at->Pos[1], at->ContinentID);
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, at->Pos.X, at->Pos.Y, at->MapID);
handler->SetSentErrorMessage(true);
return false;
}
@@ -408,7 +408,7 @@ public:
else
player->SaveRecallPosition();
player->TeleportTo(at->ContinentID, at->Pos[0], at->Pos[1], at->Pos[2], player->GetOrientation());
player->TeleportTo(at->MapID, at->Pos.X, at->Pos.Y, at->Pos.Z, player->GetOrientation());
return true;
}

View File

@@ -155,7 +155,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
if (atEntry)
{
// 5.0f is safe-distance
if (player->GetDistance(atEntry->Pos[0], atEntry->Pos[1], atEntry->Pos[2]) > 5.0f + atEntry->Radius)
if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
{
// he dropped it further, summon mound
GameObject* go = new GameObject;
@@ -192,7 +192,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
if (atEntry)
{
// 5.0f is safe-distance
if (player->GetDistance(atEntry->Pos[0], atEntry->Pos[1], atEntry->Pos[2]) > 5.0f + atEntry->Radius)
if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
{
// he dropped it further, summon mound
GameObject* go = new GameObject;