Example #1
0
        private static void World_Login(LoginEventArgs args)
        {
            Mobile m = args.Mobile;

            (( PlayerMobile )m).BankBox.MaxItems = 201;

            if (m.Hue >= 33770)
            {
                m.Hue = m.Hue - 32768;
            }

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

            if (DB == null)
            {
                CharacterDatabase MyDB = new CharacterDatabase();
                MyDB.CharacterOwner = m;
                m.BankBox.DropItem(MyDB);
            }

            CharacterDatabase DataBase = Server.Items.CharacterDatabase.GetDB(m);               // LET US SET THEIR ORIGINAL COLORS FOR LATER USE

            if (DataBase.CharHue > 0)
            {
                if (DataBase.CharHue >= 33770)
                {
                    DataBase.CharHue = DataBase.CharHue - 32768;
                }
            }
            else
            {
                DataBase.CharHue     = m.Hue;
                DataBase.CharHairHue = m.HairHue;
            }

            if (!MyServerSettings.AllowCustomTitles())
            {
                m.Title = null;
            }

            LoggingFunctions.LogAccess(m, "login");

            if (m.Region.GetLogoutDelay(m) == TimeSpan.Zero && !m.Poisoned)
            {
                m.Hits = 1000; m.Stam = 1000; m.Mana = 1000;
            }                                                                                                                               // FULLY REST UP ON LOGIN


            if (m.FindItemOnLayer(Layer.Shoes) != null)
            {
                Item shoes = m.FindItemOnLayer(Layer.Shoes);
                if (shoes is BootsofHermes)
                {
                    if (Server.Misc.MyServerSettings.NoMountsInCertainRegions() && Server.Mobiles.AnimalTrainer.IsNoMountRegion(m, Region.Find(m.Location, m.Map)))
                    {
                        m.Send(SpeedControl.Disable);
                        shoes.Weight = 5.0;
                        m.SendMessage("These boots seem to have their magic diminished here.");
                    }
                    else
                    {
                        m.Send(SpeedControl.MountSpeed);
                        shoes.Weight = 3.0;
                    }
                }
            }

            if (Server.Misc.MyServerSettings.NoMountsInCertainRegions() && Server.Mobiles.AnimalTrainer.IsNoMountRegion(m, Region.Find(m.Location, m.Map)) && !Server.Mobiles.AnimalTrainer.AllowMagicSpeed(m, Region.Find(m.Location, m.Map)))
            {
                m.Send(SpeedControl.Disable);
                Server.Spells.Mystic.WindRunner.RemoveEffect(m);
                Server.Spells.Syth.SythSpeed.RemoveEffect(m);
                Server.Spells.Jedi.Celerity.RemoveEffect(m);
            }
        }
Example #2
0
        public static Town FromLocation(Point3D location, Map map)
        {
            Region reg = Region.Find(location, map);

            return(FromRegion(reg));
        }
        public static void ImportWorld()
        {
            ArrayList retry = new ArrayList(), houses = new ArrayList();
            int       count = 0;

            foreach (Account a in Accounts.List.Values)
            {
                for (int i = 0; i < 6; i++)
                {
                    if (a[i] != null)
                    {
                        a[i].Player = false;
                    }

                    a[i] = null;
                }
            }

            using (StreamReader r = new StreamReader("world.txt", System.Text.Encoding.ASCII))
            {
                string  line;
                IEntity curObj  = null;
                Mobile  prevMob = null;
                Type    curType = null;

                while ((line = r.ReadLine()) != null)
                {
                    if (string.IsNullOrEmpty(line))
                    {
                        continue;
                    }

                    string[] parts = line.Split(new char[] { '=' }, 3, StringSplitOptions.None);

                    if (parts.Length != 3)
                    {
                        Console.WriteLine("Warning! Wrong number of fields: {0} -- {1}", parts.Length, line);
                        continue;
                    }

                    /*if (parts[0] == "Profile")
                     * {
                     *  long prevPos = r.BaseStream.Position;
                     *  while ((line = r.ReadLine()) != null)
                     *  {
                     *      string[] split = line.Split(new char[] { '=' }, 3, StringSplitOptions.None);
                     *
                     *      if (split.Length != 3)
                     *      {
                     *          parts[2] += "\n" + line;
                     *          prevPos = r.BaseStream.Position;
                     *      }
                     *      else
                     *      {
                     *          r.BaseStream.Seek(prevPos, SeekOrigin.Begin);
                     *          break;
                     *      }
                     *  }
                     * }*/

                    try
                    {
                        if (parts[0] == "Object")
                        {
                            PostProcess(curObj);
                            parts[1] = TranslateType(parts[1]);
                            curObj   = null;
                            curType  = ScriptCompiler.FindTypeByFullName(parts[1], true);

                            if (curType == null)
                            {
                                InsertError("{0}: Type missing", parts[1]);
                                continue;
                            }

                            Serial oldSer = Utility.ToInt32(parts[2]);

                            /*if (IsType(curType, typeof(Item)))
                             *  Serial.NewItem = Utility.ToInt32(parts[2]) - 1;
                             * else if (IsType(curType, typeof(Mobile) ))
                             *  Serial.NewMobile = Utility.ToInt32(parts[2]) - 1;
                             */
                            try { curObj = Activator.CreateInstance(curType, new object[0]) as IEntity; } catch { }

                            if (curObj == null)
                            {
                                try
                                {
                                    if (curType == typeof(BankBox) && prevMob != null)
                                    {
                                        curObj = new BankBox(prevMob);
                                    }
                                    //curObj = Activator.CreateInstance( curType, new object[1]{prevMob} ) as IEntity;
                                }
                                catch { }

                                if (curObj == null)
                                {
                                    InsertError("{0}: Unable to construct", parts[1]);
                                    continue;
                                }
                            }

                            if (curObj is Mobile)
                            {
                                _Mobiles[oldSer] = curObj;
                                prevMob          = (Mobile)curObj;
                            }
                            else if (curObj is Item)
                            {
                                _Items[oldSer] = curObj;
                            }

                            count++;
                            if ((count % 10000) == 0)
                            {
                                Console.WriteLine("Completed {0} objects so far", count - 1);
                            }
                        }
                        else if (parts[0] == "House")
                        {
                            string type, loc, map, owner;

                            type  = r.ReadLine();
                            loc   = r.ReadLine();
                            map   = r.ReadLine();
                            owner = r.ReadLine();
                            houses.Add(new string[] { type, loc, map, owner });
                        }
                        else if (parts[0] == "Skills")
                        {
                            Mobile m = FindMobile(Utility.ToInt32(parts[2]));

                            while ((line = r.ReadLine()) != null)
                            {
                                if (line == "EndSkills" || line == "")
                                {
                                    break;
                                }

                                parts = line.Split(new char[] { '=' }, 3, StringSplitOptions.None);

                                if (parts.Length != 3)
                                {
                                    continue;
                                }

                                SkillName name = (SkillName)Enum.Parse(typeof(SkillName), parts[0]);

                                m.Skills[name].BaseFixedPoint = Utility.ToInt32(parts[2]);
                            }
                        }
                        else if (parts[0] == "RuneBookEntry")
                        {
                            if (curObj is Runebook)
                            {
                                Point3D pt = Point3D.Parse(parts[1]);

                                bool okay = true;
                                if (Spells.SpellHelper.IsAnyT2A(Map.Felucca, pt))
                                {
                                    okay = false;
                                }
                                else if (Spells.SpellHelper.IsFeluccaDungeon(Map.Felucca, pt))
                                {
                                    Regions.DungeonRegion reg = Region.Find(pt, Map.Felucca) as Regions.DungeonRegion;

                                    if (reg != null)
                                    {
                                        if (reg.Name == "Fire" || reg.Name == "Ice" || reg.Name == "Orc Cave" || reg.Name == "Terathan Keep")
                                        {
                                            okay = false;
                                        }
                                    }
                                }

                                if (okay)
                                {
                                    ((Runebook)curObj).Entries.Add(new RunebookEntry(pt, Map.Felucca, parts[2], null));
                                }
                            }
                        }
                        else if (curObj != null)
                        {
                            DoProperty(curObj, curType, parts, retry);
                        }
                    }
                    catch (Exception e)
                    {
                        InsertError("Exception '{0}' for line '{1}'", e.Message, line);
                    }
                }

                PostProcess(curObj);
            }

            foreach (object[] list in retry)
            {
                DoProperty(list[0], list[1] as Type, list[2] as string[], null);
            }

            foreach (string[] list in houses)
            {
                list[0] = TranslateType(list[0]);
                Type    deedType = ScriptCompiler.FindTypeByFullName(list[0], true);
                Point3D loc      = Point3D.Parse(list[1]);
                Map     map      = Map.Parse(list[2]);
                Mobile  owner    = FindMobile(Utility.ToInt32(list[3]));

                if (deedType == null || !deedType.IsSubclassOf(typeof(HouseDeed)))
                {
                    InsertError("{0}: Type missing\n", list[0]);
                    continue;
                }

                if (owner == null || map == null || map == Map.Internal || loc == Point3D.Zero)
                {
                    InsertError("House properties messed up (owner probably missing)\n");
                    continue;
                }

                HouseDeed deed = null;
                try { deed = Activator.CreateInstance(deedType, new object[0]) as HouseDeed; }
                catch { }

                if (deed == null)
                {
                    InsertError("Failed to create deed {0}\n", list[0]);
                    continue;
                }

                BaseHouse house = deed.GetHouse(owner);
                house.MoveToWorld(loc, map);
                deed.Delete();
            }

            Console.WriteLine("Import complete, imported {0} objects.", count);
            Console.WriteLine("\nErrors:");
            foreach (string err in _Errors.Keys)
            {
                Console.WriteLine("{0}  (Count={1})", err, _Errors[err]);
            }

            Console.WriteLine("Done.  Saving...");
            World.Save();

            Console.WriteLine("Press enter to quit.  REMOVE THIS SCRIPT BEFORE RUNNING THE SERVER AGAIN");
            Console.ReadLine();
            System.Diagnostics.Process.GetCurrentProcess().Kill();
        }
        private static void Save(Mobile from, string region)
        {
            World.Broadcast(0x35, true, "Spawns are being saved, please wait.");
            DateTime  startTime = DateTime.Now;
            int       count     = 0;
            ArrayList itemssave = new ArrayList();

            foreach (Item itemsave in World.Items.Values)
            {
                if (itemsave is PremiumSpawner && (region == null || region == ""))
                {
                    itemssave.Add(itemsave);
                    count += 1;
                }
                else if (itemsave is PremiumSpawner && (((Region)Region.Find(itemsave.Location, itemsave.Map)).Name.ToLower() == region && itemsave.Map == from.Map))
                {
                    itemssave.Add(itemsave);
                    count += 1;
                }
            }

            if (!Directory.Exists("Data/Monsters"))
            {
                Directory.CreateDirectory("Data/Monsters");
            }


            using (StreamWriter op = new StreamWriter("Data/Monsters/spawns.map"))
            {
                foreach (PremiumSpawner itemsave2 in itemssave)
                {
                    int mapnumber = 0;
                    switch (itemsave2.Map.ToString())
                    {
                    case "Felucca":
                        mapnumber = 1;
                        break;

                    case "Trammel":
                        mapnumber = 2;
                        break;

                    case "Ilshenar":
                        mapnumber = 3;
                        break;

                    case "Malas":
                        mapnumber = 4;
                        break;

                    case "Tokuno":
                        mapnumber = 5;
                        break;

                    default:
                        mapnumber = 6;
                        Console.WriteLine("Monster Parser: Warning, unknown map {0}", itemsave2.Map);
                        break;
                    }

                    string   timer1a = itemsave2.MinDelay.ToString();
                    string[] timer1b = timer1a.Split(':');
                    int      timer1c = (Utility.ToInt32(timer1b[0]) * 60) + Utility.ToInt32(timer1b[1]);

                    string   timer2a = itemsave2.MaxDelay.ToString();
                    string[] timer2b = timer2a.Split(':');
                    int      timer2c = (Utility.ToInt32(timer2b[0]) * 60) + Utility.ToInt32(timer2b[1]);

                    string towrite = "* " + itemsave2.CreaturesName[0];

                    for (int i = 1; i < itemsave2.CreaturesName.Count; ++i)
                    {
                        towrite = towrite + ":" + itemsave2.CreaturesName[i].ToString();
                    }

                    op.WriteLine(towrite + " {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}", itemsave2.X, itemsave2.Y, itemsave2.Z, mapnumber, timer1c, timer2c, itemsave2.HomeRange, itemsave2.SpawnRange, itemsave2.SpawnID, itemsave2.Count);
                }
            }

            DateTime endTime = DateTime.Now;

            World.Broadcast(0x35, true, "{0} spawns have been saved. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds);
        }
Example #5
0
        private static void CityUpgrade_OnCommand(CommandEventArgs e)
        {
            Mobile from     = e.Mobile;
            double Fversion = Convert.ToDouble(PlayerGovernmentSystem.FileVersion);

            if (PlayerGovernmentSystem.FileVersion == PlayerGovernmentSystem.SystemVersion)
            {
                from.SendMessage("The system is current.  No upgrade is necessary.");
            }
            else
            {
                for (int q = 0; q < Versions.Length; q++)
                {
                    double current = Convert.ToDouble(Versions[q]);

                    if (current <= Fversion)
                    {
                        continue;
                    }
                    else
                    {
                        switch (q)
                        {
                        case 0:                         // 2.21
                        {
                            ArrayList        list   = new ArrayList(World.Items.Values);
                            List <BaseAddon> addons = new List <BaseAddon>();
                            for (int i = 0; i < list.Count; i++)
                            {
                                if (list[i] is BaseAddon)
                                {
                                    BaseAddon addn = (BaseAddon)list[i];
                                    Point3D   p    = new Point3D(addn.Location);
                                    Map       m    = addn.Map;
                                    if (Region.Find(p, m) is PlayerCityRegion)
                                    {
                                        addons.Add(addn);
                                    }
                                }
                            }


                            for (int i = 0; i < list.Count; i++)
                            {
                                if (list[i] is CityManagementStone)
                                {
                                    CityManagementStone stone = (CityManagementStone)list[i];
                                    stone.AddOns = new ArrayList();
                                    Region r = stone.PCRegion;

                                    if (addons.Count > 0)
                                    {
                                        for (int j = 0; j < addons.Count; j++)
                                        {
                                            Point3D p    = new Point3D(addons[j].Location);
                                            Map     m    = addons[j].Map;
                                            Type    type = addons[j].GetType();

                                            if (Region.Find(p, m) == r && !Server.CityTypes.IsCityType(type))
                                            {
                                                stone.AddOns.Add(addons[j]);
                                            }
                                        }
                                    }
                                    stone.VerifyAddons();
                                    stone.CheckVendors(false);
                                }
                            }
                            break;
                        }
                        }
                    }
                }
                World.Save();

                using (StreamWriter sw = new StreamWriter(Path.Combine(Core.BaseDirectory, "Data/GovernmentVersion.xml")))
                {
                    XmlTextWriter xml = new XmlTextWriter(sw);
                    xml.Formatting  = Formatting.Indented;
                    xml.IndentChar  = '\t';
                    xml.Indentation = 1;
                    xml.WriteStartDocument(true);
                    xml.WriteStartElement("Version");
                    xml.WriteString(PlayerGovernmentSystem.SystemVersion);
                    xml.WriteEndElement();
                    xml.Close();
                }

                from.SendMessage("City System successfully upgraded to {0}", PlayerGovernmentSystem.SystemVersion);
                Console.WriteLine("Government system successfully upgraded to version {0}", PlayerGovernmentSystem.SystemVersion);
            }
        }
Example #6
0
 public static bool CanTravelTo(Mobile m, Point3D p, Map map)
 {
     return(!(Region.Find(p, map) is DungeonRegion) && !SpellHelper.IsAnyT2A(map, p) && !SpellHelper.IsIlshenar(map, p));
 }
Example #7
0
 public static void RemovePaladinsAndKrakens()
 {
     Remove("HirePaladin");
     Remove("Kraken", sp => !Region.Find(sp.Location, sp.Map).IsPartOf("Shame"));
     ToConsole("Paladins and Krakens removed from spawners.");
 }
Example #8
0
        public void OnPlacement(PlayerMobile player, Point3D location)
        {
            if (player == null)
            {
                return;
            }
            if (!player.Alive)
            {
                return;
            }
            if (Deleted)
            {
                return;
            }

            else if (!IsChildOf(player.Backpack))
            {
                player.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.

                LaunchGump(player);
            }

            else
            {
                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                if (player.AccessLevel < AccessLevel.GameMaster && map != Map.Felucca)
                {
                    player.SendLocalizedMessage(1043284); // A ship can not be created here.

                    LaunchGump(player);
                    return;
                }

                if (player.Region.IsPartOf(typeof(HouseRegion)) || BaseShip.FindShipAt(player, player.Map) != null)
                {
                    player.SendLocalizedMessage(1010568, null, 0x25); // You may not place a ship while on another ship or inside a house.

                    LaunchGump(player);
                    return;
                }

                Region region = Region.Find(location, map);

                if (region.IsPartOf(typeof(DungeonRegion)))
                {
                    player.SendLocalizedMessage(502488); // You can not place a ship inside a dungeon.

                    LaunchGump(player);
                    return;
                }

                if (region.IsPartOf(typeof(HouseRegion)))
                {
                    player.SendLocalizedMessage(1042549); // A ship may not be placed in this area.

                    LaunchGump(player);
                    return;
                }

                if (player.GetDistanceToSqrt(location) > 10)
                {
                    player.SendMessage("You cannot place a ship that far away from land.");

                    LaunchGump(player);
                    return;
                }

                foreach (BaseShip shipInstance in BaseShip.m_Instances)
                {
                    if (shipInstance.Owner == player)
                    {
                        player.SendMessage("You already have a ship at sea.");

                        LaunchGump(player);
                        return;
                    }
                }

                BaseShip ship = (BaseShip)Activator.CreateInstance(ShipType);

                if (ship == null)
                {
                    LaunchGump(player);
                    return;
                }

                location = new Point3D(location.X - m_Offset.X, location.Y - m_Offset.Y, location.Z - m_Offset.Z);

                Direction newDirection     = Direction.North;
                int       shipFacingItemID = -1;

                switch (player.Direction)
                {
                case Direction.North:
                    newDirection     = Direction.North;
                    shipFacingItemID = ship.NorthID;
                    break;

                case Direction.Up:
                    newDirection     = Direction.North;
                    shipFacingItemID = ship.NorthID;
                    break;

                case Direction.East:
                    newDirection     = Direction.East;
                    shipFacingItemID = ship.EastID;
                    break;

                case Direction.Right:
                    newDirection     = Direction.East;
                    shipFacingItemID = ship.EastID;
                    break;

                case Direction.South:
                    newDirection     = Direction.South;
                    shipFacingItemID = ship.SouthID;
                    break;

                case Direction.Down:
                    newDirection     = Direction.South;
                    shipFacingItemID = ship.SouthID;
                    break;

                case Direction.West:
                    newDirection     = Direction.West;
                    shipFacingItemID = ship.WestID;
                    break;

                case Direction.Left:
                    newDirection     = Direction.West;
                    shipFacingItemID = ship.WestID;
                    break;

                default:
                    newDirection     = Direction.North;
                    shipFacingItemID = ship.NorthID;
                    break;
                }

                if (BaseShip.IsValidLocation(location, map) && ship.CanFit(location, map, shipFacingItemID))
                {
                    ship.Owner = player;

                    BaseShip.PushDeedStoredPropertiesToShip(this, ship);

                    ship.DecayTime = DateTime.UtcNow + ship.ShipDecayDelay;
                    ship.Anchored  = true;
                    ship.SetFacing(newDirection);

                    ship.MoveToWorld(location, map);

                    Delete();

                    ShipRune shipRune = new ShipRune(ship, player);
                    ship.m_ShipRune = shipRune;

                    ShipRune shipBankRune = new ShipRune(ship, player);
                    ship.m_ShipBankRune = shipBankRune;

                    bool addedToPack = false;
                    bool addedToBank = false;

                    if (player.AddToBackpack(shipRune))
                    {
                        addedToPack = true;
                    }

                    BankBox bankBox = player.FindBankNoCreate();

                    if (bankBox != null)
                    {
                        if (bankBox.Items.Count < bankBox.MaxItems)
                        {
                            bankBox.AddItem(shipBankRune);
                            addedToBank = true;
                        }
                    }

                    string message = "You place the ship at sea. A ship rune has been placed both in your bankbox and your backpack.";

                    if (!addedToPack && !addedToBank)
                    {
                        message = "You place the ship at sea. However, there was no room in neither your bankbox nor your backpack to place ship runes.";
                    }

                    else if (!addedToPack)
                    {
                        message = "You place the ship at sea. A ship rune was placed in your bankbox, however, there was no room in your backpack to place a ship rune.";
                    }

                    else if (!addedToBank)
                    {
                        message = "You place the ship at sea. A ship rune was placed in your backpack, however, there was no room in your bankbox to place a ship rune.";
                    }

                    player.SendMessage(message);

                    ShipGumpObject shipGumpObject = new ShipGumpObject(player, ship, null);

                    player.CloseGump(typeof(ShipGump));
                    player.SendGump(new ShipGump(player, shipGumpObject));
                }

                else
                {
                    ship.Delete();
                    player.SendMessage("A ship cannot be placed there. You may change your facing to change the direction of the ship placement.");

                    LaunchGump(player);
                }
            }
        }
Example #9
0
        private static void Save(Mobile from, string region)
        {
            World.Broadcast(0x35, true, "Spawns are being saved, please wait.");
            DateTime  startTime = DateTime.Now;
            int       count     = 0;
            ArrayList itemssave = new ArrayList();

            foreach (Item itemsave in World.Items.Values)
            {
                Region re      = Region.Find(itemsave.Location, itemsave.Map);
                string regname = re.ToString().ToLower();

                if (itemsave is PremiumSpawner && (region == null || region == ""))
                {
                    itemssave.Add(itemsave);
                    count += 1;
                }

                else if (itemsave is PremiumSpawner && itemsave.Map == from.Map)
                {
                    if (regname == region)
                    {
                        itemssave.Add(itemsave);
                        count += 1;
                    }
                }
            }

            if (!Directory.Exists("Data/Monsters"))
            {
                Directory.CreateDirectory("Data/Monsters");
            }

            using (StreamWriter op = new StreamWriter("Data/Monsters/spawns.map"))
            {
                foreach (PremiumSpawner itemsave2 in itemssave)
                {
                    int mapnumber = 0;
                    switch (itemsave2.Map.ToString())
                    {
                    case "Felucca":
                        mapnumber = 1;
                        break;

                    case "Trammel":
                        mapnumber = 2;
                        break;

                    case "Ilshenar":
                        mapnumber = 3;
                        break;

                    case "Malas":
                        mapnumber = 4;
                        break;

                    case "Tokuno":
                        mapnumber = 5;
                        break;

                    default:
                        mapnumber = 6;
                        Console.WriteLine("Monster Parser: Warning, unknown map {0}", itemsave2.Map);
                        break;
                    }

                    string   timer1a = itemsave2.MinDelay.ToString();
                    string[] timer1b = timer1a.Split(':');
                    int      timer1c = (Utility.ToInt32(timer1b[0]) * 60) + Utility.ToInt32(timer1b[1]);

                    string   timer2a = itemsave2.MaxDelay.ToString();
                    string[] timer2b = timer2a.Split(':');
                    int      timer2c = (Utility.ToInt32(timer2b[0]) * 60) + Utility.ToInt32(timer2b[1]);

                    string towrite  = "";
                    string towriteA = "";
                    string towriteB = "";
                    string towriteC = "";
                    string towriteD = "";
                    string towriteE = "";

                    if (itemsave2.CreaturesName.Count > 0)
                    {
                        towrite = itemsave2.CreaturesName[0].ToString();
                    }

                    if (itemsave2.SubSpawnerA.Count > 0)
                    {
                        towriteA = itemsave2.SubSpawnerA[0].ToString();
                    }

                    if (itemsave2.SubSpawnerB.Count > 0)
                    {
                        towriteB = itemsave2.SubSpawnerB[0].ToString();
                    }

                    if (itemsave2.SubSpawnerC.Count > 0)
                    {
                        towriteC = itemsave2.SubSpawnerC[0].ToString();
                    }

                    if (itemsave2.SubSpawnerD.Count > 0)
                    {
                        towriteD = itemsave2.SubSpawnerD[0].ToString();
                    }

                    if (itemsave2.SubSpawnerE.Count > 0)
                    {
                        towriteE = itemsave2.SubSpawnerE[0].ToString();
                    }

                    for (int i = 1; i < itemsave2.CreaturesName.Count; ++i)
                    {
                        if (itemsave2.CreaturesName.Count > 0)
                        {
                            towrite = towrite + ":" + itemsave2.CreaturesName[i].ToString();
                        }
                    }

                    for (int i = 1; i < itemsave2.SubSpawnerA.Count; ++i)
                    {
                        if (itemsave2.SubSpawnerA.Count > 0)
                        {
                            towriteA = towriteA + ":" + itemsave2.SubSpawnerA[i].ToString();
                        }
                    }

                    for (int i = 1; i < itemsave2.SubSpawnerB.Count; ++i)
                    {
                        if (itemsave2.SubSpawnerB.Count > 0)
                        {
                            towriteB = towriteB + ":" + itemsave2.SubSpawnerB[i].ToString();
                        }
                    }

                    for (int i = 1; i < itemsave2.SubSpawnerC.Count; ++i)
                    {
                        if (itemsave2.SubSpawnerC.Count > 0)
                        {
                            towriteC = towriteC + ":" + itemsave2.SubSpawnerC[i].ToString();
                        }
                    }

                    for (int i = 1; i < itemsave2.SubSpawnerD.Count; ++i)
                    {
                        if (itemsave2.SubSpawnerD.Count > 0)
                        {
                            towriteD = towriteD + ":" + itemsave2.SubSpawnerD[i].ToString();
                        }
                    }

                    for (int i = 1; i < itemsave2.SubSpawnerE.Count; ++i)
                    {
                        if (itemsave2.SubSpawnerE.Count > 0)
                        {
                            towriteE = towriteE + ":" + itemsave2.SubSpawnerE[i].ToString();
                        }
                    }

                    op.WriteLine("*|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}", towrite, towriteA, towriteB, towriteC, towriteD, towriteE, itemsave2.X, itemsave2.Y, itemsave2.Z, mapnumber, timer1c, timer2c, itemsave2.HomeRange, itemsave2.SpawnRange, itemsave2.SpawnID, itemsave2.Count, itemsave2.SubCountA, itemsave2.SubCountB, itemsave2.SubCountC, itemsave2.SubCountD, itemsave2.SubCountE);
                }
            }

            DateTime endTime = DateTime.Now;

            World.Broadcast(0x35, true, "{0} spawns have been saved. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds);
        }
Example #10
0
        public static bool CheckIfHouseInCity(Mobile from, Region region)
        {
            if (from == null)
            {
                return(false);
            }

            if (region == null)
            {
                return(false);
            }
            ArrayList list = BaseHouse.GetHouses(from);

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    BaseHouse h = (BaseHouse)list[i];
                    if (h != null)
                    {
                        int X = h.Sign.X;
                        int Y = h.Sign.Y + 1;
                        int Z = h.Sign.Z;


                        Point3D hsp = new Point3D(X, Y, Z);
                        Map     hsm = h.Sign.Map;

                        Region reg = Region.Find(hsp, hsm);

                        if (reg == region)
                        {
                            return(true);
                        }
                        else if (list.Count > 1 && i < (list.Count - 1))
                        {
                            continue;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }

            foreach (BaseHouse h in GetAllHouses(from))
            {
                if (h != null)
                {
                    int X = h.Sign.X;
                    int Y = h.Sign.Y + 1;
                    int Z = h.Sign.Z;


                    Point3D hsp = new Point3D(X, Y, Z);
                    Map     hsm = h.Sign.Map;

                    Region reg = Region.Find(hsp, hsm);
                    if (reg == region)
                    {
                        Mobile  owner = h.Owner;
                        Account acct  = (Account)from.Account;
                        Account acct2 = (Account)owner.Account;
                        if (acct == null || acct2 == null)
                        {
                            return(false);
                        }
                        else if (acct == acct2)
                        {
                            return(true);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
Example #11
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from is PlayerMobile)
            {
                Region reg = Region.Find(from.Location, from.Map);

                if (!IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (CodexOwner != from)
                {
                    from.SendMessage("This Codex does not belong to you so it vanishes!");
                    bool remove = true;
                    foreach (Account a in Accounts.GetAccounts())
                    {
                        if (a == null)
                        {
                            break;
                        }

                        int index = 0;

                        for (int i = 0; i < a.Length; ++i)
                        {
                            Mobile m = a[i];

                            if (m == null)
                            {
                                continue;
                            }

                            if (m == CodexOwner)
                            {
                                m.AddToBackpack(this);
                                remove = false;
                            }

                            ++index;
                        }
                    }
                    if (remove)
                    {
                        this.Delete();
                    }
                }
                else if (HasConvexLense == 0 || HasConcaveLense == 0)
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(LenseGump));
                    from.SendGump(new LenseGump(this, 0));
                }
                else if (!reg.IsPartOf("the Chamber of the Codex"))
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(LenseGump));
                    from.SendGump(new LenseGump(this, 1));
                }
                else
                {
                    from.SendSound(0x55);
                    from.CloseGump(typeof(CodexGump));
                    from.SendGump(new CodexGump(this));
                }
            }
        }
Example #12
0
        public static void GetSpeech(BaseCreature m_Mobile, SpeechEventArgs e)
        {
            string response = null;
            Region reg      = Region.Find(m_Mobile.Location, m_Mobile.Map);

            //Check Job
            //TODO

            //Check Region
            if (reg.Name == "Britain")
            {
                if (m_Mobile.Sophistication == SophisticationLevel.High)
                {
                    response = BritainHigh(m_Mobile, e);
                }
                else if (m_Mobile.Sophistication == SophisticationLevel.Medium)
                {
                    response = BritainMedium(m_Mobile, e);
                }
                else if (m_Mobile.Sophistication == SophisticationLevel.Low)
                {
                    response = BritainLow(m_Mobile, e);
                }
            }

            //Check World
            if (response == null)
            {
                if (m_Mobile.Sophistication == SophisticationLevel.High)
                {
                    response = BritanniaHigh(m_Mobile, e);
                }
                else if (m_Mobile.Sophistication == SophisticationLevel.Medium)
                {
                    response = BritanniaMedium(m_Mobile, e);
                }
                else if (m_Mobile.Sophistication == SophisticationLevel.Low)
                {
                    response = BritanniaLow(m_Mobile, e);
                }
            }

            //No answer found
            if (response == null)
            {
                if (m_Mobile.Sophistication == SophisticationLevel.High)
                {
                    response = DefaultHigh(m_Mobile, e.Mobile);
                }
                else if (m_Mobile.Sophistication == SophisticationLevel.Medium)
                {
                    response = DefaultMedium(m_Mobile, e.Mobile);
                }
                else if (m_Mobile.Sophistication == SophisticationLevel.Low)
                {
                    response = DefaultLow(m_Mobile, e.Mobile);
                }
            }

            m_Mobile.Say(true, response);
        }
Example #13
0
        private static void World_Login(LoginEventArgs args)
        {
            Mobile m = args.Mobile;

            (( PlayerMobile )m).BankBox.MaxItems = 201;

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

            if (DB == null)
            {
                CharacterDatabase MyDB = new CharacterDatabase();
                MyDB.CharacterOwner = m;
                m.BankBox.DropItem(MyDB);
            }

            CharacterDatabase DataBase = Server.Items.CharacterDatabase.GetDB(m);               // LET US SET THEIR ORIGINAL COLORS FOR LATER USE

            if (DataBase.CharHue > 0)
            {
                // DO NOTHING
            }
            else
            {
                DataBase.CharHue     = m.Hue;
                DataBase.CharHairHue = m.HairHue;
            }

            LoggingFunctions.LogAccess(m, "login");

            if (m.Region.GetLogoutDelay(m) == TimeSpan.Zero && !m.Poisoned)
            {
                m.Hits = 1000; m.Stam = 1000; m.Mana = 1000;
            }                                                                                                                               // FULLY REST UP ON LOGIN

            if (m.FindItemOnLayer(Layer.Shoes) != null)
            {
                Item shoes = m.FindItemOnLayer(Layer.Shoes);
                if (shoes is BootsofHermes)
                {
                    if (Server.Misc.DifficultyLevel.NoMountsInCertainRegions() && Server.Mobiles.AnimalTrainer.IsNoMountRegion(Region.Find(m.Location, m.Map)))
                    {
                        m.Send(SpeedControl.Disable);
                        shoes.Weight = 5.0;
                        m.SendMessage("These boots seem to have their magic diminished here.");
                    }
                    else
                    {
                        m.Send(SpeedControl.MountSpeed);
                        shoes.Weight = 3.0;
                    }
                }
            }
        }