Example #1
0
		public static bool IsMLRegion( Region region )
		{
			return region.IsPartOf( "Twisted Weald" )
				|| region.IsPartOf( "Sanctuary" )
				|| region.IsPartOf( "The Prism of Light" )
				|| region.IsPartOf( "The Citadel" )
				|| region.IsPartOf( "Bedlam" )
				|| region.IsPartOf( "Blighted Grove" )
				|| region.IsPartOf( "The Painted Caves" )
				|| region.IsPartOf( "The Palace of Paroxysmus" )
				|| region.IsPartOf( "Labyrinth" );
		}
Example #2
0
        public static bool IsInTokuno(IEntity e)
        {
            if (e == null)
            {
                return(false);
            }

            Region r = Region.Find(e.Location, e.Map);

            if (r.IsPartOf("Fan Dancer's Dojo"))
            {
                return(true);
            }

            if (r.IsPartOf("Yomotsu Mines"))
            {
                return(true);
            }

            return(e.Map == Map.Tokuno);
        }
Example #3
0
        public static Town FromRegion(Region region)
        {
            foreach (Town town in TownList)
            {
                if (region.IsPartOf(town.region))
                {
                    return(town);
                }
            }

            return(null);
        }
Example #4
0
		public static Town FromRegion( Region reg )
		{
			if ( reg.Map != Faction.Facet )
				return null;

			List<Town> towns = Towns;

			for ( int i = 0; i < towns.Count; ++i )
			{
				Town town = towns[i];

				if ( reg.IsPartOf( town.Definition.Region ) )
					return town;
			}

			return null;
		}
Example #5
0
        public static void CheckDrop(BaseCreature bc, Container c)
        {
            if (m_IngredientTable != null)
            {
                foreach (IngredientDropEntry entry in m_IngredientTable)
                {
                    if (entry == null)
                    {
                        continue;
                    }

                    if (entry.Region != null)
                    {
                        string reg = entry.Region;

                        if (reg == "TerMur" && c.Map != Map.TerMur)
                        {
                            continue;
                        }
                        else if (reg == "Abyss" && (c.Map != Map.TerMur || c.X < 235 || c.X > 1155 || c.Y < 40 || c.Y > 1040))
                        {
                            continue;
                        }
                        else if (reg != "TerMur" && reg != "Abyss")
                        {
                            Server.Region r = Server.Region.Find(c.Location, c.Map);

                            if (r == null || !r.IsPartOf(entry.Region))
                            {
                                continue;
                            }
                        }
                    }

                    if (bc.GetType() != entry.CreatureType && !bc.GetType().IsSubclassOf(entry.CreatureType))
                    {
                        continue;
                    }

                    double      toBeat = entry.Chance;
                    List <Item> drops  = new List <Item>();

                    if (bc is BaseVoidCreature)
                    {
                        toBeat *= ((BaseVoidCreature)bc).Stage + 1;
                    }

                    if (entry.DropMultiples)
                    {
                        foreach (Type type in entry.Ingredients)
                        {
                            if (toBeat >= Utility.RandomDouble())
                            {
                                Item drop = Loot.Construct(type);

                                if (drop != null)
                                {
                                    drops.Add(drop);
                                }
                            }
                        }
                    }
                    else if (toBeat >= Utility.RandomDouble())
                    {
                        Item drop = Loot.Construct(entry.Ingredients);

                        if (drop != null)
                        {
                            drops.Add(drop);
                        }
                    }

                    foreach (Item item in drops)
                    {
                        c.DropItem(item);
                    }

                    ColUtility.Free(drops);
                }
            }
        }
Example #6
0
		public virtual bool AcceptsSpawnsFrom(Region region)
		{
			return AllowSpawn() && region != null && (region.IsPartOf(BattleRegion) || region.IsPartOf(SpectateRegion));
		}
Example #7
0
 public static bool IsMondainDungeon(Region region)
 {
     if (region.IsPartOf("Twisted Weald"))
         return true;
     if (region.IsPartOf("Sanctuary"))
         return true;
     if (region.IsPartOf("Prism of Light"))
         return true;
     if (region.IsPartOf("Citadel"))
         return true;
     if (region.IsPartOf("Bedlam"))
         return true;
     if (region.IsPartOf("Blighted Grove"))
         return true;
     if (region.IsPartOf("Painted Caves"))
         return true;
     if (region.IsPartOf("Palace of Paroxysmus"))
         return true;
     if (region.IsPartOf("Labyrinth"))
         return true;
     return false;
 }
Example #8
0
 public static bool IsDungeon(Point3D pnt, Map map, Region region)
 {
     return region.IsPartOf(typeof(DungeonRegion)) || IsMondainDungeon(region) || Server.Spells.SpellHelper.IsTrammelWind(map, pnt) || Server.Spells.SpellHelper.IsFeluccaWind(map, pnt);
 }
Example #9
0
 public static bool IsPartOf <TRegion>(this Region region) where TRegion : Region
 {
     return(region != null && region.IsPartOf(typeof(TRegion)));
 }
Example #10
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 #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));
                }
            }
        }