Add status_failed_mangos_string_id column in areatrigger_teleport (#173)

* Add status_failed_mangos_string_id column in areatrigger_teleport

Will be able to handle specific areatrigger_teleport message ina  generic way using mangos_string table as storage table for messages
/!\ WARNING  REQUIRE DB STRUCTURE UPDATE /!\

* Fix messages for areatrigger in Champions Hall and Hall of Legends

uses now aretarrigger failed_text_mangos_string_id proeprty if available

* Fix blank space
This commit is contained in:
Elmsroth 2022-01-02 19:30:37 +01:00 committed by GitHub
parent ac4039ddeb
commit 3bc84f7bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 25 deletions

View File

@ -5597,8 +5597,8 @@ void ObjectMgr::LoadAreaTriggerTeleports()
uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 9
QueryResult* result = WorldDatabase.Query("SELECT `id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`, `condition_id` FROM `areatrigger_teleport`");
// 0 1 2 3 4 5 6 7
QueryResult* result = WorldDatabase.Query("SELECT `id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`, `status_failed_mangos_string_id`, `condition_id` FROM `areatrigger_teleport`");
if (!result)
{
BarGoLink bar(1);
@ -5622,12 +5622,13 @@ void ObjectMgr::LoadAreaTriggerTeleports()
AreaTrigger at;
at.target_mapId = fields[1].GetUInt32();
at.target_X = fields[2].GetFloat();
at.target_Y = fields[3].GetFloat();
at.target_Z = fields[4].GetFloat();
at.target_Orientation = fields[5].GetFloat();
at.condition = fields[6].GetUInt16();
at.target_mapId = fields[1].GetUInt32();
at.target_X = fields[2].GetFloat();
at.target_Y = fields[3].GetFloat();
at.target_Z = fields[4].GetFloat();
at.target_Orientation = fields[5].GetFloat();
at.failed_text_mangos_string_id = fields[6].GetUInt32();
at.condition = fields[7].GetUInt16();
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)

View File

@ -69,6 +69,7 @@ struct AreaTrigger
float target_Y;
float target_Z;
float target_Orientation;
uint32 failed_text_mangos_string_id = 0;
// Operators
bool IsMinimal() const

View File

@ -1758,7 +1758,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (!isGameMaster() && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
{
sLog.outDebug("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
SendTransferAbortedByLockStatus(mEntry, AREA_LOCKSTATUS_NOT_ALLOWED);
SendTransferAbortedByLockStatus(mEntry,nullptr, AREA_LOCKSTATUS_NOT_ALLOWED);
return false;
}
@ -20977,12 +20977,18 @@ void Player::SendUpdateToOutOfRangeGroupMembers()
}
}
void Player::SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaLockStatus lockStatus, uint32 miscRequirement)
void Player::SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaTrigger const* at, AreaLockStatus lockStatus, uint32 miscRequirement)
{
MANGOS_ASSERT(mapEntry);
DEBUG_LOG("SendTransferAbortedByLockStatus: Called for %s on map %u, LockAreaStatus %u, miscRequirement %u)", GetGuidStr().c_str(), mapEntry->MapID, lockStatus, miscRequirement);
if (at && at->failed_text_mangos_string_id > 0)
{
GetSession()->SendAreaTriggerMessage(GetSession()->GetMangosString(at->failed_text_mangos_string_id));
return;
}
switch (lockStatus)
{
case AREA_LOCKSTATUS_LEVEL_TOO_LOW:
@ -21031,17 +21037,8 @@ void Player::SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaLockS
break;
case AREA_LOCKSTATUS_PVP_RANK:
{
std::string msg = "You cannot enter this zone";
switch (GetTeamId())
{
case TEAM_INDEX_ALLIANCE:
msg = "You must be a Knight or higher rank in order to enter the Champions Hall.";
break;
case TEAM_INDEX_HORDE:
msg = "You must be a Stone Guard or higher rank in order to enter the Hall of Legends.";
break;
}
// TODO : Rely on a a status_failed_text that could be localized, need a DB structure rework for later.
// This portion of code should never be hit anymore since an AreaTrigger should handle that.
const std::string msg = "You cannot enter this zone"; // fallback message
GetSession()->SendAreaTriggerMessage(msg.c_str());
break;
}

View File

@ -2359,7 +2359,7 @@ class Player : public Unit
DungeonPersistentState* GetBoundInstanceSaveForSelfOrGroup(uint32 mapid);
AreaLockStatus GetAreaTriggerLockStatus(AreaTrigger const* at, uint32& miscRequirement);
void SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaLockStatus lockStatus, uint32 miscRequirement = 0);
void SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaTrigger const* at, AreaLockStatus lockStatus, uint32 miscRequirement = 0);
/*********************************************************/
/*** GROUP SYSTEM ***/

View File

@ -877,6 +877,8 @@ Faction Template: %u. */
LANG_COMMAND_FREEZE_PLAYER_YOU_HAVE_BEEN_UNFROZEN = 1712, /* You have been unfrozen. You can now move freely, use spells or even logout. */
LANG_COMMAND_FREEZE_PLAYER_PLAYER_NOT_FOUND = 1713, /* You can only freeze online characters. */
LANG_COMMAND_UNFREEZE_PLAYER_PLAYER_NOT_FOUND = 1714, /* You can only unfreeze online characters. */
LANG_CANNOT_ENTER_CHAMPIONS_HALL = 1715, /* You must be a Knight or higher rank in order to enter the Champions Hall. */
LANG_CANNOT_ENTER_LEGENDS_HALL = 1716, /* You must be a Stone Guard or higher rank in order to enter the Hall of Legends. */
// FREE IDS 1701-9999
// Use for not-in-official-sources patches

View File

@ -953,7 +953,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
AreaLockStatus lockStatus = player->GetAreaTriggerLockStatus(at, miscRequirement);
if (lockStatus != AREA_LOCKSTATUS_OK)
{
player->SendTransferAbortedByLockStatus(targetMapEntry, lockStatus, miscRequirement);
player->SendTransferAbortedByLockStatus(targetMapEntry, at, lockStatus, miscRequirement);
return;
}

View File

@ -37,7 +37,7 @@
#define CHAR_DB_UPDATE_DESCRIPTION "add_character_createdDate_col"
#define WORLD_DB_VERSION_NR 22
#define WORLD_DB_STRUCTURE_NR 2
#define WORLD_DB_STRUCTURE_NR 4
#define WORLD_DB_CONTENT_NR 001
#define WORLD_DB_UPDATE_DESCRIPTION "Fix_Additem_LANG_REMOVEITEM"
#define WORLD_DB_UPDATE_DESCRIPTION "Fix_messages_for_areatrigger"
#endif // __REVISION_H__