Clean up all code

This commit is contained in:
2023-08-24 15:18:12 +08:00
parent 434ec7b2df
commit 2a8cebcbb5
52 changed files with 547 additions and 119 deletions

View File

@@ -1,4 +1,23 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
@@ -10,4 +29,4 @@ namespace GrasscutterTools.Game.Data.Excels
public bool IsUsed => !IsDisuse;
}
}
}

View File

@@ -1,4 +1,23 @@
using GrasscutterTools.Game.Props;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using GrasscutterTools.Game.Props;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -11,4 +30,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("qualityType"), JsonConverter(typeof(StringEnumConverter))]
public QualityType QualityType { get; set; }
}
}
}

View File

@@ -1,4 +1,23 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
@@ -8,4 +27,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("sceneId")]
public int SceneId { get; set; }
}
}
}

View File

@@ -1,8 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Data.Excels
{
@@ -10,4 +23,4 @@ namespace GrasscutterTools.Game.Data.Excels
internal class GadgetData
{
}
}
}

View File

@@ -1,4 +1,23 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
@@ -11,4 +30,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("bgmNameTextMapHash")]
public long BgmNameTextMapHash { get; set; }
}
}
}

View File

@@ -1,7 +1,26 @@
namespace GrasscutterTools.Game.Data.Excels
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Data.Excels
{
[ResourceType("HomeWorldFurnitureExcelConfigData.json")]
internal class HomeWorldFurnitureData : GameResource
{
}
}
}

View File

@@ -1,4 +1,21 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Data.Excels
{
@@ -6,4 +23,4 @@ namespace GrasscutterTools.Game.Data.Excels
internal class MainQuestData : GameResource
{
}
}
}

View File

@@ -1,4 +1,24 @@
using System.Collections.Generic;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using GrasscutterTools.Game.Inventory;
using GrasscutterTools.Game.Props;
@@ -19,4 +39,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("itemUse")]
public List<ItemUseData> ItemUse { get; set; }
}
}
}

View File

@@ -1,4 +1,24 @@
using GrasscutterTools.Game.Props;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using GrasscutterTools.Game.Props;
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
@@ -12,4 +32,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("type")]
public MonsterType Type { get; set; }
}
}
}

View File

@@ -1,4 +1,23 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
@@ -14,4 +33,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("order")]
public int Order { get; set; }
}
}
}

View File

@@ -1,7 +1,26 @@
namespace GrasscutterTools.Game.Data.Excels
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Data.Excels
{
[ResourceType("ReliquaryExcelConfigData.json")]
internal class ReliquaryData : GameResource
{
}
}
}

View File

@@ -1,4 +1,24 @@
using GrasscutterTools.Game.Props;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using GrasscutterTools.Game.Props;
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
@@ -12,4 +32,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("scriptData")]
public string ScriptData { get; set; }
}
}
}

View File

@@ -1,4 +1,23 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
@@ -8,4 +27,4 @@ namespace GrasscutterTools.Game.Data.Excels
[JsonProperty("rankLevel")]
public int RankLevel { get; set; }
}
}
}

View File

@@ -1,4 +1,23 @@
using Newtonsoft.Json;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data
{

View File

@@ -1,4 +1,23 @@
using System;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
@@ -6,10 +25,10 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using GrasscutterTools.Game.Data.Excels;
using GrasscutterTools.Game.Inventory;
using GrasscutterTools.Game.Props;
using GrasscutterTools.GOOD;
using GrasscutterTools.Utils;
using Newtonsoft.Json;
@@ -27,7 +46,7 @@ namespace GrasscutterTools.Game.Data
public Dictionary<int, DungeonData> DungeonData { get; set; }
public Dictionary<int, HomeWorldFurnitureData> HomeWorldFurnitureData { get; set; }
public Dictionary<int, MainQuestData> MainQuestData { get; set; }
public Dictionary<int, QuestData> QuestData { get; set; }
@@ -37,15 +56,13 @@ namespace GrasscutterTools.Game.Data
public Dictionary<int, MonsterData> MonsterData { get; set; }
public Dictionary<int, ReliquaryData> ReliquaryData { get; set; }
public Dictionary<int, SceneData> SceneData { get; set; }
public Dictionary<int, WeaponData> WeaponData { get; set; }
public TextMapData TextMapData { get; set; }
public GameResources(string resourcesDirPath, TextMapData textMapData)
{
TextMapData = textMapData;
@@ -63,7 +80,6 @@ namespace GrasscutterTools.Game.Data
property.SetValue(this, data, null);
}
var illegalWeaponIds = new SparseSet(
"10000-10008, 11411, 11506-11508, 12505, 12506, 12508, 12509," +
"13503, 13506, 14411, 14503, 14508, 15504-15506, 20001");
@@ -110,8 +126,8 @@ namespace GrasscutterTools.Game.Data
{
["zh-cn"] = "TextMapCHS",
["zh-tw"] = "TextMapCHT",
["en-us"] = "TextMapEN",
["ru-ru"] = "TextMapRU",
["en-us"] = "TextMapEN",
["ru-ru"] = "TextMapRU",
};
public void ConvertResources(string projectResourcesDir)
@@ -195,7 +211,6 @@ namespace GrasscutterTools.Game.Data
File.WriteAllText(Path.Combine(dir, "Item.txt"), sb.ToString(), Encoding.UTF8);
sb.Clear();
foreach (var monsterType in MonsterData.Values.OrderBy(it => it.Id)
.GroupBy(it => it.Type)
@@ -247,7 +262,6 @@ namespace GrasscutterTools.Game.Data
sb.ToString(),
Encoding.UTF8);
sb.Clear();
foreach (var it in DungeonData.Values)
{
@@ -275,7 +289,6 @@ namespace GrasscutterTools.Game.Data
Encoding.UTF8);
}
File.WriteAllLines(
Path.Combine(projectResourcesDir, "AvatarColor.txt"),
AvatarData.Values.Select(it => $"{it.Id % 1000 + 1000}:{(int)it.QualityType}"),
@@ -285,7 +298,6 @@ namespace GrasscutterTools.Game.Data
Path.Combine(projectResourcesDir, "WeaponColor.txt"),
WeaponData.Values.Select(it => $"{it.Id}:{(it.RankLevel >= 5 ? "yellow" : it.RankLevel >= 4 ? "purple" : "blue")}"),
Encoding.UTF8);
}
finally
{
@@ -293,4 +305,4 @@ namespace GrasscutterTools.Game.Data
}
}
}
}
}

View File

@@ -1,9 +1,28 @@
using System;
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
namespace GrasscutterTools.Game.Data
{
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class ResourceTypeAttribute : Attribute
internal class ResourceTypeAttribute : Attribute
{
public string Name { get; set; }
@@ -12,4 +31,4 @@ namespace GrasscutterTools.Game.Data
Name = name;
}
}
}
}