예제 #1
0
        public CAGObject(CAGCategory parent, XmlTextReader xml)
        {
            m_Parent = parent;

            if (xml.MoveToAttribute("type"))
            {
                m_Type = ScriptCompiler.FindTypeByFullName(xml.Value, false);
            }

            if (xml.MoveToAttribute("gfx"))
            {
                m_ItemID = XmlConvert.ToInt32(xml.Value);
            }

            if (xml.MoveToAttribute("hue"))
            {
                m_Hue = XmlConvert.ToInt32(xml.Value);
            }
        }
예제 #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_AmountCur = reader.ReadInt();
                m_AmountMax = reader.ReadInt();

                string type = reader.ReadString();

                if (type != null)
                {
                    m_Type = ScriptCompiler.FindTypeByFullName(type);
                }

                m_AnimalName = reader.ReadString();
                m_Graphic    = reader.ReadInt();

                break;
            }
            }

            if (Weight == 0.0)
            {
                Weight = 1.0;
            }

            if (Core.AOS && ItemID == 0x14EF)
            {
                ItemID = 0x2258;
            }

            if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
            {
                Delete();
            }
        }
예제 #3
0
        public static void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            if (Events != null)
            {
                Events.Clear();
            }

            Events = new List <BaseEvent>();

            //Load events from configuration
            List <Type> fromConfig = new List <Type>(EventConfig.EnabledEvents);

            int count = reader.ReadInt();

            for (int i = 0; i < count; ++i)
            {
                string strType = reader.ReadString();

                Type rType = ScriptCompiler.FindTypeByFullName(strType, true);

                if (rType != null)
                {
                    object type = Activator.CreateInstance(rType);

                    if (type != null && type is BaseEvent)
                    {
                        ((BaseEvent)type).Deserialize(reader);

                        //Only add it if it's in the config file
                        if (fromConfig.Contains(rType))
                        {
                            Events.Add(type as BaseEvent);
                        }
                    }
                }
            }

            //Enable Registered BaseEvents
            Events.ForEach(delegate(BaseEvent e) { e.Enable(); });
        }
예제 #4
0
        public BOBSmallEntry(GenericReader reader)
        {
            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 2:
            {
                m_GemType = (GemType)reader.ReadInt();
                goto case 1;
            }

            case 1:
            {
                m_Hue = reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                string type = reader.ReadString();

                if (type != null)
                {
                    m_ItemType = ScriptCompiler.FindTypeByFullName(type);
                }

                m_RequireExceptional = reader.ReadBool();

                m_DeedType = (BODType)reader.ReadEncodedInt();

                m_Material  = (BulkMaterialType)reader.ReadEncodedInt();
                m_AmountCur = reader.ReadEncodedInt();
                m_AmountMax = reader.ReadEncodedInt();
                m_Number    = reader.ReadEncodedInt();
                m_Graphic   = reader.ReadEncodedInt();
                m_Price     = reader.ReadEncodedInt();

                break;
            }
            }
        }
예제 #5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_SeedlingID = reader.ReadInt();

            string cropType = reader.ReadString();

            if (cropType != null)
            {
                m_FullCropType = ScriptCompiler.FindTypeByFullName(cropType);
            }

            if (this.ItemID == 0x913)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(30.0), new TimerCallback(Delete));
            }
        }
예제 #6
0
 public static Spell NewSpell(string name, Mobile caster, Item scroll)
 {
     for (int i = 0; i < CircleNames.Length; ++i)
     {
         Type t = ScriptCompiler.FindTypeByFullName(String.Format("Server.Spells.{0}.{1}", CircleNames[i], name));
         if (t != null)
         {
             m_Params[0] = caster;
             m_Params[1] = scroll;
             try
             {
                 return((Spell)Activator.CreateInstance(t, m_Params));
             }
             catch
             {
             }
         }
     }
     return(null);
 }
예제 #7
0
        public TalismanAttribute(GenericReader reader)
        {
            int version = reader.ReadInt();

            SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

            if (GetSaveFlag(flags, SaveFlag.Type))
            {
                m_Type = ScriptCompiler.FindTypeByFullName(reader.ReadString(), false);
            }

            if (GetSaveFlag(flags, SaveFlag.Name))
            {
                m_Name = new TextDefinition(reader);
            }

            if (GetSaveFlag(flags, SaveFlag.Amount))
            {
                m_Amount = reader.ReadEncodedInt();
            }
        }
예제 #8
0
        private void Load(GenericReader reader)
        {
            try{
                int version = reader.ReadInt();

                if (version >= 1)
                {
                    c_Template = (Template)reader.ReadInt();
                }

                if (version >= 0)
                {
                    c_Mobile       = reader.ReadMobile();
                    c_Type         = ScriptCompiler.FindTypeByFullName(reader.ReadString());
                    c_Transparent  = reader.ReadBool();
                    c_DefaultTrans = reader.ReadBool();
                    c_TextColorRGB = reader.ReadString();
                    c_Background   = reader.ReadInt();
                }
            }catch { Errors.Report("GumpInfo -> Load"); }
        }
예제 #9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Range = reader.ReadInt();

            Type t = ScriptCompiler.FindTypeByFullName(reader.ReadString());

            if (t != null && m_BaseType.IsAssignableFrom(t))
            {
                m_OreType = t;
            }

            m_MinSkill = reader.ReadDouble();

            m_MaxSkill = reader.ReadDouble();

            m_ReqSkill = reader.ReadDouble();
        }
예제 #10
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_GraphicHue = reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                m_AmountCur = reader.ReadInt();
                m_AmountMax = reader.ReadInt();

                string type = reader.ReadString();

                if (type != null)
                {
                    m_Type = ScriptCompiler.FindTypeByFullName(type);
                }

                m_Number             = reader.ReadInt();
                m_Graphic            = reader.ReadInt();
                m_RequireExceptional = reader.ReadBool();
                m_Material           = (BulkMaterialType)reader.ReadInt();

                break;
            }
            }

            if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
            {
                Delete();
            }
        }
예제 #11
0
        // String support for the bm command
        public static bool UseBluePower(Mobile from, string spell)
        {
            Type t = ScriptCompiler.FindTypeByFullName("Server.Spells.BlueMagic." + spell);

            if (t == null)
            {
                t = ScriptCompiler.FindTypeByFullName("Server.Spells.BlueMagic." + spell + "spell");
            }

            if (t == null)
            {
                t = ScriptCompiler.FindTypeByFullName("Server.Spells.BlueMagic." + spell + "move");
            }

            if (t != null)
            {
                return(UseBluePower(from, t));
            }
            else
            {
                return(false);
            }
        }
        public BOBLargeSubEntry(GenericReader reader)
        {
            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 0:
            {
                string type = reader.ReadString();

                if (type != null)
                {
                    m_ItemType = ScriptCompiler.FindTypeByFullName(type);
                }

                m_AmountCur = reader.ReadEncodedInt();
                m_Number    = reader.ReadEncodedInt();
                m_Graphic   = reader.ReadEncodedInt();

                break;
            }
            }
        }
예제 #13
0
        public static Type ReadType(Type[] referenceTable, GenericReader reader)
        {
            int encoding = reader.ReadEncodedInt();

            switch (encoding)
            {
            default:
            case 0x00:     // null
            {
                return(null);
            }

            case 0x01:     // indexed
            {
                int index = reader.ReadEncodedInt();

                if (index >= 0 && index < referenceTable.Length)
                {
                    return(referenceTable[index]);
                }

                return(null);
            }

            case 0x02:     // by name
            {
                string fullName = reader.ReadString();

                if (fullName == null)
                {
                    return(null);
                }

                return(ScriptCompiler.FindTypeByFullName(fullName, false));
            }
            }
        }
예제 #14
0
        public static Type Deserialize(GenericReader reader)
        {
            int index = reader.ReadEncodedInt();

            if (index == 0)
            {
                string typeName = reader.ReadString();

                if (typeName == null)
                {
                    m_Types.Add(null);
                }
                else
                {
                    m_Types.Add(ScriptCompiler.FindTypeByFullName(typeName, false));
                }

                return((Type)m_Types[m_Types.Count - 1]);
            }
            else
            {
                return((Type)m_Types[index - 1]);
            }
        }
예제 #15
0
        public static Spell NewSpell(string name, Mobile caster, Item scroll)
        {
            for (int i = 0; i < m_CircleNames.Length; ++i)
            {
                Type t = ScriptCompiler.FindTypeByFullName(String.Format("Server.Spells.{0}.{1}", m_CircleNames[i], name));

                if (t != null)
                {
                    m_Params[0] = caster;
                    m_Params[1] = scroll;

                    try
                    {
                        return((Spell)Activator.CreateInstance(t, m_Params));
                    }
                    catch (Exception ex)
                    {
                        Misc.ExceptionLogging.WriteLine(ex, "Spell name : {0}", name);
                    }
                }
            }

            return(null);
        }
예제 #16
0
        public static Spell NewSpell(string name, Mobile caster, Item scroll)
        {
            for (int i = 0; i < m_CircleNames.Length; ++i)
            {
                Type t = ScriptCompiler.FindTypeByFullName(String.Format("Server.Spells.{0}.{1}", m_CircleNames[i], name));

                //IPY Doesnt have Special Move
                if (t != null /*&& !t.IsSubclassOf( typeof( SpecialMove ) )*/)
                {
                    m_Params[0] = caster;
                    m_Params[1] = scroll;

                    try
                    {
                        return((Spell)Activator.CreateInstance(t, m_Params));
                    }
                    catch
                    {
                    }
                }
            }

            return(null);
        }
예제 #17
0
        public static Spell NewSpell(string name, Mobile caster, Item scroll)
        {
            for (int i = 0; i < m_CircleNames.Length; ++i)
            {
                Type t = ScriptCompiler.FindTypeByFullName(String.Format("Server.Spells.{0}.{1}", m_CircleNames[i], name));

                if (t != null && !t.IsSubclassOf(typeof(SpecialMove)))
                {
                    m_Params[0] = caster;
                    m_Params[1] = scroll;

                    try
                    {
                        return((Spell)Activator.CreateInstance(t, m_Params));
                    }
                    catch (Exception e)
                    {
                        Server.Diagnostics.ExceptionLogging.LogException(e);
                    }
                }
            }

            return(null);
        }
예제 #18
0
        public static void ImportXML(string path, string file)
        {
            using (var xml = new XmlDataStore <ConquestSerial, Conquest>(path, file))
            {
                xml.OnDeserialize = doc =>
                {
                    XmlElement root = doc.DocumentElement;

                    if (root == null)
                    {
                        return(true);
                    }

                    foreach (XmlElement conquestNode in root.ChildNodes.OfType <XmlElement>())
                    {
                        string typeAttr = conquestNode.GetAttribute("type");
                        var    type     = new TypeSelectProperty <Conquest>(typeAttr);

                        if (!type.IsNotNull)
                        {
                            continue;
                        }

                        var conquest = type.CreateInstance <Conquest>();
                        PropertyList <Conquest> pList = conquest.GetProperties(
                            BindingFlags.Instance | BindingFlags.Public,
                            p => p.CanWrite && p.Name != "Enabled" && p.Name != "InvokeReset" && p.Name != "InvokeClear");

                        foreach (XmlElement conquestPropNode in conquestNode.ChildNodes.OfType <XmlElement>())
                        {
                            string pName = conquestPropNode.Name;
                            string dType = conquestPropNode.GetAttribute("type");
                            string data  = conquestPropNode.GetAttribute("value");

                            switch (dType)
                            {
                            case "Type":
                            {
                                Type t = null;

                                if (!String.IsNullOrWhiteSpace(data))
                                {
                                    t = Type.GetType(data, false, true) ??
                                        ScriptCompiler.FindTypeByName(data, true) ??
                                        ScriptCompiler.FindTypeByFullName(data);
                                }

                                pList.Set(pName, t);
                            }
                            break;

                            default:
                            {
                                DataType dataType;

                                if (!Enum.TryParse(dType, out dataType))
                                {
                                    continue;
                                }

                                SimpleType sType;

                                if (SimpleType.TryParse(data, dataType, out sType) && sType.Flag != DataType.Null)
                                {
                                    pList.Set(pName, sType.Value);
                                }
                            }
                            break;
                            }
                        }

                        pList.Serialize(conquest);

                        xml.AddOrReplace(conquest.UID, conquest);
                    }

                    return(true);
                };

                if (xml.Import() == DataStoreResult.OK)
                {
                    xml.CopyTo(ConquestRegistry);

                    xml.Document.Delete();
                }

                foreach (Exception e in xml.Errors)
                {
                    e.ToConsole();
                }
            }
        }
예제 #19
0
 private static Type FindType(string name, bool full = false, bool ignoreCase = true)
 {
     return(Type.GetType(name, false, ignoreCase) ??
            (full ? ScriptCompiler.FindTypeByFullName(name, ignoreCase) : ScriptCompiler.FindTypeByName(name, ignoreCase)));
 }
예제 #20
0
        protected void LoadFile(T dungeon, string path)
        {
            using (var r = File.OpenText(path))
            {
                string   line;
                string[] args;

                while (!r.EndOfStream)
                {
                    line = r.ReadLine();

                    if (String.IsNullOrWhiteSpace(line) || line.StartsWith("#"))
                    {
                        continue;
                    }

                    args = line.Split('\t');

                    if (args.Length < 3)
                    {
                        continue;
                    }

                    Type    type;
                    int     itemID;
                    Point3D loc;

                    try
                    {
                        type = Type.GetType(args[0], false) ?? ScriptCompiler.FindTypeByFullName(args[0]);
                    }
                    catch
                    {
                        type = null;
                    }

                    try
                    {
                        itemID = Int32.Parse(args[1]);
                    }
                    catch
                    {
                        itemID = -1;
                    }

                    try
                    {
                        loc = Point3D.Parse(args[2]);
                    }
                    catch
                    {
                        loc = Point3D.Zero;
                    }

                    var    amount = 1;
                    var    hue    = 0;
                    var    light  = -1;
                    string name   = null;

                    if (args.Length > 3)
                    {
                        try
                        {
                            amount = Int32.Parse(args[3]);
                        }
                        catch
                        {
                            amount = 1;
                        }
                    }

                    if (args.Length > 4)
                    {
                        try
                        {
                            hue = Int32.Parse(args[4]);
                        }
                        catch
                        {
                            hue = 0;
                        }
                    }

                    if (args.Length > 5)
                    {
                        try
                        {
                            light = Int32.Parse(args[5]);
                        }
                        catch
                        {
                            light = 1;
                        }
                    }

                    if (args.Length > 6)
                    {
                        name = args[6];
                    }

                    CreateObject(dungeon, type, itemID, loc, amount, hue, light, name);
                }
            }
        }
예제 #21
0
        public static void Load()
        {
            if (!Directory.Exists("Saves/ACC"))
            {
                return;
            }

            string   filename  = "acc.sav";
            string   path      = @"Saves/ACC/";
            string   pathNfile = path + filename;
            DateTime start     = DateTime.Now;

            Console.WriteLine();
            Console.WriteLine("----------");
            Console.WriteLine("Loading ACC...");

            try
            {
                using (FileStream m_FileStream = new FileStream(pathNfile, FileMode.Open, FileAccess.Read))
                {
                    BinaryReader     m_BinaryReader = new BinaryReader(m_FileStream);
                    BinaryFileReader reader         = new BinaryFileReader(m_BinaryReader);

                    if (m_RegSystems == null)
                    {
                        m_RegSystems = new Dictionary <string, bool>();
                    }

                    int Count = reader.ReadInt();
                    for (int i = 0; i < Count; i++)
                    {
                        string system  = reader.ReadString();
                        Type   t       = ScriptCompiler.FindTypeByFullName(system);
                        bool   enabled = reader.ReadBool();

                        if (t != null)
                        {
                            m_RegSystems[system] = enabled;

                            if (m_RegSystems[system])
                            {
                                ACCSystem sys = (ACCSystem)Activator.CreateInstance(t);
                                if (sys != null)
                                {
                                    sys.StartLoad(path);
                                }
                            }
                        }
                    }

                    reader.Close();
                    m_FileStream.Close();
                }

                Console.WriteLine("Done in {0:F1} seconds.", (DateTime.Now - start).TotalSeconds);
                Console.WriteLine("----------");
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed. Exception: " + e);
            }
        }
예제 #22
0
        /// <summary>
        /// 初始化SQL
        /// </summary>
        private static void InitSQL()
        {
            //////////////////////////////////////////////////////////////////////////
            // 开始在编译后的程序集合内获取密码

            Type l_Type = ScriptCompiler.FindTypeByFullName("Demo_R.O.S.E.Scripts.Globals.GlobalConfig");

            if (l_Type != null)
            {
                FieldInfo l_FieldInfo = l_Type.GetField("SQLPassword");
                if (l_FieldInfo != null)
                {
                    string l_strSQLPassword = l_FieldInfo.GetValue(string.Empty) as string;

                    if (l_strSQLPassword != null && l_strSQLPassword != string.Empty)
                    {
                        s_ConfigInfo.SQLPassword = l_strSQLPassword;
                    }
                }


                l_FieldInfo = l_Type.GetField("LoginServerPassword");
                if (l_FieldInfo != null)
                {
                    string l_strLoginPassword = l_FieldInfo.GetValue(string.Empty) as string;

                    if (l_strLoginPassword != null && l_strLoginPassword != string.Empty)
                    {
                        s_ConfigInfo.LoginPassword = l_strLoginPassword;
                    }
                }

                l_FieldInfo = l_Type.GetField("CharServerPassword");
                if (l_FieldInfo != null)
                {
                    string l_strCharPassword = l_FieldInfo.GetValue(string.Empty) as string;

                    if (l_strCharPassword != null && l_strCharPassword != string.Empty)
                    {
                        s_ConfigInfo.CharPassword = l_strCharPassword;
                    }
                }

                l_FieldInfo = l_Type.GetField("WorldServerPassword");
                if (l_FieldInfo != null)
                {
                    string l_strWorldPassword = l_FieldInfo.GetValue(string.Empty) as string;

                    if (l_strWorldPassword != null && l_strWorldPassword != string.Empty)
                    {
                        s_ConfigInfo.WorldPassword = l_strWorldPassword;
                    }
                }
            }

            //////////////////////////////////////////////////////////////////////////
            // 设置SQL的连接信息

            if (s_ConfigInfo.SQLConnection == string.Empty ||
                s_ConfigInfo.SQLUser == string.Empty ||
                s_ConfigInfo.SQLHost == string.Empty ||
                s_ConfigInfo.SQLDatabase == string.Empty)
            {
                s_ConfigInfo.SQLConnectionUrl = BaseDatabase.ConnectionURL;
            }
            else
            {
                BaseDatabase.ConnectionURL = s_ConfigInfo.SQLConnectionUrl = s_ConfigInfo.SQLConnection
                                                                             + "://"
                                                                             + s_ConfigInfo.SQLUser
                                                                             + ":"
                                                                             + s_ConfigInfo.SQLPassword
                                                                             + "@"
                                                                             + s_ConfigInfo.SQLHost
                                                                             //+ ( s_ConfigInfo.m_strSQLPort == 0 ? string.Empty : ":" + s_ConfigInfo.m_strSQLPort ) // 数据库引擎暂时不支持
                                                                             + "/"
                                                                             + s_ConfigInfo.SQLDatabase;
            }

            //////////////////////////////////////////////////////////////////////////
            // 开始连接数据库

            if (s_SQLRecreate == false)
            {
                BaseDatabase.BuildDefault();
            }
            else
            {
                // 重建数据库
                BaseDatabase.BuildRecreate();
            }
        }
예제 #23
0
        public static void On_RHFile(CommandEventArgs e)
        {
            if (e.Arguments.Length != 1)
            {
                e.Mobile.SendMessage("Usage: [LoadCont <filename>");
                return;
            }

            try
            {
                int       loaded = 0;
                int       count;
                LogHelper log = new LogHelper(e.Arguments[0] + " LoadCont.log");
                log.Log(LogType.Text, String.Format("Reload process initiated by {0}, with {1} as backup data.", e.Mobile, e.Arguments[0]));

                using (FileStream idxfs = new FileStream(e.Arguments[0] + ".idx", FileMode.Open, FileAccess.Read))
                {
                    using (FileStream binfs = new FileStream(e.Arguments[0] + ".bin", FileMode.Open, FileAccess.Read))
                    {
                        GenericReader bin = new BinaryFileReader(new BinaryReader(binfs));
                        GenericReader idx = new BinaryFileReader(new BinaryReader(idxfs));

                        count = idx.ReadInt();
                        if (count == -1)
                        {
                            log.Log(LogType.Text, "No item data to reload.");                             // do nothing
                        }
                        else
                        {
                            ArrayList items = new ArrayList(count);
                            log.Log(LogType.Text, String.Format("Attempting to reload {0} items.", count));

                            Type[]   ctortypes = new Type[] { typeof(Serial) };
                            object[] ctorargs  = new object[1];

                            for (int i = 0; i < count; i++)
                            {
                                string type     = idx.ReadString();
                                Serial serial   = (Serial)idx.ReadInt();
                                long   position = idx.ReadLong();
                                int    length   = idx.ReadInt();

                                Type t = ScriptCompiler.FindTypeByFullName(type);
                                if (t == null)
                                {
                                    Console.WriteLine("Warning: Tried to load nonexistent type {0}. Ignoring item.", type);
                                    log.Log(String.Format("Warning: Tried to load nonexistent type {0}. Ignoring item.", type));
                                    continue;
                                }

                                ConstructorInfo ctor = t.GetConstructor(ctortypes);
                                if (ctor == null)
                                {
                                    Console.WriteLine("Warning: Tried to load type {0} which has no serialization constructor. Ignoring item.", type);
                                    log.Log(String.Format("Warning: Tried to load type {0} which has no serialization constructor. Ignoring item.", type));
                                    continue;
                                }

                                Item item = null;
                                try
                                {
                                    if (World.FindItem(serial) != null)
                                    {
                                        log.Log(LogType.Item, World.FindItem(serial), "Serial already in use!! Loading of saved item failed.");
                                    }
                                    else if (!World.IsReserved(serial))
                                    {
                                        log.Log(String.Format("Serial {0} is not reserved!! Loading of saved item failed.", serial));
                                    }
                                    else
                                    {
                                        ctorargs[0] = serial;
                                        item        = (Item)(ctor.Invoke(ctorargs));
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.LogException(ex);
                                    Console.WriteLine("An exception occurred while trying to invoke {0}'s serialization constructor.", t.FullName);
                                    Console.WriteLine(ex.ToString());
                                    log.Log(String.Format("An exception occurred while trying to invoke {0}'s serialization constructor.", t.FullName));
                                    log.Log(ex.ToString());
                                }

                                if (item != null)
                                {
                                    World.FreeSerial(serial);

                                    World.AddItem(item);
                                    items.Add(new object[] { item, position, length });
                                    log.Log(String.Format("Successfully created item {0}", item));
                                }
                            }

                            for (int i = 0; i < items.Count; i++)
                            {
                                object[] entry    = (object[])items[i];
                                Item     item     = entry[0] as Item;
                                long     position = (long)entry[1];
                                int      length   = (int)entry[2];

                                if (item != null)
                                {
                                    bin.Seek(position, SeekOrigin.Begin);

                                    try
                                    {
                                        item.Deserialize(bin);

                                        // take care of parent hierarchy
                                        object p = item.Parent;
                                        if (p is Item)
                                        {
                                            ((Item)p).RemoveItem(item);
                                            item.Parent = null;
                                            ((Item)p).AddItem(item);
                                        }
                                        else if (p is Mobile)
                                        {
                                            ((Mobile)p).RemoveItem(item);
                                            item.Parent = null;
                                            ((Mobile)p).AddItem(item);
                                        }
                                        else
                                        {
                                            item.Delta(ItemDelta.Update);
                                        }

                                        item.ClearProperties();

                                        object rp = item.RootParent;
                                        if (rp is Item)
                                        {
                                            ((Item)rp).UpdateTotals();
                                        }
                                        else if (rp is Mobile)
                                        {
                                            ((Mobile)rp).UpdateTotals();
                                        }
                                        else
                                        {
                                            item.UpdateTotals();
                                        }

                                        if (bin.Position != (position + length))
                                        {
                                            throw new Exception(String.Format("Bad serialize on {0}", item));
                                        }

                                        log.Log(LogType.Item, item, "Successfully loaded.");
                                        loaded++;
                                    }
                                    catch (Exception ex)
                                    {
                                        LogHelper.LogException(ex);
                                        Console.WriteLine("Caught exception while deserializing {0}:", item);
                                        Console.WriteLine(ex.ToString());
                                        Console.WriteLine("Deleting item.");
                                        log.Log(String.Format("Caught exception while deserializing {0}:", item));
                                        log.Log(ex.ToString());
                                        log.Log("Deleting item.");
                                        item.Delete();
                                    }
                                }
                            }
                        }
                        idx.Close();
                        bin.Close();
                    }
                }

                Console.WriteLine("Attempted to load {0} items: {1} loaded, {2} failed.", count, loaded, count - loaded);
                log.Log(String.Format("Attempted to load {0} items: {1} loaded, {2} failed.", count, loaded, count - loaded));
                e.Mobile.SendMessage("Attempted to load {0} items: {1} loaded, {2} failed.", count, loaded, count - loaded);
                log.Finish();
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
                Console.WriteLine(ex.ToString());
                e.Mobile.SendMessage("Exception: {0}", ex.Message);
            }
        }
예제 #24
0
        public static void ProfileWorld(string type, string opFile)
        {
            try
            {
                ArrayList types = new ArrayList();

                using (BinaryReader bin = new BinaryReader(new FileStream(string.Format("Saves/{0}/{0}.tdb", type), FileMode.Open, FileAccess.Read, FileShare.Read)))
                {
                    int count = bin.ReadInt32();

                    for (int i = 0; i < count; ++i)
                    {
                        types.Add(ScriptCompiler.FindTypeByFullName(bin.ReadString()));
                    }
                }

                long total = 0;

                Hashtable table = new Hashtable();

                using (BinaryReader bin = new BinaryReader(new FileStream(string.Format("Saves/{0}/{0}.idx", type), FileMode.Open, FileAccess.Read, FileShare.Read)))
                {
                    int count = bin.ReadInt32();

                    for (int i = 0; i < count; ++i)
                    {
                        int  typeID  = bin.ReadInt32();
                        int  serial  = bin.ReadInt32();
                        long pos     = bin.ReadInt64();
                        int  length  = bin.ReadInt32();
                        Type objType = (Type)types[typeID];

                        while (objType != null && objType != typeof(object))
                        {
                            object obj = table[objType];

                            if (obj == null)
                            {
                                table[objType] = length;
                            }
                            else
                            {
                                table[objType] = length + (int)obj;
                            }

                            objType = objType.BaseType;
                            total  += length;
                        }
                    }
                }

                ArrayList list = new ArrayList(table);

                list.Sort(new CountSorter());

                using (StreamWriter op = new StreamWriter(opFile))
                {
                    op.WriteLine("# Profile of world {0}", type);
                    op.WriteLine("# Generated on {0}", DateTime.UtcNow);
                    op.WriteLine();
                    op.WriteLine();

                    foreach (DictionaryEntry de in list)
                    {
                        op.WriteLine("{0}\t{1:F2}%\t{2}", de.Value, (100 * (int)de.Value) / (double)total, de.Key);
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionLogging.LogException(e);
            }
        }
예제 #25
0
        public OnlineGump(Mobile mobile)
            : base(50, 50)
        {
            bool ArrowPM = false;
            Type t       = ScriptCompiler.FindTypeByFullName("Bittiez.ArrowPM");

            if (t != null)
            {
                ArrowPM = true;
            }
            caller          = mobile;
            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;

            AddPage(0);
            AddBackground(0, 0, 300, 426, 3500);
            AddPage(1);


            int           page = 0, cpage = 1;
            int           max  = 18;
            List <Mobile> name = Bittiez.Tools.List_Connected_Players();

            AddLabel(110, 5, 38, "Online Players");

            if (name != null)// && name.Count == count.Count)
            {
                foreach (Mobile n in name)
                {
                    if (n == null)
                    {
                        continue;
                    }
                    if (!Bittiez.BoxerChat.SETTINGS.Online_List_ShowStaff && n.AccessLevel >= AccessLevel.Counselor)
                    {
                        continue;
                    }
                    if (n.AccessLevel >= AccessLevel.Counselor)
                    {
                        AddLabel(15, 23 + (20 * page), Bittiez.BoxerChat.SETTINGS.Online_List_Staff, string.Format("{0}", n.Name));
                    }
                    else
                    {
                        AddLabel(15, 23 + (20 * page), Bittiez.BoxerChat.SETTINGS.Online_List_Players, string.Format("{0}", n.Name));
                    }
                    //if(ArrowPM)
                    page++;
                    if (page >= max)
                    {
                        page = 0;
                        cpage++;
                        AddButton(265, 390, 22405, 22405, 600, GumpButtonType.Page, cpage);

                        AddPage(cpage);
                        if (cpage > 1)
                        {
                            AddButton(25, 390, 22402, 22402, 600, GumpButtonType.Page, cpage - 1);
                        }
                    }
                }
            }
        }
예제 #26
0
        public override void Load(BinaryReader idx, BinaryReader tdb, BinaryFileReader reader)
        {
            object[] ctorArgs  = new object[1];
            Type[]   ctorTypes = new Type[1] {
                typeof(Serial)
            };
            List <ModuleEntry> modules = new List <ModuleEntry>();

            m_DictionaryOfModuleLists = new Dictionary <Serial, ModuleList>();

            int version = reader.ReadInt();

            int       count = tdb.ReadInt32();
            ArrayList types = new ArrayList(count);

            for (int i = 0; i < count; ++i)
            {
                string typeName = tdb.ReadString();
                Type   t        = ScriptCompiler.FindTypeByFullName(typeName);
                if (t == null)
                {
                    Console.WriteLine("Type not found: {0}, remove?", typeName);
                    if (Console.ReadKey(true).Key == ConsoleKey.Y)
                    {
                        types.Add(null);
                        continue;
                    }
                    throw new Exception(String.Format("Bad type '{0}'", typeName));
                }

                ConstructorInfo ctor = t.GetConstructor(ctorTypes);
                if (ctor != null)
                {
                    types.Add(new object[] { ctor, null });
                }
                else
                {
                    throw new Exception(String.Format("Type '{0}' does not have a serialization constructor", t));
                }
            }

            int moduleCount = idx.ReadInt32();

            for (int i = 0; i < moduleCount; ++i)
            {
                int  typeID = idx.ReadInt32();
                int  serial = idx.ReadInt32();
                long pos    = idx.ReadInt64();
                int  length = idx.ReadInt32();

                object[] objs = (object[])types[typeID];
                if (objs == null)
                {
                    continue;
                }

                Module          m        = null;
                ConstructorInfo ctor     = (ConstructorInfo)objs[0];
                string          typeName = (string)objs[1];

                try
                {
                    ctorArgs[0] = (Serial)serial;
                    m           = (Module)(ctor.Invoke(ctorArgs));
                }
                catch
                {
                }

                if (m != null)
                {
                    modules.Add(new ModuleEntry(m, typeID, typeName, pos, length));
                    AddModule(m);
                }
            }

            bool      failedModules = false;
            Type      failedType    = null;
            Exception failed        = null;
            int       failedTypeID  = 0;

            for (int i = 0; i < modules.Count; ++i)
            {
                ModuleEntry entry = modules[i];
                Module      m     = entry.Module;

                if (m != null)
                {
                    reader.Seek(entry.Position, SeekOrigin.Begin);

                    try
                    {
                        m.Deserialize(reader);

                        if (reader.Position != (entry.Position + entry.Length))
                        {
                            throw new Exception(String.Format("Bad serialize on {0}", m.GetType()));
                        }
                    }
                    catch (Exception e)
                    {
                        modules.RemoveAt(i);

                        failed        = e;
                        failedModules = true;
                        failedType    = m.GetType();
                        failedTypeID  = entry.TypeID;

                        break;
                    }
                }
            }

            if (failedModules)
            {
                Console.WriteLine("An error was encountered while loading a Module of Type: {0}", failedType);
                Console.WriteLine("Remove this type of Module? (y/n)");
                if (Console.ReadLine() == "y")
                {
                    for (int i = 0; i < modules.Count;)
                    {
                        if (((ModuleEntry)modules[i]).TypeID == failedTypeID)
                        {
                            modules.RemoveAt(i);
                        }
                        else
                        {
                            ++i;
                        }
                    }

                    SaveIndex <ModuleEntry>(modules);
                }

                Console.WriteLine("After pressing return an exception will be thrown and the server will terminate");
                Console.ReadLine();

                throw new Exception(String.Format("Load failed (type={0})", failedType), failed);
            }
        }
예제 #27
0
        private static void FillBankbox(Mobile m)
        {
            BankBox bank = m.BankBox;

            if (bank == null)
            {
                return;
            }

            bank.MaxItems = int.MaxValue;

            // The new AOS bankboxes don't have powerscrolls, they are automatically 'applied':

            for (int i = 0; i < PowerScroll.Skills.Length; ++i)
            {
                m.Skills[PowerScroll.Skills[i]].Cap = 120.0;
            }

            m.StatCap = 250;

            Container cont;
            Container cont2;

            // Begin box of money
            cont        = new WoodenBox();
            cont.ItemID = 0xE7D;
            cont.Hue    = 0x489;

            PlaceItemIn(cont, 17, 52, new BankCheck(1000000));
            PlaceItemIn(cont, 28, 52, new BankCheck(1000000));

            PlaceItemIn(cont, 17, 91, new Factions.Silver(9000));
            PlaceItemIn(cont, 34, 91, new Gold(60000));

            PlaceItemIn(bank, 38, 142, cont);
            // End box of money

            // Begin box of Magery Items
            cont        = new WoodenBox();
            cont.ItemID = 0xE7D;
            cont.Name   = "Magery Items";
            cont.Hue    = 1195;

            // Begin bag of spell casting stuff
            cont2      = new Backpack();
            cont2.Hue  = 0x480;
            cont2.Name = "Spell Casting Stuff";

            PlaceItemIn(cont2, 45, 107, new Spellbook(UInt64.MaxValue));
            PlaceItemIn(cont2, 64, 107, new NecromancerSpellbook((UInt64)0xFFFF));
            PlaceItemIn(cont2, 83, 107, new BookOfChivalry((UInt64)0x3FF));
            PlaceItemIn(cont2, 102, 107, new BookOfBushido());               //Default ctor = full
            PlaceItemIn(cont2, 121, 107, new BookOfNinjitsu());              //Default ctor = full
            PlaceItemIn(cont2, 102, 149, new SpellweavingSpellbook((UInt64)0xFFFF));
            PlaceItemIn(cont2, 121, 149, new MysticismSpellbook((UInt64)0xFFFF));

            Runebook runebook = new Runebook(20);

            runebook.CurCharges = runebook.MaxCharges;
            PlaceItemIn(cont2, 141, 107, runebook);

            Item toHue = new BagOfReagents(5000);

            toHue.Hue = 0x2D;
            PlaceItemIn(cont2, 45, 128, toHue);

            toHue     = new BagOfNecroReagents(3000);
            toHue.Hue = 0x488;
            PlaceItemIn(cont2, 64, 128, toHue);

            toHue     = new BagOfMysticReagents(3000);
            toHue.Hue = 0x48F;
            PlaceItemIn(cont2, 141, 128, toHue);

            for (int i = 0; i < 6; ++i)
            {
                PlaceItemIn(cont2, 45 + (i * 10), 74, new RecallRune());
            }

            PlaceItemIn(cont, 47, 91, cont2);
            // End bag of spell casting stuff

            // Begin bag of potion kegs
            cont2      = new Backpack();
            cont2.Name = "Various Potion Kegs";

            PlaceItemIn(cont2, 45, 149, MakePotionKeg(PotionEffect.CureGreater, 0x2D));
            PlaceItemIn(cont2, 69, 149, MakePotionKeg(PotionEffect.HealGreater, 0x499));
            PlaceItemIn(cont2, 93, 149, MakePotionKeg(PotionEffect.PoisonDeadly, 0x46));
            PlaceItemIn(cont2, 117, 149, MakePotionKeg(PotionEffect.RefreshGreater, 0x21));
            PlaceItemIn(cont2, 141, 149, MakePotionKeg(PotionEffect.ExplosionGreater, 0x74));

            PlaceItemIn(cont2, 93, 82, new Bottle(1000));

            PlaceItemIn(cont, 78, 91, cont2);
            // End bag of potion kegs

            GoldRing ring = new GoldRing();

            ring.Name = "Ring Of Arcane Tactics";
            ring.Attributes.CastRecovery = 3;
            ring.Attributes.CastSpeed    = 1;
            PlaceItemIn(cont, 109, 90, ring);

            GoldBracelet bracelet = new GoldBracelet();

            bracelet.Name = "Farmer's Band Of Mastery";
            bracelet.Attributes.CastRecovery = 3;
            bracelet.Attributes.CastSpeed    = 1;
            PlaceItemIn(cont, 139, 95, bracelet);

            PlaceItemIn(bank, 63, 142, cont);
            // End box of Magery Items

            // Begin bag of ethereals
            cont      = new Backpack();
            cont.Hue  = 0x490;
            cont.Name = "Bag Of Ethy's!";

            cont.DropItem(new EtherealHorse());
            cont.DropItem(new EtherealOstard());
            cont.DropItem(new EtherealLlama());
            cont.DropItem(new EtherealKirin());
            cont.DropItem(new EtherealUnicorn());
            cont.DropItem(new EtherealRidgeback());
            cont.DropItem(new EtherealSwampDragon());
            cont.DropItem(new EtherealBeetle());

            PlaceItemIn(bank, 43, 124, cont);
            // End bag of ethereals

            // Begin box of Artifacts
            cont        = new WoodenBox();
            cont.ItemID = 0xE7D;
            cont.Hue    = 1170;
            cont.Name   = "Artifacts";

            // Begin bag of minor artifacts
            cont2      = new Bag();
            cont2.Hue  = 1167;
            cont2.Name = "Minor Artifacts";

            cont2.DropItem(new LunaLance());
            cont2.DropItem(new VioletCourage());
            cont2.DropItem(new CavortingClub());
            cont2.DropItem(new CaptainQuacklebushsCutlass());
            cont2.DropItem(new NightsKiss());
            cont2.DropItem(new ShipModelOfTheHMSCape());
            cont2.DropItem(new AdmiralsHeartyRum());
            cont2.DropItem(new CandelabraOfSouls());
            cont2.DropItem(new IolosLute());
            cont2.DropItem(new GwennosHarp());
            cont2.DropItem(new ArcticDeathDealer());
            cont2.DropItem(new EnchantedTitanLegBone());
            cont2.DropItem(new NoxRangersHeavyCrossbow());
            cont2.DropItem(new BlazeOfDeath());
            cont2.DropItem(new DreadPirateHat());
            cont2.DropItem(new BurglarsBandana());
            cont2.DropItem(new GoldBricks());
            cont2.DropItem(new AlchemistsBauble());
            cont2.DropItem(new PhillipsWoodenSteed());
            cont2.DropItem(new PolarBearMask());
            cont2.DropItem(new BowOfTheJukaKing());
            cont2.DropItem(new GlovesOfThePugilist());
            cont2.DropItem(new OrcishVisage());
            cont2.DropItem(new StaffOfPower());
            cont2.DropItem(new ShieldOfInvulnerability());
            cont2.DropItem(new HeartOfTheLion());
            cont2.DropItem(new ColdBlood());
            cont2.DropItem(new GhostShipAnchor());
            cont2.DropItem(new SeahorseStatuette());
            cont2.DropItem(new WrathOfTheDryad());
            cont2.DropItem(new PixieSwatter());

            PlaceItemIn(cont, 17, 83, cont2);
            // End bag of minor artifacts

            // Begin Bag of Major Artifacts
            cont2      = new Bag();
            cont2.Hue  = 1266;
            cont2.Name = "Major Artifacts";

            cont2.DropItem(new GauntletsOfNobility());
            cont2.DropItem(new MidnightBracers());
            cont2.DropItem(new VoiceOfTheFallenKing());
            cont2.DropItem(new OrnateCrownOfTheHarrower());
            cont2.DropItem(new HelmOfInsight());
            cont2.DropItem(new HolyKnightsBreastplate());
            cont2.DropItem(new ArmorOfFortune());
            cont2.DropItem(new TunicOfFire());
            cont2.DropItem(new LeggingsOfBane());
            cont2.DropItem(new ArcaneShield());
            cont2.DropItem(new Aegis());
            cont2.DropItem(new RingOfTheVile());
            cont2.DropItem(new BraceletOfHealth());
            cont2.DropItem(new RingOfTheElements());
            cont2.DropItem(new OrnamentOfTheMagician());
            cont2.DropItem(new DivineCountenance());
            cont2.DropItem(new JackalsCollar());
            cont2.DropItem(new HuntersHeaddress());
            cont2.DropItem(new HatOfTheMagi());
            cont2.DropItem(new ShadowDancerLeggings());
            cont2.DropItem(new SpiritOfTheTotem());
            cont2.DropItem(new BladeOfInsanity());
            cont2.DropItem(new AxeOfTheHeavens());
            cont2.DropItem(new TheBeserkersMaul());
            cont2.DropItem(new Frostbringer());
            cont2.DropItem(new BreathOfTheDead());
            cont2.DropItem(new TheDragonSlayer());
            cont2.DropItem(new BoneCrusher());
            cont2.DropItem(new StaffOfTheMagi());
            cont2.DropItem(new SerpentsFang());
            cont2.DropItem(new LegacyOfTheDreadLord());
            cont2.DropItem(new TheTaskmaster());
            cont2.DropItem(new TheDryadBow());
            cont2.DropItem(new TitansHammer());
            cont2.DropItem(new InquisitorsResolution());
            cont2.DropItem(new BladeOfTheRighteous());
            cont2.DropItem(new ZyronicClaw());

            PlaceItemIn(cont, 90, 83, cont2);
            // End Bag of Major Artifacts

            // Begin bag of Tokuno minor artifacts
            cont2      = new Bag();
            cont2.Hue  = 1281;
            cont2.Name = "Tokuno Minor Artifacts";

            cont2.DropItem(new PeasantsBokuto());
            cont2.DropItem(new DragonNunchaku());
            cont2.DropItem(new TheDestroyer());
            cont2.DropItem(new HanzosBow());
            cont2.DropItem(new Exiler());
            cont2.DropItem(new PilferedDancerFans());
            cont2.DropItem(new DemonForks());
            cont2.DropItem(new BlackLotusHood());
            cont2.DropItem(new DaimyosHelm());
            cont2.DropItem(new ArmsOfTacticalExcellence());
            cont2.DropItem(new AncientFarmersKasa());
            cont2.DropItem(new GlovesOfTheSun());
            cont2.DropItem(new LegsOfStability());
            cont2.DropItem(new AncientSamuraiDo());
            cont2.DropItem(new PigmentsOfTokuno());
            cont2.DropItem(new FluteOfRenewal());
            cont2.DropItem(new AncientUrn());
            cont2.DropItem(new HonorableSwords());
            cont2.DropItem(new ChestOfHeirlooms());
            cont2.DropItem(new TomeOfEnlightenment());

            PlaceItemIn(cont, 53, 83, cont2);
            // End bag of Tokuno minor artifacts

            // Begin bag of Tokuno major artifacts
            cont2      = new Bag();
            cont2.Hue  = 1281;
            cont2.Name = "Tokuno Major Artifacts";

            cont2.DropItem(new DarkenedSky());
            cont2.DropItem(new KasaOfRajin());
            cont2.DropItem(new RuneBeetleCarapace());
            cont2.DropItem(new Stormgrip());
            cont2.DropItem(new SwordOfStampede());
            cont2.DropItem(new SwordsOfProsperity());
            cont2.DropItem(new TheHorselord());
            cont2.DropItem(new TomeOfLostKnowledge());
            cont2.DropItem(new WindsEdge());
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.ParagonGold, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.VioletCouragePurple, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.InvulnerabilityBlue, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.LunaWhite, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.DryadGreen, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.ShadowDancerBlack, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.BerserkerRed, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.NoxGreen, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.RumRed, 50));
            cont2.DropItem(new PigmentsOfTokunoMajor(PigmentsType.FireOrange, 50));

            PlaceItemIn(cont, 127, 83, cont2);
            // End bag of Tokuno major artifacts

            // Begin bag of ML Minor artifacts
            cont2      = new Bag();
            cont2.Hue  = 1167;
            cont2.Name = "Minor Artifacts";

            cont2.DropItem(new AegisOfGrace());
            cont2.DropItem(new BladeDance());
            cont2.DropItem(new BloodwoodSpirit());
            cont2.DropItem(new Bonesmasher());
            cont2.DropItem(new Boomstick());
            cont2.DropItem(new BrightsightLenses());
            cont2.DropItem(new FeyLeggings());
            cont2.DropItem(new FleshRipper());
            cont2.DropItem(new HelmOfSwiftness());
            cont2.DropItem(new PadsOfTheCuSidhe());
            cont2.DropItem(new QuiverOfRage());
            cont2.DropItem(new QuiverOfTheElements());
            cont2.DropItem(new RaedsGlory());
            cont2.DropItem(new RighteousAnger());
            cont2.DropItem(new RobeOfTheEclipse());
            cont2.DropItem(new RobeOfTheEquinox());
            cont2.DropItem(new SoulSeeker());
            cont2.DropItem(new TalonBite());
            cont2.DropItem(new TotemOfTheVoid());
            cont2.DropItem(new WildfireBow());
            cont2.DropItem(new Windsong());

            PlaceItemIn(cont, 140, 83, cont2);
            // End bag of ML Minor artifacts

            PlaceItemIn(bank, 63, 106, cont);
            // End box of Artifacts

            // Begin box of General Resources
            cont        = new WoodenBox();
            cont.ItemID = 0xE7D;
            cont.Hue    = 1193;
            cont.Name   = "Genereal Resources";

            // Begin bag of raw materials
            cont2      = new Bag();
            cont2.Name = "Raw Materials Bag";

            PlaceItemIn(cont2, 92, 60, new BarbedLeather(5000));
            PlaceItemIn(cont2, 92, 68, new HornedLeather(5000));
            PlaceItemIn(cont2, 92, 76, new SpinedLeather(5000));
            PlaceItemIn(cont2, 92, 84, new Leather(5000));

            PlaceItemIn(cont2, 30, 118, new Cloth(5000));
            PlaceItemIn(cont2, 30, 84, new Board(5000));
            PlaceItemIn(cont2, 57, 80, new BlankScroll(500));
            PlaceItemIn(cont2, 57, 80, new Bone(100));

            PlaceItemIn(cont2, 30, 35, new DullCopperIngot(5000));
            PlaceItemIn(cont2, 37, 35, new ShadowIronIngot(5000));
            PlaceItemIn(cont2, 44, 35, new CopperIngot(5000));
            PlaceItemIn(cont2, 51, 35, new BronzeIngot(5000));
            PlaceItemIn(cont2, 58, 35, new GoldIngot(5000));
            PlaceItemIn(cont2, 65, 35, new AgapiteIngot(5000));
            PlaceItemIn(cont2, 72, 35, new VeriteIngot(5000));
            PlaceItemIn(cont2, 79, 35, new ValoriteIngot(5000));
            PlaceItemIn(cont2, 86, 35, new IronIngot(5000));

            PlaceItemIn(cont2, 30, 59, new RedScales(5000));
            PlaceItemIn(cont2, 36, 59, new YellowScales(5000));
            PlaceItemIn(cont2, 42, 59, new BlackScales(5000));
            PlaceItemIn(cont2, 48, 59, new GreenScales(5000));
            PlaceItemIn(cont2, 54, 59, new WhiteScales(5000));
            PlaceItemIn(cont2, 60, 59, new BlueScales(5000));

            PlaceItemIn(cont, 40, 93, cont2);
            // End bag of raw materials

            // Begin bag of tools
            cont2      = new Bag();
            cont2.Name = "Tool Bag";

            cont2.DropItem(new TinkerTools(30000));
            cont2.DropItem(new HousePlacementTool());
            cont2.DropItem(new DovetailSaw(30000));
            cont2.DropItem(new Scissors());
            cont2.DropItem(new MortarPestle(30000));
            cont2.DropItem(new ScribesPen(30000));
            cont2.DropItem(new SmithHammer(30000));
            cont2.DropItem(new TwoHandedAxe());
            cont2.DropItem(new FletcherTools(30000));
            cont2.DropItem(new SewingKit(30000));
            cont2.DropItem(new Clippers(30000));

            PlaceItemIn(cont, 90, 93, cont2);
            // End bag of tools

            // Begin bag of runic tools
            cont2      = new Backpack();
            cont2.Name = "Runic Tool Bag";

            PlaceItemIn(cont2, 54, 74, new RunicHammer(CraftResource.DullCopper, 30000));
            PlaceItemIn(cont2, 64, 74, new RunicHammer(CraftResource.ShadowIron, 30000));
            PlaceItemIn(cont2, 74, 74, new RunicHammer(CraftResource.Copper, 30000));
            PlaceItemIn(cont2, 84, 74, new RunicHammer(CraftResource.Bronze, 30000));
            PlaceItemIn(cont2, 94, 74, new RunicHammer(CraftResource.Gold, 30000));
            PlaceItemIn(cont2, 104, 74, new RunicHammer(CraftResource.Agapite, 30000));
            PlaceItemIn(cont2, 114, 74, new RunicHammer(CraftResource.Verite, 30000));
            PlaceItemIn(cont2, 124, 74, new RunicHammer(CraftResource.Valorite, 30000));

            PlaceItemIn(cont2, 54, 90, new RunicSewingKit(CraftResource.SpinedLeather, 30000));
            PlaceItemIn(cont2, 64, 90, new RunicSewingKit(CraftResource.HornedLeather, 30000));
            PlaceItemIn(cont2, 74, 90, new RunicSewingKit(CraftResource.BarbedLeather, 30000));

            PlaceItemIn(cont2, 54, 107, new RunicFletchersTools(CraftResource.Oak, 30000));
            PlaceItemIn(cont2, 69, 107, new RunicFletchersTools(CraftResource.Ash, 30000));
            PlaceItemIn(cont2, 83, 107, new RunicFletchersTools(CraftResource.Yew, 30000));
            PlaceItemIn(cont2, 97, 107, new RunicFletchersTools(CraftResource.Heartwood, 30000));

            PlaceItemIn(cont2, 93, 90, new RunicDovetailSaw(CraftResource.Oak, 30000));
            PlaceItemIn(cont2, 102, 90, new RunicDovetailSaw(CraftResource.Ash, 30000));
            PlaceItemIn(cont2, 112, 90, new RunicDovetailSaw(CraftResource.Yew, 30000));
            PlaceItemIn(cont2, 122, 90, new RunicDovetailSaw(CraftResource.Heartwood, 30000));

            PlaceItemIn(cont, 65, 67, cont2);
            // End bag of runic tools

            // Begin bag of recipes
            cont2      = new Bag();
            cont2.Name = "Bag of Recipes";
            cont2.Hue  = 2301;

            for (int i = 0; i <= 92; i++)
            {
                cont2.DropItem(new RecipeScroll(i));
            }

            PlaceItemIn(cont, 115, 93, cont2);
            // End bag of recipes

            // Begin bag of archery ammo
            cont2      = new Bag();
            cont2.Name = "Bag Of Archery Ammo";

            PlaceItemIn(cont2, 48, 76, new Arrow(5000));
            PlaceItemIn(cont2, 72, 76, new Bolt(5000));

            PlaceItemIn(cont, 65, 93, cont2);
            // End bag of archery ammo

            // Begin bag of Wood
            cont2      = new Bag();
            cont2.Hue  = 1321;
            cont2.Name = "Bag of Wood";

            cont2.DropItem(new AshBoard(500));
            cont2.DropItem(new YewBoard(500));
            cont2.DropItem(new OakBoard(500));
            cont2.DropItem(new HeartwoodBoard(500));
            cont2.DropItem(new BloodwoodBoard(500));
            cont2.DropItem(new FrostwoodBoard(500));

            PlaceItemIn(cont, 139, 93, cont2);
            // End bag of Wood

            // Begin Bag of Imbuing Materials
            cont2      = new Bag();
            cont2.Hue  = 0x4B;
            cont2.Name = "Bag of Imbuing Materials";

            foreach (ImbuingResource resource in Enum.GetValues(typeof(ImbuingResource)))
            {
                try
                {
                    Type type = ScriptCompiler.FindTypeByFullName(String.Format("Server.Items.{0}", resource.ToString()));

                    Item item = (Item)Activator.CreateInstance(type);
                    item.Amount = 1000;

                    cont2.DropItem(item);
                }
                catch
                {
                }
            }

            PlaceItemIn(cont, 16, 67, cont2);
            // End Bag of Imbuing Materials

            // Begin Bag of Elven Materials
            cont2      = new Bag();
            cont2.Hue  = 1195;
            cont2.Name = "Bag of Elven Materials";

            cont2.DropItem(new BarkFragment(200));
            cont2.DropItem(new Blight(200));
            cont2.DropItem(new BlueDiamond(200));
            cont2.DropItem(new BrilliantAmber(200));
            cont2.DropItem(new CapturedEssence(200));
            cont2.DropItem(new Corruption(200));
            cont2.DropItem(new DarkSapphire(200));
            cont2.DropItem(new DiseasedBark(200));
            cont2.DropItem(new DreadHornMane(200));
            cont2.DropItem(new EcruCitrine(200));
            cont2.DropItem(new EnchantedSwitch(200));
            cont2.DropItem(new EyeOfTheTravesty(200));
            cont2.DropItem(new FireRuby(200));
            cont2.DropItem(new GrizzledBones(200));
            cont2.DropItem(new HollowPrism(200));
            cont2.DropItem(new JeweledFiligree(200));
            cont2.DropItem(new LardOfParoxysmus(200));
            cont2.DropItem(new LuminescentFungi(200));
            cont2.DropItem(new Muculent(200));
            cont2.DropItem(new ParasiticPlant(200));
            cont2.DropItem(new PerfectEmerald(200));
            cont2.DropItem(new PristineDreadHorn(200));
            cont2.DropItem(new Putrefaction(200));
            cont2.DropItem(new RunedPrism(200));
            cont2.DropItem(new Scourge(200));
            cont2.DropItem(new SwitchItem(200));
            cont2.DropItem(new Taint(200));
            cont2.DropItem(new Turquoise(200));
            cont2.DropItem(new WhitePearl(200));

            PlaceItemIn(cont, 40, 67, cont2);
            // End Bag of Elven Materials

            PlaceItemIn(bank, 88, 142, cont);
            // End box of General Resources

            // Begin box of Armor Set Pieces
            cont        = new WoodenBox();
            cont.ItemID = 0xE7D;
            cont.Hue    = 1194;
            cont.Name   = "Armor Set Pieces";

            // Begin Bag of Juggernaut Set
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Juggernaut Set";

            cont2.DropItem(new MalekisHonor());
            cont2.DropItem(new Evocaricus());

            PlaceItemIn(cont, 17, 63, cont2);
            // End Bag of Juggernaut Set

            // Begin Bag of Hunter Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Hunter Set Armor";

            cont2.DropItem(new HunterGloves());
            cont2.DropItem(new HunterLeggings());
            cont2.DropItem(new HunterSleeves());
            cont2.DropItem(new HunterTunic());

            PlaceItemIn(cont, 40, 63, cont2);
            // End Bag of Hunter Set Armor

            // Begin Bag of Paladin Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Paladin Set Armor";

            cont2.DropItem(new PlateOfHonorArms());
            cont2.DropItem(new PlateOfHonorChest());
            cont2.DropItem(new PlateOfHonorGloves());
            cont2.DropItem(new PlateOfHonorGorget());
            cont2.DropItem(new PlateOfHonorHelm());
            cont2.DropItem(new PlateOfHonorLegs());

            PlaceItemIn(cont, 65, 63, cont2);
            // End Bag of Paladin Set Armor

            // Begin Bag of Necromancer Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Necromancer Set Armor";

            cont2.DropItem(new DeathsEssenceGloves());
            cont2.DropItem(new DeathsEssenceHelm());
            cont2.DropItem(new DeathsEssenceLeggings());
            cont2.DropItem(new DeathsEssenceSleeves());
            cont2.DropItem(new DeathsEssenceTunic());

            PlaceItemIn(cont, 90, 63, cont2);
            // End Bag of Necromancer Set Armor

            // Begin Bag of Acolyte Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Acolyte Set Armor";

            cont2.DropItem(new AcolyteGloves());
            cont2.DropItem(new AcolyteLeggings());
            cont2.DropItem(new AcolyteSleeves());
            cont2.DropItem(new AcolyteTunic());

            PlaceItemIn(cont, 115, 63, cont2);
            // End Bag of Acolyte Set Armor

            // Begin Bag of Marksman Set
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Marksman Set";

            cont2.DropItem(new Feathernock());
            cont2.DropItem(new Swiftflight());

            PlaceItemIn(cont, 139, 63, cont2);
            // End Bag of Marksman Set

            // Begin Bag of Monstrous Interred Grizzle Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Monstrous Interred Grizzle Set Armor";

            cont2.DropItem(new GauntletsOfTheGrizzle());
            cont2.DropItem(new GreavesOfTheGrizzle());
            cont2.DropItem(new SkullHelmOfTheGrizzle());
            cont2.DropItem(new TunicOfTheGrizzle());
            cont2.DropItem(new VambracesOfTheGrizzle());

            PlaceItemIn(cont, 17, 89, cont2);
            // End Bag of Monstrous Interred Grizzle Set Armor

            // Begin Bag of Warrior Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Warrior Set Armor";

            cont2.DropItem(new DarkwoodChest());
            cont2.DropItem(new DarkwoodCrown());
            cont2.DropItem(new DarkwoodGauntlets());
            cont2.DropItem(new DarkwoodGorget());
            cont2.DropItem(new DarkwoodPauldrons());
            cont2.DropItem(new DarkwoodLeggings());

            PlaceItemIn(cont, 40, 89, cont2);
            // End Bag of Warrior Set Armor

            // Begin Bag of Mage Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Mage Set Armor";

            cont2.DropItem(new LeafweaveGloves());
            cont2.DropItem(new LeafweaveLeggings());
            cont2.DropItem(new LeafweaveSleeves());
            cont2.DropItem(new LeafweaveTunic());

            PlaceItemIn(cont, 65, 89, cont2);
            // End Bag of Mage Set Armor

            // Begin Bag of Assassin Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Assassin Set Armor";

            cont2.DropItem(new AssassinGloves());
            cont2.DropItem(new AssassinLeggings());
            cont2.DropItem(new AssassinSleeves());
            cont2.DropItem(new AssassinTunic());

            PlaceItemIn(cont, 90, 89, cont2);
            // End Bag of Assassin Set Armor

            // Begin Bag of Myrmidon Set Armor
            cont2      = new Bag();
            cont2.Hue  = 1177;
            cont2.Name = "Myrmidon Set Armor";

            cont2.DropItem(new MyrmidonArms());
            cont2.DropItem(new MyrmidonChest());
            cont2.DropItem(new MyrmidonGloves());
            cont2.DropItem(new MyrmidonGorget());
            cont2.DropItem(new MyrmidonHelm());
            cont2.DropItem(new MyrmidonLegs());

            PlaceItemIn(cont, 115, 89, cont2);
            // End Bag of Myrmidon Set Armor

            PlaceItemIn(bank, 113, 142, cont);
            // End box of Armor Set Pieces

            PlaceItemIn(bank, 118, 111, new ChargerOfTheFallen());
        }