예제 #1
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);
            }
        }
예제 #2
0
        public void SpawnShip()
        {
            BaseGalleon gal;

            if (this is PirateCaptain)
                gal = new OrcishGalleon(Direction.North);
            else if (this.Map == Map.Tokuno)
                gal = new TokunoGalleon(Direction.North);
            else
                gal = new GargishGalleon(Direction.North);

            if (gal.CanFit(this.Location, this.Map, gal.ItemID))
            {
                gal.Owner = this;
                gal.MoveToWorld(this.Location, this.Map);
                m_Galleon = gal;

                Server.Engines.Quests.BountyQuestSpawner.FillHold(m_Galleon);

                this.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), this.Map);

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

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

                    if (j == 0 && this is PirateCaptain)
                        crew.Title = "the orc captain";

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

                gal.AutoAddCannons(this);

                return;
            }
            else
            {
                gal.Delete();
                Delete();
            }
        }