Exemplo n.º 1
0
        public void OnTarget(Mobile from, Point3D point)
        {
            BaseBoat boat = BaseBoat.FindBoatAt(point, this.Map);

            if (boat != null)
            {
                if (boat.m_ScuttleInProgress)
                {
                    from.SendMessage("You cannot repair a ship that is being scuttled.");
                    return;
                }

                if (!from.CanBeginAction(typeof(ShipRepairTool)))
                {
                    from.SendMessage("You must wait a few moments before attempting to use that again.");
                    return;
                }

                //Last Repair Action Was Made During Combat, But Ship is Now Out of Combat (Reduce Repair Timer)
                if (boat.LastCombatTime + boat.TimeNeededToBeOutOfCombat <= DateTime.UtcNow && boat.NextTimeRepairable > DateTime.UtcNow + RepairDuration)
                {
                    boat.NextTimeRepairable = DateTime.UtcNow;
                }

                if (boat.NextTimeRepairable > DateTime.UtcNow)
                {
                    string repairString = Utility.CreateTimeRemainingString(DateTime.UtcNow, boat.NextTimeRepairable, false, false, false, true, true);

                    from.SendMessage("This ship cannot be repaired for another " + repairString + ".");

                    return;
                }

                if (!(boat.Contains(from) || boat.GetBoatToLocationDistance(boat, from.Location) <= 6))
                {
                    from.SendMessage("You are too far away from that ship to repair it.");

                    return;
                }

                if (boat.IsOwner(from) || boat.IsCoOwner(from))
                {
                    from.CloseGump(typeof(ShipRepairGump));
                    from.SendGump(new ShipRepairGump(boat, from, this));
                    from.SendMessage("What do you wish to repair on the ship?");
                }

                else
                {
                    from.SendMessage("You must be the owner or co-owner of the ship in order to repair it.");
                }
            }
        }
Exemplo n.º 2
0
        public static void StartThrowShipBomb(BaseCreature creature, BaseBoat targetBoat)
        {
            Timer.DelayCall(TimeSpan.FromSeconds(.3), delegate { Effects.PlaySound(creature.Location, creature.Map, 0x666); });

            Point3D randomShipLocation = targetBoat.GetRandomEmbarkLocation(true);

            IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z + 10), creature.Map);
            IEntity endLocation   = new Entity(Serial.Zero, new Point3D(randomShipLocation.X, randomShipLocation.Y, randomShipLocation.Z + 5), targetBoat.Map);

            Effects.SendMovingEffect(startLocation, endLocation, 0x1C19, 10, 0, false, false, 0, 0);

            int distance = targetBoat.GetBoatToLocationDistance(targetBoat, creature.Location);

            double destinationDelay = (double)distance * .06;
            double explosionDelay   = (double)distance * .16;

            Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { Effects.SendLocationEffect(endLocation.Location, targetBoat.Map, 0x1C19, 20); });
            Timer.DelayCall(TimeSpan.FromSeconds(explosionDelay), delegate { DetonateShipBomb(creature, targetBoat, randomShipLocation); });
        }
Exemplo n.º 3
0
        public static bool CanDoThrowShipBomb(BaseCreature creature)
        {
            BaseBoat targetBoat = null;

            if (creature.Combatant != null)
            {
                BaseCreature bc_Combatant = creature.Combatant as BaseCreature;
                PlayerMobile pm_Combatant = creature.Combatant as PlayerMobile;

                if (bc_Combatant != null)
                {
                    if (bc_Combatant.BoatOccupied != null && bc_Combatant.BoatOccupied != creature.BoatOccupied)
                    {
                        if (!bc_Combatant.BoatOccupied.Deleted && bc_Combatant.BoatOccupied.m_SinkTimer == null && Utility.GetDistance(creature.Location, bc_Combatant.BoatOccupied.Location) <= 8)
                        {
                            targetBoat = bc_Combatant.BoatOccupied;
                        }
                    }
                }

                if (pm_Combatant != null)
                {
                    if (pm_Combatant.BoatOccupied != null && pm_Combatant.BoatOccupied != creature.BoatOccupied)
                    {
                        if (!pm_Combatant.BoatOccupied.Deleted && pm_Combatant.BoatOccupied.m_SinkTimer == null && Utility.GetDistance(creature.Location, pm_Combatant.BoatOccupied.Location) <= 8)
                        {
                            targetBoat = pm_Combatant.BoatOccupied;
                        }
                    }
                }
            }

            if (targetBoat == null)
            {
                if (creature.BoatOccupied != null)
                {
                    if (creature.BoatOccupied.BoatCombatant != null && creature.BoatOccupied.BoatCombatant != creature.BoatOccupied)
                    {
                        if (creature.BoatOccupied.BoatCombatant != null)
                        {
                            if (!creature.BoatOccupied.BoatCombatant.Deleted && creature.BoatOccupied.BoatCombatant.m_SinkTimer == null && Utility.GetDistance(creature.Location, creature.BoatOccupied.BoatCombatant.Location) <= 8)
                            {
                                targetBoat = creature.BoatOccupied.BoatCombatant;
                            }
                        }
                    }
                }
            }

            bool targetBoatValid = false;

            if (targetBoat != null && targetBoat != creature.BoatOccupied)
            {
                if (targetBoat.GetBoatToLocationDistance(targetBoat, creature.Location) <= 8)
                {
                    targetBoatValid = true;
                }
            }

            return(targetBoatValid);
        }
Exemplo n.º 4
0
            protected override void OnTick()
            {
                //No Longer Alive
                if (!m_From.Alive)
                {
                    this.Stop();

                    return;
                }

                //No Longer On Ship or Close Enough to the Ship to Repair
                if (!(m_Boat.Contains(m_From) || m_Boat.GetBoatToLocationDistance(m_Boat, m_From.Location) <= 6))
                {
                    m_From.SendMessage("You are not close enough to the ship to finish your repairs.");

                    this.Stop();
                    return;
                }

                m_From.RevealingAction();

                //Repair Time Remains
                if ((m_Start + m_ShipRepairTools.RepairDuration) > DateTime.UtcNow)
                {
                    Effects.PlaySound(m_From.Location, m_From.Map, 0x23D);

                    if (!m_From.Mounted)
                    {
                        m_From.Animate(11, 5, 1, true, false, 0);
                    }
                }

                //Repairs Complete
                else
                {
                    Effects.PlaySound(m_From.Location, m_From.Map, 0x23D);

                    if (!m_From.Mounted)
                    {
                        m_From.Animate(11, 5, 1, true, false, 0);
                    }

                    Stop();

                    m_ShipRepairTools.FinishRepairs(m_Boat, m_From, m_DamageType, true);
                }

                //Henchman Repair Assistance
                List <Mobile> m_MobilesOnBoat = m_Boat.GetMobilesOnBoat(false, false);

                foreach (Mobile mobile in m_MobilesOnBoat)
                {
                    if (mobile is HenchmanNavyCarpenter)
                    {
                        HenchmanNavyCarpenter navyCarpenter = mobile as HenchmanNavyCarpenter;
                        navyCarpenter.AssistRepair();
                    }

                    if (mobile is HenchmanPirateCarpenter)
                    {
                        HenchmanPirateCarpenter pirateCarpenter = mobile as HenchmanPirateCarpenter;
                        pirateCarpenter.AssistRepair();
                    }
                }
            }