Implement import from GOOD dump

This commit is contained in:
Leo 2022-07-15 18:09:38 +01:00
parent ef4f06d6c3
commit 7e57154809
20 changed files with 6540 additions and 5420 deletions

View File

@ -35,6 +35,7 @@ namespace GrasscutterTools.Forms
this.GrpCommand = new System.Windows.Forms.GroupBox();
this.BtnInvokeOpenCommand = new System.Windows.Forms.Button();
this.TPRemoteCall = new System.Windows.Forms.TabPage();
this.ButtonOpenGOODImport = new System.Windows.Forms.Button();
this.LblHostTip = new System.Windows.Forms.Label();
this.GrpServerStatus = new System.Windows.Forms.GroupBox();
this.LnkOpenCommandLabel = new System.Windows.Forms.LinkLabel();
@ -70,7 +71,6 @@ namespace GrasscutterTools.Forms
this.DTPBanEndTime = new System.Windows.Forms.DateTimePicker();
this.BtnUnban = new System.Windows.Forms.Button();
this.BtnBan = new System.Windows.Forms.Button();
this.TxtBanReason = new GrasscutterTools.Controls.TextBoxXP();
this.NUDBanUID = new System.Windows.Forms.NumericUpDown();
this.LblBanUID = new System.Windows.Forms.Label();
this.GrpAccount = new System.Windows.Forms.GroupBox();
@ -221,6 +221,7 @@ namespace GrasscutterTools.Forms
this.ChkIncludeUID = new System.Windows.Forms.CheckBox();
this.LblDefaultUid = new System.Windows.Forms.Label();
this.TCMain = new System.Windows.Forms.TabControl();
this.TxtBanReason = new GrasscutterTools.Controls.TextBoxXP();
this.GrpCommand.SuspendLayout();
this.TPRemoteCall.SuspendLayout();
this.GrpServerStatus.SuspendLayout();
@ -317,16 +318,24 @@ namespace GrasscutterTools.Forms
//
// TPRemoteCall
//
resources.ApplyResources(this.TPRemoteCall, "TPRemoteCall");
this.TPRemoteCall.Controls.Add(this.ButtonOpenGOODImport);
this.TPRemoteCall.Controls.Add(this.LblHostTip);
this.TPRemoteCall.Controls.Add(this.GrpServerStatus);
this.TPRemoteCall.Controls.Add(this.GrpRemoteCommand);
this.TPRemoteCall.Controls.Add(this.TxtHost);
this.TPRemoteCall.Controls.Add(this.BtnQueryServerStatus);
this.TPRemoteCall.Controls.Add(this.LblHost);
resources.ApplyResources(this.TPRemoteCall, "TPRemoteCall");
this.TPRemoteCall.Name = "TPRemoteCall";
this.TPRemoteCall.UseVisualStyleBackColor = true;
//
// ButtonOpenGOODImport
//
resources.ApplyResources(this.ButtonOpenGOODImport, "ButtonOpenGOODImport");
this.ButtonOpenGOODImport.Name = "ButtonOpenGOODImport";
this.ButtonOpenGOODImport.UseVisualStyleBackColor = true;
this.ButtonOpenGOODImport.Click += new System.EventHandler(this.ButtonOpenGOODImport_Click);
//
// LblHostTip
//
resources.ApplyResources(this.LblHostTip, "LblHostTip");
@ -386,15 +395,14 @@ namespace GrasscutterTools.Forms
//
// TPOpenCommandCheck
//
resources.ApplyResources(this.TPOpenCommandCheck, "TPOpenCommandCheck");
this.TPOpenCommandCheck.Controls.Add(this.TPPlayerCheck);
this.TPOpenCommandCheck.Controls.Add(this.TPConsoleCheck);
resources.ApplyResources(this.TPOpenCommandCheck, "TPOpenCommandCheck");
this.TPOpenCommandCheck.Name = "TPOpenCommandCheck";
this.TPOpenCommandCheck.SelectedIndex = 0;
//
// TPPlayerCheck
//
resources.ApplyResources(this.TPPlayerCheck, "TPPlayerCheck");
this.TPPlayerCheck.Controls.Add(this.LnkRCHelp);
this.TPPlayerCheck.Controls.Add(this.NUDRemotePlayerId);
this.TPPlayerCheck.Controls.Add(this.BtnConnectOpenCommand);
@ -402,6 +410,7 @@ namespace GrasscutterTools.Forms
this.TPPlayerCheck.Controls.Add(this.BtnSendVerificationCode);
this.TPPlayerCheck.Controls.Add(this.NUDVerificationCode);
this.TPPlayerCheck.Controls.Add(this.LblRemotePlayerId);
resources.ApplyResources(this.TPPlayerCheck, "TPPlayerCheck");
this.TPPlayerCheck.Name = "TPPlayerCheck";
this.TPPlayerCheck.UseVisualStyleBackColor = true;
//
@ -473,11 +482,11 @@ namespace GrasscutterTools.Forms
//
// TPConsoleCheck
//
resources.ApplyResources(this.TPConsoleCheck, "TPConsoleCheck");
this.TPConsoleCheck.Controls.Add(this.BtnConsoleConnect);
this.TPConsoleCheck.Controls.Add(this.TxtToken);
this.TPConsoleCheck.Controls.Add(this.LblToken);
this.TPConsoleCheck.Controls.Add(this.LblConsoleTip);
resources.ApplyResources(this.TPConsoleCheck, "TPConsoleCheck");
this.TPConsoleCheck.Name = "TPConsoleCheck";
this.TPConsoleCheck.UseVisualStyleBackColor = true;
//
@ -522,10 +531,10 @@ namespace GrasscutterTools.Forms
//
// TPAbout
//
resources.ApplyResources(this.TPAbout, "TPAbout");
this.TPAbout.Controls.Add(this.GrasscutterToolsSupport);
this.TPAbout.Controls.Add(this.LnkGithub);
this.TPAbout.Controls.Add(this.LblSupportDescription);
resources.ApplyResources(this.TPAbout, "TPAbout");
this.TPAbout.Name = "TPAbout";
this.TPAbout.UseVisualStyleBackColor = true;
//
@ -550,10 +559,10 @@ namespace GrasscutterTools.Forms
//
// TPManage
//
resources.ApplyResources(this.TPManage, "TPManage");
this.TPManage.Controls.Add(this.GrpBanPlayer);
this.TPManage.Controls.Add(this.GrpAccount);
this.TPManage.Controls.Add(this.GrpPermission);
resources.ApplyResources(this.TPManage, "TPManage");
this.TPManage.Name = "TPManage";
this.TPManage.UseVisualStyleBackColor = true;
//
@ -571,8 +580,8 @@ namespace GrasscutterTools.Forms
//
// DTPBanEndTime
//
resources.ApplyResources(this.DTPBanEndTime, "DTPBanEndTime");
this.DTPBanEndTime.Format = System.Windows.Forms.DateTimePickerFormat.Short;
resources.ApplyResources(this.DTPBanEndTime, "DTPBanEndTime");
this.DTPBanEndTime.MaxDate = new System.DateTime(2034, 12, 31, 0, 0, 0, 0);
this.DTPBanEndTime.MinDate = new System.DateTime(2022, 6, 28, 0, 0, 0, 0);
this.DTPBanEndTime.Name = "DTPBanEndTime";
@ -592,14 +601,6 @@ namespace GrasscutterTools.Forms
this.BtnBan.UseVisualStyleBackColor = true;
this.BtnBan.Click += new System.EventHandler(this.BtnBan_Click);
//
// TxtBanReason
//
resources.ApplyResources(this.TxtBanReason, "TxtBanReason");
this.TxtBanReason.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.TxtBanReason.Maximum = 0F;
this.TxtBanReason.Minimum = 0F;
this.TxtBanReason.Name = "TxtBanReason";
//
// NUDBanUID
//
resources.ApplyResources(this.NUDBanUID, "NUDBanUID");
@ -693,10 +694,10 @@ namespace GrasscutterTools.Forms
//
// CmbPerm
//
resources.ApplyResources(this.CmbPerm, "CmbPerm");
this.CmbPerm.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CmbPerm.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CmbPerm.FormattingEnabled = true;
resources.ApplyResources(this.CmbPerm, "CmbPerm");
this.CmbPerm.Name = "CmbPerm";
//
// NUDPermUID
@ -742,7 +743,6 @@ namespace GrasscutterTools.Forms
//
// TPScene
//
resources.ApplyResources(this.TPScene, "TPScene");
this.TPScene.Controls.Add(this.TxtSceneFilter);
this.TPScene.Controls.Add(this.ChkIncludeSceneId);
this.TPScene.Controls.Add(this.LblTp);
@ -757,6 +757,7 @@ namespace GrasscutterTools.Forms
this.TPScene.Controls.Add(this.LblClimateType);
this.TPScene.Controls.Add(this.LblSceneDescription);
this.TPScene.Controls.Add(this.ListScenes);
resources.ApplyResources(this.TPScene, "TPScene");
this.TPScene.Name = "TPScene";
this.TPScene.UseVisualStyleBackColor = true;
//
@ -891,7 +892,6 @@ namespace GrasscutterTools.Forms
//
// TPItem
//
resources.ApplyResources(this.TPItem, "TPItem");
this.TPItem.Controls.Add(this.LblClearGiveItemLogs);
this.TPItem.Controls.Add(this.BtnSaveGiveItemLog);
this.TPItem.Controls.Add(this.BtnRemoveGiveItemLog);
@ -904,6 +904,7 @@ namespace GrasscutterTools.Forms
this.TPItem.Controls.Add(this.NUDGameItemAmout);
this.TPItem.Controls.Add(this.NUDGameItemLevel);
this.TPItem.Controls.Add(this.LblGiveCommandDescription);
resources.ApplyResources(this.TPItem, "TPItem");
this.TPItem.Name = "TPItem";
this.TPItem.UseVisualStyleBackColor = true;
//
@ -1021,7 +1022,6 @@ namespace GrasscutterTools.Forms
//
// TPWeapon
//
resources.ApplyResources(this.TPWeapon, "TPWeapon");
this.TPWeapon.Controls.Add(this.TxtWeaponFilter);
this.TPWeapon.Controls.Add(this.LblWeaponDescription);
this.TPWeapon.Controls.Add(this.LblWeaponRefinement);
@ -1031,6 +1031,7 @@ namespace GrasscutterTools.Forms
this.TPWeapon.Controls.Add(this.NUDWeaponAmout);
this.TPWeapon.Controls.Add(this.NUDWeaponLevel);
this.TPWeapon.Controls.Add(this.ListWeapons);
resources.ApplyResources(this.TPWeapon, "TPWeapon");
this.TPWeapon.Name = "TPWeapon";
this.TPWeapon.UseVisualStyleBackColor = true;
//
@ -1127,12 +1128,12 @@ namespace GrasscutterTools.Forms
//
// TPStats
//
resources.ApplyResources(this.TPStats, "TPStats");
this.TPStats.Controls.Add(this.LblResetStatsCommand);
this.TPStats.Controls.Add(this.LblResetStatsTip);
this.TPStats.Controls.Add(this.GrpSetStats);
this.TPStats.Controls.Add(this.GrpTalentLevel);
this.TPStats.Controls.Add(this.LblStatsDescription);
resources.ApplyResources(this.TPStats, "TPStats");
this.TPStats.Name = "TPStats";
this.TPStats.UseVisualStyleBackColor = true;
//
@ -1161,9 +1162,9 @@ namespace GrasscutterTools.Forms
//
// LblStatTip
//
resources.ApplyResources(this.LblStatTip, "LblStatTip");
this.LblStatTip.AutoEllipsis = true;
this.LblStatTip.ForeColor = System.Drawing.SystemColors.GrayText;
resources.ApplyResources(this.LblStatTip, "LblStatTip");
this.LblStatTip.Name = "LblStatTip";
//
// LblStatPercent
@ -1189,9 +1190,9 @@ namespace GrasscutterTools.Forms
//
// CmbStat
//
resources.ApplyResources(this.CmbStat, "CmbStat");
this.CmbStat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CmbStat.FormattingEnabled = true;
resources.ApplyResources(this.CmbStat, "CmbStat");
this.CmbStat.Name = "CmbStat";
this.CmbStat.SelectedIndexChanged += new System.EventHandler(this.SetStatsInputChanged);
//
@ -1251,7 +1252,6 @@ namespace GrasscutterTools.Forms
//
// TPAvatar
//
resources.ApplyResources(this.TPAvatar, "TPAvatar");
this.TPAvatar.Controls.Add(this.BtnGiveAllChar);
this.TPAvatar.Controls.Add(this.LblConstellationTip);
this.TPAvatar.Controls.Add(this.LblAvatarConstellation);
@ -1261,6 +1261,7 @@ namespace GrasscutterTools.Forms
this.TPAvatar.Controls.Add(this.LblAvatarLevel);
this.TPAvatar.Controls.Add(this.NUDAvatarLevel);
this.TPAvatar.Controls.Add(this.CmbAvatar);
resources.ApplyResources(this.TPAvatar, "TPAvatar");
this.TPAvatar.Name = "TPAvatar";
this.TPAvatar.UseVisualStyleBackColor = true;
//
@ -1346,7 +1347,6 @@ namespace GrasscutterTools.Forms
//
// TPSpawn
//
resources.ApplyResources(this.TPSpawn, "TPSpawn");
this.TPSpawn.Controls.Add(this.LblClearSpawnLogs);
this.TPSpawn.Controls.Add(this.BtnSaveSpawnLog);
this.TPSpawn.Controls.Add(this.BtnRemoveSpawnLog);
@ -1359,6 +1359,7 @@ namespace GrasscutterTools.Forms
this.TPSpawn.Controls.Add(this.NUDEntityLevel);
this.TPSpawn.Controls.Add(this.TxtEntityFilter);
this.TPSpawn.Controls.Add(this.ListEntity);
resources.ApplyResources(this.TPSpawn, "TPSpawn");
this.TPSpawn.Name = "TPSpawn";
this.TPSpawn.UseVisualStyleBackColor = true;
//
@ -1499,13 +1500,13 @@ namespace GrasscutterTools.Forms
//
// TPQuest
//
resources.ApplyResources(this.TPQuest, "TPQuest");
this.TPQuest.Controls.Add(this.GrpQuestFilters);
this.TPQuest.Controls.Add(this.BtnFinishQuest);
this.TPQuest.Controls.Add(this.BtnAddQuest);
this.TPQuest.Controls.Add(this.LblQuestDescription);
this.TPQuest.Controls.Add(this.TxtQuestFilter);
this.TPQuest.Controls.Add(this.ListQuest);
resources.ApplyResources(this.TPQuest, "TPQuest");
this.TPQuest.Name = "TPQuest";
this.TPQuest.UseVisualStyleBackColor = true;
//
@ -1577,7 +1578,6 @@ namespace GrasscutterTools.Forms
//
// TPArtifact
//
resources.ApplyResources(this.TPArtifact, "TPArtifact");
this.TPArtifact.Controls.Add(this.LblArtifactLevelTip);
this.TPArtifact.Controls.Add(this.BtnAddSubAttr);
this.TPArtifact.Controls.Add(this.LblArtifactName);
@ -1597,6 +1597,7 @@ namespace GrasscutterTools.Forms
this.TPArtifact.Controls.Add(this.NUDArtifactLevel);
this.TPArtifact.Controls.Add(this.LblArtifactStars);
this.TPArtifact.Controls.Add(this.NUDArtifactStars);
resources.ApplyResources(this.TPArtifact, "TPArtifact");
this.TPArtifact.Name = "TPArtifact";
this.TPArtifact.UseVisualStyleBackColor = true;
//
@ -1762,7 +1763,6 @@ namespace GrasscutterTools.Forms
//
// TPCustom
//
resources.ApplyResources(this.TPCustom, "TPCustom");
this.TPCustom.Controls.Add(this.BtnExportCustomCommands);
this.TPCustom.Controls.Add(this.BtnLoadCustomCommands);
this.TPCustom.Controls.Add(this.LblCustomName);
@ -1770,6 +1770,7 @@ namespace GrasscutterTools.Forms
this.TPCustom.Controls.Add(this.BtnRemoveCustomCommand);
this.TPCustom.Controls.Add(this.BtnSaveCustomCommand);
this.TPCustom.Controls.Add(this.TxtCustomName);
resources.ApplyResources(this.TPCustom, "TPCustom");
this.TPCustom.Name = "TPCustom";
this.TPCustom.UseVisualStyleBackColor = true;
//
@ -1833,12 +1834,12 @@ namespace GrasscutterTools.Forms
//
// TPHome
//
resources.ApplyResources(this.TPHome, "TPHome");
this.TPHome.Controls.Add(this.LblAbout);
this.TPHome.Controls.Add(this.BtnOpenTextMap);
this.TPHome.Controls.Add(this.BtnOpenGachaBannerEditor);
this.TPHome.Controls.Add(this.GrasscutterToolsIcon);
this.TPHome.Controls.Add(this.GrpSettings);
resources.ApplyResources(this.TPHome, "TPHome");
this.TPHome.Name = "TPHome";
this.TPHome.UseVisualStyleBackColor = true;
//
@ -1897,9 +1898,9 @@ namespace GrasscutterTools.Forms
//
// CmbLanguage
//
resources.ApplyResources(this.CmbLanguage, "CmbLanguage");
this.CmbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CmbLanguage.FormattingEnabled = true;
resources.ApplyResources(this.CmbLanguage, "CmbLanguage");
this.CmbLanguage.Name = "CmbLanguage";
this.CmbLanguage.SelectedIndexChanged += new System.EventHandler(this.CmbLanguage_SelectedIndexChanged);
//
@ -1953,6 +1954,14 @@ namespace GrasscutterTools.Forms
this.TCMain.Name = "TCMain";
this.TCMain.SelectedIndex = 0;
//
// TxtBanReason
//
this.TxtBanReason.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
resources.ApplyResources(this.TxtBanReason, "TxtBanReason");
this.TxtBanReason.Maximum = 0F;
this.TxtBanReason.Minimum = 0F;
this.TxtBanReason.Name = "TxtBanReason";
//
// FormMain
//
resources.ApplyResources(this, "$this");
@ -2244,5 +2253,6 @@ namespace GrasscutterTools.Forms
private System.Windows.Forms.Label LblConstellationTip;
private System.Windows.Forms.Button BtnGiveAllChar;
private System.Windows.Forms.Label LblHostTip;
private System.Windows.Forms.Button ButtonOpenGOODImport;
}
}

View File

@ -21,15 +21,18 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.Json;
using GrasscutterTools.DispatchServer;
using GrasscutterTools.Game;
using GrasscutterTools.OpenCommand;
using GrasscutterTools.Properties;
using GrasscutterTools.Utils;
namespace GrasscutterTools.Forms
{
@ -202,6 +205,127 @@ namespace GrasscutterTools.Forms
TextMapBrowser.TopMost = false;
}
}
async private void ButtonOpenGOODImport_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
DialogResult dr = MessageBox.Show(Resources.GOODImportText + openFileDialog1.FileName + "?",
Resources.GOODImportTitle, MessageBoxButtons.YesNo);
switch (dr)
{
case DialogResult.Yes:
break;
case DialogResult.No:
return;
}
var sr = new StreamReader(openFileDialog1.FileName);
var commands_list = new List<String>();
var doc = JsonDocument.Parse(sr.ReadToEnd());
JsonElement characters = doc.RootElement.GetProperty("characters");
foreach (JsonElement character in characters.EnumerateArray())
{
var character_name = character.GetProperty("key").GetString();
var character_level = character.GetProperty("level").GetInt32().ToString();
var character_constellation = character.GetProperty("constellation").GetInt32().ToString();
if (character_name != "Traveler")
{
var character_id = GameData.GOODAvatars[character_name]; // TODO: build separate GOOD-compatible database
commands_list.Add("/give " + character_id + " lv" + character_level + "c" + character_constellation);
// TODO: Implement command to set talent level when giving character in Grasscutter
}
}
JsonElement weapons = doc.RootElement.GetProperty("weapons");
foreach (JsonElement weapon in weapons.EnumerateArray())
{
var weapon_name = weapon.GetProperty("key").GetString();
var weapon_level = weapon.GetProperty("level").GetInt32().ToString();
var weapon_refinement = weapon.GetProperty("refinement").GetInt32().ToString();
var weapon_id = GameData.GOODWeapons[weapon_name];
commands_list.Add("/give " + weapon_id + " lv" + weapon_level + "r" + weapon_refinement);
// TODO: Implement command to give weapon directly to character in Grasscutter
}
JsonElement artifacts = doc.RootElement.GetProperty("artifacts");
foreach (JsonElement artifact in artifacts.EnumerateArray())
{
var artifact_set = artifact.GetProperty("setKey").GetString();
var artifact_slot = artifact.GetProperty("slotKey").GetString();
var artifact_rarity = artifact.GetProperty("rarity").GetInt32();
var artifact_level = artifact.GetProperty("level").GetInt32().ToString();
var artifact_mainStat = artifact.GetProperty("mainStatKey").GetString();
var artifact_slot_map = new Dictionary<string, string> {
{"goblet", "1"}, {"plume", "2"}, {"circlet", "3"}, {"flower", "4"}, {"sands", "5"}
};
// Format: set rarity slot
var artifact_id = GameData.GOODArtifactCats[artifact_set].ToString() + artifact_rarity.ToString() + artifact_slot_map[artifact_slot] + "4";
var artifact_mainStat_id = GameData.GOODArtifactMainAttribution[artifact_mainStat];
var artifact_substats = "";
var artifact_substat_prefix = artifact_rarity + "0";
int substat_count = 0;
foreach (JsonElement substat in artifact.GetProperty("substats").EnumerateArray())
{
var substat_value = substat.GetProperty("value").GetDouble();
if (substat_value == 0)
continue;
substat_count++;
var substat_key = substat.GetProperty("key").GetString();
var substat_key_id = GameData.GOODArtifactSubAttribution[substat_key];
var substat_indices = ArtifactUtils.SplitSubstats(substat_key, artifact_rarity, substat_value);
foreach(int index in substat_indices)
{
artifact_substats += artifact_substat_prefix + substat_key_id + index.ToString() + " ";
}
}
// HACK: Add def+2 substat to counteract Grasscutter automatically adding another substat
if (substat_count == 4)
{
artifact_substats += "101081 ";
}
commands_list.Add("/give " + artifact_id + " lv" + artifact_level + " " + artifact_mainStat_id + " " + artifact_substats);
// TODO: Implement command to give artifact directly to character in Grasscutter
}
ExpandCommandRunLog();
foreach (string command in commands_list)
{
TxtCommandRunLog.AppendText(">");
TxtCommandRunLog.AppendText(command);
TxtCommandRunLog.AppendText(Environment.NewLine);
try
{
var msg = await OC.Invoke(command.Substring(1));
TxtCommandRunLog.AppendText(string.IsNullOrEmpty(msg) ? "OK" : msg);
TxtCommandRunLog.AppendText(Environment.NewLine);
}
catch (Exception ex)
{
TxtCommandRunLog.AppendText("Error: ");
TxtCommandRunLog.AppendText(ex.Message);
TxtCommandRunLog.AppendText(Environment.NewLine);
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
}
TxtCommandRunLog.ScrollToCaret();
}
MessageBox.Show(Resources.GOODImportSuccess);
}
catch (SecurityException ex)
{
MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
$"Details:\n\n{ex.StackTrace}");
}
}
}
private void CmbLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
@ -1332,6 +1456,7 @@ namespace GrasscutterTools.Forms
GrpRemoteCommand.Enabled = false;
BtnInvokeOpenCommand.Focus();
ShowTip(Resources.ConnectedTip, BtnInvokeOpenCommand);
ButtonOpenGOODImport.Enabled = true;
}
catch (Exception ex)
{
@ -1412,6 +1537,5 @@ namespace GrasscutterTools.Forms
}
#endregion - -
}
}

View File

@ -856,4 +856,7 @@ Therefore, the quest can be added and finished, but not necessarily work.</value
<data name="ChkIncludeUID.Text" xml:space="preserve">
<value>Include UID</value>
</data>
<data name="ButtonOpenGOODImport.Text" xml:space="preserve">
<value>Import GOOD</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@ -218,7 +218,7 @@
<value>Подключить</value>
</data>
<data name="LblConsoleTip.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt, style=Italic</value>
<value>Microsoft YaHei, 8pt, style=Italic</value>
</data>
<data name="LblConsoleTip.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 34</value>
@ -397,7 +397,7 @@
<value>False</value>
</data>
<data name="LblTp.Font" type="System.Drawing.Font, System.Drawing">
<value>微软雅黑, 8pt</value>
<value>Microsoft YaHei, 8pt</value>
</data>
<data name="LblTp.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 89</value>
@ -980,4 +980,7 @@
<data name="$this.Text" xml:space="preserve">
<value>GrasscutterTools - перевод Юрий Дворецкий</value>
</data>
<data name="ButtonOpenGOODImport.Text" xml:space="preserve">
<value>импорт GOOD</value>
</data>
</root>

View File

@ -406,4 +406,7 @@
<data name="TPHome.Text" xml:space="preserve">
<value>主頁</value>
</data>
<data name="ButtonOpenGOODImport.Text" xml:space="preserve">
<value>導入GOOD檔案</value>
</data>
</root>

View File

@ -39,6 +39,12 @@ namespace GrasscutterTools.Game
WeaponColors = new ItemMap(Resources.WeaponColor);
GachaBannerPrefabs = new ItemMap(Resources.GachaBennerPrefab);
Quests = new ItemMap(Resources.Quest);
GOODArtifactCats = new ItemMap(Resources.GOODArtifactCat);
GOODArtifactMainAttribution = new ItemMap(Resources.GOODArtifactMainAttribution);
GOODArtifactSubAttribution = new ItemMap(Resources.GOODArtifactSubAttribution);
GOODAvatars = new ItemMap(Resources.GOODAvatar);
GOODWeapons = new ItemMap(Resources.GOODWeapon);
}
public static ItemMap Animals { get; private set; }
@ -70,5 +76,10 @@ namespace GrasscutterTools.Game
public static ItemMap GachaBannerPrefabs { get; private set; }
public static ItemMap Quests { get; private set; }
public static ItemMap GOODArtifactCats { get; private set; }
public static ItemMap GOODArtifactMainAttribution { get; private set; }
public static ItemMap GOODArtifactSubAttribution { get; private set; }
public static ItemMap GOODAvatars { get; private set; }
public static ItemMap GOODWeapons { get; private set; }
}
}

View File

@ -26,8 +26,8 @@ namespace GrasscutterTools.Game
{
var lines = idNamePairs.Split('\n');
var capacity = lines.Length;
//IdMap = new Dictionary<int, string>(capacity);
//NameMap = new Dictionary<string, int>(capacity);
IdMap = new Dictionary<int, string>(capacity);
NameMap = new Dictionary<string, int>(capacity);
var IdList = new List<int>(capacity);
var NameList = new List<string>(capacity);
var lineList = new List<string>(capacity);
@ -40,8 +40,8 @@ namespace GrasscutterTools.Game
var name = line.Substring(si + 1).Trim();
if (!string.IsNullOrEmpty(name))
{
//IdMap[id] = name;
//NameMap[name] = id;
IdMap[id] = name;
NameMap[name.Replace(" ", "").Replace("'", "").Replace("\"", "")] = id;
IdList.Add(id);
NameList.Add(name);
lineList.Add(line);
@ -54,16 +54,16 @@ namespace GrasscutterTools.Game
Lines = lineList.ToArray();
}
//Dictionary<int, string> IdMap;
//Dictionary<string, int> NameMap;
Dictionary<int, string> IdMap;
Dictionary<string, int> NameMap;
//List<int> IdList;
//List<string> NameList;
public int Count => Ids.Length;
//public string this[int id] => IdMap[id];
public string this[int id] => IdMap[id];
//public int this[string name] => NameMap[name];
public int this[string name] => NameMap[name];
public int[] Ids { get; }

View File

@ -63,6 +63,7 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
@ -119,6 +120,7 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" />
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
@ -175,6 +177,7 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.Json, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" />
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
<Private>True</Private>
@ -243,6 +246,7 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Utils\ArtifactUtils.cs" />
<Compile Include="Utils\HttpHelper.cs" />
<EmbeddedResource Include="Forms\FormGachaBannerEditor2.en-us.resx">
<DependentUpon>FormGachaBannerEditor2.cs</DependentUpon>
@ -349,6 +353,12 @@
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
<Content Include="Resources\GOODArtifactCat.txt" />
<Content Include="Resources\GOODArtifactMainAttribution.txt" />
<Content Include="Resources\GOODArtifactSubAttribution - Copy.txt" />
<Content Include="Resources\GOODArtifactSubAttribution.txt" />
<Content Include="Resources\GOODAvatar.txt" />
<Content Include="Resources\GOODWeapon.txt" />
<Content Include="Resources\en-us\Animal.txt" />
<Content Include="Resources\en-us\Artifact.txt" />
<Content Include="Resources\en-us\ArtifactCat.txt" />

File diff suppressed because it is too large Load Diff

View File

@ -255,4 +255,14 @@ Do you want to check for updates? Selecting No will no longer remind you of this
<data name="WeaponColor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WeaponColor.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODImportText" xml:space="preserve">
<value>Do you wish to import </value>
</data>
<data name="GOODImportTitle" xml:space="preserve">
<value>Import GOOD dump file</value>
</data>
<data name="GOODImportSuccess" xml:space="preserve">
<value>Import success!</value>
</data>
</root>

View File

@ -184,6 +184,9 @@
<data name="GachaBennerPrefab" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\zh-cn\GachaBennerPrefab.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="SettingSaveError" xml:space="preserve">
<value>保存设置时异常:</value>
</data>
<data name="Help" xml:space="preserve">
<value>帮助</value>
</data>
@ -264,4 +267,29 @@
<data name="WeaponColor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WeaponColor.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODArtifactCat" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GOODArtifactCat.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODArtifactMainAttribution" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GOODArtifactMainAttribution.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODArtifactSubAttribution" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GOODArtifactSubAttribution.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODAvatar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GOODAvatar.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODWeapon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\GOODWeapon.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODImportText" xml:space="preserve">
<value>是否导入 </value>
</data>
<data name="GOODImportTitle" xml:space="preserve">
<value>导入GOOD档案</value>
</data>
<data name="GOODImportSuccess" xml:space="preserve">
<value>导入成功!</value>
</data>
</root>

View File

@ -252,4 +252,13 @@
<data name="WeaponColor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WeaponColor.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="GOODImportText" xml:space="preserve">
<value>是否導入 </value>
</data>
<data name="GOODImportTitle" xml:space="preserve">
<value>導入GOOD檔案</value>
</data>
<data name="GOODImportSuccess" xml:space="preserve">
<value>導入成功!</value>
</data>
</root>

View File

@ -0,0 +1,42 @@
51: ResolutionOfSojourner
52: BraveHeart
53: DefendersWill
54: TinyMiracle
55: Berserker
56: MartialArtist
57: Instructor
58: Gambler
59: TheExile
60: Adventurer
61: LuckyDog
62: Scholar
63: TravelingDoctor
71: BlizzardStrayer
72: Thundersoother
73: Lavawalker
74: MaidenBeloved
75: GladiatorsFinale
76: ViridescentVenerer
77: WanderersTroupe
78: GlacierAndSnowfield
79: ThunderingFury
80: CrimsonWitchOfFlames
81: NoblesseOblige
82: BloodstainedChivalry
83: PrayersForIllumination
84: PrayersForDestiny
85: PrayersForWisdom
86: PrayersToTheFirmament
87: PrayersToSpringtime
88: ArchaicPetra
89: RetracingBolide
90: HeartOfDepth
91: TenacityOfTheMillelith
92: PaleFlame
93: ShimenawasReminiscence
94: EmblemOfSeveredFate
95: HuskOfOpulentDreams
96: OceanHuedClam
97: VermillionHereafter
98: EchoesOfAnOffering
99: LordOfTheWinds

View File

@ -0,0 +1,19 @@
10001: hp
10002: hp_
10003: atk
10004: atk_
10005: def
10006: def_
10007: enerRech_
10008: eleMas
13007: critRate_
13008: critDMG_
13009: heal_
15008: pyro_dmg_
15009: electro_dmg_
15010: cryo_dmg_
15011: hydro_dmg_
15012: anemo_dmg_
15013: geo_dmg_
15014: dendro_dmg_
15015: physical_dmg_

View File

@ -0,0 +1,170 @@
101021: HP+24
101022: HP+30
201021: HP+50
201022: HP+61
201023: HP+72
301021: HP+100
301022: HP+115
301023: HP+129
301024: HP+143
401021: HP+167
401022: HP+191
401023: HP+215
401024: HP+239
501021: HP+209
501022: HP+239
501023: HP+269
501024: HP+299
101031: hp_+1.2%
101032: hp_+1.5%
201031: hp_+1.6%
201032: hp_+2.0%
201033: hp_+2.3%
301031: hp_+2.4%
301032: hp_+2.8%
301033: hp_+3.2%
301034: hp_+3.5%
401031: hp_+3.3%
401032: hp_+3.7%
401033: hp_+4.2%
401034: hp_+4.7%
501031: hp_+4.1%
501032: hp_+4.7%
501033: hp_+5.2%
501034: hp_+5.8%
101051: ATK+2
101052: ATK+2
201051: ATK+3
201052: ATK+4
201053: ATK+5
301051: ATK+7
301052: ATK+7
301053: ATK+8
301054: ATK+9
401051: ATK+11
401052: ATK+12
401053: ATK+14
401054: ATK+16
501051: ATK+14
501052: ATK+16
501053: ATK+18
501054: ATK+19
101061: atk_+1.2%
101062: atk_+1.5%
201061: atk_+1.6%
201062: atk_+2.0%
201063: atk_+2.3%
301061: atk_+2.4%
301062: atk_+2.8%
301063: atk_+3.2%
301064: atk_+3.5%
401061: atk_+3.3%
401062: atk_+3.7%
401063: atk_+4.2%
401064: atk_+4.7%
501061: atk_+4.1%
501062: atk_+4.7%
501063: atk_+5.2%
501064: atk_+5.8%
101081: DEF+2
101082: DEF+2
201081: DEF+4
201082: DEF+5
201083: DEF+6
301081: DEF+8
301082: DEF+9
301083: DEF+10
301084: DEF+11
401081: DEF+13
401082: DEF+15
401083: DEF+17
401084: DEF+19
501081: DEF+16
501082: DEF+19
501083: DEF+21
501084: DEF+23
101091: def_+1.5%
101092: def_+1.8%
201091: def_+2.0%
201092: def_+2.5%
201093: def_+2.9%
301091: def_+3.1%
301092: def_+3.5%
301093: def_+3.9%
301094: def_+4.4%
401091: def_+4.1%
401092: def_+4.7%
401093: def_+5.2%
401094: def_+5.8%
501091: def_+5.1%
501092: def_+5.8%
501093: def_+6.6%
501094: def_+7.3%
101231: enerRech_+1.3%
101232: enerRech_+1.6%
201231: enerRech_+1.8%
201232: enerRech_+2.2%
201233: enerRech_+2.6%
301231: enerRech_+2.7%
301232: enerRech_+3.1%
301233: enerRech_+3.5%
301234: enerRech_+3.9%
401231: enerRech_+3.6%
401232: enerRech_+4.1%
401233: enerRech_+4.7%
401234: enerRech_+5.2%
501231: enerRech_+4.5%
501232: enerRech_+5.2%
501233: enerRech_+5.8%
501234: enerRech_+6.5%
101241: Elemental Mastery+5
101242: Elemental Mastery+6
201241: Elemental Mastery+7
201242: Elemental Mastery+8
201243: Elemental Mastery+9
301241: Elemental Mastery+10
301242: Elemental Mastery+11
301243: Elemental Mastery+13
301244: Elemental Mastery+14
401241: Elemental Mastery+13
401242: Elemental Mastery+15
401243: Elemental Mastery+17
401244: Elemental Mastery+19
501241: Elemental Mastery+16
501242: Elemental Mastery+19
501243: Elemental Mastery+21
501244: Elemental Mastery+23
101201: CRIT Rate+0.8%
101202: CRIT Rate+1.0%
201201: CRIT Rate+1.1%
201202: CRIT Rate+1.3%
201203: CRIT Rate+1.5%
301201: CRIT Rate+1.6%
301202: CRIT Rate+1.9%
301203: CRIT Rate+2.1%
301204: CRIT Rate+2.3%
401201: CRIT Rate+2.2%
401202: CRIT Rate+2.5%
401203: CRIT Rate+2.8%
401204: CRIT Rate+3.1%
501201: CRIT Rate+2.7%
501202: CRIT Rate+3.1%
501203: CRIT Rate+3.5%
501204: CRIT Rate+3.9%
101221: CRIT DMG+1.5%
101222: CRIT DMG+1.9%
201221: CRIT DMG+2.2%
201222: CRIT DMG+2.6%
201223: CRIT DMG+3.1%
301221: CRIT DMG+3.3%
301222: CRIT DMG+3.7%
301223: CRIT DMG+4.2%
301224: CRIT DMG+4.7%
401221: CRIT DMG+4.3%
401222: CRIT DMG+5.0%
401223: CRIT DMG+5.6%
401224: CRIT DMG+6.2%
501221: CRIT DMG+5.4%
501222: CRIT DMG+6.2%
501223: CRIT DMG+7.0%
501224: CRIT DMG+7.8%

View File

@ -0,0 +1,10 @@
102: hp
103: hp_
105: atk
106: atk_
108: def
109: def_
120: critRate_
122: critDMG_
123: enerRech_
124: eleMas

View File

@ -0,0 +1,54 @@
1002: KamisatoAyaka
1003: Jean
1005: Aether
1006: Lisa
1007: Lumine
1014: Barbara
1015: Kaeya
1016: Diluc
1020: Razor
1021: Amber
1022: Venti
1023: Xiangling
1024: Beidou
1025: Xingqiu
1026: Xiao
1027: Ningguang
1029: Klee
1030: Zhongli
1031: Fischl
1032: Bennett
1033: Tartaglia
1034: Noelle
1035: Qiqi
1036: Chongyun
1037: Ganyu
1038: Albedo
1039: Diona
1041: Mona
1042: Keqing
1043: Sucrose
1044: Xinyan
1045: Rosaria
1046: Hu Tao
1047: KaedeharaKazuha
1048: Yanfei
1049: Yoimiya
1050: Thoma
1051: Eula
1052: RaidenShogun
1053: Sayu
1054: SangonomiyaKokomi
1055: Gorou
1056: Kujou Sara
1057: Arataki Itto
1058: Yae Miko
1060: Yelan
1062: Aloy
1063: Shenhe
1064: YunJin
1065: KukiShinobu
1066: KamisatoAyato
1067: Collei
1068: Dori
1069: Tighnari

View File

@ -0,0 +1,146 @@
11101: DullBlade
11201: SilverSword
11301: CoolSteel
11302: HarbingerOf Dawn
11303: TravelersHandySword
11304: DarkIronSword
11305: FilletBlade
11306: SkyriderSword
11401: FavoniusSword
11402: TheFlute
11403: SacrificialSword
11404: RoyalLongsword
11405: LionsRoar
11406: PrototypeRancour
11407: IronSting
11408: BlackcliffLongsword
11409: TheBlackSword
11410: TheAlleyFlash
11412: SwordOfDescension
11413: FesteringDesire
11414: AmenomaKageuchi
11415: CinnabarSpindle
11501: AquilaFavonia
11502: SkywardBlade
11503: FreedomSworn
11504: SummitShaper
11505: PrimordialJadeCutter
11507: OneSide
11509: MistsplitterReforged
11510: HaranGeppakuFutsu
12101: WasterGreatsword
12201: OldMercsPal
12301: FerrousShadow
12302: BloodtaintedGreatsword
12303: WhiteIronGreatsword
12304: Quartz
12305: DebateClub
12306: SkyriderGreatsword
12401: FavoniusGreatsword
12402: TheBell
12403: SacrificialGreatsword
12404: RoyalGreatsword
12405: Rainslasher
12406: PrototypeArchaic
12407: Whiteblind
12408: BlackcliffSlasher
12409: SerpentSpine
12410: LithicBlade
12411: SnowTombedStarsilver
12412: LuxuriousSeaLord
12414: KatsuragikiriNagamasa
12416: Akuoumaru
12501: SkywardPride
12502: WolfsGravestone
12503: SongOfBrokenPines
12504: TheUnforged
12505: PrimordialJadeGreatsword
12506: TheOtherSide
12510: RedhornStonethresher
13101: BeginnersProtector
13201: IronPoint
13301: WhiteTassel
13302: Halberd
13303: BlackTassel
13304: TheFlagstaff
13401: DragonsBane
13402: PrototypeStarglitter
13403: CrescentPike
13404: BlackcliffPole
13405: Deathmatch
13406: LithicSpear
13407: FavoniusLance
13408: RoyalSpear
13409: DragonspineSpear
13414: KitainCrossSpear
13415: TheCatch
13416: WavebreakersFin
13501: StaffofHoma
13502: SkywardSpine
13504: VortexVanquisher
13505: PrimordialJadeWingedSpear
13506: Deicide
13507: CalamityQueller
13509: EngulfingLightning
14101: ApprenticesNotes
14201: PocketGrimoire
14301: MagicGuide
14302: ThrillingTalesOfDragonSlayers
14303: OtherworldlyStory
14304: EmeraldOrb
14305: TwinNephrite
14306: AmberBead
14401: FavoniusCodex
14402: TheWidsith
14403: SacrificialFragments
14404: RoyalGrimoire
14405: SolarPearl
14406: PrototypeAmber
14407: MappaMare
14408: BlackcliffAgate
14409: EyeOfPerception
14410: WineAndSong
14412: Frostbearer
14413: DodocoTales
14414: HakushinRing
14415: OathswornEye
14501: SkywardAtlas
14502: LostPrayerToTheSacredWinds
14503: LostBallade
14504: MemoryOfDust
14505: PrimordialJadeRegalia
14506: EverlastingMoonglow
14509: KagurasVerity
15101: HuntersBow
15201: SeasonedHuntersBow
15301: RavenBow
15302: SharpshootersOath
15303: RecurveBow
15304: Slingshot
15305: Messenger
15306: EbonyBow
15401: FavoniusWarbow
15402: TheStringless
15403: SacrificialBow
15404: RoyalBow
15405: Rust
15406: PrototypeCrescent
15407: CompoundBow
15408: BlackcliffWarbow
15409: TheViridescentHunt
15410: AlleyHunter
15411: FadingTwilight
15412: MitternachtsWaltz
15413: WindblumeOde
15414: Hamayumi
15415: Predator
15416: MouunsMoon
15501: SkywardHarp
15502: AmosBow
15503: ElegyForTheEnd
15504: KunwusWyrmbane
15505: PrimordialJadeVista
15506: MirrorBreaker
15507: PolarStar
15508: AquaSimulacra
15509: ThunderingPulse

View File

@ -0,0 +1,224 @@
/**
* 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GrasscutterTools.Utils
{
class SubstatSumEquality : IEqualityComparer<List<KeyValuePair<int, double>>>
{
public bool Equals(List<KeyValuePair<int, double>> left, List<KeyValuePair<int, double>> right)
{
if (sum_substat(left) == sum_substat(right))
return true;
else
return false;
}
public int GetHashCode(List<KeyValuePair<int, double>> dict)
{
return sum_substat(dict).GetHashCode();
}
public static double sum_substat(List<KeyValuePair<int, double>> dict)
{
double sum = 0;
foreach (KeyValuePair<int, double> kvp in dict)
{
sum += kvp.Value;
}
return sum;
}
}
class ArtifactUtils
{
public static Dictionary<string, double[][]> substats_rolls = new Dictionary<string, double[][]>
{
{
"hp",
new double[][] {
new double[] {23.9, 29.88},
new double[] {50.19, 60.95, 71.7},
new double[] {100.38, 114.72, 129.06, 143.4},
new double[] {167.3, 191.2, 215.1, 239},
new double[] {209.13, 239, 268.88, 298.75}
}
},
{
"hp_",
new double[][] {
new double[] {1.17, 1.46},
new double[] {1.63, 1.98, 2.33},
new double[] {2.45, 2.8, 3.15, 3.5},
new double[] {3.26, 3.73, 4.2, 4.66},
new double[] {4.08, 4.66, 5.25, 5.83}
}
},
{
"atk",
new double[][] {
new double[] {1.56, 1.95},
new double[] {3.27, 3.97, 4.67},
new double[] {6.54, 7.47, 8.4, 9.34},
new double[] {10.89, 12.45, 14, 15.56},
new double[] {13.62, 15.56, 17.51, 19.45 }
}
},
{
"atk_",
new double[][] {
new double[] {1.17, 1.46},
new double[] {1.63, 1.98, 2.33},
new double[] {2.45, 2.8, 3.15, 3.5},
new double[] {3.26, 3.73, 4.2, 4.66},
new double[] {4.08, 4.66, 5.25, 5.83}
}
},
{
"def",
new double[][] {
new double[] {1.85, 2.31},
new double[] {3.89, 4.72, 5.56},
new double[] {10, 11.11, 7.78, 8.89},
new double[] {12.96, 14.82, 16.67, 18.52},
new double[] {16.2, 18.52, 20.83, 23.15}
}
},
{
"def_",
new double[][] {
new double[] {1.46, 1.82},
new double[] {2.04, 2.48, 2.91},
new double[] {3.06, 3.5, 3.93, 4.37},
new double[] {4.08, 4.66, 5.25, 5.83},
new double[] {5.1, 5.83, 6.56, 7.29}
}
},
{
"critRate_",
new double[][] {
new double[] {.78, .97},
new double[] {1.09, 1.32, 1.55},
new double[] {1.63, 1.86, 2.1, 2.33},
new double[] {2.18, 2.49, 2.8, 3.11},
new double[] {2.72, 3.11, 3.5, 3.89}
}
},
{
"critDMG_",
new double[][] {
new double[] {1.55, 1.94},
new double[] {2.18, 2.64, 3.11},
new double[] {3.26, 3.73, 4.2, 4.66},
new double[] {4.35, 4.97, 5.6, 6.22},
new double[] {5.44, 6.22, 6.99, 7.77}
}
},
{
"eleMas",
new double[][] {
new double[] {4.66, 5.83},
new double[] {6.53, 7.93, 9.33},
new double[] {11.19, 12.59, 13.99, 9.79},
new double[] {13.06, 14.92, 16.79, 18.65},
new double[] {16.32, 18.65, 20.98, 23.31}
}
},
{
"enerRech_",
new double[][] {
new double[] {1.3, 1.62},
new double[] {1.81, 2.2, 2.59},
new double[] {2.72, 3.11, 3.5, 3.89},
new double[] {3.63, 4.14, 4.66, 5.18},
new double[] {4.53, 5.18, 5.83, 6.48}
}
}
};
// ArtifactSub -> Rarity -> Stat value -> Stat index list
public static Dictionary<string, Dictionary<int, List<KeyValuePair<double, int[]>>>> substats_dict;
public static int[] SplitSubstats(string type, int rarity, double value)
{
if (!substats_initiated)
{
InitSubstats();
substats_initiated = true;
}
double last_stat_diff = 99999;
int[] last_stat_list = { 4, 4, 4, 4, 4, 4 };
foreach (KeyValuePair<double, int[]> value_to_list in substats_dict[type][rarity])
{
if (Math.Abs(value - value_to_list.Key) >= last_stat_diff)
{
return last_stat_list;
}
last_stat_diff = value - value_to_list.Key;
last_stat_list = value_to_list.Value;
}
// Default, should never happen
return last_stat_list;
}
private static void InitSubstats()
{
substats_dict = new Dictionary<string, Dictionary<int, List<KeyValuePair<double, int[]>>>>();
foreach (KeyValuePair<string, double[][]> stat_block_info in substats_rolls)
{
string stat_name = stat_block_info.Key;
substats_dict[stat_name] = new Dictionary<int, List<KeyValuePair<double, int[]>>>();
for (int rarity_index = 0; rarity_index < stat_block_info.Value.Length; rarity_index++)
{
var substat_options = new List<KeyValuePair<int, double>>();
// Substat index == 0 means no substat upgrade
substat_options.Add(new KeyValuePair<int, double>(0, 0));
for (int substat_index = 0; substat_index < substats_rolls[stat_name][rarity_index].Length; substat_index++)
{
substat_options.Add(new KeyValuePair<int, double>(substat_index+1, substats_rolls[stat_name][rarity_index][substat_index]));
}
var substat_sum_data = (from s1 in substat_options from s2 in substat_options from s3 in substat_options from s4 in substat_options from s5 in substat_options from s6 in substat_options select new { s1, s2, s3, s4, s5, s6 })
.Select(x => new List<KeyValuePair<int, double>> { x.s1, x.s2, x.s3, x.s4, x.s5, x.s6 })
.Distinct(new SubstatSumEquality());
var stats_map = new List<KeyValuePair<double, int[]>>();
foreach (List<KeyValuePair<int, double>> val in substat_sum_data.ToArray().OrderBy(list => SubstatSumEquality.sum_substat(list)))
{
var index_list = new List<int>();
foreach (KeyValuePair<int, double> pair in val)
{
if (pair.Key != 0)
index_list.Add(pair.Key);
}
stats_map.Add(new KeyValuePair<double, int[]>(SubstatSumEquality.sum_substat(val), index_list.ToArray()));
}
substats_dict[stat_name][rarity_index + 1] = stats_map;
}
}
}
private static bool substats_initiated = false;
}
}