Exemplo n.º 1
0
        public void SaveItemDropers()
        {
            SHItemRelatedNPCXml itemRelatedNPCXml = new SHItemRelatedNPCXml();

            foreach (SHLoot loot in Lootings.dataList)
            {
                for (int i = 0; i < loot.dataList.Count; i++)
                {
                    if (loot.dataList[i].GetType() != typeof(SHLootItem))
                    {
                        continue;
                    }

                    SHLootItem lootItem = loot.dataList[i] as SHLootItem;

                    ArrayList npcIDList = NPCs.GetNPCIDListByLootID(loot.id);
                    if (null == npcIDList)
                    {
                        continue;
                    }

                    SHItemRelatedNPC_Item itemRelatedNPC_Item = itemRelatedNPCXml[lootItem.id];
                    if (null == itemRelatedNPC_Item)
                    {
                        itemRelatedNPC_Item    = new SHItemRelatedNPC_Item();
                        itemRelatedNPC_Item.id = lootItem.id;
                        itemRelatedNPCXml.Add(itemRelatedNPC_Item);
                    }

                    foreach (int nNPCID in npcIDList)
                    {
                        SHItemRelatedNPC_NPC itemRelatedNPC_NPC = itemRelatedNPC_Item[nNPCID];
                        if (null == itemRelatedNPC_NPC)
                        {
                            itemRelatedNPC_NPC    = new SHItemRelatedNPC_NPC();
                            itemRelatedNPC_NPC.id = nNPCID;
                            itemRelatedNPC_Item.Add(itemRelatedNPC_NPC);
                        }
                    }
                }
            }

            string strFileName = "\\item_droper.xml";

            if (File.Exists(SHGlobal.GetClientSystemFolder() + strFileName))
            {
                CreateBackupDirectory();

                // Backup
                File.Copy(SHGlobal.GetClientSystemFolder() + strFileName, Directory.GetCurrentDirectory() + "\\Backup\\conditions." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true);
            }

            // Save
            SHGlobal.Serialize <SHItemRelatedNPCXml>(SHGlobal.GetClientSystemFolder() + strFileName, itemRelatedNPCXml, Encoding.UTF8);
        }
Exemplo n.º 2
0
        public override bool Build(SHXmlCore core)
        {
            if (!_bPassed)
            {
                return(false);
            }

            if (dataList.Count == 0)
            {
                return(Error("획득가능한 전리품이 없습니다."));
            }

            foreach (object obj in dataList)
            {
                if (obj.GetType() == typeof(SHLootSilver))
                {
                    SHLootSilver silver = (SHLootSilver)obj;
                    if (!silver.Build(core))
                    {
                        return(Error(silver.CompiledMessage));
                    }
                }
                else if (obj.GetType() == typeof(SHLootItem))
                {
                    SHLootItem item = (SHLootItem)obj;
                    if (!item.Build(core))
                    {
                        return(Error(item.CompiledMessage));
                    }
                }
                else if (obj.GetType() == typeof(SHLootSoul))
                {
                    SHLootSoul soul = (SHLootSoul)obj;
                    if (!soul.Build(core))
                    {
                        return(Error(soul.CompiledMessage));
                    }
                }
            }

            return(_bPassed);
        }
Exemplo n.º 3
0
        private string ProcessLootItem(SHXmlCore xmlCore, SHLootItem item)
        {
            string str = "";

            if (item == null)
            {
                return(str);
            }

            str  = (xmlCore.Items.IsValid(item.id) && xmlCore.Items[item.id].Passed) ? xmlCore.GetSafeString(xmlCore.Items[item.id].name) : "미존재 아이템 (" + item.id.ToString() + ")";
            str += ",";
            str += (item.rate.ToString() + "%");
            str += ",";
            str += ((item.minSpecified) ? item.min.ToString() : "(미정의)");
            str += ",";
            str += ((item.maxSpecified) ? item.max.ToString() : "(미정의)");
            str += ",";

            return(str);
        }
Exemplo n.º 4
0
        public override bool Compile()
        {
            _bPassed = true;

            if (!idSpecified)
            {
                _szCompiled = "ID가 명시되지 않은 개체입니다.";
                _bPassed    = false;
            }

            foreach (object obj in dataList)
            {
                if (obj.GetType() == typeof(SHLootSilver))
                {
                    SHLootSilver silver = (SHLootSilver)obj;
                    if (!silver.Compile())
                    {
                        return(Error(silver.CompiledMessage));
                    }
                }
                else if (obj.GetType() == typeof(SHLootItem))
                {
                    SHLootItem item = (SHLootItem)obj;
                    if (!item.Compile())
                    {
                        return(Error(item.CompiledMessage));
                    }
                }
                else if (obj.GetType() == typeof(SHLootSoul))
                {
                    SHLootSoul soul = (SHLootSoul)obj;
                    if (!soul.Compile())
                    {
                        return(Error(soul.CompiledMessage));
                    }
                }
            }

            return(_bPassed);
        }
Exemplo n.º 5
0
 public void Add(SHLootItem i)
 {
     dataList.Add(i);
 }