public static void GiveLittle(Mobile m, DialogNPC npc)
        {
            if (m.Backpack != null)
            {
                Gold g = m.Backpack.FindItemByType(typeof(Gold), true) as Gold;

                if (g != null)
                {
                    if (g.Amount == 1)
                    {
                        g.Delete();
                    }
                    else
                    {
                        g.Amount -= 1;
                    }

                    npc.SayTo(m, "Thank ye, thank ye, M'lord");
                    npc.SayTo(m, "*bows*");
                }
                else
                {
                    npc.SayTo(m, "*spits on your empty pockets*");
                }
            }
        }
Beispiel #2
0
        public override bool CheckGold(Mobile from, Item dropped)
        {
            if (dropped is Gold)
            {
                Gold g = (Gold)dropped;

                if (g.Amount > 50)
                {
                    PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I cannot accept so large a tip!", from.NetState);
                }
                else
                {
                    string tip = m_TipMessage;

                    if (tip == null || (tip = tip.Trim()).Length == 0)
                    {
                        PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "It would not be fair of me to take your money and not offer you information in return.", from.NetState);
                    }
                    else
                    {
                        Direction = GetDirectionTo(from);
                        PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, tip, from.NetState);

                        g.Delete();
                        return(true);
                    }
                }
            }

            return(false);
        }
        public static void Steal(Mobile m, DialogNPC npc)
        {
            if (m.Backpack != null)
            {
                Gold g = m.Backpack.FindItemByType(typeof(Gold), true) as Gold;

                if (g != null)
                {
                    if (g.Amount > 200)
                    {
                        g.Amount -= 200;
                    }
                    else
                    {
                        g.Delete();
                    }

                    npc.SayTo(m, "You notice {0} steal some gold from you and laugh...", npc.Name);
                }
                else
                {
                    npc.SayTo(m, "*spits on your empty pockets*");
                }
            }
        }
Beispiel #4
0
        public override bool OnGoldGiven(Mobile from, Gold dropped)
        {
            if (from is PlayerMobile && dropped.Amount == JoinCost)
            {
                PlayerMobile pm = (PlayerMobile)from;

                if (pm.NpcGuild == this.NpcGuild)
                {
                    SayTo(from, 501047);                       // Thou art already a member of our guild.
                }
                else if (pm.NpcGuild != NpcGuild.None)
                {
                    SayTo(from, 501046);                       // Thou must resign from thy other guild first.
                }
                else if (pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now)
                {
                    SayTo(from, 501048);                       // You are too young to join my guild...
                }
                else if (CheckCustomReqs(pm))
                {
                    SayWelcomeTo(from);

                    pm.NpcGuild         = this.NpcGuild;
                    pm.NpcGuildJoinTime = DateTime.Now;
                    pm.NpcGuildGameTime = pm.GameTime;

                    dropped.Delete();
                    return(true);
                }

                return(false);
            }

            return(base.OnGoldGiven(from, dropped));
        }
Beispiel #5
0
 public override bool OnGoldGiven(Mobile from, Gold dropped)
 {
     Direction = GetDirectionTo(from);
     SayTo(from, 1153420); // Oh, thank you dearie!
     dropped.Delete();
     return(true);
 }
Beispiel #6
0
        public static void Deposit(Mobile m, Item item)
        {
            Gold gold = (Gold)item;

            //generate a list of all items in the backpack
            List <Item> packitems = LedgeGoldCommand.RecurseFindItemsInPack(m.Backpack);

            item = m.Backpack.FindItemByType(typeof(GoldLedger));
            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
            {
                m.SendMessage(33, "No gold ledger found.");
                return;
            }
            else
            {
                if (ledger.Gold + gold.Amount < 999999999)
                {
                    gold.Delete();
                    ledger.Gold += gold.Amount;
                    m.SendMessage(2125, "{0} gold has been added to your gold ledger", gold.Amount);

                    if (ledger.b_open)
                    {
                        m.CloseGump(typeof(GoldLedgerGump));
                        m.SendGump(new GoldLedgerGump(ledger));
                    }
                }
            }
        }
Beispiel #7
0
        private static void getGold(string charUID, Mobile pm)
        {
            int    amount        = 0;                                                  // montants d'or
            int    bankboxAmount = 0;
            string backpack      = getPlayerItemSerial(charUID, SphereFiles.backFile); // sac du joueur
            string bankbox       = getPlayerItemSerial(charUID, SphereFiles.bankFile); // banque du joueur

            // On parcourt le fichier qui contient tous les enregistrements d'or
            foreach (string line in File.ReadAllLines(SphereFiles.goldFile))
            {
                if (line.StartsWith("AMOUNT="))
                {
                    amount = Int32.Parse(line.Split('=')[1]);
                }

                if (amount > 0 && line.StartsWith("CONT=") && line.Split('=')[1] == backpack)
                {
                    Item      gold = new Gold(amount);
                    Container pack = pm.Backpack;

                    if (pack != null)
                    {
                        pack.DropItem(gold);
                    }
                    else
                    {
                        gold.Delete();
                    }

                    amount = 0;
                }
                else if (amount > 0 && line.StartsWith("CONT=") && line.Split('=')[1] == bankbox)
                {
                    bankboxAmount += amount;
                    amount         = 0;
                    //Item gold = new Gold(amount);
                    //Container bank = pm.BankBox;

                    //if (bank != null)
                    //    bank.DropItem(gold);
                    //else
                    //    gold.Delete();
                }
            }

            if (bankboxAmount > 0)
            {
                Container bank = pm.BankBox;
                if (bank != null)
                {
                    BankCheck check = new BankCheck(bankboxAmount);
                    check.Name = "Or Banque";
                    bank.DropItem(check);
                }
            }
            bankboxAmount = 0;
        }
Beispiel #8
0
        public override void OnDelete()
        {
            // if the game is in progress, then return all Entry fees
            if (GameInProgress)
            {
                GameBroadcast(100003, ChallengeName);  // "{0} cancelled"

                // go through the participants and return their fees and clear noto
                if (Participants != null)
                {
                    foreach (IChallengeEntry entry in Participants)
                    {
                        if (entry.Status == ChallengeStatus.Forfeit)
                        {
                            continue;
                        }

                        Mobile from = entry.Participant;

                        // return the entry fee
                        if (from != null && from.BankBox != null && EntryFee > 0)
                        {
                            Item gold = new Gold(EntryFee);

                            if (!from.BankBox.TryDropItem(from, gold, false))
                            {
                                gold.Delete();
                                from.AddToBackpack(new BankCheck(EntryFee));
                                XmlPoints.SendText(from, 100000, EntryFee);                         // "Entry fee of {0} gold has been returned to you."
                            }
                            else
                            {
                                XmlPoints.SendText(from, 100001, EntryFee);  // "Entry fee of {0} gold has been returned to your bank account."
                            }
                        }

                        entry.Status = ChallengeStatus.None;
                    }

                    // clear all noto
                    foreach (IChallengeEntry entry in Participants)
                    {
                        RefreshNoto(entry.Participant);
                    }
                }

                EndGame();
            }
            else
            if (!GameCompleted)
            {
                // this is when a game is cancelled during setup
                GameBroadcast(100003, ChallengeName); // "{0} cancelled"
            }

            base.OnDelete();
        }
Beispiel #9
0
        public static bool GiveRewardTo(PlayerMobile player)
        {
            var gold = new Gold(Utility.RandomMinMax(250, 350));

            if (player.PlaceInBackpack(gold))
            {
                player.SendLocalizedMessage(1054076); // You have been given some gold.
                return(true);
            }
            gold.Delete();
            return(false);
        }
Beispiel #10
0
        public static void CashCheck(Mobile from, BankCheck check)
        {
            BankBox box = from.BankBox;

            if (box != null)
            {
                int deposited = 0;
                int toAdd     = check.Worth;

                check.Delete();
                Gold gold;

                while (toAdd > 60000)
                {
                    gold = new Gold(60000);

                    if (box.TryDropItem(from, gold, false))
                    {
                        toAdd     -= 60000;
                        deposited += 60000;
                    }
                    else
                    {
                        gold.Delete();

                        from.AddToBackpack(new BankCheck(toAdd));
                        toAdd = 0;

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    gold = new Gold(toAdd);

                    if (box.TryDropItem(from, gold, false))
                    {
                        deposited += toAdd;
                    }
                    else
                    {
                        gold.Delete();

                        from.AddToBackpack(new BankCheck(toAdd));
                    }
                }
            }
        }
        public override bool OnGoldGiven(Mobile from, Gold dropped)
        {
            if (from is PlayerMobile pm && dropped.Amount == 700)
            {
                if (pm.NpcGuild == NpcGuild.ThievesGuild)
                {
                    pm.AddToBackpack(new DisguiseKit());

                    dropped.Delete();
                    return(true);
                }
            }

            return(base.OnGoldGiven(from, dropped));
        }
        public void Refund()
        {
            Gold toGive = new Gold(Price);

            if (Placer.BankBox.TryDropItem(Placer, toGive, false))
            {
                Delete();
                Placer.SendLocalizedMessage(1060397, toGive.Amount.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
            }
            else
            {
                toGive.Delete();
                Placer.SendMessage("Your bankbox is full!");
            }
        }
        public static void GiveRewardTo(PlayerMobile player, ref bool bagOfSending, ref bool powderOfTranslocation,
                                        ref bool gold)
        {
            if (bagOfSending)
            {
                Item reward = new BagOfSending();

                if (player.PlaceInBackpack(reward))
                {
                    player.SendLocalizedMessage(1054074, "", 0x59); // You have been given a bag of sending.
                    bagOfSending = false;
                }
                else
                {
                    reward.Delete();
                }
            }

            if (powderOfTranslocation)
            {
                Item reward = new PowderOfTranslocation(Utility.RandomMinMax(10, 12));

                if (player.PlaceInBackpack(reward))
                {
                    player.SendLocalizedMessage(1054075, "", 0x59); // You have been given some powder of translocation.
                    powderOfTranslocation = false;
                }
                else
                {
                    reward.Delete();
                }
            }

            if (gold)
            {
                Item reward = new Gold(Utility.RandomMinMax(250, 350));

                if (player.PlaceInBackpack(reward))
                {
                    player.SendLocalizedMessage(1054076, "", 0x59); // You have been given some gold.
                    gold = false;
                }
                else
                {
                    reward.Delete();
                }
            }
        }
        public override void OnClick()
        {
            Container c = m_From.Backpack;
            Gold      t = new Gold(value);

            if (c.TryDropItem(m_From, t, true))
            {
                m_Stair.Delete();
                m_From.SendMessage("The item disolves and gives you a refund");
            }
            else
            {
                t.Delete();
                m_From.SendMessage("For some reason, the refund didn't work!  Please page a GM");
            }
        }
Beispiel #15
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                if (m_SellBomb == true && m_TalkedTo == true)
                {
                    if (dropped is Gold)
                    {
                        Gold gold = (Gold)dropped;

                        if (gold.Amount < 1000)
                        {
                            this.Say("That is not enough gold sire.");
                        }
                        else if (gold.Amount > 1000)
                        {
                            this.Say("That is too much sire, I cannot accept it.");
                        }
                        else if (gold.Amount == 1000)
                        {
                            gold.Delete();

                            SayTo(from, "Take this holy hand grenade and throw it near the creature, but remember to count to three first and not four nor two, unless proceeding to three!");
                            from.AddToBackpack(new HolyHandGrenade());
                            m_SellBomb = false;
                            m_TalkedTo = false;

                            if (0.10 >= Utility.RandomDouble())
                            {
                                SayTo(from, "I found this while wandering the cave. It means nothing to me but maybe it means something to you");
                                from.AddToBackpack(new PoemPartsThree());
                            }
                        }
                    }
                }
                else if (m_SellBomb == false && m_TalkedTo == false)
                {
                    if (dropped is Gold)
                    {
                        this.Say("Why are you trying to give me gold sire?");
                    }
                }
            }
            return(false);
        }
        public static void GiveRewardTo(PlayerMobile player, ref bool gold)
        {
            if (gold)
            {
                Item reward = new Gold(Utility.RandomMinMax(250, 350));

                if (player.PlaceInBackpack(reward))
                {
                    player.SendLocalizedMessage(1054076, "", 0x59); // You have been given some gold.
                    gold = false;
                }
                else
                {
                    reward.Delete();
                }
            }
        }
        public static bool RefundForVine(Mobile m_From)
        {
            Container c = m_From.Backpack;
            Gold      t = new Gold((m_VinePrice));

            if (c.TryDropItem(m_From, t, true))
            {
                m_From.SendMessage("You have been refunded " + m_VinePrice.ToString() + " gold for the deleted vine.");

                return(true);
            }
            else
            {
                t.Delete();
                m_From.SendMessage("For some reason, the refund didn't work!  Please page a GM");

                return(false);
            }
        }
Beispiel #18
0
        public static void DropGold(Mobile from, Gold gold, Container goldBag)
        {
            /* Check to see if player has a CheckBook */
            Item      item      = from.Backpack.FindItemByType(typeof(CheckBook));
            CheckBook checkBook = item as CheckBook;

            if (checkBook == null)
            {
                if (!goldBag.TryDropItem(from, gold, false))    // Attempt to stack it
                {
                    goldBag.DropItem(gold);
                }
            }
            else
            {
                checkBook.Token += gold.Amount;
                gold.Delete();
            }

            from.PlaySound(0x2E6);               // drop gold sound
        }
Beispiel #19
0
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                switch (Utility.Random(7))
                {
                case 0: g = new DDJewels(50, 100); break;

                case 1: g = new Gold(100, 200); break;

                case 2: g = new DDSilver(200, 300); break;

                case 3: g = new DDSilver(200, 300); break;

                case 4: g = new DDCopper(300, 400); break;

                case 5: g = new DDCopper(300, 400); break;

                case 6: g = new DDCopper(300, 400); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                switch (m_Task)
                {
                case 1:
                    if (targeted is TeiravonMobile)
                    {
                        Mobile         player   = (Mobile)targeted;
                        TeiravonMobile m_Player = (TeiravonMobile)player;

                        if (from == player)
                        {
                            return;
                        }

                        if (player == m_WarStone.Commander)
                        {
                            return;
                        }

                        if (m_WarStone.Members.IndexOf(player) > -1)
                        {
                            from.SendMessage("{0} is already a citizen of {1}.", player.Name, m_WarStone.Name);
                        }
                        else if (m_Player.Town != null)
                        {
                            from.SendMessage("{0} is already a citizen of {1}.", player.Name, m_Player.Town.Name);
                        }
                        else
                        {
                            m_WarStone.Members.Add(player);
                            m_Player.Town = m_WarStone;
                            from.SendMessage("{0} has been added to {1}.", player.Name, m_WarStone.Name);
                            player.SendMessage("You have been added to {0}.", m_WarStone.Name);
                        }
                    }
                    else
                    {
                        from.SendMessage("You can only add players to the town.");
                    }

                    break;

                case 2:
                    if (targeted is Gold)
                    {
                        Gold gold = (Gold)targeted;

                        if (!gold.Movable)
                        {
                            from.SendMessage("The gold must be unlocked and in your pack to use.");
                        }
                        else
                        {
                            m_WarStone.Gold += (ulong)gold.Amount;
                            gold.Delete();

                            from.SendMessage("You add the gold to the treasury.");
                        }
                    }
                    else if (targeted is Log)
                    {
                        Log log = (Log)targeted;

                        if (!log.Movable)
                        {
                            from.SendMessage("The log{0} must be unlocked and in your pack to use.", log.Amount > 1 ? "s" : "");
                        }
                        else
                        {
                            m_WarStone.Wood += (ulong)log.Amount;

                            from.SendMessage("You add the log{0} to the treasury.", log.Amount > 1 ? "s" : "");

                            log.Delete();
                        }
                    }

                    break;
                }
            }
        public static void LedgeGold_OnCommand(CommandEventArgs e)
        {
            //generate a list of all items in the backpack
            List <Item> packitems = RecurseFindItemsInPack(e.Mobile.Backpack);

            Item       item   = e.Mobile.Backpack.FindItemByType(typeof(GoldLedger));
            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
            {
                e.Mobile.SendMessage(33, "No gold ledger found.");
                return;
            }
            else
            {
                foreach (Item pitem in packitems)
                {
                    if (pitem is Gold)
                    {
                        Gold gold = pitem as Gold;

                        if (gold != null)
                        {
                            if (ledger.Gold < 999999999)
                            {
                                int golda = gold.Amount;
                                if ((gold.Amount + ledger.Gold) > 999999999)
                                {
                                    golda = (999999999 - ledger.Gold);
                                }
                                double maxgold = golda;
                                if (golda > maxgold)
                                {
                                    golda = (int)maxgold;
                                }
                                int GoldID = 0;
                                if (golda == 1)
                                {
                                    GoldID = gold.ItemID;
                                }
                                else if (golda > 1 && golda < 6)
                                {
                                    GoldID = gold.ItemID + 1;
                                }
                                else if (golda >= 6)
                                {
                                    GoldID = gold.ItemID + 2;
                                }
                                if (golda < gold.Amount)
                                {
                                    gold.Amount -= golda;
                                }
                                else
                                {
                                    gold.Delete();
                                }
                                ledger.Gold += golda;
                                if (ledger.b_open && golda > 0)
                                {
                                    e.Mobile.CloseGump(typeof(GoldLedgerGump));
                                    e.Mobile.SendGump(new GoldLedgerGump(ledger));
                                }
                                if (golda > 0)
                                {
                                    e.Mobile.SendMessage(2125, "You ledger the gold");
                                    Effects.SendMovingEffect(e.Mobile.Backpack, e.Mobile, GoldID, 5, 50, true, false);
                                    e.Mobile.PlaySound(0x2E6);
                                }
                            }
                        }
                    }
                }
            }
        }
        public override bool OnGoldGiven(Mobile from, Gold dropped)
        {
            Direction = GetDirectionTo(from);
            if (!from.Female)
            {
                if (dropped.Amount <= 9)
                {
                    SayTo(from, "Thank you, but for that not even a goat would be at your service!");
                }

                if (dropped.Amount >= 10)
                {
                    if (dropped.Amount <= 99 && dropped.Amount <= from.HitsMax - from.Hits)
                    {
                        from.Hits = dropped.Amount;
                    }

                    if (dropped.Amount <= 99 && dropped.Amount >= from.HitsMax - from.Hits)
                    {
                        from.Hits += from.HitsMax;
                    }

                    if (dropped.Amount >= 100)
                    {
                        from.SendMessage("You feel totally relaxed and painfree.");
                        from.Hits = from.HitsMax;
                        from.Mana = from.ManaMax;
                        from.Stam = from.StamMax;
                    }
                    SayTo(from, "Let me give you a relaxing massage.");
                    from.SendMessage("She gives you a nice treatment.");

                    switch (Utility.Random(6))
                    {
                    case 0:
                    {
                        from.PlaySound(from.Female ? 811 : 1085);
                        from.Say("oooh");
                        break;
                    }

                    case 1:
                    {
                        PlaySound(800);
                        from.PlaySound(from.Female ? 800 : 1072);
                        from.Emote("*kisses*");
                        break;
                    }

                    case 2:
                    {
                        from.PlaySound(from.Female ? 816 : 1090);
                        from.Emote("*sighs*");
                        break;
                    }

                    case 3:
                    {
                        from.PlaySound(from.Female ? 823 : 1097);
                        from.Say("yeah!");
                        break;
                    }

                    case 4:
                    {
                        from.PlaySound(from.Female ? 795 : 1067);
                        from.Emote("*groans*");
                        break;
                    }

                    case 5:
                    {
                        from.PlaySound(from.Female ? 778 : 1049);
                        from.Say("ah!");
                        break;
                    }
                    }
                }
                dropped.Delete();
                return(true);
            }
            else
            {
                SayTo(from, "Hey, leave me alone!");
                from.SendMessage("She takes your money and turns around.");
                return(true);
            }
        }
Beispiel #23
0
        public virtual bool CheckAtDestination()
        {
            EDI dest = GetDestination();

            if (dest == null)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

            if (dest.Contains(Location))
            {
                Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

                // not going anywhere
                m_Destination       = null;
                m_DestinationString = null;

                Container cont = escorter.Backpack;

                if (cont == null)
                {
                    cont = escorter.BankBox;
                }

                Gold gold = new Gold(500, 1000);

                if (!cont.TryDropItem(escorter, gold, false))
                {
                    if (escorter.Map != null && escorter.Map != Map.Internal)
                    {
                        gold.MoveToWorld(escorter.Location, escorter.Map);
                    }
                    else
                    {
                        gold.Delete();
                    }
                }

                StopFollow();
                SetControlMaster(null);
                m_EscortTable.Remove(escorter);
                BeginDelete();

                Misc.Titles.AwardFame(escorter, 10, true);

                bool gainedPath = false;

                PlayerMobile pm = escorter as PlayerMobile;

                if (pm != null)
                {
                    if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)
                    {
                        pm.NextCompassionDay = DateTime.MinValue;
                        pm.CompassionGains   = 0;
                    }

                    if (pm.CompassionGains >= 5)          // have already gained 5 times in one day, can gain no more
                    {
                        pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again.
                    }
                    else if (VirtueHelper.Award(pm, VirtueName.Compassion, IsPrisoner ? 400 : 200, ref gainedPath))
                    {
                        if (gainedPath)
                        {
                            pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion!
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1053002);                            // You have gained in compassion.
                        }
                        pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0
                        ++pm.CompassionGains;
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further.
                    }
                }

                return(true);
            }

            return(false);
        }
        public static bool DetectSomething(Item item, Mobile m, bool skillCheck)
        {
            bool   foundAnyone = false;
            string sTrap;

            bool foundIt = false;

            if (m.CheckSkill(SkillName.DetectHidden, 0, 125))
            {
                foundIt = true;
            }
            else if ((AosAttributes.GetValue(m, AosAttribute.NightSight) > 0 || m.LightLevel > 0) && 1 == Utility.RandomMinMax(1, 20))
            {
                foundIt = true;
            }

            if (m is PlayerMobile && m.Alive && (!skillCheck || foundIt))
            {
                if (item is BaseTrap)
                {
                    BaseTrap trap = (BaseTrap)item;

                    if (trap is FireColumnTrap)
                    {
                        sTrap = "(fire column trap)";
                    }
                    else if (trap is FlameSpurtTrap)
                    {
                        sTrap = "(fire spurt trap)";
                    }
                    else if (trap is GasTrap)
                    {
                        sTrap = "(poison gas trap)";
                    }
                    else if (trap is GiantSpikeTrap)
                    {
                        sTrap = "(giant spike trap)";
                    }
                    else if (trap is MushroomTrap)
                    {
                        sTrap = "(odd mushroom)";
                    }
                    else if (trap is SawTrap)
                    {
                        sTrap = "(saw blade trap)";
                    }
                    else if (trap is SpikeTrap)
                    {
                        sTrap = "(spike trap)";
                    }
                    else if (trap is StoneFaceTrap)
                    {
                        sTrap = "(stone face trap)";
                    }
                    else
                    {
                        sTrap = "";
                    }

                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage("There is a trap nearby! " + sTrap + "");
                    foundAnyone = true;
                }
                else if (item is BaseDoor && (item.ItemID == 0x35E ||
                                              item.ItemID == 0xF0 ||
                                              item.ItemID == 0xF2 ||
                                              item.ItemID == 0x326 ||
                                              item.ItemID == 0x324 ||
                                              item.ItemID == 0x32E ||
                                              item.ItemID == 0x32C ||
                                              item.ItemID == 0x314 ||
                                              item.ItemID == 0x316 ||
                                              item.ItemID == 0x31C ||
                                              item.ItemID == 0x31E ||
                                              item.ItemID == 0xE8 ||
                                              item.ItemID == 0xEA ||
                                              item.ItemID == 0x34C ||
                                              item.ItemID == 0x356 ||
                                              item.ItemID == 0x35C ||
                                              item.ItemID == 0x354 ||
                                              item.ItemID == 0x344 ||
                                              item.ItemID == 0x346 ||
                                              item.ItemID == 0x34E ||
                                              item.ItemID == 0x334 ||
                                              item.ItemID == 0x336 ||
                                              item.ItemID == 0x33C ||
                                              item.ItemID == 0x33E))
                {
                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage("There is a hidden door nearby!");
                    foundAnyone = true;
                }
                else if (item is HiddenTrap)
                {
                    string textSay = "There is a hidden floor trap somewhere nearby!";
                    if (Server.Misc.Worlds.IsOnSpaceship(item.Location, item.Map))
                    {
                        textSay = "There is a dangerous area nearby!";
                    }
                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage(textSay);
                    foundAnyone = true;
                }
                else if (item is HiddenChest)
                {
                    m.SendMessage("Your eye catches something nearby.");
                    Map map = m.Map;
                    string where = Server.Misc.Worlds.GetRegionName(m.Map, m.Location);

                    int money = Utility.RandomMinMax(100, 200);

                    int level = (int)(m.Skills[SkillName.DetectHidden].Value / 10);
                    if (level < 1)
                    {
                        level = 1;
                    }
                    if (level > 10)
                    {
                        level = 10;
                    }

                    switch (Utility.RandomMinMax(1, level))
                    {
                    case 1: level = 1; break;

                    case 2: level = 2; break;

                    case 3: level = 3; break;

                    case 4: level = 4; break;

                    case 5: level = 5; break;

                    case 6: level = 6; break;

                    case 7: level = 7; break;

                    case 8: level = 8; break;

                    case 9: level = 9; break;

                    case 10: level = 10; break;
                    }

                    if (Utility.RandomMinMax(1, 3) > 1)
                    {
                        Item coins = new Gold((money * level));

                        if (Server.Misc.Worlds.IsOnSpaceship(item.Location, item.Map))
                        {
                            coins.Delete(); coins = new DDXormite(); coins.Amount = (int)((money * level) / 3);
                        }
                        else if (Server.Misc.Worlds.GetMyWorld(item.Map, item.Location, item.X, item.Y) == "the Underworld")
                        {
                            coins.Delete(); coins = new DDJewels(); coins.Amount = (int)((money * level) / 2);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 99)
                        {
                            coins.Delete(); coins = new DDGemstones(); coins.Amount = (int)((money * level) / 2);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 95)
                        {
                            coins.Delete(); coins = new DDGoldNuggets(); coins.Amount = (int)((money * level));
                        }
                        else if (Utility.RandomMinMax(1, 100) > 80)
                        {
                            coins.Delete(); coins = new DDSilver(); coins.Amount = (int)((money * level) * 5);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 60)
                        {
                            coins.Delete(); coins = new DDCopper(); coins.Amount = (int)((money * level) * 10);
                        }

                        Point3D loc = item.Location;
                        coins.MoveToWorld(loc, map);
                        Effects.SendLocationParticles(EffectItem.Create(coins.Location, coins.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                        Effects.PlaySound(coins.Location, coins.Map, 0x1FA);
                    }
                    else
                    {
                        HiddenBox mBox = new HiddenBox(level, where, m);

                        Point3D loc = item.Location;
                        mBox.MoveToWorld(loc, map);
                        Effects.SendLocationParticles(EffectItem.Create(mBox.Location, mBox.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                        Effects.PlaySound(mBox.Location, mBox.Map, 0x1FA);
                    }

                    foundAnyone = true;
                    item.Delete();
                }
            }
            return(foundAnyone);
        }
Beispiel #25
0
        public override bool OnGoldGiven(Mobile from, Gold dropped)
        {
            PlayerMobile pm = (PlayerMobile)from;

            if (from is PlayerMobile && !from.Blessed && dropped.Amount == JoiningFee(from) && ((PlayerMobile)from).Profession != 1)
            {
                if (pm.NpcGuild == this.NpcGuild)
                {
                    SayTo(from, 501047);                       // Thou art already a member of our guild.
                }
                else if (pm.NpcGuild != NpcGuild.None)
                {
                    SayTo(from, 501046);                       // Thou must resign from thy other guild first.
                }
                else if (pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow)
                {
                    SayTo(from, 501048);                       // You are too young to join my guild...
                }
                else if (CheckCustomReqs(pm))
                {
                    SayWelcomeTo(from);

                    pm.NpcGuild         = this.NpcGuild;
                    pm.NpcGuildJoinTime = DateTime.UtcNow;
                    pm.NpcGuildGameTime = pm.GameTime;

                    dropped.Delete();

                    ArrayList targets = new ArrayList();
                    foreach (Item item in World.Items.Values)
                    {
                        if (item is GuildRings)
                        {
                            GuildRings guildring = (GuildRings)item;
                            if (guildring.RingOwner == from)
                            {
                                targets.Add(item);
                            }
                        }
                    }
                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Item item = ( Item )targets[i];
                        item.Delete();
                    }

                    int GuildType = 1;
                    if (this.NpcGuild == NpcGuild.MagesGuild)
                    {
                        GuildType = 1;
                    }
                    else if (this.NpcGuild == NpcGuild.WarriorsGuild)
                    {
                        GuildType = 2;
                    }
                    else if (this.NpcGuild == NpcGuild.ThievesGuild)
                    {
                        GuildType = 3;
                    }
                    else if (this.NpcGuild == NpcGuild.RangersGuild)
                    {
                        GuildType = 4;
                    }
                    else if (this.NpcGuild == NpcGuild.HealersGuild)
                    {
                        GuildType = 5;
                    }
                    else if (this.NpcGuild == NpcGuild.MinersGuild)
                    {
                        GuildType = 6;
                    }
                    else if (this.NpcGuild == NpcGuild.MerchantsGuild)
                    {
                        GuildType = 7;
                    }
                    else if (this.NpcGuild == NpcGuild.TinkersGuild)
                    {
                        GuildType = 8;
                    }
                    else if (this.NpcGuild == NpcGuild.TailorsGuild)
                    {
                        GuildType = 9;
                    }
                    else if (this.NpcGuild == NpcGuild.FishermensGuild)
                    {
                        GuildType = 10;
                    }
                    else if (this.NpcGuild == NpcGuild.BardsGuild)
                    {
                        GuildType = 11;
                    }
                    else if (this.NpcGuild == NpcGuild.BlacksmithsGuild)
                    {
                        GuildType = 12;
                    }
                    else if (this.NpcGuild == NpcGuild.NecromancersGuild)
                    {
                        GuildType = 13;
                    }
                    else if (this.NpcGuild == NpcGuild.AlchemistsGuild)
                    {
                        GuildType = 14;
                    }
                    else if (this.NpcGuild == NpcGuild.DruidsGuild)
                    {
                        GuildType = 15;
                    }
                    else if (this.NpcGuild == NpcGuild.ArchersGuild)
                    {
                        GuildType = 16;
                    }
                    else if (this.NpcGuild == NpcGuild.CarpentersGuild)
                    {
                        GuildType = 17;
                    }
                    else if (this.NpcGuild == NpcGuild.CartographersGuild)
                    {
                        GuildType = 18;
                    }
                    else if (this.NpcGuild == NpcGuild.LibrariansGuild)
                    {
                        GuildType = 19;
                    }
                    else if (this.NpcGuild == NpcGuild.CulinariansGuild)
                    {
                        GuildType = 20;
                    }
                    else if (this.NpcGuild == NpcGuild.AssassinsGuild)
                    {
                        GuildType = 21;
                    }

                    from.AddToBackpack(new GuildRings(from, GuildType));
                    from.SendSound(0x3D);

                    return(true);
                }

                return(false);
            }

            if (from is PlayerMobile && dropped.Amount == 400 && pm.NpcGuild == this.NpcGuild)
            {
                dropped.Delete();

                ArrayList targets = new ArrayList();
                foreach (Item item in World.Items.Values)
                {
                    if (item is GuildRings)
                    {
                        GuildRings guildring = (GuildRings)item;
                        if (guildring.RingOwner == from)
                        {
                            targets.Add(item);
                        }
                    }
                }
                for (int i = 0; i < targets.Count; ++i)
                {
                    Item item = ( Item )targets[i];
                    item.Delete();
                }

                int GuildType = 1;
                if (this.NpcGuild == NpcGuild.MagesGuild)
                {
                    GuildType = 1;
                }
                else if (this.NpcGuild == NpcGuild.WarriorsGuild)
                {
                    GuildType = 2;
                }
                else if (this.NpcGuild == NpcGuild.ThievesGuild)
                {
                    GuildType = 3;
                }
                else if (this.NpcGuild == NpcGuild.RangersGuild)
                {
                    GuildType = 4;
                }
                else if (this.NpcGuild == NpcGuild.HealersGuild)
                {
                    GuildType = 5;
                }
                else if (this.NpcGuild == NpcGuild.MinersGuild)
                {
                    GuildType = 6;
                }
                else if (this.NpcGuild == NpcGuild.MerchantsGuild)
                {
                    GuildType = 7;
                }
                else if (this.NpcGuild == NpcGuild.TinkersGuild)
                {
                    GuildType = 8;
                }
                else if (this.NpcGuild == NpcGuild.TailorsGuild)
                {
                    GuildType = 9;
                }
                else if (this.NpcGuild == NpcGuild.FishermensGuild)
                {
                    GuildType = 10;
                }
                else if (this.NpcGuild == NpcGuild.BardsGuild)
                {
                    GuildType = 11;
                }
                else if (this.NpcGuild == NpcGuild.BlacksmithsGuild)
                {
                    GuildType = 12;
                }
                else if (this.NpcGuild == NpcGuild.NecromancersGuild)
                {
                    GuildType = 13;
                }
                else if (this.NpcGuild == NpcGuild.AlchemistsGuild)
                {
                    GuildType = 14;
                }
                else if (this.NpcGuild == NpcGuild.DruidsGuild)
                {
                    GuildType = 15;
                }
                else if (this.NpcGuild == NpcGuild.ArchersGuild)
                {
                    GuildType = 16;
                }
                else if (this.NpcGuild == NpcGuild.CarpentersGuild)
                {
                    GuildType = 17;
                }
                else if (this.NpcGuild == NpcGuild.CartographersGuild)
                {
                    GuildType = 18;
                }
                else if (this.NpcGuild == NpcGuild.LibrariansGuild)
                {
                    GuildType = 19;
                }
                else if (this.NpcGuild == NpcGuild.CulinariansGuild)
                {
                    GuildType = 20;
                }
                else if (this.NpcGuild == NpcGuild.AssassinsGuild)
                {
                    GuildType = 21;
                }

                this.Say("Here is your replacement ring.");

                return(true);
            }

            return(base.OnGoldGiven(from, dropped));
        }
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                int r1 = (int)(Utility.RandomMinMax(80, 160) * (MyServerSettings.GetGoldCutRate() * .01));
                int r2 = (int)(Utility.RandomMinMax(200, 400) * (MyServerSettings.GetGoldCutRate() * .01));
                int r3 = (int)(Utility.RandomMinMax(400, 800) * (MyServerSettings.GetGoldCutRate() * .01));
                int r4 = (int)(Utility.RandomMinMax(800, 1200) * (MyServerSettings.GetGoldCutRate() * .01));
                int r5 = (int)(Utility.RandomMinMax(1200, 1600) * (MyServerSettings.GetGoldCutRate() * .01));

                switch (Utility.Random(21))
                {
                case 0: g = new Crystals(r1); break;

                case 1: g = new DDGemstones(r2); break;

                case 2: g = new DDJewels(r2); break;

                case 3: g = new DDGoldNuggets(r3); break;

                case 4: g = new Gold(r3); break;

                case 5: g = new Gold(r3); break;

                case 6: g = new Gold(r3); break;

                case 7: g = new DDSilver(r4); break;

                case 8: g = new DDSilver(r4); break;

                case 9: g = new DDSilver(r4); break;

                case 10: g = new DDSilver(r4); break;

                case 11: g = new DDSilver(r4); break;

                case 12: g = new DDSilver(r4); break;

                case 13: g = new DDCopper(r5); break;

                case 14: g = new DDCopper(r5); break;

                case 15: g = new DDCopper(r5); break;

                case 16: g = new DDCopper(r5); break;

                case 17: g = new DDCopper(r5); break;

                case 18: g = new DDCopper(r5); break;

                case 19: g = new DDCopper(r5); break;

                case 20: g = new DDCopper(r5); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }