示例#1
0
        /*public void DeleteInvasion()
         * {
         *  if (Status == InvasionStatus.Running)
         *  {
         *      Status = InvasionStatus.Finished;
         *      _CoreTimer.Stop();
         *  }
         *
         *  Levels.Clear();
         *  RemoveInvaders();
         *  if (ValidSpawnPoints != null)
         *  {
         *      ValidSpawnPoints.Clear();
         *  }
         *
         *  foreach (PlayerInvasionProfile profile in EventInvasions.PlayerProfiles.Values)
         *  {
         *      if (profile.SpecificInvasionScores.ContainsKey(UID))
         *      {
         *          profile.OverallScore -= profile.SpecificInvasionScores[UID];
         *          profile.SpecificInvasionScores.Remove(UID);
         *      }
         *  }
         *
         *  EventInvasions.Invasions.Remove(UID);
         *
         * }*/

        public void SpawnInvaders(int amount)
        {
            for (int i = 0; i < amount; i++)
            {
                if (Invaders.Count >= CurrentLevel.SpawnAmount)
                {
                    break;
                }
                Type selected = CurrentLevel.Creatures.GetRandom();
                if (selected.IsEqualOrChildOf <Mobile>())
                {
                    var mob = selected.CreateInstanceSafe <BaseCreature>();
                    if (mob != null)
                    {
                        if (!String.IsNullOrWhiteSpace(CurrentLevel.InvaderTitles))
                        {
                            mob.SpecialTitle = CurrentLevel.InvaderTitles;
                        }
                        else
                        {
                            mob.SpecialTitle = "Invader";
                        }
                        mob.TitleHue    = 1174;
                        mob.GuardImmune = true;
                        mob.Invasion    = this;

                        if (Utility.RandomDouble() <= 0.01)
                        {
                            mob.IsParagon = true;
                        }
                        if (CurrentLevel.Plat > 0 && mob.Backpack != null)
                        {
                            mob.AddToBackpack(new Platinum(CurrentLevel.Plat));
                        }
                        Invaders.Add(mob);
                    }
                }
            }
            if (ValidSpawnPoints == null || ValidSpawnPoints.Count == 0)
            {
                ValidSpawnPoints = GenerateSpawnLocations();
            }
            foreach (Mobile invader in Invaders.Where(invader => invader.Map == Map.Internal))
            {
                invader.MoveToWorld(ValidSpawnPoints.GetRandom(), Map.Felucca);
            }
        }
示例#2
0
 public void FinishInvasion()
 {
     Status = InvasionStatus.Finished;
     _CoreTimer.Stop();
     RemoveInvaders();
     if (ValidSpawnPoints != null)
     {
         ValidSpawnPoints.Clear();
         ValidSpawnPoints.TrimExcess();
     }
     if (TownGates != null)
     {
         DeleteGates();
     }
     Notify.Broadcast <HydraMotMNotifyGump>(
         "The " + InvasionName + " has ended!",
         true,
         1.0,
         10.0);
     GenerateScoreboards();
     CurrentLevel = Levels.First();
 }
示例#3
0
        public List <Moongate> SpawnGates()
        {
            var gates = new List <Moongate>();

            if (ValidSpawnPoints == null || ValidSpawnPoints.Count == 0)
            {
                ValidSpawnPoints = GenerateSpawnLocations();
            }
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(1427, 1701, 0),
                Map          = Map.Felucca
            });
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(2512, 564, 0),
                Map          = Map.Felucca
            });
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(2717, 2173, 0),
                Map          = Map.Felucca
            });
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(2237, 1195, 0),
                Map          = Map.Felucca
            });
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(4453, 1166, 0),
                Map          = Map.Felucca
            });
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(1821, 2819, 0),
                Map          = Map.Felucca
            });
            gates.Add(new Moongate(ValidSpawnPoints.GetRandom(), Map.Felucca)
            {
                Dispellable  = false,
                DoesNotDecay = true,
                Name         = "Portal to the " + InvasionName,
                Hue          = 1172,
                Location     = new Point3D(2895, 689, 0),
                Map          = Map.Felucca
            });
            return(gates);
        }