Esempio n. 1
0
        public void copyModuleWithNewBody(String charactor, int bodyId, String name)
        {
            CharacterTbl   chaTbl  = findCharactor(charactor);
            List <CosBean> coslist = chaTbl.findCosByItemId(bodyId);

            if (coslist.Count == 0)
            {
                throw new Exception("BodyItemId" + bodyId + "NotFound");
            }
            ModuleBean mb = modules.findModuleByCos(charactor, StringCut.cosId2String(coslist[0].id));

            copyModuleWithNewBody(mb.id, name);
        }
Esempio n. 2
0
        public SlotEditor(String moduleIdPath, String cstmItemIdPath, String chritmPropPath,
                          String mdataObjDbPath, String objDbPath, String sprDbPath, Boolean allowTextureReplace = false)
        {
            this.allowTextureReplace = allowTextureReplace;
            FarcPack.Program.Main1(new string[] { @moduleIdPath });
            string[] moduleid = File.ReadAllLines(@moduleIdPath.Substring(0, @moduleIdPath.Length - 5) + @"\gm_module_id.bin");
            Directory.Delete(@moduleIdPath.Substring(0, @moduleIdPath.Length - 5), true);

            FarcPack.Program.Main1(new string[] { @cstmItemIdPath });
            string[] itemid = File.ReadAllLines(@cstmItemIdPath.Substring(0, @cstmItemIdPath.Length - 5) + @"\gm_customize_item_id.bin");
            Directory.Delete(@cstmItemIdPath.Substring(0, @cstmItemIdPath.Length - 5), true);

            FarcPack.Program.Main1(new string[] { @chritmPropPath });
            string[] hak = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\hakitm_tbl.txt");
            string[] kai = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\kaiitm_tbl.txt");
            string[] len = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\lenitm_tbl.txt");
            string[] luk = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\lukitm_tbl.txt");
            string[] mei = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\meiitm_tbl.txt");
            string[] mik = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\mikitm_tbl.txt");
            string[] ner = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\neritm_tbl.txt");
            string[] rin = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\rinitm_tbl.txt");
            string[] sak = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\sakitm_tbl.txt");
            string[] tet = File.ReadAllLines(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5) + @"\tetitm_tbl.txt");
            Directory.Delete(@chritmPropPath.Substring(0, @chritmPropPath.Length - 5), true);

            DatabaseConverter.Program.Main1(new string[] { mdataObjDbPath });
            DatabaseConverter.Program.Main1(new string[] { objDbPath });
            objdb = new ObjDb(mdataObjDbPath.Substring(0, mdataObjDbPath.Length - 4) + ".xml",
                              objDbPath.Substring(0, objDbPath.Length - 4) + ".xml");
            File.Delete(mdataObjDbPath.Substring(0, mdataObjDbPath.Length - 4) + ".xml");
            File.Delete(objDbPath.Substring(0, objDbPath.Length - 4) + ".xml");

            DatabaseConverter.Program.Main1(new string[] { @sprDbPath });
            sprdb = new SprDb(@sprDbPath.Substring(0, @sprDbPath.Length - 4) + ".xml");
            File.Delete(@sprDbPath.Substring(0, @sprDbPath.Length - 4) + ".xml");

            modules   = new Modules(moduleid);
            cstmItems = new CustomizeItems(itemid);
            hakTbl    = new CharacterTbl(hak);
            kaiTbl    = new CharacterTbl(kai);
            lenTbl    = new CharacterTbl(len);
            lukTbl    = new CharacterTbl(luk);
            meiTbl    = new CharacterTbl(mei);
            mikTbl    = new CharacterTbl(mik);
            nerTbl    = new CharacterTbl(ner);
            rinTbl    = new CharacterTbl(rin);
            sakTbl    = new CharacterTbl(sak);
            tetTbl    = new CharacterTbl(tet);
        }
Esempio n. 3
0
        private int farcType(string farcName)
        {
            string chaname = farcName.Substring(0, 3);

            if (chaname.Equals("cmn"))
            {
                return(0);
            }
            CharacterTbl      chaTbl = findCharactor(getStandardName(chaname));
            CharacterItemBean cib    = chaTbl.findItemByNo(Int32.Parse(farcName.Replace(chaname + "itm", "").Replace(".farc", "")));

            if (cib.sub_id == 10)
            {
                return(1);
            }
            else
            {
                return(2);
            }
        }
Esempio n. 4
0
        public void copyModuleWithNewBody(int moduleId, String name)
        {
            ModuleBean   mb     = new ModuleBean(modules.findModuleById(moduleId));
            CharacterTbl chaTbl = findCharactor(mb.chara);

            //更新module
            mb.id         = modules.lastModuleId + 1;
            mb.sort_index = modules.lastSortIndex + 1;
            if (!name.Equals(""))
            {
                mb.name = mb.name + name;
            }
            int oriCosId = StringCut.cosString2Id(mb.cos);

            mb.cos = StringCut.cosId2String(chaTbl.lastCosId + 1);
            modules.add(mb);

            //更新cos
            CosBean newCos    = new CosBean(chaTbl.findCosById(oriCosId));
            int     OldBodyno = chaTbl.findBodyNo(newCos);

            newCos.id = chaTbl.lastCosId + 1;
            foreach (ItemBean i in newCos.item)
            {
                if (Int32.Parse(i.item) == OldBodyno)
                {
                    i.item = (chaTbl.lastItemNo + 1).ToString();
                }
            }
            chaTbl.addCos(newCos);
            logs.modules.Add(new ModuleLogBean(modules.findModuleById(moduleId), mb, chaTbl.findCosById(oriCosId), newCos));

            //新增身体
            CharacterItemBean newItem = copyItemByNo(mb.chara, OldBodyno);

            //更新缩略图
            String spiritName = sprdb.addMD(mb.id);

            //更新日志
        }
Esempio n. 5
0
        public CharacterItemBean copyItemByNo(String charactor, int no, int itemid = -1, Boolean isTexReplaceAndCopyOri = false)
        //复制角色零件
        {
            //复制item
            CharacterTbl      chaTbl  = findCharactor(charactor);
            CharacterItemBean newitem = new CharacterItemBean(chaTbl.findItemByNo(no));

            String oriObjName = newitem.getObjsetName(allowTextureReplace);
            int    oriMeshNum = objdb.getMeshId(oriObjName);
            String oriUid     = objdb.getMeshName(oriObjName);

            newitem.name = newitem.name + " NEW";

            String objsetName = "";

            if (itemid == -1)
            {
                //添加普通角色配件
                newitem.no = chaTbl.lastItemNo + 1;
                objsetName = objdb.getCharacterNameUpper(charactor, 1);
            }
            else
            {
                //添加通用配件,因为要指定编号
                newitem.no = itemid;
                objsetName = "cmnitm" + itemid.ToString();
            }
            //sub_id非1的都是纹理替换更新第二个objset,特殊情况attr=9不知道什么意思
            if ((newitem.objsetLength == 1) || (!allowTextureReplace))
            {
                newitem.objset[0].objset = objsetName.ToUpper();
            }
            else
            {
                newitem.objset[1].objset = objsetName.ToUpper();
            }

            if ((newitem.sub_id == 24) && (newitem.objsetLength == 2))
            {
                //特殊处理 壱ノ桜・桜花顔 和 ctw 颜
                String t = newitem.objset[0].objset;
                newitem.objset[0].objset = newitem.objset[1].objset;
                newitem.objset[1].objset = t;
            }

            if ((newitem.attr != 1) && (!allowTextureReplace))
            {
                //不允许换色
                if (newitem.sub_id == 24)
                {
                    //脸,不能直接复制org_itm因为没有数据
                    //此外在copyFarc也要特殊处理
                    newitem.attr           = 1;
                    newitem.haveTexChg     = false;
                    newitem.haveTexOrg     = false;
                    newitem.haveTexLength  = false;
                    isTexReplaceAndCopyOri = true;
                }
                else
                {
                    //复制原色零件
                    return(copyItemByNo(charactor, newitem.org_itm, itemid, true));
                }
            }


            if (newitem.sub_id != 24)
            {
                String uid = objsetName
                             + oriUid.Replace(oriObjName, "", StringComparison.InvariantCultureIgnoreCase);

                //避免meshname长度变化
                if (uid.Length > oriUid.Length)
                {
                    uid = uid.Substring(0, oriUid.Length);
                }
                if (uid.Length < oriUid.Length)
                {
                    for (int i = uid.Length; i <= oriUid.Length - 1; i++)
                    {
                        uid = uid + "_";
                    }
                }

                newitem.dataObjUid[0].uid = uid.ToUpper();
            }


            chaTbl.addItem(newitem);
            //复制objdb
            String newObjName = newitem.getObjsetName(allowTextureReplace);

            objdb.add(newObjName,
                      objdb.lastId + 1,
                      newObjName + "_obj.bin",
                      newObjName + "_tex.bin",
                      newObjName + ".farc",
                      newitem.dataObjUid[0].uid,
                      0);

            logs.items.Add(new ItemLogBean(chaTbl.findItemByNo(no), oriMeshNum, newitem, charactor, isTexReplaceAndCopyOri));
            return(newitem);
        }