Add Weather Page

This commit is contained in:
2023-10-14 11:36:17 +08:00
parent cfdca6f031
commit f8b920100d
18 changed files with 2199 additions and 566 deletions

View File

@@ -0,0 +1,42 @@
/**
* 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
{
[ResourceType("WeatherExcelConfigData.json")]
internal class WeatherData
{
[JsonProperty("areaID")]
public int AreaId { get; set; }
[JsonProperty("weatherAreaId")]
public int WeatherAreaId { get; set; }
[JsonProperty("profileName")]
public string ProfileName { get; set; }
[JsonProperty("defaultClimate")]
public string DefaultClimate { get; set; }
[JsonProperty("sceneID")]
public int SceneId { get; set; }
}
}

View File

@@ -69,6 +69,8 @@ namespace GrasscutterTools.Game.Data
public TextMapData TextMapData { get; set; }
public List<WeatherData> WeatherData { get; set; }
public GameResources(string resourcesDirPath, TextMapData textMapData)
{
TextMapData = textMapData;
@@ -446,6 +448,31 @@ namespace GrasscutterTools.Game.Data
#endregion
#region Weather
// Weather
sb.Clear();
foreach (var scene in WeatherData
.GroupBy(it => it.SceneId)
.OrderBy(it => it.Key))
{
sb.Append("// ").AppendLine(scene.Key.ToString());
foreach (var weather in scene)
{
var profileName = weather.ProfileName.Substring(weather.ProfileName.LastIndexOf('/') + 1)
.Replace("ESP_", "");
sb.AppendLine($"{weather.AreaId}:{profileName}");
}
}
File.WriteAllText(
Path.Combine(projectResourcesDir, "Weather.txt"),
sb.ToString(),
Encoding.UTF8);
#endregion
File.WriteAllLines(
Path.Combine(projectResourcesDir, "AvatarColor.txt"),
AvatarData.Values.Select(it => $"{it.Id % 1000 + 1000}:{(int)it.QualityType}"),

View File

@@ -46,6 +46,7 @@ namespace GrasscutterTools.Game
GachaBannerTitles = new ItemMap(Resources.GachaBannerTitle);
Quests = new ItemMap(Resources.Quest);
ShopType = new ItemMap(Resources.ShopType);
Weathers = new ItemMapGroup(Resources.Weather);
}
public static ItemMap Achievements { get; private set; }
@@ -89,5 +90,7 @@ namespace GrasscutterTools.Game
public static ItemMap Quests { get; private set; }
public static ItemMap ShopType { get; private set; }
public static ItemMapGroup Weathers { get; private set; }
}
}

View File

@@ -70,7 +70,7 @@ namespace GrasscutterTools.Game
public IEnumerable<int> AllIds => Values.SelectMany(it => it.Ids);
private string[] lines;
public string[] Lines => lines ?? (lines = AllLines.ToArray());
public string[] Lines => lines ??= AllLines.ToArray();
public string this[int id]
{