Beispiel #1
0
        public void SpawnInvasion()
        {
            int NumberToSpawn = (m_SpawnDensity - m_SpawnList.Count);

            for (int i = 0; i < NumberToSpawn; ++i)
            {
                bool    foundpointmap = false;
                int     attempts      = 0;
                Point3D loc           = new Point3D();
                Map     map           = null;
                while (!foundpointmap)
                {
                    object[] found = SpawnPointMap(OffsetPointFound(), m_InvasionMap);
                    if (found != null)
                    {
                        loc           = (Point3D)found[0];
                        map           = (Map)found[1];
                        foundpointmap = true;
                    }

                    attempts += 1;
                    if (attempts >= InvasionConfig.InvasionSpawnAttempts)
                    {
                        if (NumberToSpawn > 0)
                        {
                            NumberToSpawn -= 1;
                        }
                    }
                }

                InvasionSpawn spawned = CreateNewInvasionSpawn();
                if (spawned != null)
                {
                    spawned.Home      = m_InvasionLocationTarget;
                    spawned.RangeHome = 0;
                    spawned.Location  = loc;
                    spawned.Map       = map;
                    m_SpawnList.Add(spawned);
                }
            }
        }
Beispiel #2
0
        public void EndInvasion(InvasionEventSink.InvasionEndedEventArgs.InvasionEndedReason Reason)
        {
            m_InvasionStarted = false;

            List <InvasionSpawn> ToDelete = new List <InvasionSpawn>();

            for (int i = 0; i < m_SpawnList.Count; ++i)
            {
                ToDelete.Add((InvasionSpawn)m_SpawnList[i]);
            }

            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m is InvasionSpawn)
                {
                    if (((InvasionSpawn)m).Controller == this)
                    {
                        ToDelete.Add((InvasionSpawn)m);
                    }
                }
            }

            for (int i = 0; i < ToDelete.Count; ++i)
            {
                InvasionSpawn deleting = (InvasionSpawn)ToDelete[i];
                deleting.Delete();
            }

            if (Reason == InvasionEventSink.InvasionEndedEventArgs.InvasionEndedReason.KillCountReached)
            {
                Console.WriteLine("Player Count:" + m_Players.Count.ToString());
                IEnumerator key = m_Players.Keys.GetEnumerator();
                for (int i = 0; i < m_Players.Count; ++i)
                {
                    key.MoveNext();
                    int kills   = (int)m_Players[(PlayerMobile)key.Current];
                    int percent = (kills / m_RequiredKillCount) * 100;
                    if (percent > 100)
                    {
                        percent = 100;
                    }

                    int reward = (percent * m_Reward) / 100;

                    if (reward < 1)
                    {
                        reward = 1;
                    }

                    if (reward > 60000)
                    {
                        reward = 60000;
                    }

                    Console.WriteLine("Kills:" + kills.ToString());
                    Console.WriteLine("Percent:" + percent.ToString());

                    Item givenreward;
                    if (reward >= 5000)
                    {
                        givenreward = new BankCheck(reward);
                    }
                    else
                    {
                        givenreward = new Gold(reward);
                    }

                    BankBox bank = (BankBox)((PlayerMobile)key.Current).BankBox;
                    bank.AddItem(givenreward);

                    ((PlayerMobile)key.Current).SendMessage(String.Format("The invasion has ended! You have been rewarded {0}gp!", reward.ToString()));
                }
            }

            m_SpawnList.Clear();
            m_SpawnList = null;

            m_Players.Clear();
            m_Players = null;
            m_Kills   = 0;

            InvasionEventSink.OnInvasionEnded(new InvasionEventSink.InvasionEndedEventArgs(this, Reason));
        }
Beispiel #3
0
 public InvasionSpawnDiedEventArgs(InvasionController c, InvasionSpawn spawn, Container cont)
 {
     Controller     = c;
     Spawn          = spawn;
     DeathContainer = cont;
 }
Beispiel #4
0
 public InvasionSpawnDeletedEventArgs(InvasionController c, InvasionSpawn spawn)
 {
     Controller = c;
     Spawn      = spawn;
 }
Beispiel #5
0
 public InvasionSpawnMovedEventArgs(InvasionController c, InvasionSpawn s)
 {
     Controller = c;
     Spawn      = s;
 }