Example #1
0
        public static void StartCustomInvasion(int type)
        {
            if (invasions == null)
            {
                return;
            }

            // If there is an invasion going on, but the invasion has basically already ended (invasionSize = 0).
            if (Main.invasionType != 0 && Main.invasionSize == 0)
            {
                Main.invasionType = 0;
            }

            if (Main.invasionType == 0 && InvasionWorld.invasionType == 0)
            {
                InvasionInfo info = GetInvasionInfo(type);
                info.invasionSizeModifier();

                if (InvasionWorld.invasionSize > 0)
                {
                    InvasionWorld.invasionType = type;

                    InvasionWorld.invasionSizeStart = InvasionWorld.invasionSize;
                    InvasionWorld.invasionProgress  = 0;
                    //InvasionWorld.invasionProgressWave = 0;
                    InvasionWorld.invasionProgressMax = Main.invasionSizeStart;
                    InvasionWorld.invasionX           = info.invasionXPos;

                    Main.NewText(info.beginMessage, 255, 60, 255);
                }
            }
        }
        public static void AddInvasion(out int key, InvasionInfo info)
        {
            if (invasions == null) invasions = new Dictionary<int, InvasionInfo>();

            key = customInvasionTypeStart;
            while (invasions.ContainsKey(key))
            {
                key++;
            }
            invasions.Add(key, info);
        }
        public static void ReportInvasionProgress(int progress, int progressMax, int progressWave)
        {
            InvasionWorld.invasionProgress = progress;
            InvasionWorld.invasionProgressMax = progressMax;
            //Main.invasionProgressWave = progressWave;
            InvasionHandler.invasionProgressDisplayLeft = 160;

            // Invasion has ended
            if (progressMax - progress <= 0)
            {
                if (Main.netMode == 0)
                    Main.NewText(currentInvasion.endMessage, 175, 75, 255, false);
                else if (Main.netMode == 2)
                    NetMessage.SendData(25, -1, -1, null, 255, 60f, 255f, 255f, 0, 0, 0);

                currentInvasion = null;
                InvasionWorld.invasionSize = 0;
                InvasionWorld.invasionType = 0;
            }
        }
Example #4
0
 public static void Reset()
 {
     invasions       = new Dictionary <int, InvasionInfo>();
     currentInvasion = null;
 }