public Trophy(string title, TrophyRank rank) : base(5020) { Title = title; m_Rank = rank; Date = DateTime.UtcNow; LootType = LootType.Blessed; UpdateStyle(); }
public Trophy( string title, TrophyRank rank ) : base( 5020 ) { m_Title = title; m_Rank = rank; m_Date = DateTime.UtcNow; LootType = LootType.Blessed; UpdateStyle(); }
public Trophy(string title, TrophyRank rank) : base(5020) { this.m_Title = title; this.m_Rank = rank; this.m_Date = DateTime.Now; this.LootType = LootType.Blessed; this.UpdateStyle(); }
public Trophy(string title, TrophyRank rank) : base(5020) { this.m_Title = title; this.m_Rank = rank; this.m_Date = DateTime.UtcNow; this.LootType = LootType.Blessed; this.UpdateStyle(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_Title = reader.ReadString(); m_Rank = (TrophyRank) reader.ReadInt(); m_Owner = reader.ReadMobile(); m_Date = reader.ReadDateTime(); if ( version == 0 ) LootType = LootType.Blessed; }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_Title = reader.ReadString(); m_Rank = (TrophyRank)reader.ReadInt(); m_Owner = reader.ReadMobile(); m_Date = reader.ReadDateTime(); if (version == 0) { LootType = LootType.Blessed; } }
private void GiveAwards(ArrayList players, TrophyRank rank, int cash) { if (players.Count == 0) return; if (players.Count > 1) cash /= (players.Count - 1); cash += 500; cash /= 1000; cash *= 1000; StringBuilder sb = new StringBuilder(); if (this.m_TournyType == TournyType.FreeForAll) { sb.Append(this.m_Participants.Count * this.m_PlayersPerParticipant); sb.Append("-man FFA"); } else if (this.m_TournyType == TournyType.RandomTeam) { sb.Append(this.m_ParticipantsPerMatch); sb.Append("-team"); } else if (this.m_TournyType == TournyType.RedVsBlue) { sb.Append("Red v Blue"); } else { for (int i = 0; i < this.m_ParticipantsPerMatch; ++i) { if (sb.Length > 0) sb.Append('v'); sb.Append(this.m_PlayersPerParticipant); } } if (this.m_EventController != null) sb.Append(' ').Append(this.m_EventController.Title); sb.Append(" Champion"); string title = sb.ToString(); for (int i = 0; i < players.Count; ++i) { Mobile mob = (Mobile)players[i]; if (mob == null || mob.Deleted) continue; Item item = new Trophy(title, rank); if (!mob.PlaceInBackpack(item)) mob.BankBox.DropItem(item); if (cash > 0) { item = new BankCheck(cash); if (!mob.PlaceInBackpack(item)) mob.BankBox.DropItem(item); mob.SendMessage("You have been awarded a {0} trophy and {1:N0}gp for your participation in this tournament.", rank.ToString().ToLower(), cash); } else { mob.SendMessage("You have been awarded a {0} trophy for your participation in this tournament.", rank.ToString().ToLower()); } } }
private void Finish_Callback() { ArrayList teams = new ArrayList(); for (int i = 0; i < m_Context.Participants.Count; ++i) { KHTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length]; if (teamInfo == null) { continue; } teams.Add(teamInfo); } teams.Sort(); Tournament tourny = m_Context.m_Tournament; StringBuilder sb = new StringBuilder(); if (tourny != null && tourny.TournyType == TournyType.FreeForAll) { sb.Append(m_Context.Participants.Count * tourny.PlayersPerParticipant); sb.Append("-man FFA"); } else if (tourny != null && tourny.TournyType == TournyType.RandomTeam) { sb.Append(tourny.ParticipantsPerMatch); sb.Append("-team"); } else if (tourny != null && tourny.TournyType == TournyType.RedVsBlue) { sb.Append("Red v Blue"); } else if (tourny != null) { for (int i = 0; i < tourny.ParticipantsPerMatch; ++i) { if (sb.Length > 0) { sb.Append('v'); } sb.Append(tourny.PlayersPerParticipant); } } if (m_Controller != null) { sb.Append(' ').Append(m_Controller.Title); } string title = sb.ToString(); KHTeamInfo winner = (KHTeamInfo)(teams.Count > 0 ? teams[0] : null); for (int i = 0; i < teams.Count; ++i) { TrophyRank rank = TrophyRank.Bronze; if (i == 0) { rank = TrophyRank.Gold; } else if (i == 1) { rank = TrophyRank.Silver; } KHPlayerInfo leader = ((KHTeamInfo)teams[i]).Leader; foreach (KHPlayerInfo pl in ((KHTeamInfo)teams[i]).Players.Values) { Mobile mob = pl.Player; if (mob == null) { continue; } sb = new StringBuilder(); sb.Append(title); if (pl == leader) { sb.Append(" Leader"); } if (pl.Score > 0) { sb.Append(": "); sb.Append(pl.Score.ToString("N0")); sb.Append(pl.Score == 1 ? " point" : " points"); sb.Append(", "); sb.Append(pl.Kills.ToString("N0")); sb.Append(pl.Kills == 1 ? " kill" : " kills"); if (pl.Captures > 0) { sb.Append(", "); sb.Append(pl.Captures.ToString("N0")); sb.Append(pl.Captures == 1 ? " capture" : " captures"); } } Item item = new Trophy(sb.ToString(), rank); if (pl == leader) { item.ItemID = 4810; } item.Name = String.Format("{0}, {1}", item.Name, ((KHTeamInfo)teams[i]).Name.ToLower()); if (!mob.PlaceInBackpack(item)) { mob.BankBox.DropItem(item); } int cash = pl.Score * 250; if (cash > 0) { item = new BankCheck(cash); if (!mob.PlaceInBackpack(item)) { mob.BankBox.DropItem(item); } mob.SendMessage("You have been awarded a {0} trophy and {1:N0}gp for your participation in this game.", rank.ToString().ToLower(), cash); } else { mob.SendMessage("You have been awarded a {0} trophy for your participation in this game.", rank.ToString().ToLower()); } } } for (int i = 0; i < m_Context.Participants.Count; ++i) { Participant p = m_Context.Participants[i] as Participant; if (p == null || p.Players == null) { continue; } for (int j = 0; j < p.Players.Length; ++j) { DuelPlayer dp = p.Players[j]; if (dp != null && dp.Mobile != null) { dp.Mobile.CloseGump(typeof(KHBoardGump)); dp.Mobile.SendGump(new KHBoardGump(dp.Mobile, this)); } } if (i == winner.TeamID) { continue; } if (p != null && p.Players != null) { for (int j = 0; j < p.Players.Length; ++j) { if (p.Players[j] != null) { p.Players[j].Eliminated = true; } } } } m_Context.Finish(m_Context.Participants[winner.TeamID] as Participant); }
private void GiveAwards(List<Mobile> players, TrophyRank rank, int cash) { if (players.Count == 0) { return; } if (players.Count > 1) { cash /= (players.Count - 1); } cash += 500; cash /= 1000; cash *= 1000; var sb = new StringBuilder(); if (m_TournyType == TournyType.FreeForAll) { sb.Append(m_Participants.Count * m_PlayersPerParticipant); sb.Append("-man FFA"); } else if (m_TournyType == TournyType.RandomTeam) { sb.Append(m_ParticipantsPerMatch); sb.Append("-team"); } else if (m_TournyType == TournyType.RedVsBlue) { sb.Append("Red v Blue"); } else { for (int i = 0; i < m_ParticipantsPerMatch; ++i) { if (sb.Length > 0) { sb.Append('v'); } sb.Append(m_PlayersPerParticipant); } } if (m_EventController != null) { sb.Append(' ').Append(m_EventController.Title); } sb.Append(" Champion"); string title = sb.ToString(); for (int i = 0; i < players.Count; ++i) { Mobile mob = players[i]; if (mob == null || mob.Deleted) { continue; } Item item = new Trophy(title, rank); if (!mob.PlaceInBackpack(item)) { BankBox bank = m_EventController != null ? mob.FindBank(m_EventController.Expansion) : mob.BankBox; if (bank != null) { bank.DropItem(item); } else { item.Delete(); } } if (cash > 0) { item = new Platinum(cash); if (!mob.PlaceInBackpack(item)) { mob.BankBox.DropItem(item); } mob.SendMessage( "You have been awarded a {0} trophy and {1:N0}platinum for your participation in this tournament.", rank.ToString().ToLower(), cash); } else { mob.SendMessage("You have been awarded a {0} trophy for your participation in this tournament.", rank.ToString().ToLower()); } } }