Esempio n. 1
0
        public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (Galleon != null)
            {
                if (Galleon.Contains(from))
                {
                    SecurityLevel level = Galleon.GetSecurityLevel(from);

                    if (level >= SecurityLevel.Crewman)
                    {
                        list.Add(new EmergencyRepairEntry(this, from));
                        list.Add(new ShipRepairEntry(this, from));
                    }

                    if (level == SecurityLevel.Captain)
                    {
                        list.Add(new RenameShipEntry(Galleon, from));
                        list.Add(new MoveTillermanEntry(this, from));
                        list.Add(new SecuritySettingsEntry(this, from));
                        list.Add(new ResetSecuritySettings(this, from));
                    }
                }
                else
                {
                    list.Add(new DryDockEntry(Galleon, from));
                }
            }
        }
Esempio n. 2
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is MapItem && Galleon != null && Galleon.CanCommand(from) && Galleon.Contains(from))
            {
                Galleon.AssociateMap((MapItem)dropped);
            }

            return(false);
        }
Esempio n. 3
0
        public List <IDamageable> FindDamageables(Mobile shooter, Point3D pnt, Map map, bool player, bool pet, bool monsters, bool seacreature, bool items)
        {
            List <IDamageable> list = new List <IDamageable>();

            if (map == null || map == Map.Internal || Galleon == null)
            {
                return(list);
            }

            IPooledEnumerable eable = map.GetObjectsInRange(pnt, 0);

            foreach (IDamageable dam in eable.OfType <IDamageable>())
            {
                Mobile mob = dam as Mobile;

                if (mob != null && (!shooter.CanBeHarmful(mob, false) || Galleon.Contains(mob)))
                {
                    continue;
                }

                if (!items && dam is DamageableItem)
                {
                    continue;
                }

                if (items && dam is DamageableItem && ((DamageableItem)dam).CanDamage && !Galleon.Contains(dam))
                {
                    list.Add(dam);
                }

                if (player && mob is PlayerMobile)
                {
                    list.Add(mob);
                }

                if (monsters && mob is BaseCreature && !((BaseCreature)mob).Controlled && !((BaseCreature)mob).Summoned)
                {
                    list.Add(mob);
                }

                if (pet && mob is BaseCreature && (((BaseCreature)mob).Controlled || ((BaseCreature)mob).Summoned))
                {
                    list.Add(mob);
                }

                if (seacreature && mob is BaseSeaChampion)
                {
                    list.Add(mob);
                }
            }

            eable.Free();
            return(list);
        }
Esempio n. 4
0
 public override void OnDoubleClick(Mobile from)
 {
     if (Galleon == null || !Galleon.IsOwner(from))
     {
         base.OnDoubleClick(from);
     }
     else if (Galleon != null && Galleon.Contains(from))
     {
         Galleon.BeginRename(from);
     }
     else if (Galleon != null)
     {
         Galleon.BeginDryDock(from);
     }
 }
Esempio n. 5
0
        public bool TryBound(Mobile from, BaseQuest quest)
        {
            if (from == null || Galleon == null || !Galleon.Contains(this) || quest == null)
            {
                return(false);
            }

            if (m_IsCaught)
            {
                from.SendMessage("That pirate is already bound to a ship!");
                return(false);
            }

            Combatant  = null;
            Warmode    = false;
            m_IsCaught = true;
            return(true);
        }
Esempio n. 6
0
 public override void OnDoubleClick(Mobile from)
 {
     if (Galleon == null || from.AccessLevel > AccessLevel.Player)
     {
         base.OnDoubleClick(from);
     }
     else if (!Galleon.Contains(from))
     {
         if (Galleon.TillerMan != null)
         {
             Galleon.TillerManSay(502490); // You must be on the ship to open the hold.
         }
     }
     else if (Galleon.Owner is PlayerMobile && !Galleon.Scuttled && Galleon.GetSecurityLevel(from) < SecurityLevel.Officer)
     {
         from.Say(1010436); // You do not have permission to do this.
     }
     else
     {
         base.OnDoubleClick(from);
     }
 }
Esempio n. 7
0
        public virtual void OnShipHit(object obj)
        {
            object[]    list     = (object[])obj;
            BaseGalleon target   = list[0] as BaseGalleon;
            Point3D     pnt      = (Point3D)list[1];
            AmmoInfo    ammoInfo = list[2] as AmmoInfo;
            Mobile      shooter  = list[3] as Mobile;

            if (target != null && Galleon != null)
            {
                int damage = (int)(ammoInfo.GetDamage(this) * Galleon.CannonDamageMod);
                target.OnTakenDamage(shooter, damage);

                int z = target.ZSurface;

                if (target.TillerMan != null && target.TillerMan is IEntity)
                {
                    z = ((IEntity)target.TillerMan).Z;
                }

                Direction d       = Utility.GetDirection(this, pnt);
                int       xOffset = 0;
                int       yOffset = 0;
                Point3D   hit     = pnt;

                if (!ammoInfo.RequiresSurface)
                {
                    switch (d)
                    {
                    default:
                    case Direction.North:
                        xOffset = Utility.RandomMinMax(-1, 1);
                        yOffset = Utility.RandomMinMax(-2, 0);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;

                    case Direction.South:
                        xOffset = Utility.RandomMinMax(-1, 1);
                        yOffset = Utility.RandomMinMax(0, 2);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;

                    case Direction.East:
                        xOffset = Utility.RandomMinMax(0, 2);
                        yOffset = Utility.RandomMinMax(-1, 1);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;

                    case Direction.West:
                        xOffset = Utility.RandomMinMax(-2, 0);
                        yOffset = Utility.RandomMinMax(-1, 1);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;
                    }
                }

                Effects.SendLocationEffect(hit, target.Map, Utility.RandomBool() ? 14000 : 14013, 15, 10);
                Effects.PlaySound(hit, target.Map, 0x207);

                Mobile victim = target.Owner;

                if (victim != null && target.Contains(victim) && shooter.CanBeHarmful(victim, false))
                {
                    shooter.DoHarmful(victim);
                }
                else
                {
                    List <Mobile> candidates = new List <Mobile>();
                    SecurityLevel highest    = SecurityLevel.Passenger;

                    foreach (var mob in target.GetMobilesOnBoard().OfType <PlayerMobile>().Where(pm => shooter.CanBeHarmful(pm, false)))
                    {
                        if (Galleon.GetSecurityLevel(mob) > highest)
                        {
                            candidates.Insert(0, mob);
                        }
                        else
                        {
                            candidates.Add(mob);
                        }
                    }

                    if (candidates.Count > 0)
                    {
                        shooter.DoHarmful(candidates[0]);
                    }
                    else if (victim != null && shooter.IsHarmfulCriminal(victim))
                    {
                        shooter.CriminalAction(false);
                    }

                    ColUtility.Free(candidates);
                }

                if (Galleon.Map != null)
                {
                    IPooledEnumerable eable = Galleon.Map.GetItemsInRange(hit, 1);

                    foreach (Item item in eable)
                    {
                        if (item is IShipCannon && !Galleon.Contains(item))
                        {
                            ((IShipCannon)item).OnDamage(damage, shooter);
                        }
                    }

                    eable.Free();
                }
            }
        }
Esempio n. 8
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Galleon != null && !Galleon.Contains(from))
            {
                if (!(from.InRange(Location, 12)))
                {
                    return;
                }

                Galleon.Refresh();

                if (from == Galleon.Owner)
                {
                    base.OnDoubleClick(from);
                    from.MoveToWorld(Location, Map);
                    Galleon.Embark(from);
                }
                else if (Galleon.PlayerAccess != null)
                {
                    if (Galleon.PlayerAccess.ContainsKey((PlayerMobile)from))
                    {
                        if (1 <= Galleon.PlayerAccess[(PlayerMobile)from] && Galleon.PlayerAccess[(PlayerMobile)from] <= 4)
                        {
                            base.OnDoubleClick(from);
                            from.MoveToWorld(Location, Map);
                            Galleon.Embark(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                            base.OnDoubleClick(from);
                        }
                    }
                    else if ((Galleon.Owner != null) && (from.Guild == Galleon.Owner.Guild) && (from.Guild != null))
                    {
                        if (1 <= Galleon.Guild && Galleon.Guild <= 4)
                        {
                            base.OnDoubleClick(from);
                            from.MoveToWorld(Location, Map);
                            Galleon.Embark(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                            base.OnDoubleClick(from);
                        }
                    }
                    else if ((Galleon.Owner != null) && (from.Party == Galleon.Owner.Party) && (from.Party != null))
                    {
                        if (1 <= Galleon.Party && Galleon.Party <= 4)
                        {
                            base.OnDoubleClick(from);
                            from.MoveToWorld(Location, Map);
                            Galleon.Embark(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                            base.OnDoubleClick(from);
                        }
                    }
                    else if (1 <= Galleon.Public && Galleon.Public <= 4)
                    {
                        base.OnDoubleClick(from);
                        from.MoveToWorld(Location, Map);
                        Galleon.Embark(from);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                        base.OnDoubleClick(from);
                    }
                }
                else if ((Galleon.Owner != null) && (from.Guild == Galleon.Owner.Guild) && (from.Guild != null))
                {
                    if (1 <= Galleon.Guild && Galleon.Guild <= 4)
                    {
                        base.OnDoubleClick(from);
                        from.MoveToWorld(Location, Map);
                        Galleon.Embark(from);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                        base.OnDoubleClick(from);
                    }
                }
                else if ((Galleon.Owner != null) && (from.Party == Galleon.Owner.Party) && (from.Party != null))
                {
                    if (1 <= Galleon.Party && Galleon.Party <= 4)
                    {
                        base.OnDoubleClick(from);
                        from.MoveToWorld(Location, Map);
                        Galleon.Embark(from);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                        base.OnDoubleClick(from);
                    }
                }
                else if (1 <= Galleon.Public && Galleon.Public <= 4)
                {
                    base.OnDoubleClick(from);
                    from.MoveToWorld(Location, Map);
                    Galleon.Embark(from);
                }
                else
                {
                    from.SendLocalizedMessage(1116617); //You do not have permission to board this ship. -Dian
                    base.OnDoubleClick(from);
                }
            }
            else if (Galleon != null && Galleon.Contains(from))
            {
                Galleon.Refresh();

                if (Galleon.IsDriven)
                {
                    from.SendLocalizedMessage(1116610);                     //You can't do that while piloting a ship! -Dian
                    return;
                }

                Map map = Map;

                if (map == null)
                {
                    return;
                }

                int rx = 0, ry = 0;

                if (Side == BoatRopeSide.Port)
                {
                    if (Galleon.Facing == Direction.North)
                    {
                        rx = 1;
                    }
                    else if (Galleon.Facing == Direction.South)
                    {
                        rx = -1;
                    }
                    else if (Galleon.Facing == Direction.East)
                    {
                        ry = 1;
                    }
                    else if (Galleon.Facing == Direction.West)
                    {
                        ry = -1;
                    }
                }
                else if (Side == BoatRopeSide.Starboard)
                {
                    if (Galleon.Facing == Direction.North)
                    {
                        rx = -1;
                    }
                    else if (Galleon.Facing == Direction.South)
                    {
                        rx = 1;
                    }
                    else if (Galleon.Facing == Direction.East)
                    {
                        ry = -1;
                    }
                    else if (Galleon.Facing == Direction.West)
                    {
                        ry = 1;
                    }
                }

                for (int i = 1; i <= 12; ++i)
                {
                    int x = X + (i * rx);
                    int y = Y + (i * ry);
                    int z;

                    for (int j = -16; j <= 16; ++j)
                    {
                        z = from.Z + j;

                        if (map.CanFit(x, y, z, 16, false, false) && !Server.Spells.SpellHelper.CheckMulti(new Point3D(x, y, z), map) && !Region.Find(new Point3D(x, y, z), map).IsPartOf(typeof(Factions.StrongholdRegion)))
                        {
                            if (i == 1 && j >= -2 && j <= 2)
                            {
                                return;
                            }

                            from.Location = new Point3D(x, y, z);
                            Galleon.Disembark(from);
                            return;
                        }
                    }

                    z = map.GetAverageZ(x, y);

                    if (map.CanFit(x, y, z, 16, false, false) && !Server.Spells.SpellHelper.CheckMulti(new Point3D(x, y, z), map) && !Region.Find(new Point3D(x, y, z), map).IsPartOf(typeof(Factions.StrongholdRegion)))
                    {
                        if (i == 1)
                        {
                            return;
                        }

                        from.Location = new Point3D(x, y, z);
                        Galleon.Disembark(from);
                        return;
                    }
                }
            }
        }
Esempio n. 9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Galleon.IsDriven)
            {
                Galleon.LeaveCommand(from);
                from.SendLocalizedMessage(1149592); //You are no longer piloting this vessel. -Dian
            }
            else if (Galleon != null && from != null)
            {
                if (!Galleon.Contains(from))                 // -Dian
                {
                    from.SendLocalizedMessage(1116724);      //You cannot pilot a ship unless you are aboard it! -Dian
                    return;
                }

                if (from.Mounted)
                {
                    from.SendLocalizedMessage(1042146);                     //You cannot use this while mounted. -Dian
                    return;
                }

                if (from.Flying)                        // -Dian
                {
                    from.SendLocalizedMessage(1116615); //You cannot pilot a ship while flying! -Dian
                    return;
                }

                if (from == Galleon.Owner)
                {
                    from.SendLocalizedMessage(1116727);                     //You are now piloting this vessel. -Dian
                    Galleon.TakeCommand(from);
                }
                else if (Galleon.PlayerAccess != null)
                {
                    if (Galleon.PlayerAccess.ContainsKey((PlayerMobile)from))
                    {
                        if (2 <= Galleon.PlayerAccess[(PlayerMobile)from] && Galleon.PlayerAccess[(PlayerMobile)from] <= 4)
                        {
                            from.SendLocalizedMessage(1116727);                             //You are now piloting this vessel. -Dian
                            Galleon.TakeCommand(from);
                        }
                        else if ((from.Guild != null) && (from.Guild == Galleon.Owner.Guild))
                        {
                            if (2 <= Galleon.Guild && Galleon.Guild <= 4)
                            {
                                from.SendLocalizedMessage(1116727);                                 //You are now piloting this vessel. -Dian
                                Galleon.TakeCommand(from);
                            }
                            else
                            {
                                from.SendLocalizedMessage(1061637);                                 //You are not allowed to access this. -Dian
                            }
                        }
                        else if ((from.Party != null) && (from.Party == Galleon.Owner.Party))
                        {
                            if (2 <= Galleon.Party && Galleon.Party <= 4)
                            {
                                from.SendLocalizedMessage(1116727);                                 //You are now piloting this vessel. -Dian
                                Galleon.TakeCommand(from);
                            }
                            else
                            {
                                from.SendLocalizedMessage(1061637);                                 //You are not allowed to access this. -Dian
                            }
                        }
                        else if (2 <= Galleon.Public && Galleon.Public <= 4)
                        {
                            from.SendLocalizedMessage(1116727);                             //You are now piloting this vessel. -Dian
                            Galleon.TakeCommand(from);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1061637);                             //You are not allowed to access this. -Dian
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1061637);                         //You are not allowed to access this. -Dian
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1061637);                     //You are not allowed to access this. -Dian
                }
            }
        }