public RenameBoatPrompt(BaseBoat boat)
 {
     this.m_Boat = boat;
 }
        public static void SailBoat(Mobile from, BaseBoat boat)
        {
            bool newsail = true;

            if (m_SailTime.ContainsKey(from))
            {
                if (m_SailTime[from] >= DateTime.Now)
                {
                    newsail = false;
                }
                else
                {
                    m_SailTime.Remove(from);
                }
            }

            if (newsail)
            {
                int MinLevel = 10;
                int MaxLevel = 100;
                //if (Core.Debug) from.SendMessage("TEST: SAILING IN A BOAT");

                Mobile sailor = from;

                LokaiSkills skils = LokaiSkillUtilities.XMLGetSkills(sailor);

                List <Mobile> crew = GetMobilesOn(boat);

                SuccessRating rating = SuccessRating.LokaiSkillNotEnabled;

                foreach (Mobile seaman in crew)
                {
                    skils = LokaiSkillUtilities.XMLGetSkills(sailor);

                    LokaiSkills seamanAbs = LokaiSkillUtilities.XMLGetSkills(seaman);
                    if (seamanAbs.Sailing.Value > skils.Sailing.Value)
                    {
                        sailor = seaman;
                    }
                    MinLevel--;
                    MaxLevel--;
                    if ((MinLevel == 5 && (boat is SmallBoat || boat is SmallDragonBoat)) ||
                        (MinLevel == 0 && (boat is MediumBoat || boat is MediumDragonBoat)) ||
                        (MinLevel == -5 && (boat is LargeBoat || boat is LargeDragonBoat)))
                    {
                        break;
                    }
                }

                int count = 0;
                foreach (Mobile seaman in crew)
                {
                    if ((count == 5 && (boat is SmallBoat || boat is SmallDragonBoat)) ||
                        (count == 10 && (boat is MediumBoat || boat is MediumDragonBoat)) ||
                        (count == 15 && (boat is LargeBoat || boat is LargeDragonBoat)))
                    {
                        break;
                    }
                    else
                    {
                        count++;
                        skils = LokaiSkillUtilities.XMLGetSkills(seaman);
                        if (seaman != sailor)
                        {
                            rating = LokaiSkillUtilities.CheckLokaiSkill(seaman, skils.Sailing, MinLevel, MaxLevel);
                            if (rating >= SuccessRating.PartialSuccess)
                            {
                                seaman.SendMessage("You did your part.");
                            }
                            else
                            {
                                seaman.SendMessage("You could have been more helpful.");
                            }
                        }
                    }
                }

                skils = LokaiSkillUtilities.XMLGetSkills(sailor);

                rating = LokaiSkillUtilities.CheckLokaiSkill(sailor, skils.Sailing, MinLevel, MaxLevel);
                if (rating <= SuccessRating.Failure)
                {
                    int severity = 25;
                    if (rating == SuccessRating.HazzardousFailure)
                    {
                        severity += 4;
                    }
                    else if (rating == SuccessRating.CriticalFailure)
                    {
                        severity += 8;
                    }

                    bool crash = false;

                    foreach (Mobile seaman in crew)
                    {
                        if (!m_SailTime.ContainsKey(seaman))
                        {
                            m_SailTime.Add(seaman, DateTime.Now.AddSeconds(FAILSECONDS));
                        }
                    }

                    switch (Utility.Random(severity))
                    {
                    case 0:
                    case 1:
                    case 2: boat.StartMove(Direction.Down, true); goto case 24;

                    case 3:
                    case 4:
                    case 5: boat.StartMove(Direction.East, true); goto case 24;

                    case 6:
                    case 7:
                    case 8: boat.StartMove(Direction.Left, true); goto case 24;

                    case 9:
                    case 10:
                    case 11: boat.StartMove(Direction.North, true); goto case 24;

                    case 12:
                    case 13:
                    case 14: boat.StartMove(Direction.Right, true); goto case 24;

                    case 15:
                    case 16:
                    case 17: boat.StartMove(Direction.South, true); goto case 24;

                    case 18:
                    case 19:
                    case 20: boat.StartMove(Direction.Up, true); goto case 24;

                    case 21:
                    case 22:
                    case 23: boat.StartMove(Direction.West, true); goto case 24;

                    case 24: boat.StartTurn(Utility.RandomList(2, -2, -4), false); goto case 99;

                    case 99:
                    {
                        foreach (Mobile mobile in crew)
                        {
                            MightGetSick(mobile);
                        }
                        break;
                    }

                    default: crash = true; break;
                    }

                    if (crash)
                    {
                        boat.LowerAnchor(false);
                        List <Item> items = CheckForItems(boat);

                        BaseDockedBoat dboat = boat.DockedBoat;

                        foreach (Mobile seaman in crew)
                        {
                            seaman.SendMessage("The boat runs aground at some nearby land.");
                            boat.RemoveKeys(seaman);
                            if (seaman == boat.Owner)
                            {
                                if (dboat != null)
                                {
                                    seaman.AddToBackpack(dboat);
                                }
                            }
                        }

                        boat.Delete();

                        foreach (Mobile seaman in crew)
                        {
                            Strand(seaman);
                        }
                        if (items.Count > 0)
                        {
                            for (int v = 0; v < items.Count; v++)
                            {
                                int x = from.X + Utility.Random(7) - 3;
                                int y = from.Y + Utility.Random(7) - 3;
                                items[v].MoveToWorld(new Point3D(x, y, from.Z));
                            }
                        }
                    }
                    else
                    {
                        foreach (Mobile seaman in crew)
                        {
                            seaman.SendMessage("You go off course slightly.");
                        }
                    }
                }
                else
                {
                    //if (Core.Debug) from.SendMessage("TEST: SAILING SUCCESSFUL.");

                    foreach (Mobile seaman in crew)
                    {
                        seaman.SendMessage("You feel the gentle breeze of the open sea.");
                        if (!m_SailTime.ContainsKey(seaman))
                        {
                            m_SailTime.Add(seaman, DateTime.Now.AddSeconds(SAILSECONDS));
                        }
                    }
                }
            }
        }
Beispiel #3
0
 public static void ResetNavPoints(BaseBoat boat)
 {
     boat.NextNavPoint = 0;
     boat.StartCourse(false, false);
 }
 public MagicDockedCarpetF(BaseBoat boat) : base(0xC5, Point3D.Zero, boat)
 {
 }
Beispiel #5
0
 public Hold(BaseBoat boat) : base(0x3EAE)
 {
     m_Boat  = boat;
     Movable = false;
 }
        public void OnPlacement(Mobile from, Point3D p, int itemID, Direction d)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || (Server.Multis.BaseBoat.FindBoatAt(from, from.Map) != null && !(this is RowBoatDeed)))
                {
                    from.SendLocalizedMessage(1010568, null, 0x25);                       // You may not place a ship while on another ship or inside a house.
                    return;
                }

                m_Direction = d;
                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

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

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, itemID))
                {
                    Delete();

                    boat.Owner  = from;
                    boat.ItemID = itemID;

                    if (boat is BaseGalleon)
                    {
                        ((BaseGalleon)boat).SecurityEntry = new SecurityEntry((BaseGalleon)boat);
                    }

                    if (boat.IsClassicBoat)
                    {
                        uint keyValue = boat.CreateKeys(from);

                        if (boat.PPlank != null)
                        {
                            boat.PPlank.KeyValue = keyValue;
                        }

                        if (boat.SPlank != null)
                        {
                            boat.SPlank.KeyValue = keyValue;
                        }
                    }

                    boat.MoveToWorld(p, map);

                    var addon = LighthouseAddon.GetLighthouse(from);

                    if (addon != null)
                    {
                        if (boat.CanLinkToLighthouse)
                        {
                            from.SendLocalizedMessage(1154592); // You have linked your boat lighthouse.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1154597); // Failed to link to lighthouse.
                        }
                    }
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }
Beispiel #7
0
        }                                                           //mooring line

        public MooringLine(BaseBoat boat) : base(5368)
        {
            m_Boat  = boat;
            Movable = false;
        }
Beispiel #8
0
 public DockedGargishGalleon(BaseBoat boat)
     : base(0x24, Point3D.Zero, boat)
 {
 }
Beispiel #9
0
        public void TryDamageBoat()
        {
            Mobile focusMob = m_Fisher;

            if (focusMob == null || !focusMob.Alive)
            {
                focusMob = Combatant as Mobile;
            }

            if (focusMob == null || focusMob.AccessLevel > AccessLevel.Player || !InRange(focusMob.Location, DamageRange) || BaseBoat.FindBoatAt(focusMob, focusMob.Map) == null)
            {
                return;
            }

            BaseBoat boat = BaseBoat.FindBoatAt(focusMob, focusMob.Map);

            if (boat != null && boat is BaseGalleon)
            {
                int range = DamageRange;
                for (int x = this.X - range; x <= this.X + range; x++)
                {
                    for (int y = this.Y - range; y <= this.Y + range; y++)
                    {
                        if (BaseBoat.FindBoatAt(new Point2D(x, y), this.Map) == boat)
                        {
                            DoDamageBoat(boat as BaseGalleon);
                            m_NextBoatDamage = DateTime.UtcNow + BoatDamageCooldown;
                            m_InDamageMode   = false;
                            return;
                        }
                    }
                }
            }
        }
Beispiel #10
0
        public void CheckEnter(BaseBoat boat)
        {
            if (boat == null || Map == null || Map == Map.Internal)
            {
                return;
            }

            //Do not enter corgul region if we aren't in this region anymore
            Region r = Find(boat.Location, boat.Map);

            if (r != null && !r.IsPartOf(this))
            {
                return;
            }

            Map map = Map;

            List <PlayerMobile> pms = new List <PlayerMobile>();
            bool hasMap             = false;

            foreach (PlayerMobile i in boat.GetEntitiesOnBoard().OfType <PlayerMobile>().Where(pm => pm.NetState != null))
            {
                pms.Add(i);
                PlayerMobile pm = i;

                if (pm.Backpack == null)
                {
                    continue;
                }

                Item item = pm.Backpack.FindItemByType(typeof(CorgulIslandMap));
                if (item != null && item is CorgulIslandMap && Contains(((CorgulIslandMap)item).DestinationPoint))
                {
                    hasMap = true;
                    break;
                }
            }

            if (hasMap)
            {
                int x = boat.X - m_Bounds.X;
                int y = boat.Y - m_Bounds.Y;
                int z = map.GetAverageZ(x, y);

                Point3D ePnt = new Point3D(CorgulAltar.CorgulBounds.X + x, CorgulAltar.CorgulBounds.Y + y, 0);

                int offsetX = ePnt.X - boat.X;
                int offsetY = ePnt.Y - boat.Y;
                int offsetZ = map.GetAverageZ(ePnt.X, ePnt.Y) - boat.Z;

                if (boat.CanFit(ePnt, Map, boat.ItemID))
                {
                    boat.Teleport(offsetX, offsetY, offsetZ);

                    //int z = this.Map.GetAverageZ(boat.X, boat.Y);
                    if (boat.Z != 0)
                    {
                        boat.Z = 0;
                    }

                    if (boat.TillerMan != null)
                    {
                        boat.TillerManSay(501425); //Ar, turbulent water!
                    }
                }
                else
                {
                    boat.StopMove(true);
                    boat.SendMessageToAllOnBoard("The boat has struck a coral reef!");
                }
            }
        }
Beispiel #11
0
 public SmallDockedDragonBoat(BaseBoat boat) : base(0x4, Point3D.Zero, boat)
 {
 }
Beispiel #12
0
        public void OnTick(Point3DList path, Direction dir, int i)
        {
            if (path.Count > i)
            {
                Point3D point = path[i];
                int     o     = i - 1;

                Effects.PlaySound(point, Map, 278);
                Effects.PlaySound(point, Map, 279);

                for (int rn = 0; rn < (o * 2) + 1; rn++)
                {
                    int  y = 0, x = 0, y2 = 0, x2 = 0;
                    bool diag = false;
                    switch ((int)dir)
                    {
                    case (int)Direction.Running:
                    case (int)Direction.North: { x = x - o + rn; break; }

                    case 129:
                    case (int)Direction.Right: { x = x - o + rn; y = y - o + rn; break; }

                    case 130:
                    case (int)Direction.East: { y = y - o + rn; break; }

                    case 131:
                    case (int)Direction.Down: { y = y - o + rn; x = x + o - rn; break; }

                    case 132:
                    case (int)Direction.South: { x = x + o - rn; break; }

                    case 133:
                    case (int)Direction.Left: { x = x + o - rn; y = y + o - rn; break; }

                    case 134:
                    case (int)Direction.West: { y = y + o - rn; break; }

                    case (int)Direction.ValueMask:
                    case (int)Direction.Up: { y = y + o - rn; x = x - o + rn; break; }
                    }
                    switch ((int)dir)
                    {
                    case 129:
                    case (int)Direction.Right: { y2++; diag = true; break; }

                    case 131:
                    case (int)Direction.Down: { x2--; diag = true; break; }

                    case 133:
                    case (int)Direction.Left: { y2--; diag = true; break; }

                    case (int)Direction.ValueMask:
                    case (int)Direction.Up: { x2++; diag = true; break; }
                    }

                    Point3D ep  = new Point3D(point.X + x, point.Y + y, point.Z);
                    Point3D ep2 = new Point3D(ep.X + x2, ep.Y + y2, ep.Z);

                    if (diag && i >= (2 * path.Count) / 3)
                    {
                        return;
                    }

                    Point3D p;
                    if (diag && rn < o * 2)
                    {
                        p = ep2;
                    }
                    else
                    {
                        p = ep;
                    }

                    if (Spells.SpellHelper.CheckMulti(p, Map))
                    {
                        BaseBoat boat = BaseBoat.FindBoatAt(p, Map);

                        if (boat != null && !m_HasPushed)
                        {
                            int damage = Utility.RandomMinMax(MinBoatDamage, MaxBoatDamage);
                            boat.OnTakenDamage(this, damage);

                            boat.StartMove(dir, 1, 0x2, boat.SlowDriftInterval, true, false);
                            m_HasPushed = true;
                        }
                        continue;
                    }

                    LandTile t = Map.Tiles.GetLandTile(x, y);

                    if (IsSeaTile(t))
                    {
                        Mobile spawn = new EffectSpawn();
                        spawn.MoveToWorld(p, Map);
                    }
                }
            }
        }
Beispiel #13
0
        public override void OnThink()
        {
            base.OnThink();

            if (m_NextSpawn < DateTime.UtcNow && m_Tentacles.Count < SpawnMax)
            {
                SpawnTentacle();
            }

            if (m_NextTeleport < DateTime.UtcNow && Combatant is Mobile m && !InRange(m, RangeFight) && BaseBoat.FindBoatAt(m, Map) != null)
            {
                DoTeleport(m.Location);
            }
        }
Beispiel #14
0
 public TillerMan(BaseBoat boat) : base(0x3E4E)
 {
     m_Boat  = boat;
     Movable = false;
 }
Beispiel #15
0
		public MediumDockedBoat( BaseBoat boat ) : base( 0x8, Point3D.Zero, boat )
		{
		}
        public void OnPlacement(Mobile from, Point3D p)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                    return;
                }

                BaseBoat boat = Boat;

                if (boat == null)
                {
                    return;
                }

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

                if (BaseBoat.IsValidLocation(p, map) && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.MoveToWorld(p, map);
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }
		public LargeDockedDragonBoat( BaseBoat boat ) : base( 0x14, new Point3D( 0, -1, 0 ), boat )
		{
		}
 public MediumDockedDragonBoat(BaseBoat boat) : base(0xC, Point3D.Zero, boat)
 {
 }
Beispiel #19
0
 public SmallDockedBoat(BaseBoat boat) : base(0x0, Point3D.Zero, boat)
 {
 }
Beispiel #20
0
 public Rudder(BaseBoat boat, Direction d)
     : base(boat)
 {
     SetFacing(d);
 }
Beispiel #21
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Boat == null || from == null)
            {
                return;
            }

            BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map);

            int  range   = boat != null && boat == this.Boat ? 3 : 8;
            bool canMove = false;

            if (m_Boat != null)
            {
                if (m_Boat.Owner == from && m_Boat.Status > 1043010)
                {
                    from.SendLocalizedMessage(1043294); // Your ship's age and contents have been refreshed.
                }

                m_Boat.Refresh();
            }

            if (boat != null && m_Boat != boat)
            {
                if (boat.Owner == from && boat.Status > 1043010)
                {
                    from.SendLocalizedMessage(1043294); // Your ship's age and contents have been refreshed.
                }

                boat.Refresh();
            }

            if (!from.InRange(this.Location, range))
            {
                from.SendLocalizedMessage(500295); //You are too far away to do that.
            }
            else if (!from.InLOS(this.Location))
            {
                from.SendLocalizedMessage(500950); //You cannot see that.
            }
            else if (m_Boat.IsMoving || m_Boat.IsTurning)
            {
                from.SendLocalizedMessage(1116611); //You can't use that while the ship is moving!
            }
            else if (BaseBoat.IsDriving(from))
            {
                from.SendLocalizedMessage(1116610); //You can't do that while piloting a ship!
            }
            else if (BaseHouse.FindHouseAt(from) != null)
            {
                from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
            }
            else if (!m_Boat.IsClassicBoat)
            {
                if (boat == m_Boat && !MoveToNearestDockOrLand(from))
                {
                    from.SendLocalizedMessage(1149796); //You can not dock a ship this far out to sea. You must be near land or shallow water.
                }
                else if (boat == null)
                {
                    if (!from.Alive)
                    {
                        from.SendLocalizedMessage(1060190); //You cannot do that while dead!
                    }
                    else if ((m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from)) || (m_Boat is RowBoat && ((RowBoat)m_Boat).HasAccess(from)))
                    {
                        canMove = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116617); //You do not have permission to board this ship.
                    }
                }
                else if (boat != null && m_Boat != boat)
                {
                    if (!from.Alive)
                    {
                        from.SendLocalizedMessage(1060190); //You cannot do that while dead!
                    }
                    else if (m_Boat is RowBoat && ((RowBoat)m_Boat).HasAccess(from))
                    {
                        canMove = true;
                    }
                    else if (boat is RowBoat && m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from))
                    {
                        canMove = true;
                    }
                    else if (boat is BaseGalleon && m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from))
                    {
                        canMove = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
                    }
                }
            }

            if (canMove)
            {
                BaseCreature.TeleportPets(from, this.Location, this.Map);
                from.MoveToWorld(this.Location, this.Map);

                m_Boat.SendContainerPacket();
            }
        }
Beispiel #22
0
 public DockedRowBoat(BaseBoat boat) : base(0x3C, Point3D.Zero, boat)
 {
 }
Beispiel #23
0
 private static bool IsSpecialShip(BaseBoat b)
 {
     return(m_ShipTypes.Any(t => t == b.GetType()));
 }
Beispiel #24
0
    public IEnumerator InitCoroutine()
    {
        WorldSetup worldSetup = null;

        if (!World.CanLoadFromUrl())
        {
            object[] size = new object[] { "Generating procedural map of size ", World.Size, " with seed ", World.Seed };
            UnityEngine.Debug.Log(string.Concat(size));
        }
        else
        {
            UnityEngine.Debug.Log(string.Concat("Loading custom map from ", World.Url));
        }
        ProceduralComponent[] componentsInChildren = worldSetup.GetComponentsInChildren <ProceduralComponent>(true);
        Timing timing = Timing.Start("Downloading World");

        if (World.Procedural && !World.CanLoadFromDisk() && World.CanLoadFromUrl())
        {
            LoadingScreen.Update("DOWNLOADING WORLD");
            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            UnityWebRequest downloadHandlerBuffer = UnityWebRequest.Get(World.Url);
            downloadHandlerBuffer.downloadHandler = new DownloadHandlerBuffer();
            downloadHandlerBuffer.Send();
            while (!downloadHandlerBuffer.isDone)
            {
                float single = downloadHandlerBuffer.downloadProgress * 100f;
                LoadingScreen.Update(string.Concat("DOWNLOADING WORLD ", single.ToString("0.0"), "%"));
                yield return(CoroutineEx.waitForEndOfFrame);
            }
            if (downloadHandlerBuffer.isHttpError || downloadHandlerBuffer.isNetworkError)
            {
                string[] name = new string[] { "Couldn't Download Level: ", World.Name, " (", downloadHandlerBuffer.error, ")" };
                worldSetup.CancelSetup(string.Concat(name));
            }
            else
            {
                File.WriteAllBytes(string.Concat(World.MapFolderName, "/", World.MapFileName), downloadHandlerBuffer.downloadHandler.data);
            }
            downloadHandlerBuffer = null;
        }
        timing.End();
        Timing timing1 = Timing.Start("Loading World");

        if (World.Procedural && World.CanLoadFromDisk())
        {
            LoadingScreen.Update("LOADING WORLD");
            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            World.Serialization.Load(string.Concat(World.MapFolderName, "/", World.MapFileName));
            World.Cached = true;
        }
        timing1.End();
        if (World.Cached && 9 != World.Serialization.Version)
        {
            object[] version = new object[] { "World cache version mismatch: ", (uint)9, " != ", World.Serialization.Version };
            UnityEngine.Debug.LogWarning(string.Concat(version));
            World.Serialization.Clear();
            World.Cached = false;
            if (World.CanLoadFromUrl())
            {
                worldSetup.CancelSetup(string.Concat("World File Outdated: ", World.Name));
            }
        }
        if (World.Cached && string.IsNullOrEmpty(World.Checksum))
        {
            World.Checksum = World.Serialization.Checksum;
        }
        if (World.Cached)
        {
            World.InitSize(World.Serialization.world.size);
        }
        if (worldSetup.terrain)
        {
            TerrainGenerator terrainGenerator = worldSetup.terrain.GetComponent <TerrainGenerator>();
            if (terrainGenerator)
            {
                worldSetup.terrain     = terrainGenerator.CreateTerrain();
                worldSetup.terrainMeta = worldSetup.terrain.GetComponent <TerrainMeta>();
                worldSetup.terrainMeta.Init(null, null);
                worldSetup.terrainMeta.SetupComponents();
                worldSetup.CreateObject(worldSetup.decorPrefab);
                worldSetup.CreateObject(worldSetup.grassPrefab);
                worldSetup.CreateObject(worldSetup.spawnPrefab);
            }
        }
        Timing timing2 = Timing.Start("Spawning World");

        if (World.Cached)
        {
            LoadingScreen.Update("SPAWNING WORLD");
            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            TerrainMeta.HeightMap.FromByteArray(World.GetMap("terrain"));
            TerrainMeta.SplatMap.FromByteArray(World.GetMap("splat"));
            TerrainMeta.BiomeMap.FromByteArray(World.GetMap("biome"));
            TerrainMeta.TopologyMap.FromByteArray(World.GetMap("topology"));
            TerrainMeta.AlphaMap.FromByteArray(World.GetMap("alpha"));
            TerrainMeta.WaterMap.FromByteArray(World.GetMap("water"));
            IEnumerator enumerator = World.Spawn(0.2f, (string str) => LoadingScreen.Update(str));
            while (enumerator.MoveNext())
            {
                yield return(enumerator.Current);
            }
            TerrainMeta.Path.Clear();
            TerrainMeta.Path.Roads.AddRange(World.GetPaths("Road"));
            TerrainMeta.Path.Rivers.AddRange(World.GetPaths("River"));
            TerrainMeta.Path.Powerlines.AddRange(World.GetPaths("Powerline"));
            enumerator = null;
        }
        timing2.End();
        Timing timing3 = Timing.Start("Processing World");

        if (componentsInChildren.Length != 0)
        {
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                ProceduralComponent proceduralComponent = componentsInChildren[i];
                if (proceduralComponent && proceduralComponent.ShouldRun())
                {
                    uint num = (uint)((ulong)World.Seed + (long)i);
                    LoadingScreen.Update(proceduralComponent.Description.ToUpper());
                    yield return(CoroutineEx.waitForEndOfFrame);

                    yield return(CoroutineEx.waitForEndOfFrame);

                    yield return(CoroutineEx.waitForEndOfFrame);

                    Timing timing4 = Timing.Start(proceduralComponent.Description);
                    if (proceduralComponent)
                    {
                        proceduralComponent.Process(num);
                    }
                    timing4.End();
                    proceduralComponent = null;
                }
            }
        }
        timing3.End();
        Timing timing5 = Timing.Start("Saving World");

        if (ConVar.World.cache && World.Procedural && !World.Cached)
        {
            LoadingScreen.Update("SAVING WORLD");
            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            World.Serialization.world.size = World.Size;
            World.AddPaths(TerrainMeta.Path.Roads);
            World.AddPaths(TerrainMeta.Path.Rivers);
            World.AddPaths(TerrainMeta.Path.Powerlines);
            World.Serialization.Save(string.Concat(World.MapFolderName, "/", World.MapFileName));
        }
        timing5.End();
        Timing timing6 = Timing.Start("Calculating Checksum");

        if (string.IsNullOrEmpty(World.Serialization.Checksum))
        {
            LoadingScreen.Update("CALCULATING CHECKSUM");
            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            yield return(CoroutineEx.waitForEndOfFrame);

            World.Serialization.CalculateChecksum();
        }
        timing6.End();
        if (string.IsNullOrEmpty(World.Checksum))
        {
            World.Checksum = World.Serialization.Checksum;
        }
        Timing timing7 = Timing.Start("Ocean Patrol Paths");

        LoadingScreen.Update("OCEAN PATROL PATHS");
        yield return(CoroutineEx.waitForEndOfFrame);

        yield return(CoroutineEx.waitForEndOfFrame);

        yield return(CoroutineEx.waitForEndOfFrame);

        if (!BaseBoat.generate_paths || !(TerrainMeta.Path != null))
        {
            UnityEngine.Debug.Log("Skipping ocean patrol paths, baseboat.generate_paths == false");
        }
        else
        {
            TerrainMeta.Path.OceanPatrolFar = BaseBoat.GenerateOceanPatrolPath(200f, 8f);
        }
        timing7.End();
        Timing timing8 = Timing.Start("Finalizing World");

        LoadingScreen.Update("FINALIZING WORLD");
        yield return(CoroutineEx.waitForEndOfFrame);

        yield return(CoroutineEx.waitForEndOfFrame);

        yield return(CoroutineEx.waitForEndOfFrame);

        if (worldSetup.terrainMeta)
        {
            worldSetup.terrainMeta.BindShaderProperties();
            worldSetup.terrainMeta.PostSetupComponents();
            TerrainMargin.Create();
        }
        World.Serialization.Clear();
        timing8.End();
        LoadingScreen.Update("DONE");
        yield return(CoroutineEx.waitForEndOfFrame);

        yield return(CoroutineEx.waitForEndOfFrame);

        yield return(CoroutineEx.waitForEndOfFrame);

        if (worldSetup)
        {
            GameManager.Destroy(worldSetup.gameObject, 0f);
        }
    }
Beispiel #25
0
 public LargeDockedBoat(BaseBoat boat) : base(0x10, new Point3D(0, -1, 0), boat)
 {
 }
Beispiel #26
0
        public void OnPlacement(Mobile from, Point3D p, int hue)
        {
            if (Deleted)
            {
                return;
            }
            else if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else
            {
                string phrase_a = "You may not place a ship while on another ship or inside a house.";
                string phrase_b = "A ship can not be launched here.";
                if (BaseBoat.isCarpet(Boat))
                {
                    phrase_a = "You may not place the carpet while on a ship or carpet, or inside a house.";
                }

                Map    map = from.Map;
                Region reg = Region.Find(from.Location, from.Map);

                if (map == null)
                {
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) || BaseBoat.FindBoatAt(from, from.Map) != null)
                {
                    from.SendMessage(phrase_a);
                    return;
                }

                BaseBoat boat = Boat;
                boat.Hue = hue;

                if (boat == null)
                {
                    return;
                }

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

                bool CanBuild = false;

                if (reg.IsPartOf(typeof(OutDoorBadRegion)) ||
                    reg.IsPartOf(typeof(VillageRegion)) ||
                    reg.IsPartOf(typeof(BargeDeadRegion)) ||
                    reg.IsPartOf(typeof(NecromancerRegion)) ||
                    reg.IsPartOf(typeof(DeadRegion)) ||
                    reg.IsPartOf("the Forgotten Lighthouse") ||
                    reg.IsPartOf("Anchor Rock Docks") ||
                    reg.IsPartOf("Kraken Reef Docks") ||
                    reg.IsPartOf("Savage Sea Docks") ||
                    reg.IsPartOf("Serpent Sail Docks") ||
                    reg.IsPartOf(typeof(PirateRegion)) ||
                    reg.IsPartOf(typeof(OutDoorRegion)) ||
                    reg.IsPartOf(typeof(PublicRegion)) ||
                    Server.Misc.Worlds.IsMainRegion(Server.Misc.Worlds.GetRegionName(from.Map, from.Location)))
                {
                    CanBuild = true;
                }

                if (!DockSearch.NearDock(from) && !BaseBoat.isCarpet(boat))
                {
                    from.SendMessage(phrase_a);
                }
                else if (BaseBoat.IsValidLocation(p, map) && CanBuild == true && boat.CanFit(p, map, boat.ItemID))
                {
                    Delete();

                    boat.Owner    = from;
                    boat.Anchored = true;

                    if (from.Skills[SkillName.Fishing].Base >= 90 && boat.m_BoatDoor != null)
                    {
                        boat.m_BoatDoor.Visible = true; boat.BoatDoor.Hue = hue;
                    }

                    uint keyValue = boat.CreateKeys(from);

                    if (boat.PPlank != null)
                    {
                        boat.PPlank.KeyValue = keyValue;
                    }

                    if (boat.SPlank != null)
                    {
                        boat.SPlank.KeyValue = keyValue;
                    }

                    boat.TillerMan.Hue = hue;
                    boat.Hold.Hue      = hue;
                    boat.PPlank.Hue    = hue;
                    boat.SPlank.Hue    = hue;

                    boat.MoveToWorld(p, map);
                    if (BaseBoat.isCarpet(Boat))
                    {
                        from.PlaySound(0x1FD);
                    }
                    else
                    {
                        from.PlaySound(0x026);
                    }
                }
                else
                {
                    boat.Delete();
                    from.SendMessage(phrase_b);
                }
            }
        }
Beispiel #27
0
        public static void SpawnCreatures(Mobile m, double difficulty)
        {
            BaseBoat boat = BaseBoat.FindBoatAt(m.Location, m.Map);

            Type[] types = GetCreatureType(m, boat != null);

            if (types == null)
            {
                return;
            }

            int amount = Utility.RandomMinMax(3, 5);

            for (int i = 0; i < amount; i++)
            {
                BaseCreature bc = Activator.CreateInstance(types[Utility.Random(types.Length)]) as BaseCreature;

                if (bc != null)
                {
                    if (KrampusEncounterActive)
                    {
                        bc.Name = "An Icy Creature";
                    }

                    Rectangle2D zone;

                    if (boat != null)
                    {
                        if (boat.Facing == Direction.North || boat.Facing == Direction.South)
                        {
                            if (Utility.RandomBool())
                            {
                                zone = new Rectangle2D(boat.X - 7, m.Y - 4, 3, 3);
                            }
                            else
                            {
                                zone = new Rectangle2D(boat.X + 4, m.Y - 4, 3, 3);
                            }
                        }
                        else
                        {
                            if (Utility.RandomBool())
                            {
                                zone = new Rectangle2D(m.X + 4, boat.Y - 7, 3, 3);
                            }
                            else
                            {
                                zone = new Rectangle2D(m.X + 4, boat.Y + 4, 3, 3);
                            }
                        }
                    }
                    else
                    {
                        zone = new Rectangle2D(m.X - 3, m.Y - 3, 6, 6);
                    }

                    Point3D p = m.Location;

                    if (m.Map != null)
                    {
                        for (int j = 0; j < 25; j++)
                        {
                            Point3D check = m.Map.GetRandomSpawnPoint(zone);

                            if (CanFit(check.X, check.Y, check.Z, m.Map, bc))
                            {
                                p = check;
                                break;
                            }
                        }
                    }

                    foreach (Skill sk in bc.Skills.Where(s => s.Base > 0))
                    {
                        sk.Base += sk.Base * (difficulty);
                    }

                    bc.RawStr += (int)(bc.RawStr * difficulty);
                    bc.RawInt += (int)(bc.RawInt * difficulty);
                    bc.RawDex += (int)(bc.RawDex * difficulty);

                    if (bc.HitsMaxSeed == -1)
                    {
                        bc.HitsMaxSeed = bc.RawStr;
                    }

                    if (bc.StamMaxSeed == -1)
                    {
                        bc.StamMaxSeed = bc.RawDex;
                    }

                    if (bc.ManaMaxSeed == -1)
                    {
                        bc.ManaMaxSeed = bc.RawInt;
                    }

                    bc.HitsMaxSeed += (int)(bc.HitsMaxSeed * difficulty);
                    bc.StamMaxSeed += (int)(bc.StamMaxSeed * difficulty);
                    bc.ManaMaxSeed += (int)(bc.ManaMaxSeed * difficulty);

                    bc.Hits = bc.HitsMaxSeed;
                    bc.Stam = bc.RawDex;
                    bc.Mana = bc.RawInt;

                    bc.PhysicalResistanceSeed += (int)(bc.PhysicalResistanceSeed * (difficulty / 3));
                    bc.FireResistSeed         += (int)(bc.FireResistSeed * (difficulty / 3));
                    bc.ColdResistSeed         += (int)(bc.ColdResistSeed * (difficulty / 3));
                    bc.PoisonResistSeed       += (int)(bc.PoisonResistSeed * (difficulty / 3));
                    bc.EnergyResistSeed       += (int)(bc.EnergyResistSeed * (difficulty / 3));

                    bc.IsAmbusher = true;

                    if (Ambushers == null)
                    {
                        Ambushers = new Dictionary <BaseCreature, DateTime>();
                    }

                    Ambushers.Add(bc, DateTime.UtcNow + TimeSpan.FromMinutes(AmbusherDelete));

                    bc.MoveToWorld(p, m.Map);
                    Timer.DelayCall(() => bc.Combatant = m);
                }
            }

            m.LocalOverheadMessage(Server.Network.MessageType.Regular, 1150, 1155479); // *Your keen senses alert you to an incoming ambush of attackers!*
            m.SendLocalizedMessage(1049330, "", 0x22);                                 // You have been ambushed! Fight for your honor!!!
        }
Beispiel #28
0
        public static void SpawnCreatures(Mobile m, double difficulty)
        {
            BaseBoat boat = BaseBoat.FindBoatAt(m.Location, m.Map);

            Type[] types  = boat != null ? _SeaTypes : _LandTypes;
            int    amount = Utility.RandomMinMax(2, 4);

            for (int i = 0; i < amount; i++)
            {
                BaseCreature bc = Activator.CreateInstance(types[Utility.Random(types.Length)]) as BaseCreature;

                if (bc != null)
                {
                    Rectangle2D zone;

                    if (boat != null)
                    {
                        if (boat.Facing == Direction.North || boat.Facing == Direction.South)
                        {
                            if (Utility.RandomBool())
                            {
                                zone = new Rectangle2D(boat.X - 7, m.Y - 4, 3, 3);
                            }
                            else
                            {
                                zone = new Rectangle2D(boat.X + 4, m.Y - 4, 3, 3);
                            }
                        }
                        else
                        {
                            if (Utility.RandomBool())
                            {
                                zone = new Rectangle2D(m.X + 4, boat.Y - 7, 3, 3);
                            }
                            else
                            {
                                zone = new Rectangle2D(m.X + 4, boat.Y + 4, 3, 3);
                            }
                        }
                    }
                    else
                    {
                        zone = new Rectangle2D(m.X - 3, m.Y - 3, 6, 6);
                    }

                    Point3D p = m.Location;

                    for (int j = 0; j < 25; j++)
                    {
                        Point3D check = zone.GetRandomSpawnPoint(m.Map);

                        if (CanFit(check.X, check.Y, check.Z, m.Map, bc))
                        {
                            p = check;
                            break;
                        }
                    }

                    foreach (Skill sk in bc.Skills.Where(s => s.Base > 0))
                    {
                        sk.Base += sk.Base * (difficulty);
                    }

                    bc.RawStr += (int)(bc.RawStr * difficulty);
                    bc.RawInt += (int)(bc.RawInt * difficulty);
                    bc.RawDex += (int)(bc.RawDex * difficulty);

                    if (bc.HitsMaxSeed == -1)
                    {
                        bc.HitsMaxSeed = bc.RawStr;
                    }

                    if (bc.StamMaxSeed == -1)
                    {
                        bc.StamMaxSeed = bc.RawDex;
                    }

                    if (bc.ManaMaxSeed == -1)
                    {
                        bc.ManaMaxSeed = bc.RawInt;
                    }

                    bc.HitsMaxSeed += (int)(bc.HitsMaxSeed * difficulty);
                    bc.StamMaxSeed += (int)(bc.StamMaxSeed * difficulty);
                    bc.ManaMaxSeed += (int)(bc.ManaMaxSeed * difficulty);

                    bc.Hits = bc.HitsMaxSeed;
                    bc.Stam = bc.RawDex;
                    bc.Mana = bc.RawInt;

                    bc.PhysicalResistanceSeed += (int)(bc.PhysicalResistanceSeed * (difficulty / 3));
                    bc.FireResistSeed         += (int)(bc.FireResistSeed * (difficulty / 3));
                    bc.ColdResistSeed         += (int)(bc.ColdResistSeed * (difficulty / 3));
                    bc.PoisonResistSeed       += (int)(bc.PoisonResistSeed * (difficulty / 3));
                    bc.EnergyResistSeed       += (int)(bc.EnergyResistSeed * (difficulty / 3));

                    bc.IsAmbusher = true;

                    if (Ambushers == null)
                    {
                        Ambushers = new Dictionary <BaseCreature, DateTime>();
                    }

                    Ambushers.Add(bc, DateTime.UtcNow + TimeSpan.FromMinutes(AmbusherDelete));

                    bc.MoveToWorld(p, m.Map);
                    Timer.DelayCall(() => bc.Combatant = m);

                    m.SendLocalizedMessage(1049330, "", 0x22); // You have been ambushed! Fight for your honor!!!
                }
            }
        }
Beispiel #29
0
 public DockedTokunoGalleon(BaseBoat boat)
     : base(0x30, Point3D.Zero, boat)
 {
 }
Beispiel #30
0
        public void Mark(Mobile m)
        {
            RecallRuneEmpty();

            m_Marked = true;

            bool setDesc = false;

            m_Galleon = BaseBoat.FindBoatAt(m) as BaseGalleon;

            if (m_Galleon != null)
            {
                Type = RecallRuneType.Ship;
            }
            else
            {
                m_House = BaseHouse.FindHouseAt(m);

                if (m_House == null)
                {
                    Target      = m.Location;
                    m_TargetMap = m.Map;

                    Type = RecallRuneType.Normal;
                }
                else
                {
                    HouseSign sign = m_House.Sign;

                    if (sign != null)
                    {
                        m_Description = sign.Name;
                    }
                    else
                    {
                        m_Description = null;
                    }

                    if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0)
                    {
                        m_Description = "an unnamed house";
                    }

                    setDesc = true;

                    int x = m_House.BanLocation.X;
                    int y = m_House.BanLocation.Y + 2;
                    int z = m_House.BanLocation.Z;

                    Map map = m_House.Map;

                    if (map != null && !map.CanFit(x, y, z, 16, false, false))
                    {
                        z = map.GetAverageZ(x, y);
                    }

                    Target      = new Point3D(x, y, z);
                    m_TargetMap = map;

                    Type = RecallRuneType.Shop;
                }
            }

            if (!setDesc)
            {
                m_Description = BaseRegion.GetRuneNameFor(Region.Find(Target, m_TargetMap));
            }

            CalculateHue();
            InvalidateProperties();
        }
		public SmallDockedDragonBoat( BaseBoat boat ) : base( 0x4, Point3D.Zero, boat )
		{
		}
Beispiel #32
0
 public PirateShip_Boat_Docked(BaseBoat boat) : base(0x4014, new Point3D(0, -1, 0), boat)
 {
 }
		public MediumDockedDragonBoat( BaseBoat boat ) : base( 0xC, Point3D.Zero, boat )
		{
		}
 public LargeDockedDragonBoat(BaseBoat boat) : base(0x14, new Point3D(0, -1, 0), boat)
 {
 }
Beispiel #35
0
		public SmallDockedBoat( BaseBoat boat ) : base( 0x0, Point3D.Zero, boat )
		{
		}
Beispiel #36
0
        public LargeDockedBoat(BaseBoat boat) : base(0x10, new Point3D(0, -1, 0), boat)
        {
		}