Ejemplo n.º 1
0
        public override bool Give( Mobile m, Item item, bool placeAtFeet )
        {
            if( m is PlayerMobile )
            {
                PlayerMobile pm = m as PlayerMobile;
                pm.Crafting = true;
                LevelSystem.AwardMinimumXP( pm, 1 );
                pm.Crafting = false;
                Log log = new Log();
                Item controller = null;

                if( pm.UniqueSpot != null )
                {
                    if( World.FindItem( pm.UniqueSpot.Serial ) != null )
                    {
                        controller = World.FindItem( pm.UniqueSpot.Serial );

                        if( controller is ResourceController && pm.InRange( controller, ( (ResourceController)controller ).Range ) )
                        {
                            ResourceController rescontroller = controller as ResourceController;
                            double chance = 0;

                            switch( rescontroller.Intensity )
                            {
                                case VeinIntensity.Low: chance = 25; break;
                                case VeinIntensity.Average: chance = 50; break;
                                case VeinIntensity.Full: chance = 75; break;
                            }

                            if( chance >= Utility.RandomMinMax( 1, 1000 ) )
                            {
                                switch( rescontroller.ControlledResource )
                                {
                                    case ControlledResource.Oak: item = log; break;

                                    case ControlledResource.Yew:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 60 )
                                        {
                                            YewLog newlog = new YewLog();
                                            item = newlog;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Redwood:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 70 )
                                        {
                                            RedwoodLog newlog = new RedwoodLog();
                                            item = newlog;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Ash:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 80 )
                                        {
                                            AshLog newlog = new AshLog();
                                            item = newlog;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Greenheart:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 )>= 95 )
                                        {
                                            GreenheartLog newlog = new GreenheartLog();
                                            item = newlog;
                                            item.Amount = 10;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Amber:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 90 )
                                        {
                                            Amber gem = new Amber();
                                            item = gem;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                if( pm.GemHarvesting && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 0 && Utility.RandomMinMax( 1, 100 ) > 99 )
                    item = new Amber();

                if( pm.Nation != Nation.Alyrian )
                    pm.LastOffenseToNature = DateTime.Now;

                if( (item is Amber && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 1) || (item is GreenheartLog && pm.Feats.GetFeatLevel(FeatList.Greenheart) < 1) )
                    item = log;
            }

            string logname = "some oak logs";

            if( item is YewLog )
                logname = "some yew logs";

            else if( item is RedwoodLog )
                logname = "some redwood logs";

            else if( item is AshLog )
                logname = "some ash logs";

            else if( item is GreenheartLog )
                logname = "some greenheart logs";

            else if( item is Amber )
                logname = "an amber";

            m.SendMessage( "You put " + logname + " into your backpack." );

            return base.Give( m, item, placeAtFeet );
        }
Ejemplo n.º 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 0:
            {
                break;
            }

            case (int)Buttons.Iron:
            {
                m_step[m_itemnum] = new IronIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.DullCopper:
            {
                m_step[m_itemnum] = new DullCopperIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.ShadowIron:
            {
                m_step[m_itemnum] = new ShadowIronIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Copper:
            {
                m_step[m_itemnum] = new CopperIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Bronze:
            {
                m_step[m_itemnum] = new BronzeIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Gold:
            {
                m_step[m_itemnum] = new GoldIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Agapite:
            {
                m_step[m_itemnum] = new AgapiteIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Verite:
            {
                m_step[m_itemnum] = new VeriteIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Valorite:
            {
                m_step[m_itemnum] = new ValoriteIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Oak:
            {
                m_step[m_itemnum] = new Log();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Pine:
            {
                m_step[m_itemnum] = new PineLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Redwood:
            {
                m_step[m_itemnum] = new RedwoodLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.WhitePine:
            {
                m_step[m_itemnum] = new WhitePineLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Ashwood:
            {
                m_step[m_itemnum] = new AshwoodLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.SilverBirch:
            {
                m_step[m_itemnum] = new SilverBirchLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Silver:
            {
                m_step[m_itemnum] = new SilverIngot();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Yew:
            {
                m_step[m_itemnum] = new YewLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.BlackOak:
            {
                m_step[m_itemnum] = new BlackOakLog();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.SulfurousAsh:
            {
                m_step[m_itemnum] = new SulfurousAsh();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.ZoogiFungus:
            {
                m_step[m_itemnum] = new ZoogiFungus();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.FertileDirt:
            {
                m_step[m_itemnum] = new FertileDirt();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.PigIron:
            {
                m_step[m_itemnum] = new PigIron();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.NoxCrystal:
            {
                m_step[m_itemnum] = new NoxCrystal();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Diamond:
            {
                m_step[m_itemnum] = new Diamond();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Wool:
            {
                m_step[m_itemnum] = new Wool();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Bone:
            {
                m_step[m_itemnum] = new Bone();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Citrine:
            {
                m_step[m_itemnum] = new Citrine();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.BlackPearl:
            {
                m_step[m_itemnum] = new BlackPearl();
                m_itemnum        += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Decrease:
            {
                if (m_amt > 1)
                {
                    m_amt -= 1;
                }
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Increase:
            {
                m_amt += 1;
                m_player.SendGump(new AlloyGump(m_player, m_amt, m_itemnum, m_step[1], m_step[2], m_step[3], m_step[4], m_step[5], m_step[6]));
                break;
            }

            case (int)Buttons.Cancel:
            {
                m_player.SendGump(new AlloyGump(m_player, 1, 1, null, null, null, null, null, null));
                break;
            }

            case (int)Buttons.OK:
            {
                //check for and consume ingredients here
                Container pack = m_player.Backpack;

                if (m_step[6] == null)
                {
                    m_player.SendMessage("You must pick 6 steps");
                    m_player.SendGump(new AlloyGump(m_player, 1, 1, null, null, null, null, null, null));
                    break;
                }

                bool allres = true;

                for (int i = 1; i < 7; i++)
                {
                    Item itm     = (Item)m_step[i];
                    int  packamt = m_player.Backpack.GetAmount(itm.GetType());
                    if (packamt < m_amt)
                    {
                        m_player.SendMessage("You do not have enough {0} to attempt this", itm.GetType().Name);
                        allres = false;
                    }
                }

                if (allres)
                {
                    for (int i = 1; i < 7; i++)
                    {
                        Item itm = (Item)m_step[i];
                        m_player.Backpack.ConsumeTotal(m_step[i].GetType(), m_amt);
                        m_player.SendMessage("Step {0} consumes {1} {2}", i.ToString(), m_amt.ToString(), itm.GetType().Name);
                    }
                }
                else
                {
                    m_player.SendMessage("Please try again when you have all of the needed resources");
                    return;
                }


                if (m_step[1] is AgapiteIngot && m_step[2] is BlackOakLog && m_step[3] is AgapiteIngot && m_step[4] is ShadowIronIngot && m_step[5] is Bone && m_step[6] is AgapiteIngot)
                {
                    if (m_player.Backpack != null)
                    {
                        m_player.AddToBackpack(new BloodrockIngot(m_amt));
                    }
                    break;
                }

                if (m_step[1] is ValoriteIngot && m_step[2] is WhitePineLog && m_step[3] is ValoriteIngot && m_step[4] is CopperIngot && m_step[5] is FertileDirt && m_step[6] is SilverBirchLog)
                {
                    if (m_player.Backpack != null)
                    {
                        m_player.AddToBackpack(new SteelIngot(m_amt));
                    }
                    break;
                }

                if (m_step[1] is ShadowIronIngot && m_step[2] is AshwoodLog && m_step[3] is VeriteIngot && m_step[4] is ShadowIronIngot && m_step[5] is NoxCrystal && m_step[6] is ShadowIronIngot)
                {
                    if (m_player.Backpack != null)
                    {
                        m_player.AddToBackpack(new AdamantiteIngot(m_amt));
                    }
                    break;
                }

                if (m_step[1] is IronIngot && m_step[2] is SilverBirchLog && m_step[3] is ValoriteIngot && m_step[4] is IronIngot && m_step[5] is Citrine && m_step[6] is SilverBirchLog)
                {
                    if (m_player.Backpack != null)
                    {
                        m_player.AddToBackpack(new IthilmarIngot(m_amt));
                    }
                    break;
                }

                if (m_step[1] is SilverIngot && m_step[2] is GoldIngot && m_step[3] is Diamond && m_step[4] is SilverIngot && m_step[5] is GoldIngot && m_step[6] is SilverIngot)
                {
                    if (m_player.Backpack != null)
                    {
                        m_player.AddToBackpack(new ElectrumIngot(m_amt));
                    }
                    break;
                }

                if (m_step[1] is PigIron && m_player.IsGoblin())
                {
                    if (m_player.Backpack != null)
                    {
                        m_player.AddToBackpack(new SkazzIngot(m_amt));
                    }
                    break;
                }

                m_player.SendMessage("You fail to create a new alloy and your materials are lost");
                m_player.SendGump(new AlloyGump(m_player, 1, 1, null, null, null, null, null, null));
                break;
            }
            }
        }