public static Point3D GetTeleportLocation(CWTeam team) { Point3D home = team.Home; Point3D home2 = team.Home2; if (home != Point3D.Zero && home2 != Point3D.Zero) { if (Utility.RandomDouble() > 0.5) { return(home); } return(home2); } if (home != Point3D.Zero) { return(home); } if (home2 != Point3D.Zero) { return(home2); } return(Point3D.Zero); }
public void Reset() { for (int i = 0; i < Teams.Count; i++) { CWTeam team = (CWTeam)Teams[i]; bool home1 = true; for (int j = 0; j < team.Players.Count; j++) { Mobile m = (Mobile)team.Players[j]; if (home1) { m.Location = team.Home; m.LogoutLocation = team.Home; if (team.Home2 != Point3D.Zero) { home1 = false; } } else { m.Location = team.Home2; m.LogoutLocation = team.Home2; home1 = true; } m.Map = team.HomeMap; if (m.Corpse != null && !m.Corpse.Deleted) { m.Corpse.Delete(); } if (!m.Alive && m is PlayerMobile) { ((PlayerMobile)m).ForceResurrect(); } m.Hits = m.HitsMax; m.Mana = m.ManaMax; m.Stam = m.StamMax; } } }
public override bool OnMoveOver(Mobile m) { if (m.AccessLevel >= AccessLevel.Counselor) { m.SendAsciiMessage("This is not for staff members."); return(true); } if (m is BaseCreature) { return(Teleport(m)); } if (m is PlayerMobile) { if (!m.Alive) { ((PlayerMobile)m).ForceResurrect(); return(false); } if (!m.IsInEvent || m_Game != null) { if (m_Game != null && m_TeamID != -1) { //Store our equipment EquipmentStorage playerGear = new EquipmentStorage(m); playerGear.StoreEquip(); //Supply the right type of gear SupplySystem.SupplyGear(m, this); CWTeam team = (CWTeam)m_Game.Teams[m_TeamID - 1]; //m_Game.SwitchTeams(m, team); m.SendMessage("You have joined {0}!", team.Name); //Tag the mobile to be in the event and display a message m.IsInEvent = true; m.SendAsciiMessage("You have been auto supplied."); if (m_Game != null && m_Game.Running) { return(Teleport(m)); } } else { m.SendMessage("The game has not started yet."); return(false); } } else { m.IsInEvent = false; m.SendAsciiMessage("Your auto supply has been removed."); SupplySystem.RemoveEventGear(m); return(Teleport(m)); } } return(true); }
public DeathTimer(Mobile m, CWTeam t) : base(TimeSpan.FromSeconds(((CWGame)t.Game).ResDelay)) { m_Mob = m; m_Team = t; Priority = TimerPriority.TwoFiftyMS; }
public void ResetGame() { string kp = KillPoints > 1 ? "points" : "point"; string dp = DeathPoints == 1 ? "point" : "points"; AnnounceToPlayers("The game has started."); AnnounceToPlayers("Game will end when one of the teams reaches {0} points.", MaxScore); if (ResDelay > 0) { if (DeathPoints == 0) { AnnounceToPlayers("Team gets {0} {1} for each kill and looses {2} {3} for each death.", KillPoints, kp, DeathPoints, dp); } else { AnnounceToPlayers("Team gets {0} {1} for each kill.", KillPoints, kp); } } else { if (DeathPoints == 0) { AnnounceToPlayers("Team gets {0} points for killing the other teams, {1} {2} for each kill and looses {3} {4} for each death.", LastStandingPoints, KillPoints, kp, DeathPoints, dp); } else { AnnounceToPlayers("Team gets {0} points for killing the other teams and {1} {2} for each kill.", LastStandingPoints, KillPoints, kp); } } teamskilled.Clear(); for (int i = 0; i < Teams.Count; i++) { CWTeam team = (CWTeam)Teams[i]; team.Score = 0; bool home1 = true; for (int j = 0; j < team.Players.Count; j++) { Mobile m = (Mobile)team.Players[j]; if (home1) { m.Location = team.Home; m.LogoutLocation = team.Home; if (team.Home2 != Point3D.Zero) { home1 = false; } } else { m.Location = team.Home2; m.LogoutLocation = team.Home2; home1 = true; } m.Map = team.HomeMap; if (!m.Alive && m is PlayerMobile) { ((PlayerMobile)m).ForceResurrect(); } m.Hits = m.HitsMax; m.Mana = m.ManaMax; m.Stam = m.StamMax; } } }
public override void OnPlayerDeath(Mobile killed) { base.OnPlayerDeath(killed); Mobile killer = killed.LastKiller; CWTeam killerteam = (CWTeam)GetTeam(killer); CWTeam killedteam = (CWTeam)GetTeam(killed); if (killedteam == null) { return; } if (ResDelay <= 0) { bool teamkilled = true; for (int i = 0; i < killedteam.Players.Count; i++) { Mobile m = (Mobile)killedteam.Players[i]; if (m.Alive) { teamkilled = false; break; } } if (teamkilled) { AnnounceToPlayers(string.Format("{0} got taken out!", killedteam.Name)); teamskilled.Add(killedteam); } if (teamskilled.Count >= (TeamCount - 1)) { AnnounceToPlayers(string.Format("{0} is the only team standing and gets {1} points", killerteam.Name, LastStandingPoints)); killerteam.Score += LastStandingPoints; teamskilled.Clear(); Reset(); } } else { RemoveTimer(killed); Timer t = new DeathTimer(killed, killedteam); m_Table[killed] = t; t.Start(); } if (killerteam != null && killerteam != killedteam) { killerteam.Score += KillPoints; AddPlayerScore(killer, KillPoints); } if (((CWGame)killedteam.Game).DeathPoints > 0 && killerteam != killedteam) { SubtractPlayerScore(killed, DeathPoints); killedteam.Score -= DeathPoints; } }
public DeathTimer( Mobile m, CWTeam t ) : base( TimeSpan.FromSeconds(((CWGame)t.Game).ResDelay) ) { m_Mob = m; m_Team = t; Priority = TimerPriority.TwoFiftyMS; }
public static Point3D GetTeleportLocation( CWTeam team ) { Point3D home = team.Home; Point3D home2 = team.Home2; if (home != Point3D.Zero && home2 != Point3D.Zero) { if (Utility.RandomDouble() > 0.5) return home; return home2; } if (home != Point3D.Zero) return home; if (home2 != Point3D.Zero) return home2; return Point3D.Zero; }