private static void MakeSpawner(string[] types, string[] fakespawnsA, string[] fakespawnsB, string[] fakespawnsC, string[] fakespawnsD, string[] fakespawnsE, int x, int y, int z, Map map, TimeSpan mintime, TimeSpan maxtime, int walkingrange, int homerange, int spawnid, int npccount, int fakecountA, int fakecountB, int fakecountC, int fakecountD, int fakecountE)
        {
            if (types.Length == 0)
            {
                return;
            }

            List <string> tipos = new List <string>(types);
            List <string> noneA = new List <string>();
            List <string> noneB = new List <string>();
            List <string> noneC = new List <string>();
            List <string> noneD = new List <string>();
            List <string> noneE = new List <string>();

            if (fakespawnsA[0] != "")
            {
                noneA = new List <string>(fakespawnsA);
            }

            if (fakespawnsB[0] != "")
            {
                noneB = new List <string>(fakespawnsB);
            }

            if (fakespawnsC[0] != "")
            {
                noneC = new List <string>(fakespawnsC);
            }

            if (fakespawnsD[0] != "")
            {
                noneD = new List <string>(fakespawnsD);
            }

            if (fakespawnsE[0] != "")
            {
                noneE = new List <string>(fakespawnsE);
            }

            PremiumSpawner spawner = new PremiumSpawner(npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE, spawnid, mintime, maxtime, Team, walkingrange, homerange, tipos, noneA, noneB, noneC, noneD, noneE);

            spawner.MoveToWorld(new Point3D(x, y, z), map);

            if (TotalRespawn)
            {
                spawner.Respawn();

                if (((PremiumSpawner)spawner).SpawnID == 132)                   // if is ChampionSpawn
                {
                    spawner.BringToHome();
                }
            }

            m_Count++;
        }
        private static void MakeSpawner(string[] types, int x, int y, int z, Map map, TimeSpan mintime, TimeSpan maxtime, int homerange, int spawnrange, int spawnid, int npccount)
        {
            if (types.Length == 0)
            {
                return;
            }

            PremiumSpawner spawner = new PremiumSpawner(npccount, mintime, maxtime, Team, homerange, spawnrange, spawnid, new ArrayList(types));

            spawner.MoveToWorld(new Point3D(x, y, z), map);

            if (TotalRespawn)
            {
                spawner.Respawn();

                if (((PremiumSpawner)spawner).SpawnID == 132)                   // if is ChampionSpawn
                {
                    spawner.BringToHome();
                }
            }

            m_Count++;
        }
Exemple #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile    from        = state.Mobile;
            int       buttonNum   = 0;
            ArrayList currentList = new ArrayList(tempList);
            int       page        = m_page;

            if (info.ButtonID > 0 && info.ButtonID < 10000)
            {
                buttonNum = 1;
            }
            else if (info.ButtonID > 20004)
            {
                buttonNum = 30000;
            }
            else
            {
                buttonNum = info.ButtonID;
            }

            switch (buttonNum)
            {
            case 0:
            {
                //Close
                break;
            }

            case 1:
            {
                selSpawner = currentList[info.ButtonID - 1] as Item;
                SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner);
                break;
            }

            case 10000:
            {
                if (m_page * 10 < currentList.Count)
                {
                    page = m_page += 1;
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 10001:
            {
                if (m_page != 0)
                {
                    page = m_page -= 1;
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 10002:
            {
                //Close
                break;
            }

            case 10003:
            {
                FilterByRegion(from, tempList, from.Region, from.Map, page);
                break;
            }

            case 10004:
            {
                TextRelay oDis = info.GetTextEntry(0);
                string    sDis = (oDis == null ? "" : oDis.Text.Trim());
                if (sDis != "")
                {
                    try
                    {
                        int distance = Convert.ToInt32(sDis);
                        FilterByDistance(tempList, from, distance, page);
                    }
                    catch
                    {
                        from.SendMessage("Distance must be a number");
                        SpawnEditor_OnCommand(from, page, currentList);
                    }
                }
                else
                {
                    from.SendMessage("You must specify a distance");
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 10005:
            {
                from.Location = new Point3D(selSpawner.X, selSpawner.Y, selSpawner.Z);
                SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner);
                break;
            }

            case 10006:
            {
                selSpawner.Delete();
                SpawnEditor_OnCommand(from);
                break;
            }

            case 10007:
            {
                from.SendGump(new PremiumSpawnerGump(selSpawner as PremiumSpawner));
                SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner);
                break;
            }

            case 10008:
            {
                SpawnEditor_OnCommand(from);
                break;
            }

            case 10009:
            {
                TextRelay oSearch = info.GetTextEntry(1);
                string    sSearch = (oSearch == null ? null : oSearch.Text.Trim());
                SearchByName(tempList, from, sSearch, page);
                break;
            }

            case 10010:
            {
                TextRelay oID = info.GetTextEntry(2);
                string    sID = (oID == null ? "" : oID.Text.Trim());
                if (sID != "")
                {
                    try
                    {
                        int SearchID = Convert.ToInt32(sID);
                        SearchByID(tempList, from, SearchID, page);
                    }
                    catch
                    {
                        from.SendMessage("SpawnID must be a number");
                        SpawnEditor_OnCommand(from, page, currentList);
                    }
                }
                else
                {
                    from.SendMessage("You must specify a SpawnID");
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 20000:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                spawner.CreaturesName = CreateArray(info, state.Mobile);
                break;
            }

            case 20001:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                spawner.BringToHome();
                break;
            }

            case 20002:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                spawner.Respawn();
                break;
            }

            case 20003:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                state.Mobile.SendGump(new PropertiesGump(state.Mobile, spawner));
                break;
            }

            case 30000:
            {
                int buttonID = info.ButtonID - 20004;
                int index    = buttonID / 2;
                int type     = buttonID % 2;

                PremiumSpawner spawner = selSpawner as PremiumSpawner;

                TextRelay entry = info.GetTextEntry(index);

                if (entry != null && entry.Text.Length > 0)
                {
                    if (type == 0)                               // Spawn creature
                    {
                        spawner.Spawn(entry.Text);
                    }
                    else                             // Remove creatures
                    {
                        spawner.RemoveCreatures(entry.Text);
                    }
                    //spawner.RemoveCreaturesA( entry.Text );

                    spawner.CreaturesName = CreateArray(info, state.Mobile);
                }

                break;
            }
            }
        }
        public void DungeonReset()
        {
            IPooledEnumerable eable = m_Stone.GetItemsInRange(m_Stone.Size);

            ArrayList trash = new ArrayList();

            //Here we set all spawners to global values(if bool)
            if (this != null && m_Stone != null) // error check & global bool
            {
                // Find all spawners within the dungeon, and set their values.
                foreach (Item s in eable)
                {
                    if (m_UseGlobalRespawn) // control spawners
                    {
                        if (s is Spawner)
                        {
                            Spawner sp = (Spawner)s;
                            sp.MaxDelay = sp.MinDelay = m_RespawnDelay;
                            sp.Respawn();
                        }
                        else if (s is XmlSpawner) //// comment out if XMLSpawner is not installed
                        {
                            XmlSpawner sp = (XmlSpawner)s;
                            sp.MaxDelay = sp.MinDelay = m_RespawnDelay;
                            sp.Respawn();
                        }
                        else if (s is PremiumSpawner) //// comment out if PremiumSpawner is not installed
                        {
                            PremiumSpawner sp = (PremiumSpawner)s;
                            sp.MaxDelay = sp.MinDelay = m_RespawnDelay;
                            sp.Respawn();
                        }
                    }
                    // add trash to the list
                    if (s.Movable || s is Corpse)
                    {
                        trash.Add(s);
                    }
                    // Lock Dungeon Doors.
                    else if (s is DungeonDoor)
                    {
                        DungeonDoor dd = (DungeonDoor)s;
                        dd.Locked = true;
                    }
                }
            }

            // delete trash and corpses
            for (int i = 0; i < trash.Count; i++)
            {
                ((Item)trash[i]).Delete();
            }

            // Reset AFK list and restart the timers.
            if (m_PlayerMovements != null)
            {
                m_PlayerMovements.Clear();
            }
            if (m_AFKTimer != null)
            {
                if (m_AFKTimer.Running)
                {
                    m_AFKTimer.Stop();
                }
                m_AFKTimer.Start();
            }
        }
Exemple #5
0
        private static void MakeSpawner(string[] types, string[] fakespawnsA, string[] fakespawnsB, string[] fakespawnsC, string[] fakespawnsD, string[] fakespawnsE, int x, int y, int z, Map map, TimeSpan mintime, TimeSpan maxtime, int walkingrange, int homerange, int spawnid, int npccount, int fakecountA, int fakecountB, int fakecountC, int fakecountD, int fakecountE)
        {
            if (types.Length == 0)
            {
                return;
            }

            List <string> tipos = new List <string>(types);
            List <string> noneA = new List <string>();
            List <string> noneB = new List <string>();
            List <string> noneC = new List <string>();
            List <string> noneD = new List <string>();
            List <string> noneE = new List <string>();

            if (fakespawnsA[0] != "")
            {
                noneA = new List <string>(fakespawnsA);
            }

            if (fakespawnsB[0] != "")
            {
                noneB = new List <string>(fakespawnsB);
            }

            if (fakespawnsC[0] != "")
            {
                noneC = new List <string>(fakespawnsC);
            }

            if (fakespawnsD[0] != "")
            {
                noneD = new List <string>(fakespawnsD);
            }

            if (fakespawnsE[0] != "")
            {
                noneE = new List <string>(fakespawnsE);
            }

            PremiumSpawner spawner = new PremiumSpawner(npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE, spawnid, mintime, maxtime, Team, walkingrange, homerange, tipos, noneA, noneB, noneC, noneD, noneE);

            spawner.MoveToWorld(new Point3D(x, y, z), map);

            if (spawner.SpawnID == 9999)
            {
                spawner.MinDelay  = TimeSpan.FromSeconds(1.0);
                spawner.MaxDelay  = TimeSpan.FromSeconds(1.0);
                spawner.NextSpawn = TimeSpan.FromSeconds(1.0);
                spawner.Respawn();
            }
            else if (spawner.SpawnID == 8888)
            {
                spawner.MinDelay  = TimeSpan.FromMinutes(10.0);
                spawner.MaxDelay  = TimeSpan.FromMinutes(15.0);
                spawner.NextSpawn = TimeSpan.FromSeconds(1.0);
                Server.Mobiles.PremiumSpawner.Reconfigure(spawner, true);
            }
            else if (TotalRespawn && spawner.Running == true)
            {
                spawner.Respawn();
            }

            m_Count++;
        }