mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-10-20 19:39:47 +08:00
Implement import from GOOD dump (#86)
* Implement import from GOOD dump * Optimized implementation * Add available urls * Add prompt Co-authored-by: Leo <chun.huang@student.manchester.ac.uk> Co-authored-by: 筱傑 <jie65535@qq.com>
This commit is contained in:
94
Source/GrasscutterTools/GOOD/Artifact.cs
Normal file
94
Source/GrasscutterTools/GOOD/Artifact.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Grasscutter Tools
|
||||
* Copyright (C) 2022 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.GOOD
|
||||
{
|
||||
/// <summary>
|
||||
/// Artifact data representation
|
||||
/// Doc: https://frzyc.github.io/genshin-optimizer/#/doc
|
||||
/// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/game/Artifact.cs
|
||||
/// </summary>
|
||||
public class Artifact
|
||||
{
|
||||
/// <summary>
|
||||
/// e.g. "GladiatorsFinale"
|
||||
/// </summary>
|
||||
[JsonProperty("setKey")]
|
||||
public string SetName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// //e.g. "plume"
|
||||
/// type SlotKey = "flower" | "plume" | "sands" | "goblet" | "circlet"
|
||||
/// </summary>
|
||||
[JsonProperty("slotKey")]
|
||||
public string GearSlot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1-5 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("rarity")]
|
||||
public int Rarity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// mainStatKey
|
||||
/// </summary>
|
||||
[JsonProperty("mainStatKey")]
|
||||
public string MainStat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0-20 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("level")]
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// substats
|
||||
/// </summary>
|
||||
[JsonProperty("substats")]
|
||||
public SubStat[] SubStats { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// where "" means not equipped.
|
||||
/// </summary>
|
||||
[JsonProperty("location")]
|
||||
public string EquippedCharacter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the artifact is locked in game.
|
||||
/// </summary>
|
||||
[JsonProperty("lock")]
|
||||
public bool Lock { get; set; }
|
||||
|
||||
public struct SubStat
|
||||
{
|
||||
/// <summary>
|
||||
/// e.g. "critDMG_"
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Stat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// e.g. 19.4
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
public double Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
72
Source/GrasscutterTools/GOOD/Character.cs
Normal file
72
Source/GrasscutterTools/GOOD/Character.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Grasscutter Tools
|
||||
* Copyright (C) 2022 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.GOOD
|
||||
{
|
||||
/// <summary>
|
||||
/// Character data representation
|
||||
/// Doc: https://frzyc.github.io/genshin-optimizer/#/doc
|
||||
/// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/game/Character.cs
|
||||
/// </summary>
|
||||
public class Character
|
||||
{
|
||||
/// <summary>
|
||||
/// e.g. "Rosaria"
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1-90 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("level")]
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0-6 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("constellation")]
|
||||
public int Constellation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0-6 inclusive. need to disambiguate 80/90 or 80/80
|
||||
/// </summary>
|
||||
[JsonProperty("ascension")]
|
||||
public int Ascension { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// does not include boost from constellations. 1-15 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("talent")]
|
||||
public Talents Talents { get; set; }
|
||||
}
|
||||
|
||||
public struct Talents
|
||||
{
|
||||
[JsonProperty("auto")]
|
||||
public int Auto { get; set; }
|
||||
|
||||
[JsonProperty("skill")]
|
||||
public int Skill { get; set; }
|
||||
|
||||
[JsonProperty("burst")]
|
||||
public int Burst { get; set; }
|
||||
}
|
||||
}
|
63
Source/GrasscutterTools/GOOD/GOOD.cs
Normal file
63
Source/GrasscutterTools/GOOD/GOOD.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Grasscutter Tools
|
||||
* Copyright (C) 2022 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 Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.GOOD
|
||||
{
|
||||
/// <summary>
|
||||
/// Genshin Open Object Description (GOOD)
|
||||
/// Doc: https://frzyc.github.io/genshin-optimizer/#/doc
|
||||
/// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/data/GOOD.cs
|
||||
///
|
||||
/// Available for
|
||||
/// https://frzyc.github.io/genshin-optimizer/
|
||||
/// https://github.com/Andrewthe13th/Inventory_Kamera
|
||||
/// https://genshin.aspirine.su/
|
||||
/// https://seelie.me/
|
||||
/// https://github.com/daydreaming666/Amenoma
|
||||
/// https://www.mona-uranai.com/
|
||||
/// https://genshin.mingyulab.com/
|
||||
/// https://genshin-center.com/
|
||||
/// </summary>
|
||||
public class GOOD
|
||||
{
|
||||
[JsonProperty("format")]
|
||||
public string Format { get; set; }
|
||||
|
||||
[JsonProperty("version")]
|
||||
public int Version { get; set; }
|
||||
|
||||
[JsonProperty("source")]
|
||||
public string Source { get; set; }
|
||||
|
||||
[JsonProperty("weapons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Weapon> Weapons { get; set; }
|
||||
|
||||
[JsonProperty("artifacts", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Artifact> Artifacts { get; set; }
|
||||
|
||||
[JsonProperty("characters", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<Character> Characters { get; set; }
|
||||
|
||||
[JsonProperty("materials", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Dictionary<string, int> Materials { get; set; }
|
||||
}
|
||||
}
|
107
Source/GrasscutterTools/GOOD/GOODData.cs
Normal file
107
Source/GrasscutterTools/GOOD/GOODData.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Grasscutter Tools
|
||||
* Copyright (C) 2022 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 System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using GrasscutterTools.Game;
|
||||
using GrasscutterTools.Properties;
|
||||
|
||||
namespace GrasscutterTools.GOOD
|
||||
{
|
||||
public static class GOODData
|
||||
{
|
||||
static GOODData()
|
||||
{
|
||||
var cultureInfo = CultureInfo.GetCultureInfo("en-US");
|
||||
var regex = new Regex(@"[\W]", RegexOptions.Compiled);
|
||||
|
||||
Dictionary<string, int> ToGOODMap(ItemMap itemMap)
|
||||
{
|
||||
var dic = new Dictionary<string, int>(itemMap.Count);
|
||||
for (int i = 0; i < itemMap.Count; i++)
|
||||
{
|
||||
var name = itemMap.Names[i];
|
||||
var pascalCase = cultureInfo.TextInfo.ToTitleCase(name);
|
||||
var nameGOOD = regex.Replace(pascalCase, string.Empty);
|
||||
dic.Add(nameGOOD, itemMap.Ids[i]);
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
var artifactCats = new ItemMap(Resources.ResourceManager.GetString("ArtifactCat", cultureInfo));
|
||||
var avatars = new ItemMap(Resources.ResourceManager.GetString("Avatar", cultureInfo));
|
||||
var weapons = new ItemMap(Resources.ResourceManager.GetString("Weapon", cultureInfo));
|
||||
|
||||
ArtifactCats = ToGOODMap(artifactCats);
|
||||
Avatars = ToGOODMap(avatars);
|
||||
Weapons = ToGOODMap(weapons);
|
||||
}
|
||||
|
||||
|
||||
public static Dictionary<string, int> ArtifactCats { get; private set; }
|
||||
|
||||
|
||||
public static Dictionary<string, string> ArtifactSlotMap = new Dictionary<string, string> {
|
||||
{"goblet", "1"}, {"plume", "2"}, {"circlet", "3"}, {"flower", "4"}, {"sands", "5"}
|
||||
};
|
||||
|
||||
public static Dictionary<string, int> ArtifactMainAttribution { get; } = new Dictionary<string, int>
|
||||
{
|
||||
{ "hp" , 10001 },
|
||||
{ "hp_" , 10002 },
|
||||
{ "atk" , 10003 },
|
||||
{ "atk_" , 10004 },
|
||||
{ "def" , 10005 },
|
||||
{ "def_" , 10006 },
|
||||
{ "enerRech_" , 10007 },
|
||||
{ "eleMas" , 10008 },
|
||||
{ "critRate_" , 13007 },
|
||||
{ "critDMG_" , 13008 },
|
||||
{ "heal_" , 13009 },
|
||||
{ "pyro_dmg_" , 15008 },
|
||||
{ "electro_dmg_" , 15009 },
|
||||
{ "cryo_dmg_" , 15010 },
|
||||
{ "hydro_dmg_" , 15011 },
|
||||
{ "anemo_dmg_" , 15012 },
|
||||
{ "geo_dmg_" , 15013 },
|
||||
{ "dendro_dmg_" , 15014 },
|
||||
{ "physical_dmg_", 15015 },
|
||||
};
|
||||
|
||||
public static Dictionary<string, int> ArtifactSubAttribution { get; } = new Dictionary<string, int>
|
||||
{
|
||||
{ "hp" , 102 },
|
||||
{ "hp_" , 103 },
|
||||
{ "atk" , 105 },
|
||||
{ "atk_" , 106 },
|
||||
{ "def" , 108 },
|
||||
{ "def_" , 109 },
|
||||
{ "critRate_", 120 },
|
||||
{ "critDMG_" , 122 },
|
||||
{ "enerRech_", 123 },
|
||||
{ "eleMas" , 124 },
|
||||
};
|
||||
|
||||
public static Dictionary<string, int> Avatars { get; private set; }
|
||||
|
||||
public static Dictionary<string, int> Weapons { get; private set; }
|
||||
|
||||
}
|
||||
}
|
68
Source/GrasscutterTools/GOOD/Weapon.cs
Normal file
68
Source/GrasscutterTools/GOOD/Weapon.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Grasscutter Tools
|
||||
* Copyright (C) 2022 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.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.GOOD
|
||||
{
|
||||
/// <summary>
|
||||
/// Weapon data representation
|
||||
/// Doc: https://frzyc.github.io/genshin-optimizer/#/doc
|
||||
/// Modified from https://github.com/Andrewthe13th/Inventory_Kamera/blob/master/InventoryKamera/game/Weapon.cs
|
||||
/// </summary>
|
||||
public class Weapon
|
||||
{
|
||||
/// <summary>
|
||||
/// e.g. "CrescentPike"
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1-90 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("level")]
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0-6 inclusive. need to disambiguate 80/90 or 80/80
|
||||
/// </summary>
|
||||
[JsonProperty("ascension")]
|
||||
public int AscensionLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1-5 inclusive
|
||||
/// </summary>
|
||||
[JsonProperty("refinement")]
|
||||
public int RefinementLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// where "" means not equipped.
|
||||
/// </summary>
|
||||
[JsonProperty("location")]
|
||||
[DefaultValue("")]
|
||||
public string EquippedCharacter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the weapon is locked in game.
|
||||
/// </summary>
|
||||
[JsonProperty("lock")]
|
||||
public bool Lock { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user