Exemplo n.º 1
0
        private string NPCSHOP_Item(SHNPCShop npcShop, SHXmlCore xmlCore)
        {
            string str = "";

            for (int i = 0; i < npcShop.dataList.Count; i++)
            {
                if (npcShop.dataList[i].GetType() == typeof(SHItemString))
                {
                    str += ProcessItem(xmlCore, npcShop.dataList[i] as SHItemString);
                }
            }

            return(str);
        }
Exemplo n.º 2
0
        private string NPCSHOP_SetString(SHNPCShop npcShop, SHXmlCore xmlCore)
        {
            string str = "";

            npcShop.Compile();
            npcShop.Build(xmlCore);

            if (npcShop.idSpecified)
            {
                str += GetNPCName(xmlCore, npcShop.id);
            }

            //str = (npcShop.idSpecified) ? npcShop.id.ToString() : String.Empty;

            str += "\n";

            str += NPCSHOP_Item(npcShop, xmlCore);

            return(str);
        }
Exemplo n.º 3
0
 public void Add(SHNPCShop i)
 {
     dataList.Add(i);
 }
Exemplo n.º 4
0
        public void NPCInfoSave(int fieldID)
        {
            string strFieldFileName = String.Format("\\{0}.field.xml", fieldID);

            if (File.Exists(SHGlobal.GetClientFieldFolder() + strFieldFileName) == false)
            {
                return;
            }

            SHFieldXml field = SHGlobal.Deserialize <SHFieldXml>(SHGlobal.GetClientFieldFolder() + strFieldFileName, Encoding.UTF8);

            field.Compile();

            SHFieldNPCXml fieldNPCXml = new SHFieldNPCXml();

            foreach (SHSpawn spawn in field.fieldInfo.spawnList)
            {
                if (false == spawn.enabled)
                {
                    continue;
                }

                foreach (SHSpawnNPC spawnnpc in spawn.dataList)
                {
                    if (NPCs.IsValid(spawnnpc.id) == false)
                    {
                        continue;
                    }

                    SHNPC npc = NPCs[spawnnpc.id];
                    if (npc.InteractCount == 0)
                    {
                        continue;
                    }

                    string[] _Type = new string[2];
                    string[] _ICon = new string[2];
                    int      Index = 0;

                    SHNPCIType[] _iType = npc.GetIType();
                    string[]     _iAct  = npc.GetIAct();
                    for (int i = 0; i < 10; i++)
                    {
                        if (_iType[i] == SHNPCIType.craft)
                        {
                            if (Craft.IsValid(_iAct[i]) == false)
                            {
                                continue;
                            }

                            SHCraft craftinfo = Craft[_iAct[i]];
                            if (craftinfo.hidden == true)
                            {
                                continue;
                            }

                            _Type[Index] = "craft";
                            _ICon[Index] = craftinfo.type;
                            Index++;

                            break;
                        }
                    }
                    for (int i = 0; i < 10; i++)
                    {
                        if (_iType[i] == SHNPCIType.trade)
                        {
                            if (NPCShop.IsValid(_iAct[i]) == false)
                            {
                                continue;
                            }

                            _ICon[Index] = "common";
                            SHNPCShop npcshop = NPCShop[_iAct[i]];
                            if (npcshop.repairable == true)
                            {
                                _ICon[Index] = "repair";
                            }

                            if (npcshop.IsLicensable(Items, Talents) == true)
                            {
                                _ICon[Index] = "license";
                            }

                            _Type[Index] = "shop";
                            Index++;

                            break;
                        }
                    }

                    if (Index == 0)
                    {
                        continue;
                    }

                    SHFieldNPC sNPC = new SHFieldNPC();
                    sNPC.id    = spawnnpc.id;
                    sNPC.name  = npc.Name;
                    sNPC.x     = spawn.x;
                    sNPC.y     = spawn.y;
                    sNPC.z     = spawn.z;
                    sNPC.type1 = _Type[0];
                    sNPC.icon1 = _ICon[0];
                    sNPC.type2 = _Type[1];
                    sNPC.icon2 = _ICon[1];
                    fieldNPCXml.Add(sNPC);
                }
            }

            if (fieldNPCXml.dataList.Count == 0)
            {
                return;
            }

            string strFileName = String.Format("\\{0}.field.npc.xml", fieldID);

            SHGlobal.Serialize <SHFieldNPCXml>(SHGlobal.GetClientFieldFolder() + "\\map" + strFileName, fieldNPCXml, Encoding.UTF8);
        }