Пример #1
0
        public override void OnComponentUsed(AddonComponent component, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            if (house != null && (house.IsOwner(from) || (house.LockDowns.ContainsKey(this) && house.LockDowns[this] == from)))
            {
                if (m_ResourceCount > 0)
                {
                    Container cont = from.Backpack;

                    MessageInABottle mib = new MessageInABottle();

                    if (cont == null || !cont.TryDropItem(from, mib, false))
                    {
                        from.BankBox.DropItem(mib);
                        from.SendLocalizedMessage(1072224); // An item has been placed in your bank box.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
                    }
                    ResourceCount--;
                    NextResourceCount = DateTime.UtcNow + TimeSpan.FromDays(7);
                }
            }
            else
            {
                from.SendLocalizedMessage(502092); // You must be in your house to do this.
            }
        }
Пример #2
0
        private static Item GetRandomSpecial(int level, Map map)
        {
            Item special;

            switch (Utility.Random(8))
            {
            default:
            case 0: special = new CreepingVine(); break;

            case 1: special = new MessageInABottle(); break;

            case 2: special = new ScrollofAlacrity(PowerScroll.Skills[Utility.Random(PowerScroll.Skills.Count)]); break;

            case 3: special = new Skeletonkey(); break;

            case 4: special = new TastyTreat(5); break;

            case 5: special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), map); break;

            case 6: special = GetRandomRecipe(); break;

            case 7: special = ScrollofTranscendence.CreateRandom(1, 5); break;
            }

            return(special);
        }
Пример #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
            case 3:
            case 2:
            {
                m_Level = reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                m_TargetMap      = reader.ReadMap();
                m_TargetLocation = reader.ReadPoint3D();
                m_MessageIndex   = reader.ReadInt();

                break;
            }

            case 0:
            {
                m_TargetMap = Map;

                if (m_TargetMap == null || m_TargetMap == Map.Internal)
                {
                    m_TargetMap = Map.Trammel;
                }

                m_TargetLocation = FindLocation(m_TargetMap);
                m_MessageIndex   = Utility.Random(MessageEntry.Entries.Length);

                break;
            }
            }

            if (version < 2)
            {
                m_Level = MessageInABottle.GetRandomLevel();
            }

            if (version < 3)
            {
                UpdateHue();
            }

            if (version < 4 && m_TargetMap == Map.Tokuno)
            {
                m_TargetMap = Map.Trammel;
            }
        }
Пример #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
        public override void OnComponentUsed(AddonComponent component, Mobile from)
        {
            if (m_NextUse < DateTime.Now)
            {
                Container cont = from.Backpack;

                MessageInABottle mib = new MessageInABottle();

                if (cont == null || !cont.TryDropItem(from, mib, false))
                {
                    from.BankBox.DropItem(mib);
                    from.SendLocalizedMessage(1072224); // An item has been placed in your bank box.
                }
                else
                    from.SendLocalizedMessage(1072223); // An item has been placed in your backpack.

                m_NextUse = DateTime.Now + TimeSpan.FromDays(7);
            }
        }
Пример #6
0
        public override void OnComponentUsed(AddonComponent component, Mobile from)
        {
            if (m_NextUse < DateTime.UtcNow)
            {
                Container cont = from.Backpack;

                MessageInABottle mib = new MessageInABottle();

                if (cont == null || !cont.TryDropItem(from, mib, false))
                {
                    from.BankBox.DropItem(mib);
                    from.SendLocalizedMessage(1072224); // An item has been placed in your bank box.
                }
                else
                {
                    from.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
                }
                m_NextUse = DateTime.UtcNow + TimeSpan.FromDays(7);
            }
        }
Пример #7
0
 public SOS(Map map)
     : this(map, MessageInABottle.GetRandomLevel())
 {
 }
        protected virtual void FinishEffect(Point3D p, Map map, Mobile from)
        {
            from.RevealingAction();

            from.ShilCheckSkill(SkillName.Fishing, points: 100);

            switch (Utility.Random(10))
            {
            case 0:
            case 1:
            case 2:
            {
                BaseCreature spawn = null;

                if (Utility.Random(11) > 9)
                {
                    spawn = new Kraken();
                }
                else if (Utility.Random(11) > 9)
                {
                    spawn = new Kraken();
                }
                else if (Utility.Random(11) > 9)
                {
                    spawn = new SeaSerpent();
                }

                if (spawn != null)
                {
                    from.SendFailureMessage("You caught something dangerous in your net!");
                    from.ShilCheckSkill(SkillName.Fishing, points: 100);
                    spawn.MoveToWorld(from.Location, from.Map);
                }
                else
                {
                    if (Utility.Random(6) == 2)
                    {
                        var sosBottle = new MessageInABottle();
                        from.AddToBackpack(sosBottle);
                    }
                    else
                    {
                        var pouch = new Pouch();
                        pouch.AddItem(new Gold(Utility.Random(100) + 250));
                        from.AddToBackpack(pouch);
                        from.SendSuccessMessage("You find an old backpack!");
                    }
                }
                break;
            }

            case 3:
            {
                var shell = GetRandomShell(from);
                from.AddToBackpack(shell);
                from.SendSuccessMessage("You find something valuable!");
                break;
            }

            case 4:
            case 5:
            {
                var magicFish = GetFish(from);
                if (magicFish == null)
                {
                    from.AddToBackpack(new Fish(Utility.RandomMinMax(6, 12)));
                    from.ShilCheckSkill(SkillName.Fishing, points: 100);
                }
                else
                {
                    magicFish.Amount = Utility.RandomMinMax(1, 2);
                    from.AddToBackpack(magicFish);
                    from.ShilCheckSkill(SkillName.Fishing, points: 150);
                }
                from.SendSuccessMessage("You caught some fish.");
                break;
            }

            case 6:
            {
                if (Utility.Random(10) > 8)
                {
                    from.AddToBackpack(new FishingTrophy1(from));
                    from.SendSuccessMessage("You catch a trophy!");
                }
                else if (Utility.Random(10) > 8)
                {
                    from.AddToBackpack(new FishingTrophy2(from));
                    from.SendSuccessMessage("You catch a trophy!");
                }
                else
                {
                    var bag = new Bag();
                    bag.AddItem(new Gold(Utility.Random(200) + 150));
                    from.AddToBackpack(bag);
                    from.SendSuccessMessage("You find an old bag!");
                }

                break;
            }

            case 7:
            case 8:
            {
                var remains = GetRemains(from);
                from.AddToBackpack(remains);
                from.SendSuccessMessage("You find human skeleton remains!");
                break;
            }

            case 9:
            {
                var seaSerpent = new SeaSerpent();
                Spawn(from.Location, from.Map, seaSerpent);
                from.SendFailureMessage("You did not catch anything, except...");
                break;
            }
            }

            Delete();
        }
Пример #9
0
        private static Item GetRandomSpecial(int level, Map map)
        {
            Item special;

            switch (Utility.Random(8))
            {
                default:
                case 0: special = new CreepingVine(); break;
                case 1: special = new MessageInABottle(); break;
                case 2: special = new ScrollofAlacrity(PowerScroll.Skills[Utility.Random(PowerScroll.Skills.Count)]); break;
                case 3: special = new Skeletonkey(); break;
                case 4: special = new TastyTreat(5); break;
                case 5: special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), map); break;
                case 6: special = GetRandomRecipe(); break;
                case 7: special = ScrollofTranscendence.CreateRandom(1, 5); break;
            }

            return special;
        }
Пример #10
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);
        }
Пример #11
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");
            }
        }
Пример #12
0
        public SOS(string world, int level) : base(0x14ED)
        {
            if (level < 1)
            {
                level = MessageInABottle.GetRandomLevel();
            }

            if (world == "the Town of Skara Brae")
            {
                world = "the Land of Sosaria";
            }                                                                                      // NO SOSs IN SKARA BRAE
            else if (world == "the Moon of Luna")
            {
                world = "the Land of Sosaria";
            }                                                                                     // NO SOSs ON THE MOON
            else if (world == "the Underworld")
            {
                world = "the Land of Sosaria";
            }                                                                                   // NO SOSs IN THE UNDERWORLD

            Weight = 1.0;

            Point3D loc = Worlds.GetRandomLocation(world, "sea");
            Map     map = Worlds.GetMyDefaultMap(world);

            MapWorld    = world;
            m_Level     = level;
            m_TargetMap = map;

            m_TargetLocation = loc;

            UpdateHue();

            ShipName = RandomThings.GetRandomShipName("", 0);

            string Beast = "a sea dragon";

            switch (Utility.Random(12))
            {
            case 0: Beast = "a gigantic monster"; break;

            case 1: Beast = "a sea hag"; break;

            case 2: Beast = "a leviathan"; break;

            case 3: Beast = "a sea dragon"; break;

            case 4: Beast = "a sea giant"; break;

            case 5: Beast = "a storm giant"; break;

            case 6: Beast = "a sea serpent"; break;

            case 7: Beast = "a demon of the sea"; break;

            case 8: Beast = "a rotting squid"; break;

            case 9: Beast = "a giant beast"; break;

            case 10: Beast = "a dragon turtle"; break;

            case 11: Beast = "a huge creature"; break;
            }

            if (IsAncient)
            {
                ShipStory = "This parchment is very old and almost crumbles in your hand. You know that whoever wrote this has been dead for possibly centuries, but it reads... ";
            }

            switch (Utility.Random(5))
            {
            case 0: ShipStory = ShipStory + "We were sailing in " + MapWorld + " when " + Beast + " rose from the depths of the ocean and attacked our ship! The hull has taken alot of damage and '" + ShipName + "' is slowly sinking into the depths of the sea! Whoever finds this, send a ship to the coordinates below! Hurry! I am not sure how long we will last out here!"; break;

            case 1: ShipStory = ShipStory + "If ya never seen " + Beast + " before, consider yerself lucky. There be little warning before they hit our ship, '" + ShipName + "', while sailing in " + MapWorld + ". We thought we hit a reef but we were wrong. It tore the ship apart. Only me and " + QuestCharacters.ParchmentWriter() + " managed to survive the onslaught of the beast. Now we sit here, on some island. The coordinates I last remember is where your ship went down. We may be close to there if you can send a ship. There be gold for payment if you do."; break;

            case 2: ShipStory = ShipStory + "I am writing this with my dying strength on board '" + ShipName + "'. " + QuestCharacters.ParchmentWriter() + " the Pirate came upon us in the night while far from land in " + MapWorld + ". We didn't stand a chance. We tried to outrun er but the wind was against us to be sure. He set our ship ablaze and fled off into the distance. Now we slowly sink into the ocean. If you find this, I wrote our coordinates below. You may still get here in time to save the others. If you can, tell " + QuestCharacters.ParchmentWriter() + " my tale so they never live wondering my fate. They live somewhere in " + RandomThings.GetRandomCity() + "."; break;

            case 3: ShipStory = ShipStory + "'" + ShipName + "' be sinking far from land. What we thought was a merchant ship was actually a war ship in disguise. They be hunting us pirates on the high seas in " + MapWorld + "...and today our luck ran out. Their cannons ripped through our sails, and tore holes in our hull. They killed most of the crew, where only " + Utility.RandomMinMax(3, 16) + " of us survived. They be gone now, but the sharks started circling the wreck. I just saw " + QuestCharacters.ParchmentWriter() + " being pulled below the waves, blood gushing up from below. I be on the largest piece of flotsam and can only hope I survive till ya get here."; break;

            case 4: ShipStory = ShipStory + "I knew " + QuestCharacters.ParchmentWriter() + " weren't no good at being a captain of '" + ShipName + "'. Now this probably be our end here in " + MapWorld + ". We be under attack by " + Beast + " and we have no chance of making it to " + RandomThings.GetRandomCity() + " now. I fear that me never see me wife again. If ye find this note, please find us before we sink. I have an ancient artifact I could trade for yer help."; break;
            }
        }
Пример #13
0
 public SOSEntry(MessageInABottle mib) : base(mib.TargetMap, Point3D.Zero, mib.Level)
 {
     m_Opened = false;
     m_IsAncient = false;
     m_MessageIndex = -1;
 }