Пример #1
0
        private void doDbgset(string line)
        {
            int index = Int32.Parse(StringCut.splitPoint(line, 2));

            if (dbgsetList[index] == null)
            {
                dbgsetList[index] = new DbgsetBean();
            }
            dbgsetList[index].index = index;
            String key   = StringCut.splitBeforeEqual(line);
            String value = StringCut.splitAfterEqual(line);

            switch (key)
            {
            case "name":
                dbgsetList[index].name     = value;
                dbgsetList[index].haveName = true;
                break;

            case "length":
                dbgsetList[index].length     = Int32.Parse(value);
                dbgsetList[index].haveLength = true;
                break;

            default:
                dbgsetList[index].haveItem = true;
                ItemBean item = new ItemBean();
                item.index = Int32.Parse(key);
                item.item  = value;
                dbgsetList[index].item.Add(item);
                break;
            }
        }
Пример #2
0
 private string[] linecut(string line)
 {
     string[] linearr = new string[4];
     linearr[0] = StringCut.splitPoint(line, 1);
     linearr[1] = StringCut.splitPoint(line, 2);
     linearr[2] = StringCut.splitBeforeEqual(line);
     linearr[3] = StringCut.splitAfterEqual(line);
     return(linearr);
 }
Пример #3
0
        private void doCos(string line)
        {
            int index = Int32.Parse(StringCut.splitPoint(line, 2));

            if (cosList[index] == null)
            {
                cosList[index] = new CosBean();
            }
            cosList[index].index = index;
            if (index > lastCosIndex)
            {
                lastCosIndex = index;
            }
            String key   = StringCut.splitBeforeEqual(line);
            String value = StringCut.splitAfterEqual(line);

            switch (key)
            {
            case "id":
                cosList[index].haveId = true;
                cosList[index].id     = Int32.Parse(value);
                if (cosList[index].id > lastCosId)
                {
                    lastCosId = cosList[index].id;
                }
                break;

            case "length":
                cosList[index].haveLength = true;
                cosList[index].length     = Int32.Parse(value);
                break;

            default:
                cosList[index].haveItem = true;
                ItemBean item = new ItemBean();
                item.index = Int32.Parse(key);
                item.item  = value;
                cosList[index].item.Add(item);
                break;
            }
        }
Пример #4
0
        public Modules(string[] ori)
        {
            //寻找长度行
            foreach (string line in ori.Reverse())
            {
                if (line.Contains("data_list.length"))
                {
                    length     = Int32.Parse(StringCut.splitAfterEqual(line));
                    moduleList = new ModuleBean[length + 500];
                    break;
                }
            }
            foreach (string line in ori)
            {
                //读取文件
                //注释
                if (line[0].Equals('#'))
                {
                    continue;
                }
                //最后一行
                if (line.Contains("data_list.length"))
                {
                    break;
                }
                string[] linearr = new string[4];
                //切分
                linearr = linecut(line);
                int    index = Int32.Parse(linearr[1]);
                String key   = linearr[2];
                String value = linearr[3];
                if (moduleList[index] == null)
                {
                    moduleList[index] = new ModuleBean();
                }
                moduleList[index].index = index;
                if (index > lastIndex)
                {
                    lastIndex = index;
                }
                switch (key)
                {
                case "attr":
                    moduleList[index].attr = Int32.Parse(value);
                    break;

                case "chara":
                    moduleList[index].chara = value;
                    break;

                case "cos":
                    moduleList[index].cos = value;
                    break;

                case "id":
                    moduleList[index].id = Int32.Parse(value);
                    if (moduleList[index].id > lastModuleId)
                    {
                        lastModuleId = moduleList[index].id;
                    }
                    break;

                case "name":
                    moduleList[index].name = value;
                    break;

                case "ng":
                    moduleList[index].ng = Int32.Parse(value);
                    break;

                case "shop_ed_day":
                    moduleList[index].shop_ed_day = Int32.Parse(value);
                    break;

                case "shop_ed_month":
                    moduleList[index].shop_ed_month = Int32.Parse(value);
                    break;

                case "shop_ed_year":
                    moduleList[index].shop_ed_year = Int32.Parse(value);
                    break;

                case "shop_price":
                    moduleList[index].shop_price = Int32.Parse(value);
                    break;

                case "shop_st_day":
                    moduleList[index].shop_st_day = Int32.Parse(value);
                    break;

                case "shop_st_month":
                    moduleList[index].shop_st_month = Int32.Parse(value);
                    break;

                case "shop_st_year":
                    moduleList[index].shop_st_year = Int32.Parse(value);
                    break;

                case "sort_index":
                    moduleList[index].sort_index = Int32.Parse(value);
                    if (moduleList[index].sort_index > lastSortIndex)
                    {
                        lastSortIndex = moduleList[index].sort_index;
                    }
                    break;

                default:
                    Console.WriteLine(value);
                    break;
                }
            }
            if ((lastIndex + 1) > length)
            {
                length = lastIndex + 1;
            }
        }
Пример #5
0
        public CustomizeItems(String[] ori)
        {
            //寻找长度行
            int flag = 0;

            foreach (string line in ori.Reverse())
            {
                switch (StringCut.splitBeforeEqual(line))
                {
                case "version":
                    version = Int32.Parse(StringCut.splitAfterEqual(line));
                    flag++;
                    break;

                case "patch":
                    patch = Int32.Parse(StringCut.splitAfterEqual(line));
                    flag++;
                    break;

                case "length":
                    length   = Int32.Parse(StringCut.splitAfterEqual(line));
                    itemList = new CustomizeItemBean[length + 500];
                    flag++;
                    break;
                }
                if (flag == 3)
                {
                    break;
                }
            }
            foreach (string line in ori)
            {
                //读取文件
                //注释
                if (line[0].Equals('#'))
                {
                    continue;
                }
                //最后一行
                if (line.Contains("data_list.length"))
                {
                    break;
                }
                //切分
                int    index = Int32.Parse(StringCut.splitPoint(line, 2));
                String key   = StringCut.splitBeforeEqual(line);
                String value = StringCut.splitAfterEqual(line);
                if (itemList[index] == null)
                {
                    itemList[index] = new CustomizeItemBean();
                }
                itemList[index].index = index;
                if (lastIndex < index)
                {
                    lastIndex = index;
                }
                switch (key)
                {
                case "chara":
                    itemList[index].chara = value;
                    break;

                case "id":
                    if (Int32.Parse(value) > lastId)
                    {
                        lastId = Int32.Parse(value);
                    }
                    itemList[index].id = Int32.Parse(value);
                    break;

                case "name":
                    itemList[index].name = value;
                    break;

                case "ng":
                    itemList[index].ng = Int32.Parse(value);
                    break;

                case "obj_id":
                    itemList[index].obj_id = Int32.Parse(value);
                    break;

                case "parts":
                    itemList[index].parts = value;
                    break;

                case "sell_type":
                    itemList[index].sell_type = Int32.Parse(value);
                    break;

                case "shop_ed_day":
                    itemList[index].shop_ed_day = Int32.Parse(value);
                    break;

                case "shop_ed_month":
                    itemList[index].shop_ed_month = Int32.Parse(value);
                    break;

                case "shop_ed_year":
                    itemList[index].shop_ed_year = Int32.Parse(value);
                    break;

                case "shop_price":
                    itemList[index].shop_price = Int32.Parse(value);
                    break;

                case "shop_st_day":
                    itemList[index].shop_st_day = Int32.Parse(value);
                    break;

                case "shop_st_month":
                    itemList[index].shop_st_month = Int32.Parse(value);
                    break;

                case "shop_st_year":
                    itemList[index].shop_st_year = Int32.Parse(value);
                    break;

                case "sort_index":
                    if (Int32.Parse(value) > lastSort_index)
                    {
                        lastSort_index = Int32.Parse(value);
                    }
                    itemList[index].sort_index = Int32.Parse(value);
                    break;

                default:
                    Console.WriteLine(value);
                    break;
                }
            }
        }
Пример #6
0
        private static void readConfig()
        {
            //从文件读取配置信息
            string programPath = Environment.CurrentDirectory;

            if (!File.Exists(programPath + "\\SlotEditor.ini"))
            {
                createConfig(programPath + "\\SlotEditor.ini");
            }
            String[] configFile = File.ReadAllLines(programPath + "\\SlotEditor.ini");

            List <string> modsList = new List <string>();
            List <string> dlcList  = new List <string>();

            foreach (String line in configFile)
            {
                if ((line.Trim().Length == 0) || (line.Trim()[0].Equals('#')))
                {
                    continue;
                }
                String key   = StringCut.splitBeforeEqual(line).Trim();
                String value = StringCut.splitAfterEqual(line).Trim();
                if (value.Equals(""))
                {
                    throw new Exception("'" + line + "' ERROR");
                }
                if (value[value.Length - 1].Equals('\\'))
                {
                    value = value.Substring(0, value.Length - 1);
                }


                Console.WriteLine(line);
                switch (key.ToLower())
                {
                case "gm_module_tbl":
                    moduleIdPath = value;
                    break;

                case "gm_customize_item_tbl":
                    cstmItemIdPath = value;
                    break;

                case "chritm_prop":
                    chritmPropPath = value;
                    break;

                case "obj_db":
                    objDbPath = value;
                    break;

                case "mdata_obj_db":
                    mdataObjDbPath = value;
                    break;

                case "spr_db":
                    sprDbPath = value;
                    break;

                case "outputfolder":
                    outputPath = value;
                    break;

                case "modspathlist":
                    modsList.Add(value);
                    break;

                case "basegamepath":
                    oriRomPath = value;
                    break;

                case "officialmdatapathlist":
                    string str = "";
                    if (!value[0].Equals('\\'))
                    {
                        str = "\\";
                    }
                    dlcList.Add(str + value);
                    break;

                case "allowtexturereplace":
                    switch (value.ToLower())
                    {
                    case "true":
                        allowTextureReplace = true;
                        break;

                    case "false":
                        allowTextureReplace = false;
                        break;

                    default:
                        throw new Exception(line + " ERROR");
                    }
                    break;

                default:
                    Console.WriteLine("undefine:" + key);
                    break;
                }
            }
            for (int i = 0; i <= dlcList.Count - 1; i++)
            {
                dlcList[i] = oriRomPath + dlcList[i];
            }
            dlcList.Insert(0, oriRomPath);
            newFarcRomPath    = modsList.ToArray();
            officialMdataPath = dlcList.ToArray();
        }
Пример #7
0
        private void docol()
        {
            foreach (CharacterItemBean cib in itemList)
            {
                if ((cib != null) && (cib.haveCol))
                {
                    foreach (String line in cib.colOri)
                    {
                        String key   = StringCut.splitBeforeEqual(line);
                        String value = StringCut.splitAfterEqual(line);
                        //等号前第二段
                        String index1 = StringCut.splitPoint(StringCut.splitBeforeEqual(line, 2), 1);
                        String index2 = "";
                        if (index1.Equals("blend") || (index1.Equals("offset")))
                        {
                            index2 = key;
                            key    = index1;
                            index1 = StringCut.splitPoint(StringCut.splitBeforeEqual(line, 3), 1);
                        }
                        int index = Int32.Parse(index1);
                        if (cib.col[index] == null)
                        {
                            cib.col[index] = new ColBean();
                        }
                        cib.col[index].index = index;
                        switch (key)
                        {
                        case "contrast":
                            cib.col[index].contrast = double.Parse(value);
                            break;

                        case "flag":
                            cib.col[index].flag = Int32.Parse(value);
                            break;

                        case "hue":
                            cib.col[index].hue = Int32.Parse(value);
                            break;

                        case "inverse":
                            cib.col[index].inverse = Int32.Parse(value);
                            break;

                        case "saturation":
                            cib.col[index].saturation = double.Parse(value);
                            break;

                        case "tex":
                            cib.col[index].tex = value;
                            break;

                        case "value":
                            cib.col[index].value = double.Parse(value);
                            break;

                        case "blend":
                            switch (index2)
                            {
                            case "0":
                                cib.col[index].blend0 = double.Parse(value);
                                break;

                            case "1":
                                cib.col[index].blend1 = double.Parse(value);
                                break;

                            case "2":
                                cib.col[index].blend2 = double.Parse(value);
                                break;

                            default:
                                Console.WriteLine(line);
                                break;
                            }
                            break;

                        case "offset":
                            switch (index2)
                            {
                            case "0":
                                cib.col[index].offset0 = Double.Parse(value);
                                break;

                            case "1":
                                cib.col[index].offset1 = Double.Parse(value);
                                break;

                            case "2":
                                cib.col[index].offset2 = Double.Parse(value);
                                break;

                            default:
                                Console.WriteLine(line);
                                break;
                            }
                            break;

                        default:
                            Console.WriteLine(line);
                            break;
                        }
                    }
                }
            }
        }
Пример #8
0
        public CharacterTbl(string[] ori)
        {
            //寻找长度行
            foreach (string line in ori)
            {
                if (line.Contains("cos.length"))
                {
                    cosLength = Int32.Parse(StringCut.splitAfterEqual(line));
                    cosList   = new CosBean[cosLength + 500];
                }
                if (line.Contains("dbgset.length"))
                {
                    dbgsetLength = Int32.Parse(StringCut.splitAfterEqual(line));
                    dbgsetList   = new DbgsetBean[dbgsetLength + 500];
                }
                if (line.Contains("item.length"))
                {
                    itemLength = Int32.Parse(StringCut.splitAfterEqual(line));
                    itemList   = new CharacterItemBean[itemLength + 500];
                }
            }
            foreach (string line in ori)
            {
                //注释
                if (line[0].Equals('#'))
                {
                    continue;
                }
                //长度行
                if (line.Contains("cos.length"))
                {
                    continue;
                }
                if (line.Contains("dbgset.length"))
                {
                    continue;
                }
                if (line.Contains("item.length") && !line.Contains("cos") && !line.Contains("dbgset"))
                {
                    continue;
                }
                switch (StringCut.splitPoint(line, 1))
                {
                case "cos":
                    doCos(line);
                    break;

                case "dbgset":
                    doDbgset(line);
                    break;

                case "item":
                    doItem(line);
                    break;

                default:
                    Console.WriteLine(line);
                    break;
                }
            }
            docol();
            if (cosLength < lastCosIndex + 1)
            {
                cosLength = lastCosIndex + 1;
            }
            if (itemLength < lastItemIndex + 1)
            {
                itemLength = lastItemIndex + 1;
            }
        }
Пример #9
0
        private void doItem(string line)
        {
            int index = Int32.Parse(StringCut.splitPoint(line, 2));

            if (itemList[index] == null)
            {
                itemList[index] = new CharacterItemBean();
            }
            itemList[index].index = index;
            if (index > lastItemIndex)
            {
                lastItemIndex = index;
            }
            String key   = StringCut.splitBeforeEqual(line);
            String value = StringCut.splitAfterEqual(line);
            //等号前第二段
            String index1 = StringCut.splitPoint(StringCut.splitBeforeEqual(line, 2), 1);

            //处理col
            if (line.Contains(".col."))
            {
                if (key.Equals("length"))
                {
                    itemList[index].haveColLength = true;
                    itemList[index].colLength     = Int32.Parse(value);
                    itemList[index].col           = new ColBean[Int32.Parse(value)];
                    return;
                }
                itemList[index].haveCol = true;
                itemList[index].colOri.Add(line);
                return;
            }
            switch (key)
            {
            case "attr":
                itemList[index].attr     = Int32.Parse(value);
                itemList[index].haveAttr = true;
                break;

            case "rpk":
                ObjRpkBean objrpk = new ObjRpkBean();
                objrpk.index = Int32.Parse(index1);
                objrpk.rpk   = Int32.Parse(value);
                itemList[index].dataObjRpk.Add(objrpk);
                itemList[index].haveRpk = true;
                break;

            case "uid":
                ObjUidBean objuid = new ObjUidBean();
                objuid.index = Int32.Parse(index1);
                objuid.uid   = value;
                itemList[index].dataObjUid.Add(objuid);
                itemList[index].haveUid = true;
                break;

            case "length":
                String lengthKey = StringCut.splitBeforeEqual(line, 2);
                switch (lengthKey)
                {
                case "obj.length":
                    itemList[index].dataObjLength = Int32.Parse(value);
                    itemList[index].haveObjLength = true;
                    break;

                case "tex.length":
                    itemList[index].dataTexLength = Int32.Parse(value);
                    itemList[index].haveTexLength = true;
                    break;

                case "objset.length":
                    itemList[index].objsetLength     = Int32.Parse(value);
                    itemList[index].haveObjsetLength = true;
                    break;

                default:
                    Console.WriteLine(line);
                    break;
                }
                break;

            case "chg":
                TexChgBean texchg = new TexChgBean();
                texchg.index = Int32.Parse(index1);
                texchg.chg   = value;
                itemList[index].dataTexChg.Add(texchg);
                itemList[index].haveTexChg = true;
                break;

            case "org":
                TexOrgBean texorg = new TexOrgBean();
                texorg.index = Int32.Parse(index1);
                texorg.org   = value;
                itemList[index].dataTexOrg.Add(texorg);
                itemList[index].haveTexOrg = true;
                break;

            case "des_id":
                itemList[index].des_id     = Int32.Parse(value);
                itemList[index].haveDes_id = true;
                break;

            case "exclusion":
                itemList[index].exclusion     = Int32.Parse(value);
                itemList[index].haveExclusion = true;
                break;

            case "face_depth":
                itemList[index].face_depth     = double.Parse(value);
                itemList[index].haveFace_depth = true;
                break;

            case "flag":
                itemList[index].flag     = Int32.Parse(value);
                itemList[index].haveFlag = true;
                break;

            case "name":
                itemList[index].name     = value;
                itemList[index].haveName = true;
                break;

            case "no":
                itemList[index].no     = Int32.Parse(value);
                itemList[index].haveNo = true;
                if (itemList[index].no > lastItemNo)
                {
                    lastItemNo = itemList[index].no;
                }
                break;

            case "org_itm":
                itemList[index].org_itm     = Int32.Parse(value);
                itemList[index].haveOrg_itm = true;
                break;

            case "point":
                itemList[index].point     = Int32.Parse(value);
                itemList[index].havePoint = true;
                break;

            case "sub_id":
                itemList[index].sub_id     = Int32.Parse(value);
                itemList[index].haveSub_id = true;
                break;

            case "type":
                itemList[index].type     = Int32.Parse(value);
                itemList[index].haveType = true;
                break;

            case "npr_flag":
                itemList[index].npr_flag     = Int32.Parse(value);
                itemList[index].haveNpr_flag = true;
                break;

            default:
                //数字
                if (index1 == "objset")
                {
                    ObjsetBean objset = new ObjsetBean();
                    //格式和别的行不同
                    objset.index  = Int32.Parse(key);
                    objset.objset = value;
                    itemList[index].objset.Add(objset);
                    itemList[index].haveObjset = true;
                }
                else
                {
                    Console.WriteLine(line);
                }
                break;
            }
        }