Ejemplo n.º 1
0
        public static void FindItemByType_OnCommand(CommandEventArgs e)
        {
            try
            {
                if (e == null || e.Mobile == null || e.Mobile is PlayerMobile == false)
                {
                    return;
                }

                string name = null;

                if (e.Length >= 1)
                {
                    name = e.GetString(0);

                    // if you are a GM the world needs to be in 'Build' mode to access this comand
                    if (e.Mobile.AccessLevel < AccessLevel.Administrator && Core.Building == false)
                    {
                        e.Mobile.SendMessage("The server must be in build mode for you to access this command.");
                        return;
                    }

                    PlayerMobile pm     = e.Mobile as PlayerMobile;
                    LogHelper    Logger = new LogHelper("FindNPCResourceByType.log", e.Mobile, false);

                    // reset jump table
                    pm.JumpIndex = 0;
                    pm.JumpList  = new ArrayList();
                    Type tx = ScriptCompiler.FindTypeByName(name);

                    if (tx != null)
                    {
                        foreach (Mobile mob in World.Mobiles.Values)
                        {
                            if (mob is BaseVendor == false)
                            {
                                continue;
                            }

                            BaseVendor vendor = mob as BaseVendor;

                            if (vendor.Inventory == null || vendor.Inventory.Count == 0)
                            {
                                continue;
                            }

                            foreach (object ox in vendor.Inventory)
                            {
                                if (ox is SBInfo == false)
                                {
                                    continue;
                                }

                                SBInfo sbi = ox as SBInfo;

                                if (sbi.BuyInfo == null || sbi.BuyInfo.Count == 0)
                                {
                                    continue;
                                }

                                ArrayList bi = sbi.BuyInfo;

                                foreach (GenericBuyInfo gbi in bi)
                                {
                                    if (tx.IsAssignableFrom(gbi.Type))
                                    {
                                        pm.JumpList.Add(vendor);
                                        Logger.Log(LogType.Mobile, vendor);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        e.Mobile.SendMessage("{0} is not a recognized type.", name);
                    }
                    Logger.Finish();
                }
                else
                {
                    e.Mobile.SendMessage("Format: FindNPCResourceByType <type>");
                }
            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
        }
Ejemplo n.º 2
0
        public static void Initialize()
        {
            //vendor items
            m_SBInfos.Add(new SBAlchemist());
            m_SBInfos.Add(new SBArchitect());
            m_SBInfos.Add(new SBBaker());
            m_SBInfos.Add(new SBBanker());
            m_SBInfos.Add(new SBBard());
            m_SBInfos.Add(new SBBarkeeper());
            m_SBInfos.Add(new SBBeekeeper());
            m_SBInfos.Add(new SBBowyer());
            m_SBInfos.Add(new SBButcher());
            m_SBInfos.Add(new SBCarpenter());
            m_SBInfos.Add(new SBCobbler());
            m_SBInfos.Add(new SBCook());
            m_SBInfos.Add(new SBFarmer());
            m_SBInfos.Add(new SBFisherman());
            m_SBInfos.Add(new SBFortuneTeller());
            m_SBInfos.Add(new SBFurtrader());
            m_SBInfos.Add(new SBGlassblower());
            //m_SBInfos.Add( new SBHairStylist() );
            m_SBInfos.Add(new SBHealer());
            m_SBInfos.Add(new SBHerbalist());
            m_SBInfos.Add(new SBHolyMage());
            m_SBInfos.Add(new SBHouseDeed());
            m_SBInfos.Add(new SBInnKeeper());
            m_SBInfos.Add(new SBJewel());
            m_SBInfos.Add(new SBLeatherWorker());
            m_SBInfos.Add(new SBMage());
            m_SBInfos.Add(new SBMapmaker());
            m_SBInfos.Add(new SBProvisioner());
            m_SBInfos.Add(new SBRancher());
            m_SBInfos.Add(new SBRealEstateBroker());
            m_SBInfos.Add(new SBScribe());
            m_SBInfos.Add(new SBShipwright());
            m_SBInfos.Add(new SBSmithTools());
            m_SBInfos.Add(new SBStoneCrafter());
            m_SBInfos.Add(new SBTailor());
            m_SBInfos.Add(new SBTanner());
            m_SBInfos.Add(new SBTavernKeeper());
            m_SBInfos.Add(new SBTinker());
            m_SBInfos.Add(new SBVagabond());
            m_SBInfos.Add(new SBVarietyDealer());
            m_SBInfos.Add(new SBVeterinarian());
            m_SBInfos.Add(new SBWaiter());
            m_SBInfos.Add(new SBWeaver());

            //weapons
            m_SBInfos.Add(new SBAxeWeapon());
            m_SBInfos.Add(new SBKnifeWeapon());
            m_SBInfos.Add(new SBMaceWeapon());
            m_SBInfos.Add(new SBPoleArmWeapon());
            m_SBInfos.Add(new SBRangedWeapon());
            m_SBInfos.Add(new SBSpearForkWeapon());
            m_SBInfos.Add(new SBStavesWeapon());
            m_SBInfos.Add(new SBSwordWeapon());

            //armors
            m_SBInfos.Add(new SBChainmailArmor());
            m_SBInfos.Add(new SBHelmetArmor());
            m_SBInfos.Add(new SBLeatherArmor());
            m_SBInfos.Add(new SBMetalShields());
            m_SBInfos.Add(new SBPlateArmor());
            m_SBInfos.Add(new SBRingmailArmor());
            m_SBInfos.Add(new SBStuddedArmor());
            m_SBInfos.Add(new SBWoodenShields());

            //custom: edit SBCustom.cs
            m_SBInfos.Add(new SBCustom());

            m_BuyInfo.Clear();
            m_SellInfo.Clear();

            for (int i = 0; i < m_SBInfos.Count; i++)               // compile lists for item values
            {
                SBInfo sbInfo = (SBInfo)m_SBInfos[i];
                m_BuyInfo.AddRange(sbInfo.BuyInfo);
                m_SellInfo.Add(sbInfo.SellInfo);
            }

            //add forbidden items here
            m_ForbiddenTypes.Add(typeof(Gold));
            m_ForbiddenTypes.Add(typeof(Robe));
            m_ForbiddenTypes.Add(typeof(DeathRobe));
            m_ForbiddenTypes.Add(typeof(BaseClothing));
            m_ForbiddenTypes.Add(typeof(GuildDeed));
        }