Exemplo n.º 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || m_hive.Deleted || !from.InRange(m_hive.GetWorldLocation(), 3))
            {
                return;
            }

            if (!m_hive.IsAccessibleTo(from))
            {
                m_hive.LabelTo(from, "You cannot use that.");
                return;
            }

            switch (info.ButtonID)
            {
            case (int)Buttons.butCancel:                     //cancel
            {
                from.SendGump(new apiBeeHiveMainGump(from, m_hive));
                break;
            }

            case (int)Buttons.butOkay:                     //okay
            {
                apiBeeHiveDeed deed = new apiBeeHiveDeed();

                if (!from.PlaceInBackpack(deed))
                {
                    deed.Delete();

                    m_hive.LabelTo(from, "You cannot destroy the hive with a full backpack!");
                    from.SendGump(new apiBeeHiveMainGump(from, m_hive));

                    break;
                }

                m_hive.Delete();

                break;
            }
            }
        }
Exemplo n.º 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || m_hive.Deleted || !from.InRange(m_hive.GetWorldLocation(), 3))
            {
                return;
            }

            if (!m_hive.IsAccessibleTo(from))
            {
                m_hive.LabelTo(from, "You cannot use that.");
                return;
            }

            switch (info.ButtonID)
            {
            case (int)Buttons.butExit:                     //Exit back to main gump
            {
                from.SendGump(new apiBeeHiveMainGump(from, m_hive));
                break;
            }

            case (int)Buttons.butHoney:                     //Honey
            {
                //ToDo: get hurt or poisoned when harvesting

                Item hivetool = GetHiveTool(from);

                if (NeedHiveTool)
                {
                    if (hivetool == null || !(hivetool is HiveTool))
                    {
                        m_hive.LabelTo(from, "You need a hive tool to extract the excess honey!");
                        from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                        return;
                    }
                }

                if (m_hive.Honey < 3)
                {
                    m_hive.LabelTo(from, "There isn't enough honey in the hive to fill a bottle!");
                    from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                    break;
                }

                Container pack = from.Backpack;

                if (pack != null && pack.ConsumeTotal(typeof(Bottle), 1))
                {
                    JarHoney honey = new JarHoney();

                    if (!from.PlaceInBackpack(honey))
                    {
                        honey.Delete();
                        from.PlaceInBackpack(new Bottle());                                   //add the consumed bottle
                        m_hive.LabelTo(from, "There is not enough room in your backpack for the honey!");
                        from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                        break;
                    }

                    if (NeedHiveTool)
                    {
                        ((HiveTool)hivetool).UsesRemaining--;
                        if (((HiveTool)hivetool).UsesRemaining < 1)
                        {
                            from.SendMessage("You wear out the hive tool.");
                            hivetool.Delete();
                        }
                    }

                    m_hive.Honey -= 3;
                    m_hive.LabelTo(from, "You fill a bottle with golden honey and place it in your pack.");
                    from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                    break;
                }
                else
                {
                    m_hive.LabelTo(from, "You need a bottle to fill with honey!");
                    from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                    break;
                }
            }

            case (int)Buttons.butWax:                     //Wax
            {
                //ToDo: get hurt or poisoned when harvesting

                Item hivetool = GetHiveTool(from);

                if (NeedHiveTool)
                {
                    if (hivetool == null || !(hivetool is HiveTool))
                    {
                        m_hive.LabelTo(from, "You need a hive tool to scrape the excess beeswax!");
                        from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                        return;
                    }
                }

                if (m_hive.Wax < 1)
                {
                    m_hive.LabelTo(from, "There isn't enough excess wax in the hive to harvest!");
                    return;
                }

                Item wax;

                if (PureWax)
                {
                    wax = new Beeswax(m_hive.Wax);
                }
                else
                {
                    wax = new RawBeeswax(m_hive.Wax);
                }

                if (!from.PlaceInBackpack(wax))
                {
                    wax.Delete();

                    m_hive.LabelTo(from, "There is not enough room in your backpack for the wax!");
                    from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                    break;
                }

                if (NeedHiveTool)
                {
                    ((HiveTool)hivetool).UsesRemaining--;
                    if (((HiveTool)hivetool).UsesRemaining < 1)
                    {
                        from.SendMessage("You wear out the hive tool.");
                        hivetool.Delete();
                    }
                }

                m_hive.Wax = 0;
                m_hive.LabelTo(from, "You collect the excess beeswax and place it in your pack.");
                from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                break;
            }
            }
        }
Exemplo n.º 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || m_hive.Deleted || !from.InRange(m_hive.GetWorldLocation(), 3))
            {
                return;
            }

            if (!m_hive.IsAccessibleTo(from))
            {
                m_hive.LabelTo(from, "You cannot use that.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     //Resources
            {
                from.SendGump(new apiBeeHiveProductionGump(from, m_hive));
                break;
            }

            case 2:                     //Destroy
            {
                from.SendGump(new apiBeeHiveDestroyGump(from, m_hive));
                break;
            }

            case 3:                     //Help
            {
                from.SendGump(new apiBeeHiveMainGump(from, m_hive));
                from.SendGump(new apiBeeHiveHelpGump(from, 0));
                break;
            }

            case 4:                     //Agility Potion
            {
                AddPotion(from, PotionEffect.AgilityGreater);

                break;
            }

            case 5:                     //Poison Potion
            {
                AddPotion(from, PotionEffect.PoisonGreater, PotionEffect.PoisonDeadly);

                break;
            }

            case 6:                     //Cure Potion
            {
                AddPotion(from, PotionEffect.CureGreater);

                break;
            }

            case 7:                     //Heal Potion
            {
                AddPotion(from, PotionEffect.HealGreater);

                break;
            }

            case 8:                     //Strength Potion
            {
                AddPotion(from, PotionEffect.StrengthGreater);

                break;
            }
            }
        }