Core/Players: Implemented PlayerDataElementAccount, PlayerDataElementCharacter, PlayerDataFlagAccount and PlayerDataFlagCharacter

Port From (https://github.com/TrinityCore/TrinityCore/commit/60400d25f5fff2dabd4aa74bbdbc0d2370360a35)
This commit is contained in:
Hondacrx
2025-08-19 16:29:13 -04:00
parent df197587a3
commit a9fc9f454f
18 changed files with 710 additions and 26 deletions
@@ -450,8 +450,8 @@ namespace Framework.Constants
PlayerWeaponHighWatermarkAboveOrEqual = 375, /*NYI*/
PlayerHeadHighWatermarkAboveOrEqual = 376, /*NYI*/
PlayerHasDisplayedCurrencyLessThan = 377, /*NYI*/ // Player has {CurrencyTypes} less than {#Amount} (value visible in ui is taken into account, not raw value)
PlayerDataFlagAccountIsSet = 378, /*NYI*/ // Player {PlayerDataFlagAccount} is set
PlayerDataFlagCharacterIsSet = 379, /*NYI*/ // Player {PlayerDataFlagCharacter} is set
PlayerDataFlagAccountIsSet = 378, // Player {PlayerDataFlagAccount} is set
PlayerDataFlagCharacterIsSet = 379, // Player {PlayerDataFlagCharacter} is set
PlayerIsOnMapWithExpansion = 380, // Player is on map that has {ExpansionID}
PlayerHasCompletedQuestOnAccount = 382, /*NYI*/ // Player has previously completed quest "{QuestV2}" on account
@@ -462,12 +462,16 @@ namespace Framework.Constants
PlayerIsInSoloRBG = 387, /*NYI*/ // Player is in solo RBG (BG Blitz)
PlayerHasCompletedCampaign = 388, /*NYI*/ // Player has completed campaign "{Campaign}"
TargetCreatureClassificationEqual = 389, // Creature classification is {CreatureClassification}
PlayerDataElementCharacterEqual = 390, /*NYI*/ // Player {PlayerDataElementCharacter} is greater than {#Amount}
PlayerDataElementAccountEqual = 391, /*NYI*/ // Player {PlayerDataElementAccount} is greater than {#Amount}
PlayerDataElementCharacterBetween = 390, // Player {PlayerDataElementCharacter} is between {#Amount} and {#Amount2}
PlayerDataElementAccountBetween = 391, // Player {PlayerDataElementAccount} is between {#Amount} and {#Amount2}
PlayerHasCompletedQuestOrIsReadyToTurnIn = 392, // Player has previously completed quest "{QuestV2}" or is ready to turn it in
PlayerTitle = 393, // Player is currently using "{ChrTitles}" title
PlayerWeeklyCurrencyIsRelOpFromMax = 397, /*NYI*/ // Player weekly {CurrencyTypes} is {RelOp} {#Amount} from currency weekly limit
PlayerIsInGuild = 404, // Player is in a guild
PlayerAvgItemLevelRelOp = 415, /*NYI*/ // Player average item level {AvgItemLevelCategory} is {RelOp} {#Amount}
}
public enum CriteriaFailEvent : byte
+6
View File
@@ -1969,6 +1969,12 @@ namespace Framework.Constants
GearDiff = 8
}
public enum PlayerDataElementType
{
Int64 = 0,
Float = 1
}
public enum PlayerInteractionType
{
None = 0,
@@ -22,6 +22,7 @@ namespace Framework.Constants
public const int ExploredZonesSize = 240;
public const int ExploredZonesBits = sizeof(ulong) * 8;
public const int DataFlagValueBits = sizeof(ulong) * 8;
public const ulong MaxMoneyAmount = 99999999999UL;
public const int MaxActionButtons = 180;
@@ -2620,7 +2620,7 @@ namespace Framework.Constants
CraftItem = 288, // Miscvalue[0] = Craftingdataid
ModifyAuraStacks = 289, // Miscvalue[0] = 0 Means Add, = 1 Means Set
ModifyCooldown = 290,
ModifyCooldowns = 291, // Miscvalue[0] = Spellfamily, Miscvalue[1] = Maybe Bit Index For Family Flags? Off By 1 For The Only Spell Using This Effect
ModifyCooldowns = 291, // Miscvalue[0] = Spellfamily, Miscvalue[1] = bit index for family flags
ModifyCooldownsByCategory = 292, // Miscvalue[0] = Category
ModifyCharges = 293, // Miscvalue[0] = Charge Category
CraftLoot = 294, // Miscvalue[0] = Craftingdataid
@@ -2664,10 +2664,10 @@ namespace Framework.Constants
Unk332 = 332,
Unk333 = 333,
Unk334 = 334,
Unk335 = 335,
Unk336 = 336,
Unk337 = 337,
Unk338 = 338,
SetPlayerDataElementAccount = 335, // MiscValue[0] = PlayerDataElementAccount
SetPlayerDataElementCharacter = 336, // MiscValue[0] = PlayerDataElementCharacter
SetPlayerDataFlagAccount = 337, // MiscValue[0] = PlayerDataFlagAccount
SetPlayerDataFlagCharacter = 338, // MiscValue[0] = PlayerDataFlagCharacter
UiAction = 339,
Unk340 = 340,
LearnWarbanScene = 341,
@@ -767,6 +767,13 @@ namespace Framework.Database
PrepareStatement(CharStatements.UPD_CHARACTER_INSTANCE_LOCK_FORCE_EXPIRE, "UPDATE character_instance_lock SET expiryTime = ?, extended = 0 WHERE guid = ? AND mapId = ? AND lockId = ?");
PrepareStatement(CharStatements.DEL_INSTANCE, "DELETE FROM instance WHERE instanceId = ?");
PrepareStatement(CharStatements.INS_INSTANCE, "INSERT INTO instance (instanceId, data, completedEncountersMask, entranceWorldSafeLocId) VALUES (?, ?, ?, ?)");
PrepareStatement(CharStatements.SEL_PLAYER_DATA_ELEMENTS_CHARACTER, "SELECT playerDataElementCharacterId, floatValue, int64Value FROM character_player_data_element WHERE characterGuid = ?");
PrepareStatement(CharStatements.DEL_PLAYER_DATA_ELEMENTS_CHARACTER, "DELETE FROM character_player_data_element WHERE characterGuid = ? AND playerDataElementCharacterId = ?");
PrepareStatement(CharStatements.INS_PLAYER_DATA_ELEMENTS_CHARACTER, "INSERT INTO character_player_data_element (characterGuid, playerDataElementCharacterId, floatValue, int64Value) VALUES (?, ?, ?, ?)");
PrepareStatement(CharStatements.SEL_PLAYER_DATA_FLAGS_CHARACTER, "SELECT storageIndex, mask FROM character_player_data_flag WHERE characterGuid = ?");
PrepareStatement(CharStatements.DEL_PLAYER_DATA_FLAGS_CHARACTER, "DELETE FROM character_player_data_flag WHERE characterGuid = ? AND storageIndex = ?");
PrepareStatement(CharStatements.INS_PLAYER_DATA_FLAGS_CHARACTER, "INSERT INTO character_player_data_flag (characterGuid, storageIndex, mask) VALUES (?, ?, ?)");
}
}
@@ -1395,6 +1402,13 @@ namespace Framework.Database
DEL_INSTANCE,
INS_INSTANCE,
SEL_PLAYER_DATA_ELEMENTS_CHARACTER,
DEL_PLAYER_DATA_ELEMENTS_CHARACTER,
INS_PLAYER_DATA_ELEMENTS_CHARACTER,
SEL_PLAYER_DATA_FLAGS_CHARACTER,
DEL_PLAYER_DATA_FLAGS_CHARACTER,
INS_PLAYER_DATA_FLAGS_CHARACTER,
MAX_CHARACTERDATABASE_STATEMENTS
}
}
@@ -1052,6 +1052,22 @@ namespace Framework.Database
PrepareStatement(HotfixStatements.SEL_PLAYER_CONDITION_LOCALE, "SELECT ID, FailureDescription_lang FROM player_condition_locale WHERE (`VerifiedBuild` > 0) = ?" +
" AND locale = ?");
// PlayerDataElementAccount.db2
PrepareStatement(HotfixStatements.SEL_PLAYER_DATA_ELEMENT_ACCOUNT, "SELECT ID, StorageIndex, Type FROM player_data_element_account" +
" WHERE (`VerifiedBuild` > 0) = ?");
// PlayerDataElementCharacter.db2
PrepareStatement(HotfixStatements.SEL_PLAYER_DATA_ELEMENT_CHARACTER, "SELECT ID, StorageIndex, Type FROM player_data_element_character" +
" WHERE (`VerifiedBuild` > 0) = ?");
// PlayerDataFlagAccount.db2
PrepareStatement(HotfixStatements.SEL_PLAYER_DATA_FLAG_ACCOUNT, "SELECT ID, StorageIndex, Unknown1107 FROM player_data_flag_account" +
" WHERE (`VerifiedBuild` > 0) = ?");
// PlayerDataFlagCharacter.db2
PrepareStatement(HotfixStatements.SEL_PLAYER_DATA_FLAG_CHARACTER, "SELECT ID, StorageIndex, Unknown1107 FROM player_data_flag_character" +
" WHERE (`VerifiedBuild` > 0) = ?");
// PowerDisplay.db2
PrepareStatement(HotfixStatements.SEL_POWER_DISPLAY, "SELECT ID, GlobalStringBaseTag, ActualType, Red, Green, Blue FROM power_display" +
" WHERE (`VerifiedBuild` > 0) = ?");
@@ -2157,6 +2173,14 @@ namespace Framework.Database
SEL_PLAYER_CONDITION,
SEL_PLAYER_CONDITION_LOCALE,
SEL_PLAYER_DATA_ELEMENT_ACCOUNT,
SEL_PLAYER_DATA_ELEMENT_CHARACTER,
SEL_PLAYER_DATA_FLAG_ACCOUNT,
SEL_PLAYER_DATA_FLAG_CHARACTER,
SEL_POWER_DISPLAY,
SEL_POWER_TYPE,
@@ -28,7 +28,7 @@ namespace Framework.Database
PrepareStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?");
PrepareStatement(LoginStatements.SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?");
PrepareStatement(LoginStatements.SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id AS aId, a.session_key_bnet, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, a.client_build, a.locale, a.recruiter, a.os, a.timezone_offset, ba.id AS baId, aa.SecurityLevel, " +
"bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate AS is_banned, r.id " +
"bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate AS is_bnet_banned, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate AS is_banned, r.id " +
"FROM account a LEFT JOIN account r ON a.id = r.recruiter LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id " +
"LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?) LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 " +
"WHERE a.username = ? AND LENGTH(a.session_key_bnet) = 64 ORDER BY aa.RealmID DESC LIMIT 1");
@@ -108,8 +108,8 @@ namespace Framework.Database
PrepareStatement(LoginStatements.SEL_BNET_EXISTING_AUTHENTICATION, "SELECT LoginTicketExpiry FROM battlenet_accounts WHERE LoginTicket = ?");
PrepareStatement(LoginStatements.SEL_BNET_EXISTING_AUTHENTICATION_BY_ID, "SELECT LoginTicket FROM battlenet_accounts WHERE id = ?");
PrepareStatement(LoginStatements.UPD_BNET_EXISTING_AUTHENTICATION, "UPDATE battlenet_accounts SET LoginTicketExpiry = ? WHERE LoginTicket = ?");
PrepareStatement(LoginStatements.SEL_BNET_ACCOUNT_INFO, $"SELECT {BnetAccountInfo}, {BnetGameAccountInfo}" +
" FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account a ON ba.id = a.battlenet_account" +
PrepareStatement(LoginStatements.SEL_BNET_ACCOUNT_INFO, $"SELECT {BnetAccountInfo}, {BnetGameAccountInfo}" +
" FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account a ON ba.id = a.battlenet_account" +
" LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID = -1 WHERE ba.LoginTicket = ? ORDER BY a.id");
PrepareStatement(LoginStatements.UPD_BNET_LAST_LOGIN_INFO, "UPDATE battlenet_accounts SET last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE id = ?");
PrepareStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, "UPDATE account SET session_key_bnet = ?, last_ip = ?, last_login = NOW(), client_build = ?, locale = ?, failed_logins = 0, os = ?, timezone_offset = ? WHERE username = ?");
@@ -166,19 +166,26 @@ namespace Framework.Database
// Transmog collection
PrepareStatement(LoginStatements.SEL_BNET_ITEM_APPEARANCES, "SELECT blobIndex, appearanceMask FROM battlenet_item_appearances WHERE battlenetAccountId = ? ORDER BY blobIndex DESC");
PrepareStatement(LoginStatements.INS_BNET_ITEM_APPEARANCES, "INSERT INTO battlenet_item_appearances (battlenetAccountId, blobIndex, appearanceMask) VALUES (?, ?, ?) " +
PrepareStatement(LoginStatements.INS_BNET_ITEM_APPEARANCES, "INSERT INTO battlenet_item_appearances (battlenetAccountId, blobIndex, appearanceMask) VALUES (?, ?, ?) " +
"ON DUPLICATE KEY UPDATE appearanceMask = appearanceMask | VALUES(appearanceMask)");
PrepareStatement(LoginStatements.SEL_BNET_ITEM_FAVORITE_APPEARANCES, "SELECT itemModifiedAppearanceId FROM battlenet_item_favorite_appearances WHERE battlenetAccountId = ?");
PrepareStatement(LoginStatements.INS_BNET_ITEM_FAVORITE_APPEARANCE, "INSERT INTO battlenet_item_favorite_appearances (battlenetAccountId, itemModifiedAppearanceId) VALUES (?, ?)");
PrepareStatement(LoginStatements.DEL_BNET_ITEM_FAVORITE_APPEARANCE, "DELETE FROM battlenet_item_favorite_appearances WHERE battlenetAccountId = ? AND itemModifiedAppearanceId = ?");
PrepareStatement(LoginStatements.SEL_BNET_TRANSMOG_ILLUSIONS, "SELECT blobIndex, illusionMask FROM battlenet_account_transmog_illusions WHERE battlenetAccountId = ? ORDER BY blobIndex DESC");
PrepareStatement(LoginStatements.INS_BNET_TRANSMOG_ILLUSIONS, "INSERT INTO battlenet_account_transmog_illusions (battlenetAccountId, blobIndex, illusionMask) VALUES (?, ?, ?) " +
PrepareStatement(LoginStatements.INS_BNET_TRANSMOG_ILLUSIONS, "INSERT INTO battlenet_account_transmog_illusions (battlenetAccountId, blobIndex, illusionMask) VALUES (?, ?, ?) " +
"ON DUPLICATE KEY UPDATE illusionMask = illusionMask | VALUES(illusionMask)");
PrepareStatement(LoginStatements.SEL_BNET_WARBAND_SCENES, "SELECT warbandSceneId, isFavorite, hasFanfare FROM battlenet_account_warband_scenes WHERE battlenetAccountId = ?");
PrepareStatement(LoginStatements.INS_BNET_WARBAND_SCENE, "INSERT INTO battlenet_account_warband_scenes (battlenetAccountId, warbandSceneId, isFavorite, hasFanfare) VALUES (?, ?, ?, ?) " +
"ON DUPLICATE KEY UPDATE isFavorite = VALUES(isFavorite)");
PrepareStatement(LoginStatements.UPD_BNET_WARBAND_SCENE, "UPDATE battlenet_account_warband_scenes SET isFavorite = ?, hasFanfare = ? WHERE battlenetAccountId = ? AND warbandSceneId = ?");
PrepareStatement(LoginStatements.DEL_BNET_WARBAND_SCENE, "DELETE FROM battlenet_account_warband_scenes WHERE battlenetAccountId = ? AND warbandSceneId = ?");
PrepareStatement(LoginStatements.SEL_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT, "SELECT playerDataElementAccountId, floatValue, int64Value FROM battlenet_account_player_data_element WHERE battlenetAccountId = ?");
PrepareStatement(LoginStatements.DEL_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT, "DELETE FROM battlenet_account_player_data_element WHERE battlenetAccountId = ? AND playerDataElementAccountId = ?");
PrepareStatement(LoginStatements.INS_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT, "INSERT INTO battlenet_account_player_data_element (battlenetAccountId, playerDataElementAccountId, floatValue, int64Value) VALUES (?, ?, ?, ?)");
PrepareStatement(LoginStatements.SEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT, "SELECT storageIndex, mask FROM battlenet_account_player_data_flag WHERE battlenetAccountId = ?");
PrepareStatement(LoginStatements.DEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT, "DELETE FROM battlenet_account_player_data_flag WHERE battlenetAccountId = ? AND storageIndex = ?");
PrepareStatement(LoginStatements.INS_BNET_PLAYER_DATA_FLAGS_ACCOUNT, "INSERT INTO battlenet_account_player_data_flag (battlenetAccountId, storageIndex, mask) VALUES (?, ?, ?)");
}
}
@@ -337,6 +344,13 @@ namespace Framework.Database
UPD_BNET_WARBAND_SCENE,
DEL_BNET_WARBAND_SCENE,
SEL_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT,
DEL_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT,
INS_BNET_PLAYER_DATA_ELEMENTS_ACCOUNT,
SEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT,
DEL_BNET_PLAYER_DATA_FLAGS_ACCOUNT,
INS_BNET_PLAYER_DATA_FLAGS_ACCOUNT,
MAX_LOGINDATABASE_STATEMENTS
}
}