public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); //Version 0 if (version >= 0) { m_ArenaMatch = reader.ReadItem() as ArenaMatch; m_MatchStatus = (ArenaMatchResultStatusType)reader.ReadInt(); m_CompletionDate = reader.ReadDateTime(); m_MatchType = (ArenaRuleset.MatchTypeType)reader.ReadInt(); m_MatchDuration = reader.ReadTimeSpan(); m_WinningTeam = reader.ReadString(); int teamResultEntriesCount = reader.ReadInt(); for (int a = 0; a < teamResultEntriesCount; a++) { bool winner = reader.ReadBool(); string teamName = reader.ReadString(); List <ArenaMatchPlayerResultEntry> m_playerResultEntries = new List <ArenaMatchPlayerResultEntry>(); int playerResultEntriesCount = reader.ReadInt(); for (int b = 0; b < playerResultEntriesCount; b++) { PlayerMobile player = reader.ReadMobile() as PlayerMobile; string playerName = reader.ReadString(); bool alive = reader.ReadBool(); int lowestHP = reader.ReadInt(); TimeSpan timeAlive = reader.ReadTimeSpan(); int damageDealt = reader.ReadInt(); int damageReceived = reader.ReadInt(); ArenaMatchPlayerResultEntry playerResultEntry = new ArenaMatchPlayerResultEntry(player, playerName, alive, lowestHP, timeAlive, damageDealt, damageReceived); m_playerResultEntries.Add(playerResultEntry); } ArenaMatchTeamResultEntry teamResultEntry = new ArenaMatchTeamResultEntry(winner, teamName, m_playerResultEntries); m_TeamResultEntries.Add(teamResultEntry); } } //----- ArenaPersistance.m_ArenaMatchResultEntries.Add(this); if (m_ArenaMatch != null) { m_ArenaMatch.m_ArenaMatchResultEntry = this; } }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); //Version 0 writer.Write(m_ArenaMatch); writer.Write((int)m_MatchStatus); writer.Write(m_CompletionDate); writer.Write((int)m_MatchType); writer.Write(m_MatchDuration); writer.Write(m_WinningTeam); writer.Write(m_TeamResultEntries.Count); for (int a = 0; a < m_TeamResultEntries.Count; a++) { ArenaMatchTeamResultEntry teamResultEntry = m_TeamResultEntries[a]; writer.Write(teamResultEntry.m_Winner); writer.Write(teamResultEntry.m_TeamName); writer.Write(teamResultEntry.m_PlayerResultEntries.Count); for (int b = 0; b < teamResultEntry.m_PlayerResultEntries.Count; b++) { ArenaMatchPlayerResultEntry playerResultEntry = teamResultEntry.m_PlayerResultEntries[b]; writer.Write(playerResultEntry.m_Player); writer.Write(playerResultEntry.m_PlayerName); writer.Write(playerResultEntry.m_Alive); writer.Write(playerResultEntry.m_LowestHP); writer.Write(playerResultEntry.m_TimeAlive); writer.Write(playerResultEntry.m_DamageDealt); writer.Write(playerResultEntry.m_DamageReceived); } } }