Exemple #1
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is Gold)
            {
                int    Coins    = dropped.Amount;
                string sMessage = "";

                if (Coins == 10000 ||
                    Coins == 9000 ||
                    Coins == 8000 ||
                    Coins == 7000 ||
                    Coins == 6000 ||
                    Coins == 5000
                    )
                {
                    int nAllowedForAnotherQuest = SearchPage.ArtifactQuestTimeNew(from);
                    int nServerQuestTimeAllowed = DifficultyLevel.GetTimeBetweenArtifactQuests();
                    int nWhenForAnotherQuest    = nServerQuestTimeAllowed - nAllowedForAnotherQuest;

                    if (nWhenForAnotherQuest > 0)
                    {
                        TimeSpan t = TimeSpan.FromMinutes(nWhenForAnotherQuest);

                        string wait = string.Format("{0:D2} days {1:D2} hours and {2:D2} minutes",
                                                    t.Days,
                                                    t.Hours,
                                                    t.Minutes);

                        sMessage = "I have no artifact encyclopedias at the moment. Check back in " + wait + ".";
                        from.AddToBackpack(dropped);
                    }
                    else
                    {
                        sMessage = "Good luck in your quest.";

                        ArrayList targets = new ArrayList();
                        foreach (Item item in World.Items.Values)
                        {
                            if (item is SearchBook)
                            {
                                SearchBook searchbook = (SearchBook)item;
                                if (searchbook.owner == from)
                                {
                                    targets.Add(item);
                                }
                            }
                            else if (item is SearchPage)
                            {
                                SearchPage searchpage = (SearchPage)item;
                                if (searchpage.owner == from)
                                {
                                    targets.Add(item);
                                }
                            }
                        }
                        for (int i = 0; i < targets.Count; ++i)
                        {
                            Item item = ( Item )targets[i];
                            item.Delete();
                        }

                        from.AddToBackpack(new SearchBook(from, Coins));
                        dropped.Delete();
                    }
                }
                else
                {
                    sMessage = "You look like you need this more than I do.";
                    from.AddToBackpack(dropped);
                }

                this.PrivateOverheadMessage(MessageType.Regular, 1153, false, sMessage, from.NetState);
            }

            return(base.OnDragDrop(from, dropped));
        }