Core/Misc: Change all unix time columns in character database to bigint (signed)

Port From (https://github.com/TrinityCore/TrinityCore/commit/d29dd1eeb5c52dc76bd741fe1ee0e875c416b8e7)
This commit is contained in:
hondacrx
2021-04-06 23:32:52 -04:00
parent b274d1f6ab
commit be2292e815
25 changed files with 243 additions and 141 deletions
@@ -255,7 +255,7 @@ namespace Game.Achievements
continue;
CompletedAchievementData ca = new();
ca.Date = achievementResult.Read<uint>(1);
ca.Date = achievementResult.Read<long>(1);
ca.Changed = false;
_achievementPoints += achievement.Points;
@@ -284,7 +284,7 @@ namespace Game.Achievements
{
uint id = criteriaResult.Read<uint>(0);
ulong counter = criteriaResult.Read<ulong>(1);
long date = criteriaResult.Read<uint>(2);
long date = criteriaResult.Read<long>(2);
Criteria criteria = Global.CriteriaMgr.GetCriteria(id);
if (criteria == null)
@@ -768,7 +768,7 @@ namespace Game.Achievements
continue;
CompletedAchievementData ca = _completedAchievements[achievementid];
ca.Date = achievementResult.Read<uint>(1);
ca.Date = achievementResult.Read<long>(1);
var guids = new StringArray(achievementResult.Read<string>(2), ' ');
if (!guids.IsEmpty())
{
@@ -792,7 +792,7 @@ namespace Game.Achievements
{
uint id = criteriaResult.Read<uint>(0);
ulong counter = criteriaResult.Read<ulong>(1);
long date = criteriaResult.Read<uint>(2);
long date = criteriaResult.Read<long>(2);
ulong guidLow = criteriaResult.Read<ulong>(3);
Criteria criteria = Global.CriteriaMgr.GetCriteria(id);
@@ -839,7 +839,7 @@ namespace Game.Achievements
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_ACHIEVEMENT);
stmt.AddValue(0, _owner.GetId());
stmt.AddValue(1, pair.Key);
stmt.AddValue(2, (uint)pair.Value.Date);
stmt.AddValue(2, pair.Value.Date);
foreach (var guid in pair.Value.CompletingPlayers)
guidstr.AppendFormat("{0},", guid.GetCounter());
@@ -863,7 +863,7 @@ namespace Game.Achievements
stmt.AddValue(0, _owner.GetId());
stmt.AddValue(1, pair.Key);
stmt.AddValue(2, pair.Value.Counter);
stmt.AddValue(3, (uint)pair.Value.Date);
stmt.AddValue(3, pair.Value.Date);
stmt.AddValue(4, pair.Value.PlayerGUID.GetCounter());
trans.Append(stmt);
}
+4 -4
View File
@@ -252,8 +252,8 @@ namespace Game
auction.BuyoutOrUnitPrice = result.Read<ulong>(5);
auction.Deposit = result.Read<ulong>(6);
auction.BidAmount = result.Read<ulong>(7);
auction.StartTime = Time.UnixTimeToDateTime(result.Read<uint>(8));
auction.EndTime = Time.UnixTimeToDateTime(result.Read<uint>(9));
auction.StartTime = Time.UnixTimeToDateTime(result.Read<long>(8));
auction.EndTime = Time.UnixTimeToDateTime(result.Read<long>(9));
if (biddersByAuction.ContainsKey(auction.Id))
auction.BidderHistory = biddersByAuction[auction.Id];
@@ -654,8 +654,8 @@ namespace Game
stmt.AddValue(5, auction.BuyoutOrUnitPrice);
stmt.AddValue(6, auction.Deposit);
stmt.AddValue(7, auction.BidAmount);
stmt.AddValue(8, (uint)Time.DateTimeToUnixTime(auction.StartTime));
stmt.AddValue(9, (uint)Time.DateTimeToUnixTime(auction.EndTime));
stmt.AddValue(8, Time.DateTimeToUnixTime(auction.StartTime));
stmt.AddValue(9, Time.DateTimeToUnixTime(auction.EndTime));
trans.Append(stmt);
foreach (Item item in auction.Items)
+1 -1
View File
@@ -124,7 +124,7 @@ namespace Game.BlackMarket
}
_currentBid = fields.Read<ulong>(1);
_secondsRemaining = (uint)(fields.Read<uint>(2) - Global.BlackMarketMgr.GetLastUpdate());
_secondsRemaining = (uint)(fields.Read<long>(2) - Global.BlackMarketMgr.GetLastUpdate());
_numBids = fields.Read<uint>(3);
_bidder = fields.Read<ulong>(4);
+3 -3
View File
@@ -56,9 +56,9 @@ namespace Game
string description = result.Read<string>(3);
CalendarEventType type = (CalendarEventType)result.Read<byte>(4);
int textureID = result.Read<int>(5);
uint date = result.Read<uint>(6);
long date = result.Read<long>(6);
CalendarFlags flags = (CalendarFlags)result.Read<uint>(7);
uint lockDate = result.Read<uint>(8);
long lockDate = result.Read<long>(8);
ulong guildID = 0;
if (flags.HasAnyFlag(CalendarFlags.GuildEvent) || flags.HasAnyFlag(CalendarFlags.WithoutInvites))
@@ -89,7 +89,7 @@ namespace Game
ObjectGuid invitee = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(2));
ObjectGuid senderGUID = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(3));
CalendarInviteStatus status = (CalendarInviteStatus)result.Read<byte>(4);
uint responseTime = result.Read<uint>(5);
long responseTime = result.Read<long>(5);
CalendarModerationRank rank = (CalendarModerationRank)result.Read<byte>(6);
string note = result.Read<string>(7);
+1 -1
View File
@@ -165,7 +165,7 @@ namespace Game.Chat
if (WorldConfig.GetIntValue(WorldCfg.PreserveCustomChannelDuration) > 0)
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_OLD_CHANNELS);
stmt.AddValue(0, WorldConfig.GetIntValue(WorldCfg.PreserveCustomChannelDuration) * Time.Day);
stmt.AddValue(0, (long)(WorldConfig.GetIntValue(WorldCfg.PreserveCustomChannelDuration) * Time.Day));
DB.Characters.Execute(stmt);
Log.outDebug(LogFilter.ChatSystem, "Cleaned out unused custom chat channels.");
+8 -8
View File
@@ -245,13 +245,13 @@ namespace Game.Chat.Commands
handler.SendSysMessage(CypherStrings.BaninfoBanhistory, name);
do
{
long unbanDate = result.Read<uint>(3);
long unbanDate = result.Read<long>(3);
bool active = false;
if (result.Read<bool>(2) && (result.Read<uint>(1) == 0 || unbanDate >= Time.UnixTime))
if (result.Read<bool>(2) && (result.Read<long>(1) == 0L || unbanDate >= Time.UnixTime))
active = true;
bool permanent = (result.Read<uint>(1) == 0);
string banTime = permanent ? handler.GetCypherString(CypherStrings.BaninfoInfinite) : Time.secsToTimeString(result.Read<uint>(1), true);
handler.SendSysMessage(CypherStrings.BaninfoHistoryentry, Time.UnixTimeToDateTime(result.Read<uint>(0)).ToShortTimeString(), banTime,
bool permanent = (result.Read<long>(1) == 0L);
string banTime = permanent ? handler.GetCypherString(CypherStrings.BaninfoInfinite) : Time.secsToTimeString(result.Read<ulong>(1), true);
handler.SendSysMessage(CypherStrings.BaninfoHistoryentry, Time.UnixTimeToDateTime(result.Read<long>(0)).ToShortTimeString(), banTime,
active ? handler.GetCypherString(CypherStrings.Yes) : handler.GetCypherString(CypherStrings.No), result.Read<string>(4), result.Read<string>(5));
}
while (result.NextRow());
@@ -399,12 +399,12 @@ namespace Game.Chat.Commands
{
do
{
long timeBan = banInfo.Read<uint>(0);
long timeBan = banInfo.Read<long>(0);
DateTime tmBan = Time.UnixTimeToDateTime(timeBan);
string bannedby = banInfo.Read<string>(2).Substring(0, 15);
string banreason = banInfo.Read<string>(3).Substring(0, 15);
if (banInfo.Read<uint>(0) == banInfo.Read<uint>(1))
if (banInfo.Read<long>(0) == banInfo.Read<long>(1))
{
handler.SendSysMessage("|{0}|{1:D2}-{2:D2}-{3:D2} {4:D2}:{5:D2}| permanent |{6}|{7}|",
char_name, tmBan.Year % 100, tmBan.Month + 1, tmBan.Day, tmBan.Hour, tmBan.Minute,
@@ -412,7 +412,7 @@ namespace Game.Chat.Commands
}
else
{
long timeUnban = banInfo.Read<uint>(1);
long timeUnban = banInfo.Read<long>(1);
DateTime tmUnban = Time.UnixTimeToDateTime(timeUnban);
handler.SendSysMessage("|{0}|{1:D2}-{2:D2}-{3:D2} {4:D2}:{5:D2}|{6:D2}-{7:D2}-{8:D2} {9:D2}:{10:D2}|{11}|{12}|",
char_name, tmBan.Year % 100, tmBan.Month + 1, tmBan.Day, tmBan.Hour, tmBan.Minute,
@@ -654,7 +654,7 @@ namespace Game.Chat
// account name will be empty for not existed account
Global.AccountMgr.GetName(info.accountId, out info.accountName);
info.deleteDate = result.Read<uint>(3);
info.deleteDate = result.Read<long>(3);
foundList.Add(info);
}
while (result.NextRow());
+2 -2
View File
@@ -407,8 +407,8 @@ namespace Game.Chat.Commands
ulong receiverId = result1.Read<ulong>(3);
string receiver = result1.Read<string>(4);
string subject = result1.Read<string>(5);
long deliverTime = result1.Read<uint>(6);
long expireTime = result1.Read<uint>(7);
long deliverTime = result1.Read<long>(6);
long expireTime = result1.Read<long>(7);
ulong money = result1.Read<ulong>(8);
byte hasItem = result1.Read<byte>(9);
uint gold = (uint)(money / MoneyConstants.Gold);
+10 -10
View File
@@ -692,7 +692,7 @@ namespace Game.Entities
GetName(), GetGUID().ToString(), quest_id, qstatus);
}
long quest_time = result.Read<uint>(2);
long quest_time = result.Read<long>(2);
if (quest.HasSpecialFlag(QuestSpecialFlags.Timed) && !GetQuestRewardStatus(quest_id))
{
@@ -851,7 +851,7 @@ namespace Game.Entities
}
// save _any_ from daily quest times (it must be after last reset anyway)
m_lastDailyQuestTime = result.Read<uint>(1);
m_lastDailyQuestTime = result.Read<long>(1);
Quest quest = Global.ObjectMgr.GetQuestTemplate(quest_id);
if (quest == null)
@@ -1176,8 +1176,8 @@ namespace Game.Entities
m.receiver = result.Read<uint>(3);
m.subject = result.Read<string>(4);
m.body = result.Read<string>(5);
m.expire_time = result.Read<uint>(6);
m.deliver_time = result.Read<uint>(7);
m.expire_time = result.Read<long>(6);
m.deliver_time = result.Read<long>(7);
m.money = result.Read<ulong>(8);
m.COD = result.Read<ulong>(9);
m.checkMask = (MailCheckMask)result.Read<byte>(10);
@@ -2544,10 +2544,10 @@ namespace Game.Entities
uint totaltime = result.Read<uint> (fieldIndex++);
uint leveltime = result.Read<uint>(fieldIndex++);
float rest_bonus = result.Read<float>(fieldIndex++);
uint logout_time = result.Read<uint>(fieldIndex++);
long logout_time = result.Read<long>(fieldIndex++);
byte is_logout_resting = result.Read<byte>(fieldIndex++);
uint resettalents_cost = result.Read<uint>(fieldIndex++);
uint resettalents_time = result.Read<uint>(fieldIndex++);
long resettalents_time = result.Read<long>(fieldIndex++);
uint primarySpecialization = result.Read<uint>(fieldIndex++);
float trans_x = result.Read<float>(fieldIndex++);
float trans_y = result.Read<float>(fieldIndex++);
@@ -2559,7 +2559,7 @@ namespace Game.Entities
ushort at_login = result.Read<ushort>(fieldIndex++);
ushort zone = result.Read<ushort>(fieldIndex++);
byte online = result.Read<byte>(fieldIndex++);
uint death_expire_time = result.Read<uint>(fieldIndex++);
long death_expire_time = result.Read<long>(fieldIndex++);
string taxi_path = result.Read<string>(fieldIndex++);
Difficulty dungeonDifficulty = (Difficulty)result.Read<byte>(fieldIndex++);
uint totalKills = result.Read<uint>(fieldIndex++);
@@ -3381,7 +3381,7 @@ namespace Game.Entities
stmt.AddValue(index++, m_PlayedTimeTotal);
stmt.AddValue(index++, m_PlayedTimeLevel);
stmt.AddValue(index++, finiteAlways(_restMgr.GetRestBonus(RestTypes.XP)));
stmt.AddValue(index++, (uint)Time.UnixTime);
stmt.AddValue(index++, Time.UnixTime);
stmt.AddValue(index++, (HasPlayerFlag(PlayerFlags.Resting) ? 1 : 0));
//save, far from tavern/city
//save, but in tavern/city
@@ -3392,7 +3392,7 @@ namespace Game.Entities
stmt.AddValue(index++, m_stableSlots);
stmt.AddValue(index++, (ushort)atLoginFlags);
stmt.AddValue(index++, GetZoneId());
stmt.AddValue(index++, (uint)m_deathExpireTime);
stmt.AddValue(index++, m_deathExpireTime);
ss.Clear();
ss.Append(m_taxi.SaveTaxiDestinationsToString());
@@ -3521,7 +3521,7 @@ namespace Game.Entities
stmt.AddValue(index++, m_PlayedTimeTotal);
stmt.AddValue(index++, m_PlayedTimeLevel);
stmt.AddValue(index++, finiteAlways(_restMgr.GetRestBonus(RestTypes.XP)));
stmt.AddValue(index++, (uint)Time.UnixTime);
stmt.AddValue(index++, Time.UnixTime);
stmt.AddValue(index++, (HasPlayerFlag(PlayerFlags.Resting) ? 1 : 0));
//save, far from tavern/city
//save, but in tavern/city
+1 -1
View File
@@ -1543,7 +1543,7 @@ namespace Game
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GAME_EVENT_SAVE);
stmt.AddValue(0, event_id);
stmt.AddValue(1, mGameEvent[event_id].state);
stmt.AddValue(2, mGameEvent[event_id].nextstart != 0 ? mGameEvent[event_id].nextstart : 0);
stmt.AddValue(2, mGameEvent[event_id].nextstart != 0 ? mGameEvent[event_id].nextstart : 0L);
trans.Append(stmt);
DB.Characters.CommitTransaction(trans);
}
+2 -2
View File
@@ -66,7 +66,7 @@ namespace Game.Garrisons
{
uint plotInstanceId = buildings.Read<uint>(0);
uint buildingId = buildings.Read<uint>(1);
ulong timeBuilt = buildings.Read<ulong>(2);
long timeBuilt = buildings.Read<long>(2);
bool active = buildings.Read<bool>(3);
@@ -80,7 +80,7 @@ namespace Game.Garrisons
plot.BuildingInfo.PacketInfo.HasValue = true;
plot.BuildingInfo.PacketInfo.Value.GarrPlotInstanceID = plotInstanceId;
plot.BuildingInfo.PacketInfo.Value.GarrBuildingID = buildingId;
plot.BuildingInfo.PacketInfo.Value.TimeBuilt = (long)timeBuilt;
plot.BuildingInfo.PacketInfo.Value.TimeBuilt = timeBuilt;
plot.BuildingInfo.PacketInfo.Value.Active = active;
} while (buildings.NextRow());
+6 -7
View File
@@ -9085,7 +9085,6 @@ namespace Game
long curTime = Time.UnixTime;
DateTime lt = Time.UnixTimeToDateTime(curTime).ToLocalTime();
long basetime = curTime;
Log.outInfo(LogFilter.Server, "Returning mails current time: hour: {0}, minute: {1}, second: {2} ", lt.Hour, lt.Minute, lt.Second);
PreparedStatement stmt;
@@ -9093,11 +9092,11 @@ namespace Game
if (!serverUp)
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_EMPTY_EXPIRED_MAIL);
stmt.AddValue(0, basetime);
stmt.AddValue(0, curTime);
DB.Characters.Execute(stmt);
}
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL);
stmt.AddValue(0, basetime);
stmt.AddValue(0, curTime);
SQLResult result = DB.Characters.Query(stmt);
if (result.IsEmpty())
{
@@ -9107,7 +9106,7 @@ namespace Game
MultiMap<uint, MailItemInfo> itemsCache = new();
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL_ITEMS);
stmt.AddValue(0, (uint)basetime);
stmt.AddValue(0, curTime);
SQLResult items = DB.Characters.Query(stmt);
if (!items.IsEmpty())
{
@@ -9131,7 +9130,7 @@ namespace Game
m.sender = result.Read<uint>(2);
m.receiver = result.Read<ulong>(3);
bool has_items = result.Read<bool>(4);
m.expire_time = result.Read<uint>(5);
m.expire_time = result.Read<long>(5);
m.deliver_time = 0;
m.COD = result.Read<ulong>(6);
m.checkMask = (MailCheckMask)result.Read<byte>(7);
@@ -9175,8 +9174,8 @@ namespace Game
stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_MAIL_RETURNED);
stmt.AddValue(0, m.receiver);
stmt.AddValue(1, m.sender);
stmt.AddValue(2, basetime + 30 * Time.Day);
stmt.AddValue(3, basetime);
stmt.AddValue(2, curTime + 30 * Time.Day);
stmt.AddValue(3, curTime);
stmt.AddValue(4, MailCheckMask.Returned);
stmt.AddValue(5, m.messageID);
DB.Characters.Execute(stmt);
+1 -1
View File
@@ -212,7 +212,7 @@ namespace Game.Groups
if (difficultyEntry == null || difficultyEntry.InstanceType != mapEntry.InstanceType)
continue;
InstanceSave save = Global.InstanceSaveMgr.AddInstanceSave(mapEntry.Id, result.Read<uint>(2), (Difficulty)diff, result.Read<uint>(5), result.Read<uint>(6), result.Read<ulong>(7) == 0, true);
InstanceSave save = Global.InstanceSaveMgr.AddInstanceSave(mapEntry.Id, result.Read<uint>(2), (Difficulty)diff, result.Read<long>(5), result.Read<uint>(6), result.Read<ulong>(7) == 0, true);
group.BindToInstance(save, result.Read<bool>(3), true);
++count;
}
+3 -3
View File
@@ -1259,7 +1259,7 @@ namespace Game.Guilds
m_eventLog.LoadEvent(new EventLogEntry(
m_id, // guild id
field.Read<uint>(1), // guid
field.Read<uint>(6), // timestamp
field.Read<long>(6), // timestamp
(GuildEventLogTypes)field.Read<byte>(2), // event type
field.Read<ulong>(3), // player guid 1
field.Read<ulong>(4), // player guid 2
@@ -1297,7 +1297,7 @@ namespace Game.Guilds
pLog.LoadEvent(new BankEventLogEntry(
m_id, // guild id
guid, // guid
field.Read<uint>(8), // timestamp
field.Read<long>(8), // timestamp
dbTabId, // tab id
eventType, // event type
field.Read<ulong>(4), // player guid
@@ -1317,7 +1317,7 @@ namespace Game.Guilds
var news = new NewsLogEntry(
m_id, // guild id
field.Read<uint>(1), // guid
field.Read<uint>(6), // timestamp //64 bits?
field.Read<long>(6), // timestamp //64 bits?
(GuildNews)field.Read<byte>(2), // type
ObjectGuid.Create(HighGuid.Player, field.Read<ulong>(3)), // player guid
field.Read<uint>(4), // Flags
+1 -1
View File
@@ -97,7 +97,7 @@ namespace Game.Guilds
byte classRoles = result.Read<byte>(3);
byte interests = result.Read<byte>(4);
string comment = result.Read<string>(5);
uint submitTime = result.Read<uint>(6);
long submitTime = result.Read<long>(6);
MembershipRequest request = new(playerId, guildId, availability, classRoles, interests, comment, submitTime);
@@ -143,7 +143,7 @@ namespace Game.Networking.Packets
StringArguments equipment = new(fields.Read<string>(17));
ListPosition = fields.Read<byte>(19);
LastPlayedTime = fields.Read<uint>(20);
LastPlayedTime = fields.Read<long>(20);
var spec = Global.DB2Mgr.GetChrSpecializationByIndex(ClassId, fields.Read<byte>(21));
if (spec != null)
@@ -188,7 +188,7 @@ namespace Game.Networking.Packets
foreach (var visualItem in VisualItems)
visualItem.Write(data);
data.WriteUInt32(LastPlayedTime);
data.WriteUInt32((uint)LastPlayedTime);
data.WriteUInt16(SpecID);
data.WriteUInt32(Unknown703);
data.WriteUInt32(LastLoginVersion);
@@ -242,7 +242,7 @@ namespace Game.Networking.Packets
public uint Flags4;
public bool FirstLogin;
public byte unkWod61x;
public uint LastPlayedTime;
public long LastPlayedTime;
public ushort SpecID;
public uint Unknown703;
public uint LastLoginVersion;
@@ -224,9 +224,9 @@ namespace Game.Networking.Packets
Text = data.ReadString(data.ReadBits<uint>(12));
}
public SupportTicketChatLine(uint timestamp, string text)
public SupportTicketChatLine(long timestamp, string text)
{
Timestamp = timestamp;
Timestamp = (uint)timestamp;
Text = text;
}
@@ -91,7 +91,7 @@ namespace Game
{
uint criteriaId = criteriaResult.Read<uint>(0);
ulong counter = criteriaResult.Read<ulong>(1);
long date = criteriaResult.Read<uint>(2);
long date = criteriaResult.Read<long>(2);
Criteria criteria = Global.CriteriaMgr.GetCriteria(criteriaId);
if (criteria == null)
@@ -154,7 +154,7 @@ namespace Game
stmt.AddValue(0, _owner.GetGUID().GetCounter());
stmt.AddValue(1, pair.Key);
stmt.AddValue(2, pair.Value.Counter);
stmt.AddValue(3, (uint)pair.Value.Date);
stmt.AddValue(3, pair.Value.Date);
trans.Append(stmt);
}
+2 -2
View File
@@ -83,7 +83,7 @@ namespace Game.Scenarios
stmt.AddValue(0, id);
stmt.AddValue(1, iter.Key);
stmt.AddValue(2, iter.Value.Counter);
stmt.AddValue(3, (uint)iter.Value.Date);
stmt.AddValue(3, iter.Value.Date);
trans.Append(stmt);
}
@@ -109,7 +109,7 @@ namespace Game.Scenarios
{
uint id = result.Read<uint>(0);
ulong counter = result.Read<ulong>(1);
long date = result.Read<uint>(2);
long date = result.Read<long>(2);
Criteria criteria = Global.CriteriaMgr.GetCriteria(id);
if (criteria == null)
+1 -1
View File
@@ -1691,7 +1691,7 @@ namespace Game
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_BAN);
stmt.AddValue(0, guid.GetCounter());
stmt.AddValue(1, duration_secs);
stmt.AddValue(1, (long)duration_secs);
stmt.AddValue(2, author);
stmt.AddValue(3, reason);
trans.Append(stmt);
+2 -2
View File
@@ -514,7 +514,7 @@ namespace Game
continue;
}
_accountData[type].Time = result.Read<uint>(1);
_accountData[type].Time = result.Read<long>(1);
var bytes = result.Read<byte[]>(2);
var line = Encoding.Default.GetString(bytes);
_accountData[type].Data = line;
@@ -522,7 +522,7 @@ namespace Game
while (result.NextRow());
}
void SetAccountData(AccountDataTypes type, uint time, string data)
void SetAccountData(AccountDataTypes type, long time, string data)
{
if (Convert.ToBoolean((1 << (int)type) & (int)AccountDataTypes.GlobalCacheMask))
{
+31 -24
View File
@@ -39,22 +39,29 @@ namespace Game.Spells
{
do
{
uint spellId = cooldownsResult.Read<uint>(0);
if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
CooldownEntry cooldownEntry = new();
cooldownEntry.SpellId = cooldownsResult.Read<uint>(0);
if (!Global.SpellMgr.HasSpellInfo(cooldownEntry.SpellId, Difficulty.None))
continue;
int index = (typeof(T) == typeof(Pet) ? 1 : 2);
if (typeof(T) == typeof(Pet))
{
cooldownEntry.CooldownEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<long>(1));
cooldownEntry.ItemId = 0;
cooldownEntry.CategoryId = cooldownsResult.Read<uint>(2);
cooldownEntry.CategoryEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<long>(3));
}
else
{
cooldownEntry.CooldownEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<long>(2));
cooldownEntry.ItemId = cooldownsResult.Read<uint>(1);
cooldownEntry.CategoryId = cooldownsResult.Read<uint>(3);
cooldownEntry.CategoryEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<long>(4));
}
CooldownEntry cooldownEntry = new();
cooldownEntry.SpellId = spellId;
cooldownEntry.CooldownEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<uint>(index++));
cooldownEntry.ItemId = 0;
cooldownEntry.CategoryId = cooldownsResult.Read<uint>(index++);
cooldownEntry.CategoryEnd = Time.UnixTimeToDateTime(cooldownsResult.Read<uint>(index++));
_spellCooldowns[spellId] = cooldownEntry;
_spellCooldowns[cooldownEntry.SpellId] = cooldownEntry;
if (cooldownEntry.CategoryId != 0)
_categoryCooldowns[cooldownEntry.CategoryId] = _spellCooldowns[spellId];
_categoryCooldowns[cooldownEntry.CategoryId] = _spellCooldowns[cooldownEntry.SpellId];
} while (cooldownsResult.NextRow());
}
@@ -69,8 +76,8 @@ namespace Game.Spells
continue;
ChargeEntry charges;
charges.RechargeStart = Time.UnixTimeToDateTime(chargesResult.Read<uint>(1));
charges.RechargeEnd = Time.UnixTimeToDateTime(chargesResult.Read<uint>(2));
charges.RechargeStart = Time.UnixTimeToDateTime(chargesResult.Read<long>(1));
charges.RechargeEnd = Time.UnixTimeToDateTime(chargesResult.Read<long>(2));
_categoryCharges.Add(categoryId, charges);
} while (chargesResult.NextRow());
@@ -90,7 +97,7 @@ namespace Game.Spells
stmt.AddValue(0, _owner.GetCharmInfo().GetPetNumber());
trans.Append(stmt);
byte index = 0;
byte index;
foreach (var pair in _spellCooldowns)
{
if (!pair.Value.OnHold)
@@ -99,9 +106,9 @@ namespace Game.Spells
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_SPELL_COOLDOWN);
stmt.AddValue(index++, _owner.GetCharmInfo().GetPetNumber());
stmt.AddValue(index++, pair.Key);
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.CooldownEnd));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.CooldownEnd));
stmt.AddValue(index++, pair.Value.CategoryId);
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.CategoryEnd));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.CategoryEnd));
trans.Append(stmt);
}
}
@@ -112,8 +119,8 @@ namespace Game.Spells
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_SPELL_CHARGES);
stmt.AddValue(index++, _owner.GetCharmInfo().GetPetNumber());
stmt.AddValue(index++, pair.Key);
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.RechargeStart));
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.RechargeEnd));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.RechargeStart));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.RechargeEnd));
trans.Append(stmt);
}
}
@@ -127,7 +134,7 @@ namespace Game.Spells
stmt.AddValue(0, _owner.GetGUID().GetCounter());
trans.Append(stmt);
byte index = 0;
byte index;
foreach (var pair in _spellCooldowns)
{
if (!pair.Value.OnHold)
@@ -137,9 +144,9 @@ namespace Game.Spells
stmt.AddValue(index++, _owner.GetGUID().GetCounter());
stmt.AddValue(index++, pair.Key);
stmt.AddValue(index++, pair.Value.ItemId);
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.CooldownEnd));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.CooldownEnd));
stmt.AddValue(index++, pair.Value.CategoryId);
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.CategoryEnd));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.CategoryEnd));
trans.Append(stmt);
}
}
@@ -150,8 +157,8 @@ namespace Game.Spells
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_CHARGES);
stmt.AddValue(index++, _owner.GetGUID().GetCounter());
stmt.AddValue(index++, pair.Key);
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.RechargeStart));
stmt.AddValue(index++, (uint)Time.DateTimeToUnixTime(pair.Value.RechargeEnd));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.RechargeStart));
stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.RechargeEnd));
trans.Append(stmt);
}
}
+8 -6
View File
@@ -116,7 +116,6 @@ namespace Game.SupportSystem
float _facing;
string _note;
public BugTicket()
{
_note = "";
@@ -134,7 +133,7 @@ namespace Game.SupportSystem
_id = fields.Read<uint>(idx);
_playerGuid = ObjectGuid.Create(HighGuid.Player, fields.Read<ulong>(++idx));
_note = fields.Read<string>(++idx);
_createTime = fields.Read<uint>(++idx);
_createTime = fields.Read<ulong>(++idx);
_mapId = fields.Read<ushort>(++idx);
_pos = new Vector3(fields.Read<float>(++idx), fields.Read<float>(++idx), fields.Read<float>(++idx));
_facing = fields.Read<float>(++idx);
@@ -163,6 +162,7 @@ namespace Game.SupportSystem
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, _playerGuid.GetCounter());
stmt.AddValue(++idx, _note);
stmt.AddValue(++idx, _createTime);
stmt.AddValue(++idx, _mapId);
stmt.AddValue(++idx, _pos.X);
stmt.AddValue(++idx, _pos.Y);
@@ -184,7 +184,7 @@ namespace Game.SupportSystem
public override string FormatViewMessageString(CommandHandler handler, bool detailed = false)
{
ulong curTime = (ulong)Time.UnixTime;
var curTime = (ulong)Time.UnixTime;
StringBuilder ss = new();
ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id));
@@ -234,7 +234,7 @@ namespace Game.SupportSystem
_id = fields.Read<uint>(idx);
_playerGuid = ObjectGuid.Create(HighGuid.Player, fields.Read<ulong>(++idx));
_note = fields.Read<string>(++idx);
_createTime = fields.Read<uint>(++idx);
_createTime = fields.Read<ulong>(++idx);
_mapId = fields.Read<ushort>(++idx);
_pos = new Vector3(fields.Read<float>(++idx), fields.Read<float>(++idx), fields.Read<float>(++idx));
_facing = fields.Read<float>(++idx);
@@ -263,7 +263,7 @@ namespace Game.SupportSystem
public void LoadChatLineFromDB(SQLFields fields)
{
_chatLog.Lines.Add(new SupportTicketSubmitComplaint.SupportTicketChatLine(fields.Read<uint>(0), fields.Read<string>(1)));
_chatLog.Lines.Add(new SupportTicketSubmitComplaint.SupportTicketChatLine(fields.Read<long>(0), fields.Read<string>(1)));
}
public override void SaveToDB()
@@ -275,6 +275,7 @@ namespace Game.SupportSystem
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, _playerGuid.GetCounter());
stmt.AddValue(++idx, _note);
stmt.AddValue(++idx, _createTime);
stmt.AddValue(++idx, _mapId);
stmt.AddValue(++idx, _pos.X);
stmt.AddValue(++idx, _pos.Y);
@@ -376,7 +377,7 @@ namespace Game.SupportSystem
_id = fields.Read<uint>(idx);
_playerGuid = ObjectGuid.Create(HighGuid.Player, fields.Read<ulong>(++idx));
_note = fields.Read<string>(++idx);
_createTime = fields.Read<uint>(++idx);
_createTime = fields.Read<ulong>(++idx);
_mapId = fields.Read<ushort>(++idx);
_pos = new Vector3(fields.Read<float>(++idx), fields.Read<float>(++idx), fields.Read<float>(++idx));
_facing = fields.Read<float>(++idx);
@@ -405,6 +406,7 @@ namespace Game.SupportSystem
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, _playerGuid.GetCounter());
stmt.AddValue(++idx, _note);
stmt.AddValue(++idx, _createTime);
stmt.AddValue(++idx, _mapId);
stmt.AddValue(++idx, _pos.X);
stmt.AddValue(++idx, _pos.Y);