public override double ComputeScore(PvPTeam t, ref double min, ref double max, ref double total) { var score = base.ComputeScore(t, ref min, ref max, ref total); if (t == null || t.Deleted) { return(score); } var ct = t as CTFTeam; if (ct == null) { return(score); } double val; if (FlagsCaptured > 0) { score += val = Math.Min(1.0, ct.GetTotalFlagsCaptured() / (double)FlagsCaptured); min = Math.Min(min, val); max = Math.Max(max, val); ++total; } if (FlagsDropped > 0) { score += val = Math.Min(1.0, ct.GetTotalFlagsDropped() / (double)FlagsDropped); min = Math.Min(min, val); max = Math.Max(max, val); ++total; } if (FlagsStolen > 0) { score += val = Math.Min(1.0, ct.GetTotalFlagsStolen() / (double)FlagsStolen); min = Math.Min(min, val); max = Math.Max(max, val); ++total; } if (FlagsReturned > 0) { score += val = Math.Min(1.0, ct.GetTotalFlagsReturned() / (double)FlagsReturned); min = Math.Min(min, val); max = Math.Max(max, val); ++total; } return(score); }
public override bool TryKickOnDeath(PvPTeam team, PlayerMobile pm, bool isLoss) { if (isLoss && IsFinalMatch && FinalBestOfCur < FinalBestOfMax) { var o = FindActiveMatch(pm); int min = 0, max = 0; if (o == null) { ++FinalBestOfCur; } else if (o.CountAlive <= 1) { foreach (var c in o.Players.Where(p => p != null).Select(CountMatchesWon)) { min = Math.Min(min, c); max = Math.Max(max, c); } ++FinalBestOfCur; } if (max - min < (FinalBestOfMax / 2) + 1) { return(false); } } return(base.TryKickOnDeath(team, pm, isLoss)); }
public override void OnTeamWin(PvPTeam team) { WorldBroadcast("{0} has won the Battle of Wind!", team.Name); var t = team as BoWTeam; if (t == null) { return; } /*if (IsFaction) * { * if (WinGate != null) * { * WinGate.Delete(); * } * * WinGate = new BoWWinPortal(this) * { * Controller = t.Name, * Hue = t.Color * }; * * WinGate.MoveToWorld(t.GatePoint, Map); * }*/ if (Crystal != null) { Crystal.Carrier = null; //For the lols if (!MyPeopleNeedMe()) { //Aesthetic stuff for crystal Crystal.Hue = t.Color; if (t.Name == "Minax" || t.Name == "The Shadowlords") { Crystal.Name = "the corrupted Crystal of Power"; } if (t.Name == "The True Britannians" || t.Name == "The Council of Mages") { Crystal.Name = "the purified Crystal of Power"; } if (Crystal == null || Crystal.Deleted) { Crystal = new BoWCrystal(this); } Crystal.MoveToWorld(t.CrystalLoc, Map); } } Cleanup(); base.OnTeamWin(team); }
public override bool AddTeam(PvPTeam team) { return(team != null && !team.Deleted && (team is UOF_PvPTeam ? base.AddTeam(team) : AddTeam(team.Name, team.MinCapacity, team.MinCapacity, team.Color))); }
public void SendSound(PvPTeam t, int soundID) { if (Options.Sounds.Enabled && t != null && !t.Deleted && soundID > 0) { t.SendSound(soundID); } }
public override void OnTeamMemberRemoved(PvPTeam team, PlayerMobile pm) { base.OnTeamMemberRemoved(team, pm); if (IncognitoMode) { pm.SetHairMods(-1, -1); pm.BodyMod = 0; pm.HueMod = -1; pm.NameMod = null; pm.EndAction(typeof(IncognitoSpell)); BaseArmor.ValidateMobile(pm); BaseClothing.ValidateMobile(pm); } if (ThrowableMode) { if (_Axes != null && _Axes.ContainsKey(pm)) { ThrowableAxe axe = _Axes[pm]; if (axe != null) { _Axes.Remove(pm); axe.Delete(); } } } PvPTemplates.FetchProfile(pm).ClearDelta(); }
public virtual void Enqueue(PlayerMobile pm, PvPTeam team = null, bool party = true) { if (pm == null || pm.Deleted) { return; } if (!CanQueue(pm)) { OnQueueReject(pm); return; } if (team != null && team.Deleted) { team = null; } if (!IsQueued(pm)) { Queue.Add(pm, team); OnQueueJoin(pm, team); } else { Queue[pm] = team; OnQueueUpdate(pm, team); } if (party) { EnqueueParty(pm, Party.Get(pm), team); } }
protected override void OnReset() { base.OnReset(); Winners = new PvPTeam[0]; TeamStats.Clear(); }
protected override void GetAssignPriority(PvPTeam team, out double weight) { base.GetAssignPriority(team, out weight); if (weight > Double.MinValue && weight < Double.MaxValue) { weight = team.Members.Count; } }
public override void OnAfterTeamMemberResurrected(PvPTeam team, PlayerMobile pm) { if (UseTemplates) { PvPTemplates.FetchProfile(pm).ApplyDelta(UseTemplateEquipment); } base.OnAfterTeamMemberResurrected(team, pm); }
public override void OnTeamLose(PvPTeam team) { if (team != null && !team.Deleted) { OnTeamLose(team, GetTeamRank(team)); } base.OnTeamLose(team); }
public virtual void EnqueueParty(PlayerMobile pm, Party party, PvPTeam team = null) { if (pm != null && !pm.Deleted && party != null && party.Active && party.Leader == pm) { party.Members.Where(pmi => pmi != null && pmi.Mobile != null && !pmi.Mobile.Deleted && pmi.Mobile != pm) .Select(pmi => (PlayerMobile)pmi.Mobile) .ForEach(m => Enqueue(m, team, false)); } }
public override bool IsWinningTeam(PvPTeam team) { var t = team as CTFTeam; if (t == null || t.Deleted) { return(false); } return(t.Caps >= CapsToWin); }
public override bool IsWinningTeam(PvPTeam team) { var t = team as BoWTeam; if (t == null || t.Deleted) { return(false); } return(t.Points >= PointsToWin); }
protected virtual void OnTeamLose(PvPTeam team, int rank) { if (team == null || team.Deleted || rank < 0) { return; } if (GiveRankTrophies) { team.ForEachMember(m => AwardRankTrophy(m, rank)); } }
public virtual IEnumerable<PlayerMobile> GetQueued(PvPTeam team) { if (team == null || team.Deleted) { yield break; } foreach (var kvp in Queue.Where(kvp => kvp.Value == team)) { yield return kvp.Key; } }
public virtual void AwardTeamPoints(PvPTeam team) { if (team != null) { team.ForEachMember( pm => { int points = GetAwardPoints(team, pm); EnsureStatistics(pm).PointsGained += points; AutoPvP.EnsureProfile(pm).Points += points; }); } }
public override int CompareTeamRank(PvPTeam a, PvPTeam b) { if (a == b) { return(0); } if (b == null) { return(-1); } if (a == null) { return(1); } if (a.Deleted && b.Deleted) { return(0); } if (b.Deleted) { return(-1); } if (a.Deleted) { return(1); } if (!a.RespawnOnDeath && !b.RespawnOnDeath) { if (a.Dead.Count > b.Dead.Count) { return(-1); } if (a.Dead.Count < b.Dead.Count) { return(1); } return(0); } return(base.CompareTeamRank(a, b)); }
public override int CompareTeamRank(PvPTeam a, PvPTeam b) { if (a == b) { return 0; } if (b == null) { return -1; } if (a == null) { return 1; } if (a.Deleted && b.Deleted) { return 0; } if (b.Deleted) { return -1; } if (a.Deleted) { return 1; } if (!a.RespawnOnDeath && !b.RespawnOnDeath) { if (a.Dead.Count > b.Dead.Count) { return -1; } if (a.Dead.Count < b.Dead.Count) { return 1; } return 0; } return base.CompareTeamRank(a, b); }
public override void OnTeamMemberDeath(PvPTeam team, PlayerMobile pm) { base.OnTeamMemberDeath(team, pm); if (team is TournamentTeam) { var o = FindActiveMatch(pm); if (o != null) { o.HandleDeath(pm); o.Sync(this, (TournamentTeam)team); } } }
public override bool AddTeam(PvPTeam team) { if (team == null || team.Deleted) { return(false); } if (team is CTFTeam) { return(base.AddTeam(team)); } var added = AddTeam(team.Name, team.MinCapacity, team.MinCapacity, team.Color); team.Delete(); return(added); }
public override int CompareTeamRank(PvPTeam a, PvPTeam b) { int result = 0; if (a.CompareNull(b, ref result)) { return result; } if (a.Deleted && b.Deleted) { return 0; } if (a.Deleted) { return 1; } if (b.Deleted) { return -1; } if (!a.RespawnOnDeath && !b.RespawnOnDeath) { if (a.Dead.Count > b.Dead.Count) { return 1; } if (a.Dead.Count < b.Dead.Count) { return -1; } return 0; } return base.CompareTeamRank(a, b); }
public override int CompareTeamRank(PvPTeam a, PvPTeam b) { int result = 0; if (a.CompareNull(b, ref result)) { return(result); } if (a.Deleted && b.Deleted) { return(0); } if (a.Deleted) { return(1); } if (b.Deleted) { return(-1); } if (!a.RespawnOnDeath && !b.RespawnOnDeath) { if (a.Dead.Count > b.Dead.Count) { return(1); } if (a.Dead.Count < b.Dead.Count) { return(-1); } return(0); } return(base.CompareTeamRank(a, b)); }
public override string GetStatus(PvPTeam t) { var status = base.GetStatus(t); if (t == null || t.Deleted) { return(status); } var ct = t as CTFTeam; if (ct == null) { return(status); } var lines = new StringBuilder(status); if (FlagsCaptured > 0) { lines.AppendLine("Flags Captured: {0:#,0} / {1:#,0}", ct.GetTotalFlagsCaptured(), FlagsCaptured); } if (FlagsDropped > 0) { lines.AppendLine("Flags Dropped: {0:#,0} / {1:#,0}", ct.GetTotalFlagsDropped(), FlagsDropped); } if (FlagsStolen > 0) { lines.AppendLine("Flags Stolen: {0:#,0} / {1:#,0}", ct.GetTotalFlagsStolen(), FlagsStolen); } if (FlagsReturned > 0) { lines.AppendLine("Flags Returned: {0:#,0} / {1:#,0}", ct.GetTotalFlagsReturned(), FlagsReturned); } return(lines.ToString()); }
public override void Enqueue(PlayerMobile pm, PvPTeam team = null, bool party = true) { if (IsFaction && pm != null && !pm.Deleted) { string faction = null; switch (pm.FactionName.ToUpper()) { case "LORD BRITISH": faction = "The True Britannians"; break; case "MINAX": faction = "Minax"; break; case "SHADOWLORDS": faction = "The Shadowlords"; break; case "COUNCIL OF MAGES": faction = "The Council of Mages"; break; } if (team != null && faction != null && team.Name != null && faction != team.Name) { team = Teams.Find(x => x.Name == faction); } else if (team == null && faction != null) { team = Teams.Find(x => x.Name == faction); } } base.Enqueue(pm, team, party); }
public virtual void RevokeTeamPoints(PvPTeam team, int points) { if (team != null) { team.ForEachMember( pm => { EnsureStatistics(pm).PointsLost += points; AutoPvP.EnsureProfile(pm).Points -= points; }); } }
protected virtual void OnQueueUpdate(PlayerMobile pm, PvPTeam team) { if (pm == null || pm.Deleted) { return; } pm.SendMessage( "Your queue status for {0} has changed{1}", Name, team != null ? ", your team is " + team.Name : String.Empty); SendSound(pm, Options.Sounds.QueueJoin); }
public virtual void TeleportToHomeBase(PvPTeam team, PlayerMobile pm) { if (pm != null && !pm.Deleted && team != null && !team.Deleted && team.IsMember(pm)) { Teleport(pm, team.HomeBase, Options.Locations.Map); } }
public override void OnAfterTeamMemberDeath(PvPTeam team, PlayerMobile pm) { base.OnAfterTeamMemberDeath(team, pm); UpdateUI(true); }
public override int CompareTeamRank(PvPTeam a, PvPTeam b) { return CompareTeamRank(a as BoWTeam, b as BoWTeam); }
public virtual int GetAwardPoints(PvPTeam team, PlayerMobile pm) { return (int)Math.Floor(PointsBase + (PointsRankFactor * (Teams.Count - GetTeamRank(team)))); }
public override void OnTeamMemberAdded(PvPTeam team, PlayerMobile pm) { if (TeamStats.ContainsKey(pm)) { TeamStats[pm] = team; } else { TeamStats.Add(pm, team); } base.OnTeamMemberAdded(team, pm); if (UseTemplates) { PvPTemplates.FetchProfile(pm).ApplyDelta(UseTemplateEquipment); } if (IncognitoMode) { IncogMode(pm); } if (ThrowableMode) { if (_Axes == null) { _Axes = new Dictionary<PlayerMobile, ThrowableAxe>(); } if (ThrowableID == 0) { ThrowableID = 0x13FB; } if (ThrowableHue == 0) { ThrowableHue = 1161; } var Axe = new ThrowableAxe { Movable = false, ItemID = ThrowableID, }; if (Utility.RandomDouble() <= 0.1) { Axe.Name = "Stone Chair"; Axe.ItemID = 4632; } Axe.EffectID = Axe.ItemID; Axe.Hue = ThrowableHue; Axe.EffectHue = Axe.Hue-1; Axe.Stackable = false; if (_Axes != null && !_Axes.ContainsKey(pm)) { _Axes.Add(pm, Axe); } if (pm.Backpack != null) { pm.AddToBackpack(Axe); } } }
public virtual int GetAwardPoints(PvPTeam team, PlayerMobile pm) { return PointsBase; }
public override void OnTeamMemberAdded(PvPTeam team, PlayerMobile pm) { if (TeamStats.ContainsKey(pm)) { TeamStats[pm] = team; } else { TeamStats.Add(pm, team); } base.OnTeamMemberAdded(team, pm); if (UseTemplates) { PvPTemplates.FetchProfile(pm).ApplyDelta(UseTemplateEquipment); } if (IncognitoMode) { IncogMode(pm); } if (ThrowableMode) { if (_Axes == null) { _Axes = new Dictionary <PlayerMobile, ThrowableAxe>(); } if (ThrowableID == 0) { ThrowableID = 0x13FB; } if (ThrowableHue == 0) { ThrowableHue = 1161; } var Axe = new ThrowableAxe { Movable = false, ItemID = ThrowableID, }; if (Utility.RandomDouble() <= 0.1) { Axe.Name = "Stone Chair"; Axe.ItemID = 4632; } Axe.EffectID = Axe.ItemID; Axe.Hue = ThrowableHue; Axe.EffectHue = Axe.Hue - 1; Axe.Stackable = false; if (_Axes != null && !_Axes.ContainsKey(pm)) { _Axes.Add(pm, Axe); } if (pm.Backpack != null) { pm.AddToBackpack(Axe); } } }
public override bool IsWinningTeam(PvPTeam team) { var t = team as BoWTeam; if (t == null || t.Deleted) { return false; } return t.Points >= PointsToWin; }
public override void OnTeamWin(PvPTeam team) { WorldBroadcast("Team {0} has won {1}!", team.Name, Name); base.OnTeamWin(team); }
public override void OnTeamWin(PvPTeam team) { WorldBroadcast("{0} has won the Battle of Wind!", team.Name); var t = team as BoWTeam; if (t == null) { return; } /*if (IsFaction) { if (WinGate != null) { WinGate.Delete(); } WinGate = new BoWWinPortal(this) { Controller = t.Name, Hue = t.Color }; WinGate.MoveToWorld(t.GatePoint, Map); }*/ if (Crystal != null) { Crystal.Carrier = null; //For the lols if (!MyPeopleNeedMe()) { //Aesthetic stuff for crystal Crystal.Hue = t.Color; if (t.Name == "Minax" || t.Name == "The Shadowlords") { Crystal.Name = "the corrupted Crystal of Power"; } if (t.Name == "The True Britannians" || t.Name == "The Council of Mages") { Crystal.Name = "the purified Crystal of Power"; } if (Crystal == null || Crystal.Deleted) { Crystal = new BoWCrystal(this); } Crystal.MoveToWorld(t.CrystalLoc, Map); } } Cleanup(); base.OnTeamWin(team); }
public bool IsParticipant(PlayerMobile pm, out PvPTeam team) { team = FindTeam(pm); return (team != null); }
public override int CompareTeamRank(PvPTeam a, PvPTeam b) { return(CompareTeamRank(a as CTFTeam, b as CTFTeam)); }
protected virtual void OnQueueJoin(PlayerMobile pm, PvPTeam team) { if (pm == null || pm.Deleted) { return; } pm.SendMessage( "You have joined the queue for {0}{1}", Name, team != null ? ", your team is " + team.Name : String.Empty); SendSound(pm, Options.Sounds.QueueJoin); }
public override void OnAfterTeamMemberDeath(PvPTeam team, PlayerMobile pm) { PvPTemplates.FetchProfile(pm).ClearDelta(); base.OnAfterTeamMemberDeath(team, pm); }
public override bool AddTeam(PvPTeam team) { return team != null && !team.Deleted && (team is BoWTeam ? base.AddTeam(team) : AddTeam(team.Name, team.MinCapacity, team.MinCapacity, team.Color)); }
public override bool IsWinningTeam(PvPTeam team) { var t = team as CTFTeam; if (t == null || t.Deleted) { return false; } return t.Caps >= CapsToWin; }