Пример #1
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:
            {
                selIntelliSpawner = currentList[info.ButtonID - 1] as Item;
                SpawnEditor_OnCommand(from, page, currentList, 1, selIntelliSpawner);
                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(selIntelliSpawner.X, selIntelliSpawner.Y, selIntelliSpawner.Z);
                SpawnEditor_OnCommand(from, page, currentList, 1, selIntelliSpawner);
                break;
            }

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

            case 10007:
            {
                from.SendGump(new IntelliSpawnerGump(selIntelliSpawner as IntelliSpawner));
                SpawnEditor_OnCommand(from, page, currentList, 1, selIntelliSpawner);
                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 20000:
            {
                IntelliSpawner spawner = selIntelliSpawner as IntelliSpawner;
                spawner.SpawnNames = CreateArray(info, state.Mobile);
                break;
            }

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

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

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

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

                IntelliSpawner spawner = selIntelliSpawner as IntelliSpawner;

                TextRelay entry = info.GetTextEntry(index);

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

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

                break;
            }
            }
        }
Пример #2
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 npccount, int fakecountA, int fakecountB, int fakecountC, int fakecountD, int fakecountE)
        {
            if (types.Length == 0)
            {
                return;
            }

            IntelliSpawner spawner;

            if (types[0] != "")
            {
                List <string> tipos = new List <string>(types);

                spawner = new IntelliSpawner(npccount, mintime, maxtime, Team, homerange, tipos);

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

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

                spawner = new IntelliSpawner(fakecountA, mintime, maxtime, Team, homerange, noneA);

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

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

                spawner = new IntelliSpawner(fakecountB, mintime, maxtime, Team, homerange, noneB);

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

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

                spawner = new IntelliSpawner(fakecountC, mintime, maxtime, Team, homerange, noneC);

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

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

                spawner = new IntelliSpawner(fakecountD, mintime, maxtime, Team, homerange, noneD);

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

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

                spawner = new IntelliSpawner(fakecountE, mintime, maxtime, Team, homerange, noneE);

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

            m_Count++;
        }
Пример #3
0
        public void InitializeSelectedRightPanel()
        {
            string spX     = selIntelliSpawner.X.ToString();
            string spY     = selIntelliSpawner.Y.ToString();
            string spnText = "IntelliSpawner at " + spX + ", " + spY;

            AddLabel(350, 65, 52, spnText);

            IntelliSpawner initSpn = selIntelliSpawner as IntelliSpawner;
            int            strNum  = 0;
            string         spns    = "Containing: ";
            string         spnsNEW = "";
            string         spns1   = "";
            string         spns2   = "";
            string         spns3   = "";

            for (int i = 0; i < initSpn.SpawnNames.Count; i++)
            {
                if (strNum == 0)
                {
                    if (i < initSpn.SpawnNames.Count - 1)
                    {
                        if (spns.Length + initSpn.SpawnNames[i].ToString().Length < 50)
                        {
                            spnsNEW += (string)initSpn.SpawnNames[i] + ", ";
                        }
                        else
                        {
                            strNum = 1;
                            spns1 += (string)initSpn.SpawnNames[i] + ", ";
                        }
                    }
                    else
                    {
                        spnsNEW += (string)initSpn.SpawnNames[i];
                    }
                }
                else if (strNum == 1)
                {
                    if (i < initSpn.SpawnNames.Count - 1)
                    {
                        if (spns1.Length + initSpn.SpawnNames[i].ToString().Length < 50)
                        {
                            spns1 += (string)initSpn.SpawnNames[i] + ", ";
                        }
                        else
                        {
                            strNum = 2;
                            spns2 += (string)initSpn.SpawnNames[i] + ", ";
                        }
                    }
                    else
                    {
                        if (spns1.Length + initSpn.SpawnNames[i].ToString().Length < 50)
                        {
                            spns1 += (string)initSpn.SpawnNames[i];
                        }
                        else
                        {
                            strNum = 3;
                            spns2 += (string)initSpn.SpawnNames[i];
                        }
                    }
                }
                else if (strNum == 2)
                {
                    if (i < initSpn.SpawnNames.Count - 1)
                    {
                        if (spns2.Length + initSpn.SpawnNames[i].ToString().Length < 50)
                        {
                            spns2 += (string)initSpn.SpawnNames[i] + ", ";
                        }
                        else
                        {
                            strNum = 3;
                            spns3 += (string)initSpn.SpawnNames[i] + ", ";
                        }
                    }
                    else
                    {
                        if (spns2.Length + initSpn.SpawnNames[i].ToString().Length < 50)
                        {
                            spns2 += (string)initSpn.SpawnNames[i];
                        }
                        else
                        {
                            strNum = 4;
                            spns3 += (string)initSpn.SpawnNames[i];
                        }
                    }
                }
                else if (strNum == 3)
                {
                    if (i < initSpn.SpawnNames.Count - 1)
                    {
                        spns3 += (string)initSpn.SpawnNames[i] + ", ";
                    }
                    else
                    {
                        spns3 += (string)initSpn.SpawnNames[i];
                    }
                }
            }

            AddLabel(275, 85, 52, spns);
            AddHtml(280, 110, 300, 200, spnsNEW, true, true);
            if (spns1 != "")
            {
                AddLabel(275, 105, 200, spns1);
            }

            if (spns2 != "")
            {
                AddLabel(275, 125, 200, spns2);
            }

            if (spns3 != "")
            {
                AddLabel(275, 145, 200, spns3);
            }

            AddLabel(320, 320, 52, "Go to IntelliSpawner");
            AddButton(525, 320, 0x15E1, 0x15E5, 10005, GumpButtonType.Reply, 1);
            AddLabel(320, 345, 52, "Delete Selected IntelliSpawner");
            AddButton(525, 345, 0x15E1, 0x15E5, 10006, GumpButtonType.Reply, 0);
            AddLabel(320, 370, 52, "Edit Spawns");
            AddButton(525, 370, 0x15E1, 0x15E5, 10007, GumpButtonType.Reply, 0);
        }