Пример #1
0
        public void NPCEvil(Mobile m, QuestTome book)
        {
            int  c      = 0;
            bool picked = false;

            while (!picked)
            {
                ArrayList npcs = new ArrayList();
                foreach (Mobile msg in World.Mobiles.Values)
                {
                    if (msg is EpicCharacter && msg.Name != "the Great Earth Serpent")
                    {
                        if (((EpicCharacter)msg).MyAlignment == "evil")
                        {
                            npcs.Add(msg); c++;
                        }
                    }
                }

                int o = Utility.RandomMinMax(0, c);

                for (int i = 0; i < npcs.Count; ++i)
                {
                    EpicCharacter dude = ( EpicCharacter )npcs[i];

                    if (i == o)
                    {
                        Point3D WhoLoc = new Point3D(dude.MyX, dude.MyY, 0);
                        Map     WhoMap = dude.MyWorld;

                        string my_location = "";

                        int  xLong = 0, yLat = 0;
                        int  xMins = 0, yMins = 0;
                        bool xEast = false, ySouth = false;

                        if (Sextant.Format(WhoLoc, WhoMap, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                        {
                            my_location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                        }

                        book.QuestTomeWorldEvil  = Server.Misc.Worlds.GetMyWorld(WhoMap, WhoLoc, dude.MyX, dude.MyY);
                        book.QuestTomeNPCEvil    = dude.Name + " " + dude.Title;
                        book.QuestTomeLocateEvil = my_location;
                        picked = true;
                    }
                }
            }
        }
Пример #2
0
        public void FindMessage(Mobile m)
        {
            if (Deleted || !m.Alive)
            {
                return;
            }

            CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(m);

            string msgQuest = DB.MessageQuest;

            string myHomeWorld = "the Land of Sosaria";

            bool GiveMail = true;

            if (msgQuest != "" && msgQuest != null)
            {
                ArrayList targets = new ArrayList();
                foreach (Item item in World.Items.Values)
                {
                    if (item is CourierMail)
                    {
                        if (((CourierMail)item).owner == m)
                        {
                            GiveMail = false;
                            m.AddToBackpack(item);
                            m.PlaySound(0x249);
                            SayTo(m, "Hmmm...I already gave you a message from " + msgQuest + ". Here is a another if you lost it.");
                        }
                    }
                }
            }

            if (GiveMail)
            {
                CourierMail envelope = new CourierMail(m);
                envelope.owner = m;
                string alignment = "good";

                int c = 0;

                ArrayList npcs = new ArrayList();
                foreach (Mobile msg in World.Mobiles.Values)
                {
                    if (msg is EpicCharacter && msg.Name != "the Great Earth Serpent")
                    {
                        string tWorld = Worlds.GetMyWorld(msg.Map, msg.Location, msg.X, msg.Y);

                        if ((((EpicCharacter)msg).MyAlignment == "neutral" || ((EpicCharacter)msg).MyAlignment == "evil") && (m.Karma < 0 || ((PlayerMobile)m).KarmaLocked == true))
                        {
                            if (tWorld == "the Land of Sosaria")
                            {
                                npcs.Add(msg); c++;
                            }
                            else if (CharacterDatabase.GetDiscovered(m, tWorld))
                            {
                                npcs.Add(msg); c++;
                            }
                        }
                        else if ((((EpicCharacter)msg).MyAlignment == "neutral" || ((EpicCharacter)msg).MyAlignment == "good") && m.Karma >= 0)
                        {
                            if (tWorld == "the Land of Sosaria")
                            {
                                npcs.Add(msg); c++;
                            }
                            else if (CharacterDatabase.GetDiscovered(m, tWorld))
                            {
                                npcs.Add(msg); c++;
                            }
                        }
                        else
                        {
                            if (tWorld == "the Land of Sosaria")
                            {
                                npcs.Add(msg); c++;
                            }
                            else if (CharacterDatabase.GetDiscovered(m, tWorld))
                            {
                                npcs.Add(msg); c++;
                            }
                        }
                    }
                }

                int o = Utility.RandomMinMax(0, c);

                for (int i = 0; i < npcs.Count; ++i)
                {
                    EpicCharacter dude = ( EpicCharacter )npcs[i];

                    if (i == o)
                    {
                        Point3D WhoLoc = new Point3D(dude.MyX, dude.MyY, 0);
                        Map     WhoMap = dude.MyWorld;

                        string my_location = "";

                        int  xLong = 0, yLat = 0;
                        int  xMins = 0, yMins = 0;
                        bool xEast = false, ySouth = false;

                        if (Sextant.Format(WhoLoc, WhoMap, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                        {
                            my_location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                        }

                        myHomeWorld           = Server.Misc.Worlds.GetMyWorld(WhoMap, WhoLoc, dude.MyX, dude.MyY);
                        envelope.ForWho       = dude.Name + " " + dude.Title;
                        envelope.ForWhere     = my_location;
                        envelope.ForAlignment = dude.MyAlignment;
                        alignment             = dude.MyAlignment;
                        DB.MessageQuest       = dude.Name;
                    }
                }

                PickSearchLocation(envelope, "No Dungeon Yet", m, alignment, myHomeWorld);

                m.AddToBackpack(envelope);
                m.PlaySound(0x249);
                SayTo(m, "Hmmm...I do have a message for you. Here you go.");
            }
        }