コード例 #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    if (targeted is PirateCaptain)
                    {
                        PirateCaptain cap = (PirateCaptain)targeted;

                        if (cap.Hits > cap.HitsMax / 10)
                        {
                            from.SendLocalizedMessage(1116756); //The pirate seems to have too much fight left to be bound.
                        }
                        else if (cap.TryBound(from, m_Rope.Quest))
                        {
                            m_Rope.BoundMobile = cap;
                            m_Rope.Quest.OnBound(cap);
                            cap.OnBound(m_Rope.Quest);

                            from.SendLocalizedMessage(1116721); //You begin binding the pirate.

                            m_Rope.DoDelayedDelete(from);
                        }
                    }
                    else
                    {
                        from.SendMessage("They cannot by bound by that!");
                    }
                }
                else
                {
                    from.SendMessage("They cannot by bound by that!");
                }
            }
コード例 #2
0
ファイル: SeaMarket.cs プロジェクト: sector1337/ServUO
        public static void TryPirateBlab(Mobile from, Mobile npc)
        {
            if (m_PirateBlabTable.ContainsKey(from) && m_PirateBlabTable[from] > DateTime.UtcNow || BountyQuestSpawner.Bounties.Count <= 0)
            {
                return;
            }

            //Make of list of bounties on their map
            List <Mobile> bounties = new List <Mobile>();

            foreach (Mobile mob in BountyQuestSpawner.Bounties.Keys)
            {
                if (mob.Map == from.Map && mob is PirateCaptain && !bounties.Contains(mob))
                {
                    bounties.Add(mob);
                }
            }

            if (bounties.Count > 0)
            {
                Mobile bounty = bounties[Utility.Random(bounties.Count)];

                if (bounty != null)
                {
                    PirateCaptain capt = (PirateCaptain)bounty;

                    int     xLong = 0, yLat = 0;
                    int     xMins = 0, yMins = 0;
                    bool    xEast = false, ySouth = false;
                    Point3D loc = capt.Location;
                    Map     map = capt.Map;

                    string locArgs;
                    //string nameArgs;
                    string combine;

                    if (Sextant.Format(loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                    {
                        locArgs = String.Format("{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                    }
                    else
                    {
                        locArgs = "?????";
                    }

                    combine = String.Format("{0}\t{1}", capt.PirateName > -1 ? String.Format("#{0}", capt.PirateName) : capt.Name, locArgs);

                    int cliloc = Utility.RandomMinMax(1149856, 1149865);
                    npc.SayTo(from, cliloc, combine);

                    m_PirateBlabTable[from] = DateTime.UtcNow + BlabDuration;
                }
            }

            ColUtility.Free(bounties);
        }
コード例 #3
0
ファイル: DeathCertificate.cs プロジェクト: pallop/Servuo
        public DeathCertificate(Mobile owner)
            : base(0x14F0)
        {
            if (owner is PirateCaptain)
            {
                PirateCaptain capt = (PirateCaptain)owner;

                if (capt.PirateName > 0)
                {
                    m_Owner = String.Format("#{0}\t#{1}\t#{2}", capt.Adjective, capt.Noun, capt.PirateName);
                }
                else
                {
                    m_Owner = String.Format("#{0}\t#{1}\t{2}", capt.Adjective, capt.Noun, Name);
                }
            }
        }
コード例 #4
0
        public void SpawnPirateAndGalleon(SpawnZone zone, Map map)
        {
            SpawnDefinition def = m_Zones[zone];

            if (map != Map.Internal && map != null)
            {
                Rectangle2D   rec    = def.SpawnRegion;
                OrcishGalleon gal    = new OrcishGalleon(Direction.North);
                PirateCaptain pirate = new PirateCaptain(gal);
                pirate.Zone = zone;
                gal.Owner   = pirate;
                Point3D p       = Point3D.Zero;
                bool    spawned = false;
                for (int i = 0; i < 25; i++)
                {
                    int x = Utility.Random(rec.X, rec.Width);
                    int y = Utility.Random(rec.Y, rec.Height);
                    p = new Point3D(x, y, -5);

                    if (gal.CanFit(p, map, gal.ItemID))
                    {
                        spawned = true;
                        break;
                    }
                }

                if (!spawned)
                {
                    gal.Delete();
                    pirate.Delete();
                    return;
                }

                int gold = Utility.RandomMinMax(GoldRange[0], GoldRange[1]);
                gal.MoveToWorld(p, map);
                gal.AutoAddCannons(pirate);
                pirate.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), map);

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

                for (int i = 0; i < crewCount; i++)
                {
                    Mobile crew = new PirateCrew();

                    if (i == 0)
                    {
                        crew.Title = "the orc captain";
                    }

                    pirate.AddToCrew(crew);
                    crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), map);
                }

                Point2D[] course = def.GetRandomWaypoints();
                gal.BoatCourse = new BoatCourse(gal, new List <Point2D>(def.GetRandomWaypoints()));

                gal.NextNavPoint = 0;
                gal.StartCourse(false, false);

                FillHold(gal);

                m_Bounties.Add(pirate, gold);
                m_ActiveZones[zone].Add(pirate);
            }
        }
コード例 #5
0
        public BountyBoardGump(int index) : base(20, 20)
        {
            int darkHue  = 19686;
            int lightHue = 19884;

            AddAlphaRegion(50, 50, 50, 50);
            AddImage(0, 0, 5400);

            AddHtmlLocalized(172, 37, 200, 16, 1116689, darkHue, false, false);   // WANTED FOR PIRACY
            AddHtmlLocalized(166, 320, 200, 16, 1116703, darkHue, false, false);  // WANTED DEAD OR ALIVE

            AddHtmlLocalized(180, 135, 200, 16, 1116704, lightHue, false, false); //Notice to all sailors
            AddHtmlLocalized(130, 150, 300, 16, 1116705, lightHue, false, false); //There be a bounty on these lowlifes!
            AddHtmlLocalized(150, 170, 300, 16, 1116706, lightHue, false, false); //See officers fer information.
            AddHtmlLocalized(195, 190, 300, 16, 1116707, lightHue, false, false); //********

            if (index < 0)
            {
                index = 0;
            }
            if (index >= BountyQuestSpawner.Bounties.Count)
            {
                index = BountyQuestSpawner.Bounties.Count - 1;
            }

            List <Mobile> mobs = new List <Mobile>(BountyQuestSpawner.Bounties.Keys);

            if (mobs.Count == 0)
            {
                return;
            }

            int y      = 210;
            int idx    = 0;
            int reward = 1116696; //Reward: ~1_val~
            int cliloc = 1116690; //~1_val~ ~2_val~ ~3_val~

            for (int i = index; i < mobs.Count; i++)
            {
                if (idx++ > 4)
                {
                    break;
                }

                Mobile mob      = mobs[i];
                int    toReward = 1000;

                BountyQuestSpawner.Bounties.TryGetValue(mob, out toReward);
                PirateCaptain capt = mob as PirateCaptain;

                if (capt == null)
                {
                    continue;
                }

                string args;

                if (capt.PirateName > 0)
                {
                    args = String.Format("#{0}\t#{1}\t#{2}", capt.Adjective, capt.Noun, capt.PirateName);
                }
                else
                {
                    args = String.Format("#{0}\t#{1}\t{2}", capt.Adjective, capt.Noun, capt.Name);
                }

                AddHtmlLocalized(110, y, 160, 16, cliloc, args, lightHue, false, false);
                AddHtmlLocalized(280, y, 125, 16, reward, toReward.ToString(), lightHue, false, false);

                reward++;
                cliloc++;
                y += 16;
            }

            AddButton(362, 115, 2084, 2084, 1 + index, GumpButtonType.Reply, 0);
            AddButton(362, 342, 2085, 2085, 500 + index, GumpButtonType.Reply, 0);
        }
コード例 #6
0
        public override void GiveRewards()
        {
            bool captured = false;

            foreach (BaseObjective obj in Objectives)
            {
                if (obj is BountyQuestObjective && ((BountyQuestObjective)obj).Captured)
                {
                    BountyQuestObjective o = (BountyQuestObjective)obj;
                    captured = true;

                    if (o.CapturedCaptain != null && o.CapturedCaptain is PirateCaptain)
                    {
                        PirateCaptain p = o.CapturedCaptain as PirateCaptain;
                        p.Quest = null;
                    }

                    o.CapturedCaptain = null;
                    o.Captured        = false;
                    break;
                }
            }

            if (Owner == null)
            {
                return;
            }

            m_Helpers.Add(Owner);
            int totalAward = 7523;

            if (m_Captain != null && BountyQuestSpawner.Bounties.ContainsKey(m_Captain))
            {
                totalAward = BountyQuestSpawner.Bounties[m_Captain];
            }

            int eachAward = totalAward;

            if (m_Helpers.Count > 1)
            {
                eachAward = totalAward / m_Helpers.Count;
            }

            foreach (Mobile mob in m_Helpers)
            {
                if (mob.NetState != null || mob == Owner)
                {
                    mob.AddToBackpack(new Gold(eachAward));

                    if (captured)
                    {
                        Item reward = Loot.Construct(m_CapturedRewards[Utility.Random(m_CapturedRewards.Length)]);

                        if (reward != null)
                        {
                            if (reward is RuinedShipPlans)
                            {
                                mob.SendLocalizedMessage(1149838); //Here is something special!  It's a salvaged set of orc ship plans.  Parts of it are unreadable, but if you could get another copy you might be able to fill in some of the missing parts...
                            }
                            else
                            {
                                mob.SendLocalizedMessage(1149840); //Here is some special cannon ammunition.  It's imported!
                            }
                            if (reward is HeavyFlameCannonball || reward is LightFlameCannonball || reward is HeavyFrostCannonball || reward is LightFrostCannonball)
                            {
                                reward.Amount = Utility.RandomMinMax(5, 10);
                            }

                            mob.AddToBackpack(reward);
                        }
                    }

                    mob.SendLocalizedMessage(1149825, String.Format("{0}\t{1}", totalAward, eachAward)); //Here's your share of the ~1_val~ reward money, you get ~2_val~ gold.  You've earned it!
                }
                else
                {
                    foreach (Mobile mobile in m_Helpers)
                    {
                        if (mobile != mob && mobile.NetState != null)
                        {
                            mobile.SendLocalizedMessage(1149837, String.Format("{0}\t{1}\t{2}", eachAward, mob.Name, Owner.Name)); //~1_val~ gold is for ~2_val~, I can't find them so I'm giving this to Captain ~3_val~.
                        }
                    }

                    Owner.AddToBackpack(new Gold(eachAward));
                }
            }

            if (m_Captain != null && m_Captain.Alive)
            {
                m_Captain.Delete();
            }

            base.GiveRewards();
        }
コード例 #7
0
        public override void AddGumpLayout()
        {
            AddAlphaRegion(50, 50, 50, 50);
            AddImage(0, 0, 5400);

            AddHtmlLocalized(150, 37, 190, 16, CenterLoc, "#1116689", darkHue, false, false);  // WANTED FOR PIRACY
            AddHtmlLocalized(150, 320, 190, 16, CenterLoc, "#1116703", darkHue, false, false); // WANTED DEAD OR ALIVE

            AddHtmlLocalized(180, 135, 200, 16, 1116704, lightHue, false, false);              //Notice to all sailors
            AddHtmlLocalized(130, 150, 300, 16, 1116705, lightHue, false, false);              //There be a bounty on these lowlifes!
            AddHtmlLocalized(150, 170, 300, 16, 1116706, lightHue, false, false);              //See officers fer information.
            AddHtmlLocalized(195, 190, 300, 16, 1116707, lightHue, false, false);              //********

            if (Index < 0)
            {
                Index = 0;
            }
            if (Index >= BountyQuestSpawner.Bounties.Count)
            {
                Index = BountyQuestSpawner.Bounties.Count - 1;
            }

            List <Mobile> mobs = new List <Mobile>(BountyQuestSpawner.Bounties.Keys);

            if (mobs.Count == 0)
            {
                return;
            }

            int y   = 210;
            int idx = 0;

            for (int i = Index; i < mobs.Count; i++)
            {
                if (idx++ > 4)
                {
                    break;
                }

                Mobile mob      = mobs[i];
                int    toReward = 1000;

                BountyQuestSpawner.Bounties.TryGetValue(mob, out toReward);
                PirateCaptain capt = mob as PirateCaptain;

                if (capt == null)
                {
                    continue;
                }

                string args;

                if (User.NetState != null && User.NetState.IsEnhancedClient && VendorSearch.StringList != null)
                {
                    var strList = VendorSearch.StringList;

                    args = string.Format("{0} {1} {2}", strList.GetString(capt.Adjective), strList.GetString(capt.Noun), capt.PirateName > 0 ? strList.GetString(capt.PirateName) : capt.Name);

                    AddHtml(110, y, 400, 16, Color(C16232(lightHue), args), false, false);
                }
                else
                {
                    if (capt.PirateName > 0)
                    {
                        args = string.Format("#{0}\t#{1}\t#{2}", capt.Adjective, capt.Noun, capt.PirateName);
                    }
                    else
                    {
                        args = string.Format("#{0}\t#{1}\t{2}", capt.Adjective, capt.Noun, capt.Name);
                    }

                    AddHtmlLocalized(110, y, 400, 16, 1116690 + (idx - 1), args, lightHue, false, false); // ~1_val~ ~2_val~ ~3_val~
                }

                AddHtmlLocalized(280, y, 125, 16, 1116696 + (idx - 1), toReward.ToString(), lightHue, false, false); // Reward: ~1_val~

                y += 16;
            }

            AddButton(362, 115, 2084, 2084, 1 + Index, GumpButtonType.Reply, 0);
            AddButton(362, 342, 2085, 2085, 500 + Index, GumpButtonType.Reply, 0);
        }
コード例 #8
0
        public void SpawnPirateAndGalleon(SpawnZone zone, Map map)
        {
            SpawnDefinition def = m_Zones[zone];

            if (map != Map.Internal && map != null)
            {
                Rectangle2D   rec    = def.SpawnRegion;
                OrcishGalleon gal    = new OrcishGalleon(Direction.North);
                PirateCaptain pirate = new PirateCaptain(gal);
                pirate.Zone = zone;
                gal.Owner   = pirate;
                FillHold(gal);
                Point3D p       = Point3D.Zero;
                bool    spawned = false;
                for (int i = 0; i < 25; i++)
                {
                    int x = Utility.Random(rec.X, rec.Width);
                    int y = Utility.Random(rec.Y, rec.Height);
                    p = new Point3D(x, y, -5);

                    if (gal.CanFit(p, map, gal.ItemID))
                    {
                        spawned = true;
                        break;
                    }
                }

                if (!spawned)
                {
                    gal.Delete();
                    pirate.Delete();
                    return;
                }

                int gold = Utility.RandomMinMax(GoldRange[0], GoldRange[1]);
                gal.MoveToWorld(p, map);
                gal.AutoAddCannons(pirate);
                pirate.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), map);

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

                for (int i = 0; i < crewCount; i++)
                {
                    Mobile crew = new PirateCrew();

                    if (i == 0)
                    {
                        crew.Title = "the orc captain";
                    }

                    pirate.AddToCrew(crew);
                    crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), map);
                }

                Point2D[] course = def.GetRandomWaypoints();
                gal.BoatCourse = new BoatCourse(gal, new List <Point2D>(def.GetRandomWaypoints()));

                gal.NextNavPoint = 0;
                gal.StartCourse(false, false);

                /*MapItem mapItem = new MapItem(map);
                 *
                 * if (map == Map.Tokuno)
                 *  mapItem.SetDisplay(5, 5, 1448 - 32, 1448 - 10, 400, 400);
                 * else
                 *  mapItem.SetDisplay(5, 5, 5120 - 32, 4096 - 10, 400, 400);
                 *
                 * for (int i = 0; i < course.Length; i++)
                 *  mapItem.AddWorldPin(course[i].X, course[i].Y);
                 *
                 * pirate.Backpack.DropItem(mapItem);
                 *
                 * gal.MapItem = mapItem;*/

                //mapItem.Name = "Pirate Map";

                //if (0.90 > Utility.RandomDouble())
                //    mapItem.Movable = false;

                m_Bounties.Add(pirate, gold);
                m_ActiveZones[zone].Add(pirate);
            }
        }