Beispiel #1
0
 public void Save()
 {
     try
     {
         lock (AMSXml)
         {
             using (AMSXml.Buffer())
             {
                 AMSXml.SetValue("Informations", "OwnerUID", OwnerUIDValue);
                 AMSXml.SetValue("Informations", "Position", PositionValue);
                 AMSXml.SetValue("Informations", "Id", IdValue);
                 AMSXml.SetValue("Informations", "Craft", CraftValue);
                 AMSXml.SetValue("Informations", "Bless", BlessValue);
                 AMSXml.SetValue("Informations", "Enchant", EnchantValue);
                 AMSXml.SetValue("Informations", "Gem1", Gem1Value);
                 AMSXml.SetValue("Informations", "Gem2", Gem2Value);
                 AMSXml.SetValue("Informations", "Attr", AttrValue);
                 AMSXml.SetValue("Informations", "Restrain", RestrainValue);
                 AMSXml.SetValue("Informations", "CurDura", CurDuraValue);
                 AMSXml.SetValue("Informations", "MaxDura", MaxDuraValue);
             }
         }
     }
     catch (Exception Exc) { Program.WriteLine(Exc); }
 }
Beispiel #2
0
        public static Item Create(Int32 OwnerUID, Byte Position, Int32 Id, Byte Craft, Byte Bless, Byte Enchant, Byte Gem1, Byte Gem2, Byte Attr, Int32 Restrain, UInt16 CurDura, UInt16 MaxDura)
        {
            Int32 UniqId = 1;
            Xml   AMSXml = null;
            Item  Item   = null;

            try
            {
                lock (World.AllItems)
                {
                    UniqId = World.GetNextItemUID();
                    if (World.AllItems.ContainsKey(UniqId))
                    {
                        UniqId = World.GetNextItemUID();
                    }
                    World.AllItems.Add(UniqId, null);

                    AMSXml          = new Xml(Program.RootPath + "\\Items\\" + UniqId + ".item");
                    AMSXml.RootName = "Item";

                    Item = new Item(AMSXml, UniqId, OwnerUID, Position, Id, Craft, Bless, Enchant, Gem1, Gem2, Attr, Restrain, CurDura, MaxDura);
                    World.AllItems[UniqId] = Item;
                }

                using (AMSXml.Buffer())
                {
                    AMSXml.SetValue("Informations", "UniqId", UniqId);
                    AMSXml.SetValue("Informations", "OwnerUID", OwnerUID);
                    AMSXml.SetValue("Informations", "Position", Position);
                    AMSXml.SetValue("Informations", "Id", Id);
                    AMSXml.SetValue("Informations", "Craft", Craft);
                    AMSXml.SetValue("Informations", "Bless", Bless);
                    AMSXml.SetValue("Informations", "Enchant", Enchant);
                    AMSXml.SetValue("Informations", "Gem1", Gem1);
                    AMSXml.SetValue("Informations", "Gem2", Gem2);
                    AMSXml.SetValue("Informations", "Attr", Attr);
                    AMSXml.SetValue("Informations", "Restrain", Restrain);
                    AMSXml.SetValue("Informations", "CurDura", CurDura);
                    AMSXml.SetValue("Informations", "MaxDura", MaxDura);
                }
                AMSXml = null;
                return(Item);
            }
            catch (Exception Exc) { Program.WriteLine(UniqId + " " + Exc); AMSXml = null; return(null); }
        }