Core/Players: Store player creation timestamp and type (normal/npe)

Port From (https://github.com/TrinityCore/TrinityCore/commit/11762273c68b24b332238aa89a73b9ed9ac1d249)
This commit is contained in:
hondacrx
2021-10-02 20:50:59 -04:00
parent 9785c8cb0e
commit 4a97883559
7 changed files with 36 additions and 4 deletions
@@ -784,4 +784,10 @@ namespace Framework.Constants
Contested = 3,
Combat = 4
}
public enum PlayerCreateMode
{
Normal = 0,
NPE = 1
}
}
@@ -81,7 +81,7 @@ namespace Framework.Database
PrepareStatement(CharStatements.INS_BATTLEGROUND_RANDOM, "INSERT INTO character_battleground_random (guid) VALUES (?)");
PrepareStatement(CharStatements.SEL_CHARACTER, "SELECT c.guid, account, name, race, class, gender, level, xp, money, inventorySlots, bankSlots, restState, playerFlags, playerFlagsEx, " +
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, " +
"position_x, position_y, position_z, map, orientation, taximask, createTime, createMode, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, " +
"resettalents_time, primarySpecialization, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, " +
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, " +
"knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, fishingSteps, honor, honorLevel, honorRestState, honorRestBonus, numRespecs " +
@@ -472,10 +472,10 @@ namespace Framework.Database
// Player saving
PrepareStatement(CharStatements.INS_CHARACTER, "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, inventorySlots, bankSlots, restState, playerFlags, playerFlagsEx, " +
"map, instance_id, dungeonDifficulty, raidDifficulty, legacyRaidDifficulty, position_x, position_y, position_z, orientation, trans_x, trans_y, trans_z, trans_o, transguid, " +
"taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, primarySpecialization, " +
"taximask, createTime, createMode, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, primarySpecialization, " +
"extra_flags, stable_slots, at_login, zone, death_expire_time, taxi_path, totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, " +
"power4, power5, power6, latency, activeTalentGroup, lootSpecId, exploredZones, equipmentCache, knownTitles, actionBars, lastLoginBuild) VALUES " +
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
PrepareStatement(CharStatements.UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,inventorySlots=?,bankSlots=?,restState=?,playerFlags=?,playerFlagsEx=?," +
"map=?,instance_id=?,dungeonDifficulty=?,raidDifficulty=?,legacyRaidDifficulty=?,position_x=?,position_y=?,position_z=?,orientation=?,trans_x=?,trans_y=?,trans_z=?,trans_o=?,transguid=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?," +
"logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,numRespecs=?,primarySpecialization=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?," +
+6
View File
@@ -2551,6 +2551,8 @@ namespace Game.Entities
uint mapId = result.Read<ushort>(fieldIndex++);
float orientation = result.Read<float>(fieldIndex++);
string taximask = result.Read<string>(fieldIndex++);
long createTime = result.Read<long>(fieldIndex++);
PlayerCreateMode createMode = (PlayerCreateMode)result.Read<byte>(fieldIndex++);
byte cinematic = result.Read<byte>(fieldIndex++);
uint totaltime = result.Read<uint>(fieldIndex++);
uint leveltime = result.Read<uint>(fieldIndex++);
@@ -3030,6 +3032,8 @@ namespace Game.Entities
SetDrunkValue(newDrunkValue);
m_createTime = createTime;
m_createMode = createMode;
m_cinematic = cinematic;
m_PlayedTimeTotal = totaltime;
m_PlayedTimeLevel = leveltime;
@@ -3385,6 +3389,8 @@ namespace Game.Entities
ss.Append(m_taxi.m_taximask[i] + " ");
stmt.AddValue(index++, ss.ToString());
stmt.AddValue(index++, m_createTime);
stmt.AddValue(index++, (byte)m_createMode);
stmt.AddValue(index++, m_cinematic);
stmt.AddValue(index++, m_PlayedTimeTotal);
stmt.AddValue(index++, m_PlayedTimeLevel);
@@ -196,6 +196,9 @@ namespace Game.Entities
public PlayerData m_playerData;
public ActivePlayerData m_activePlayerData;
long m_createTime;
PlayerCreateMode m_createMode;
uint m_nextSave;
byte m_cinematic;
+1
View File
@@ -194,6 +194,7 @@ namespace Game.Entities
}
SetMap(Global.MapMgr.CreateMap(info.MapId, this));
m_createTime = GameTime.GetGameTime();
UpdatePositionData();
PowerType powertype = cEntry.DisplayPower;