示例#1
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is BaseTreasureChest)
     {
         BaseTreasureChest targ = (BaseTreasureChest)targeted;
         targ.Reset(true, false);
     }
     else
     {
         from.SendMessage(256, "Il faut cliquer sur un coffre au trésor !");
     }
 }
示例#2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 1)
            {
                #region entries
                TextRelay entry;
                string    text;

                try
                {
                    entry = info.GetTextEntry(1);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.LockLevelSeed = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.LockLevelSeed = m_StartLockLevel;
                }

                try
                {
                    entry         = info.GetTextEntry(2);
                    text          = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.Delay = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.Delay = m_StartDelay;
                }

                try
                {
                    entry = info.GetTextEntry(3);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.GoldQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.GoldQuantity = m_StartGold;
                }

                try
                {
                    entry = info.GetTextEntry(4);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.FoodQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.FoodQuantity = m_StartFood;
                }

                try
                {
                    entry = info.GetTextEntry(5);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.JunkQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.JunkQuantity = m_StartJunk;
                }

                try
                {
                    entry = info.GetTextEntry(6);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.RegsQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.RegsQuantity = m_StartRegs;
                }

                try
                {
                    entry = info.GetTextEntry(7);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.UtilityQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.UtilityQuantity = m_StartUtility;
                }


                try
                {
                    entry = info.GetTextEntry(8);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.ScrollsQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.ScrollsQuantity = m_StartScrolls;
                }


                try
                {
                    entry = info.GetTextEntry(9);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.NecroRegsQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.NecroRegsQuantity = m_StartNecroRegs;
                }


                try
                {
                    entry = info.GetTextEntry(10);
                    text  = (entry == null ? "" : entry.Text.Trim());
                    m_Chest.SpecialItemsQuantity = Convert.ToInt32(Utility.FixHtml(text));
                }
                catch
                {
                    m_Chest.SpecialItemsQuantity = m_StartSpecialItems;
                }
                #endregion

                from.CloseGump(typeof(SetChestInfo));
                from.CloseGump(typeof(SetChestLocations));

                m_Chest.Reset(true, false);
            }

            if (info.ButtonID == 0)
            {
                from.CloseGump(typeof(SetChestInfo));
                from.CloseGump(typeof(SetChestLocations));
            }

            if (info.ButtonID == 2)
            {
                m_Chest.GenBag();
                m_Chest.cont.DisplayTo(from);
            }
        }