상속: Item
		//this generates an item from what is stored in the entry.  Note no exception handling
		public override Item GenerateItem()
		{
			SOS sos = new SOS( _TargetMap, _Level );
			
			sos.TargetLocation = _TargetLocation;
			sos.MessageIndex = _MessageIndex;
			
			sos.LootType = _LootType;
			sos.Insured = _Insured;

			
			return sos;
		}
예제 #2
0
        public static void Initialize()
        {
            Schools = new Dictionary <Map, List <SchoolEntry> >();

            Schools[Map.Trammel]  = new List <SchoolEntry>();
            Schools[Map.Felucca]  = new List <SchoolEntry>();
            Schools[Map.Ilshenar] = new List <SchoolEntry>();
            Schools[Map.Tokuno]   = new List <SchoolEntry>();

            foreach (KeyValuePair <Map, List <SchoolEntry> > kvp in Schools)
            {
                int amount = 150;

                if (kvp.Key == Map.Ilshenar || kvp.Key == Map.Tokuno)
                {
                    amount = 50;
                }

                for (int i = 0; i < amount; i++)
                {
                    Point3D p;
                    int     failsafe = 0;

                    do
                    {
                        p = SOS.FindLocation(kvp.Key);
                        failsafe++;
                    }while (p == Point3D.Zero && failsafe < 10);

                    kvp.Value.Add(new SchoolEntry(kvp.Key, new Point2D(p.X, p.Y)));
                }

                if (kvp.Value.Count == 0)
                {
                    Console.WriteLine("Warning: {0} has 0 School entries!", kvp.Key);
                }
            }

            CommandSystem.Register("MoveToSchool", AccessLevel.GameMaster, e =>
            {
                Mobile m = e.Mobile;

                if (Schools.ContainsKey(m.Map))
                {
                    SchoolEntry entry = Schools[m.Map][Utility.Random(Schools[m.Map].Count)];

                    if (entry != null)
                    {
                        m.MoveToWorld(new Point3D(entry.Location.X, entry.Location.Y, m.Map.GetAverageZ(entry.Location.X, entry.Location.Y)), m.Map);
                    }
                    else
                    {
                        m.SendMessage("Bad entry");
                    }
                }
                else
                {
                    m.SendMessage("Bad map");
                }
            });
        }
예제 #3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is TreasureMap)
            {
                if (m_Entries.Count < 500)
                {
                    TreasureMap tmap = (TreasureMap)dropped;
                    if (tmap.Completed)
                    {
                        from.SendMessage("This map is completed and can not be stored in this book");
                        InvalidateProperties();
                        dropped.Delete();
                        return(false);
                    }
                    if (tmap.ChestMap != null)
                    {
                        bool matched = false;

                        Point2D p2d       = tmap.ChestLocation;
                        Point3D p3d       = Point3D.Zero;
                        string  mapnumber = "B";


                        Console.WriteLine("Searching for TMap point matching {0}", p2d);


                        foreach (TMList list in TMList.UORLists)
                        {
                            foreach (TMEntry entry in list.Entries)
                            {
                                p3d       = entry.Location;
                                mapnumber = entry.Text;

                                if (p2d.X == p3d.X && p2d.Y == p3d.Y)
                                {
                                    matched = true;
                                    //Setting of Map #

                                    break; // Escape from TMEntry loop.
                                }
                            }

                            if (matched)
                            {
                                break; // Escape from TMList loop.
                            }
                        }

                        if (matched)
                        {
                            Console.WriteLine("Matched TMap point: {0} - {1}", p3d, mapnumber);
                        }
                        else
                        {
                            Console.WriteLine("Unable to find valid spot @ {0}", p3d);
                            mapnumber = "Unknown Spot";
                        }


                        Point3D p3D = new Point3D(0, 0, 0);
                        m_Entries.Add(new DaviesLockerEntry(1, tmap.Level, tmap.Decoder, tmap.ChestMap,
                                                            tmap.ChestLocation, p3D, tmap.Bounds, mapnumber));
                        InvalidateProperties();
                        dropped.Delete();
                        from.Send(new PlaySound(0x42, GetWorldLocation()));

                        from.CloseGump(typeof(DaviesLockerGump));
                        from.SendGump(new DaviesLockerGump(this));

                        return(true);
                    }
                    @from.SendMessage("This map is invalid");
                }
                else
                {
                    from.SendMessage("This TMap Book is full");
                }
            }

            else if (dropped is SOS)
            {
                if (m_Entries.Count < 500)
                {
                    SOS     sos = (SOS)dropped;
                    Point2D p2D = new Point2D(0, 0);
                    m_Entries.Add(new DaviesLockerEntry(2, sos.Level, null, sos.TargetMap, p2D, sos.TargetLocation,
                                                        new Rectangle2D(0, 0, 0, 0), "Blank"));
                    InvalidateProperties();
                    dropped.Delete();
                    from.Send(new PlaySound(0x42, GetWorldLocation()));

                    from.CloseGump(typeof(DaviesLockerGump));
                    from.SendGump(new DaviesLockerGump(this));

                    return(true);
                }
                @from.SendMessage("This TMap Book is full");
            }
            else if (dropped is MessageInABottle)
            {
                if (m_Entries.Count < 500)
                {
                    MessageInABottle bottle = (MessageInABottle)dropped;
                    Point2D          p2D    = new Point2D(0, 0);
                    Point3D          p3D    = new Point3D(0, 0, 0);
                    m_Entries.Add(new DaviesLockerEntry(3, bottle.Level, null, bottle.TargetMap, p2D, p3D,
                                                        new Rectangle2D(0, 0, 0, 0), "Blank"));
                    InvalidateProperties();
                    dropped.Delete();
                    from.Send(new PlaySound(0x42, GetWorldLocation()));

                    from.CloseGump(typeof(DaviesLockerGump));
                    from.SendGump(new DaviesLockerGump(this));

                    return(true);
                }
                @from.SendMessage("This TMap Book is full");
            }


            return(false);
        }
예제 #4
0
        public void DropTMap(Mobile from, DaviesLockerEntry e, int index)
        {
            if (m_DefaultIndex == index)
                m_DefaultIndex = -1;

            m_Entries.RemoveAt(index);

            if (e.type == 1)
            {
                TreasureMap tmap = new TreasureMap(e.Level, e.Map)
                {
                    Decoder = e.Decoder,
                    ChestLocation = e.Location2d,
                    ChestMap = e.Map,
                    Bounds = e.Bounds
                };

                tmap.ClearPins();
                tmap.AddWorldPin(e.Location2d.X, e.Location2d.Y);

                from.AddToBackpack(tmap);

                from.SendMessage("You have removed the Treasure Map");
            }
            else if (e.type == 2)
            {
                SOS sos = new SOS(e.Map, e.Level) {TargetLocation = e.Location3d};

                from.AddToBackpack(sos);
                from.SendMessage("You have removed the S.O.S.");
            }
            else
            {
                MessageInABottle mib = new MessageInABottle(e.Map, e.Level);

                from.AddToBackpack(mib);
                from.SendMessage("You have removed the message in a bottle");
            }
        }
예제 #5
0
        private Item Construct(SOSEntry entry)
        {
            if (entry == null)
                return null;

            if (entry.Opened)
            {
                SOS sos = new SOS(entry.Map, entry.Level);

                sos.MessageIndex = entry.MessageIndex;
                sos.TargetLocation = entry.Location;
                return sos;
            }
            else
            {
                return new MessageInABottle(entry.Map, entry.Level);
            }
        }
예제 #6
0
 public SOSEntry(SOS sos) : base(sos.TargetMap, sos.TargetLocation, sos.Level)
 {
     m_Opened = true;
     m_IsAncient = sos.IsAncient;
     m_MessageIndex = sos.MessageIndex;
 }