mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-10-22 20:09:46 +08:00
Compare commits
18 Commits
v0.10.0-M2
...
v1.0.0
Author | SHA1 | Date | |
---|---|---|---|
8eca0a728b | |||
2a3ba29b1d | |||
3defcbbdc1 | |||
e471253b12 | |||
0a0d33ae4a | |||
fb17ebe60b | |||
2f161a5586 | |||
d82b5b590e | |||
a36c376fc0 | |||
c4c543b0d4 | |||
182f71d4ca | |||
0b7347e118 | |||
e30a2f79cf | |||
94a8a490b3 | |||
68c42b16dd | |||
c089b7ac07 | |||
da7033395b | |||
![]() |
3264ed8de6 |
17
README.md
17
README.md
@@ -6,6 +6,10 @@
|
||||
|
||||
请从 [Releases](https://github.com/jie65535/GrasscutterCommandGenerator/releases) 中获取最新版本
|
||||
|
||||
## 远程执行
|
||||
|
||||
服务端需要 [gc-opencommand-plugin](https://github.com/jie65535/gc-opencommand-plugin) 插件支持
|
||||
|
||||
---
|
||||
|
||||
## TODO List
|
||||
@@ -16,25 +20,18 @@
|
||||
- [ ] ArtifactMainAttribution.txt
|
||||
- [ ] ArtifactSubAttribution.txt
|
||||
- [x] Avatar.txt
|
||||
- [ ] CustomCommands.txt
|
||||
- [x] CustomCommands.txt
|
||||
- [x] Item.txt
|
||||
- [x] Monster.txt
|
||||
- [ ] NPC.txt
|
||||
- [ ] Ornament.txt
|
||||
- [x] Scene.txt
|
||||
- [ ] Weapon.txt
|
||||
- [ ] 远程执行命令(进度:新建文件夹)
|
||||
- [x] 远程执行命令
|
||||
- [ ] 割草机启动器(无进度)
|
||||
- [ ] 邮件编辑器(无进度)
|
||||
- [ ] 商店编辑器(无进度)
|
||||
|
||||
## v0.10.0 未发布
|
||||
- 新增`文本资源浏览器`,可使用**正则**搜索文本映射文件
|
||||

|
||||
- `主页` 页面新增 `语言` 下拉框,可选择简体中文和英语。
|
||||
- `生成` 页面新增 `摆件` ID分类。
|
||||
|
||||
|
||||
## 软件截图
|
||||
|
||||

|
||||
@@ -61,4 +58,4 @@
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
@@ -6,6 +6,10 @@
|
||||
|
||||
Please download the latest version from [Releases](https://github.com/jie65535/GrasscutterCommandGenerator/releases)
|
||||
|
||||
## Remote command
|
||||
|
||||
The server require [gc-opencommand-plugin](https://github.com/jie65535/gc-opencommand-plugin) support
|
||||
|
||||
---
|
||||
|
||||
## TODO List
|
||||
@@ -16,22 +20,18 @@ Please download the latest version from [Releases](https://github.com/jie65535/G
|
||||
- [ ] ArtifactMainAttribution.txt
|
||||
- [ ] ArtifactSubAttribution.txt
|
||||
- [x] Avatar.txt
|
||||
- [ ] CustomCommands.txt
|
||||
- [x] CustomCommands.txt
|
||||
- [x] Item.txt
|
||||
- [x] Monster.txt
|
||||
- [ ] NPC.txt
|
||||
- [ ] Ornament.txt
|
||||
- [x] Scene.txt
|
||||
- [ ] Weapon.txt
|
||||
- [ ] Execute command remotely (progress: new folder)
|
||||
- [x] Execute command remotely
|
||||
- [ ] Grasscutter Launcher (no progress)
|
||||
- [ ] Mail Editor (no progress)
|
||||
- [ ] Shop Editor (no progress)
|
||||
|
||||
## v0.10.0 Unpublished
|
||||
Added `Text Map Browser`, you can use **regular** search text mapping files
|
||||

|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
@@ -58,4 +58,4 @@ Added `Text Map Browser`, you can use **regular** search text mapping files
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
@@ -2,11 +2,11 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="GrasscutterTools.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
<section name="GrasscutterTools.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<GrasscutterTools.Properties.Settings>
|
||||
@@ -25,6 +25,12 @@
|
||||
<setting name="TextMapFileName" serializeAs="String">
|
||||
<value>TextMapCHS</value>
|
||||
</setting>
|
||||
<setting name="RemoteUid" serializeAs="String">
|
||||
<value>10001</value>
|
||||
</setting>
|
||||
<setting name="Host" serializeAs="String">
|
||||
<value>https://127.0.0.1</value>
|
||||
</setting>
|
||||
</GrasscutterTools.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
</configuration>
|
16
Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs
Normal file
16
Source/GrasscutterTools/DispatchServer/DispatchServerAPI.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using GrasscutterTools.DispatchServer.Model;
|
||||
using GrasscutterTools.Utils;
|
||||
|
||||
namespace GrasscutterTools.DispatchServer
|
||||
{
|
||||
public static class DispatchServerAPI
|
||||
{
|
||||
public static async Task<ServerStatus> QueryServerStatus(string host)
|
||||
{
|
||||
var response = await HttpHelper.GetAsync<ServerStatusResponse>(host + "/status/server");
|
||||
return response?.Status;
|
||||
}
|
||||
}
|
||||
}
|
22
Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs
Normal file
22
Source/GrasscutterTools/DispatchServer/Model/ServerStatus.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.DispatchServer.Model
|
||||
{
|
||||
public class ServerStatus
|
||||
{
|
||||
[JsonProperty("playerCount")]
|
||||
public int PlayerCount { get; set; }
|
||||
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
|
||||
public class ServerStatusResponse
|
||||
{
|
||||
[JsonProperty("retcode")]
|
||||
public int RetCode { get; set; }
|
||||
|
||||
[JsonProperty("status")]
|
||||
public ServerStatus Status { get; set; }
|
||||
}
|
||||
}
|
@@ -31,6 +31,7 @@ namespace GrasscutterTools
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormGachaBannerEditor));
|
||||
this.GrpBannerValues = new System.Windows.Forms.GroupBox();
|
||||
this.CmbPrefab = new System.Windows.Forms.ComboBox();
|
||||
this.LblEventChanceTip = new System.Windows.Forms.Label();
|
||||
this.NUDEventChance = new System.Windows.Forms.NumericUpDown();
|
||||
this.LblGachaType = new System.Windows.Forms.Label();
|
||||
@@ -60,19 +61,14 @@ namespace GrasscutterTools
|
||||
this.LblSoftPityTip = new System.Windows.Forms.Label();
|
||||
this.LblBasePurpleWeight = new System.Windows.Forms.Label();
|
||||
this.CmbBannerType = new System.Windows.Forms.ComboBox();
|
||||
this.TxtTitlePath = new System.Windows.Forms.TextBox();
|
||||
this.LblSortIdTip = new System.Windows.Forms.Label();
|
||||
this.NUDBasePurpleWeight = new System.Windows.Forms.NumericUpDown();
|
||||
this.LblBannerType = new System.Windows.Forms.Label();
|
||||
this.LblTitlePath = new System.Windows.Forms.Label();
|
||||
this.LblBasePurpleWeightTip = new System.Windows.Forms.Label();
|
||||
this.RbCostItem224 = new System.Windows.Forms.RadioButton();
|
||||
this.TxtPrefabPath = new System.Windows.Forms.TextBox();
|
||||
this.TxtPreviewPrefabPath = new System.Windows.Forms.TextBox();
|
||||
this.LblBaseYellowWeightTip = new System.Windows.Forms.Label();
|
||||
this.LblCostItem = new System.Windows.Forms.Label();
|
||||
this.LblPrefabPath = new System.Windows.Forms.Label();
|
||||
this.LblPreviewPrefabPath = new System.Windows.Forms.Label();
|
||||
this.RbCostItem223 = new System.Windows.Forms.RadioButton();
|
||||
this.GrpPurplePool = new System.Windows.Forms.GroupBox();
|
||||
this.ListPurplePool = new System.Windows.Forms.CheckedListBox();
|
||||
@@ -101,6 +97,7 @@ namespace GrasscutterTools
|
||||
// GrpBannerValues
|
||||
//
|
||||
resources.ApplyResources(this.GrpBannerValues, "GrpBannerValues");
|
||||
this.GrpBannerValues.Controls.Add(this.CmbPrefab);
|
||||
this.GrpBannerValues.Controls.Add(this.LblEventChanceTip);
|
||||
this.GrpBannerValues.Controls.Add(this.NUDEventChance);
|
||||
this.GrpBannerValues.Controls.Add(this.LblGachaType);
|
||||
@@ -130,23 +127,25 @@ namespace GrasscutterTools
|
||||
this.GrpBannerValues.Controls.Add(this.LblSoftPityTip);
|
||||
this.GrpBannerValues.Controls.Add(this.LblBasePurpleWeight);
|
||||
this.GrpBannerValues.Controls.Add(this.CmbBannerType);
|
||||
this.GrpBannerValues.Controls.Add(this.TxtTitlePath);
|
||||
this.GrpBannerValues.Controls.Add(this.LblSortIdTip);
|
||||
this.GrpBannerValues.Controls.Add(this.NUDBasePurpleWeight);
|
||||
this.GrpBannerValues.Controls.Add(this.LblBannerType);
|
||||
this.GrpBannerValues.Controls.Add(this.LblTitlePath);
|
||||
this.GrpBannerValues.Controls.Add(this.LblBasePurpleWeightTip);
|
||||
this.GrpBannerValues.Controls.Add(this.RbCostItem224);
|
||||
this.GrpBannerValues.Controls.Add(this.TxtPrefabPath);
|
||||
this.GrpBannerValues.Controls.Add(this.TxtPreviewPrefabPath);
|
||||
this.GrpBannerValues.Controls.Add(this.LblBaseYellowWeightTip);
|
||||
this.GrpBannerValues.Controls.Add(this.LblCostItem);
|
||||
this.GrpBannerValues.Controls.Add(this.LblPrefabPath);
|
||||
this.GrpBannerValues.Controls.Add(this.LblPreviewPrefabPath);
|
||||
this.GrpBannerValues.Controls.Add(this.RbCostItem223);
|
||||
this.GrpBannerValues.Name = "GrpBannerValues";
|
||||
this.GrpBannerValues.TabStop = false;
|
||||
//
|
||||
// CmbPrefab
|
||||
//
|
||||
resources.ApplyResources(this.CmbPrefab, "CmbPrefab");
|
||||
this.CmbPrefab.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CmbPrefab.FormattingEnabled = true;
|
||||
this.CmbPrefab.Name = "CmbPrefab";
|
||||
//
|
||||
// LblEventChanceTip
|
||||
//
|
||||
resources.ApplyResources(this.LblEventChanceTip, "LblEventChanceTip");
|
||||
@@ -383,11 +382,6 @@ namespace GrasscutterTools
|
||||
resources.GetString("CmbBannerType.Items2")});
|
||||
this.CmbBannerType.Name = "CmbBannerType";
|
||||
//
|
||||
// TxtTitlePath
|
||||
//
|
||||
resources.ApplyResources(this.TxtTitlePath, "TxtTitlePath");
|
||||
this.TxtTitlePath.Name = "TxtTitlePath";
|
||||
//
|
||||
// LblSortIdTip
|
||||
//
|
||||
resources.ApplyResources(this.LblSortIdTip, "LblSortIdTip");
|
||||
@@ -409,11 +403,6 @@ namespace GrasscutterTools
|
||||
resources.ApplyResources(this.LblBannerType, "LblBannerType");
|
||||
this.LblBannerType.Name = "LblBannerType";
|
||||
//
|
||||
// LblTitlePath
|
||||
//
|
||||
resources.ApplyResources(this.LblTitlePath, "LblTitlePath");
|
||||
this.LblTitlePath.Name = "LblTitlePath";
|
||||
//
|
||||
// LblBasePurpleWeightTip
|
||||
//
|
||||
resources.ApplyResources(this.LblBasePurpleWeightTip, "LblBasePurpleWeightTip");
|
||||
@@ -427,16 +416,6 @@ namespace GrasscutterTools
|
||||
this.RbCostItem224.TabStop = true;
|
||||
this.RbCostItem224.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// TxtPrefabPath
|
||||
//
|
||||
resources.ApplyResources(this.TxtPrefabPath, "TxtPrefabPath");
|
||||
this.TxtPrefabPath.Name = "TxtPrefabPath";
|
||||
//
|
||||
// TxtPreviewPrefabPath
|
||||
//
|
||||
resources.ApplyResources(this.TxtPreviewPrefabPath, "TxtPreviewPrefabPath");
|
||||
this.TxtPreviewPrefabPath.Name = "TxtPreviewPrefabPath";
|
||||
//
|
||||
// LblBaseYellowWeightTip
|
||||
//
|
||||
resources.ApplyResources(this.LblBaseYellowWeightTip, "LblBaseYellowWeightTip");
|
||||
@@ -452,11 +431,6 @@ namespace GrasscutterTools
|
||||
resources.ApplyResources(this.LblPrefabPath, "LblPrefabPath");
|
||||
this.LblPrefabPath.Name = "LblPrefabPath";
|
||||
//
|
||||
// LblPreviewPrefabPath
|
||||
//
|
||||
resources.ApplyResources(this.LblPreviewPrefabPath, "LblPreviewPrefabPath");
|
||||
this.LblPreviewPrefabPath.Name = "LblPreviewPrefabPath";
|
||||
//
|
||||
// RbCostItem223
|
||||
//
|
||||
resources.ApplyResources(this.RbCostItem223, "RbCostItem223");
|
||||
@@ -583,19 +557,14 @@ namespace GrasscutterTools
|
||||
private System.Windows.Forms.Label LblSoftPityTip;
|
||||
private System.Windows.Forms.Label LblBasePurpleWeight;
|
||||
private System.Windows.Forms.ComboBox CmbBannerType;
|
||||
private System.Windows.Forms.TextBox TxtTitlePath;
|
||||
private System.Windows.Forms.Label LblSortIdTip;
|
||||
private System.Windows.Forms.NumericUpDown NUDBasePurpleWeight;
|
||||
private System.Windows.Forms.Label LblBannerType;
|
||||
private System.Windows.Forms.Label LblTitlePath;
|
||||
private System.Windows.Forms.Label LblBasePurpleWeightTip;
|
||||
private System.Windows.Forms.RadioButton RbCostItem224;
|
||||
private System.Windows.Forms.TextBox TxtPrefabPath;
|
||||
private System.Windows.Forms.TextBox TxtPreviewPrefabPath;
|
||||
private System.Windows.Forms.Label LblBaseYellowWeightTip;
|
||||
private System.Windows.Forms.Label LblCostItem;
|
||||
private System.Windows.Forms.Label LblPrefabPath;
|
||||
private System.Windows.Forms.Label LblPreviewPrefabPath;
|
||||
private System.Windows.Forms.RadioButton RbCostItem223;
|
||||
private System.Windows.Forms.GroupBox GrpPurplePool;
|
||||
private System.Windows.Forms.CheckedListBox ListPurplePool;
|
||||
@@ -605,5 +574,6 @@ namespace GrasscutterTools
|
||||
private System.Windows.Forms.TextBox TxtJson;
|
||||
private System.Windows.Forms.Button BtnGen;
|
||||
private System.Windows.Forms.Button BtnParse;
|
||||
private System.Windows.Forms.ComboBox CmbPrefab;
|
||||
}
|
||||
}
|
@@ -26,9 +26,16 @@ namespace GrasscutterTools
|
||||
|
||||
Icon = Resources.IconGrasscutter;
|
||||
CmbBannerType.SelectedIndex = 0;
|
||||
InitBannerPrefab();
|
||||
InitCheckedListBoxs();
|
||||
}
|
||||
|
||||
private void InitBannerPrefab()
|
||||
{
|
||||
CmbPrefab.Items.Clear();
|
||||
CmbPrefab.Items.AddRange(GameData.GachaBannerPrefabs.Names);
|
||||
}
|
||||
|
||||
private void InitCheckedListBoxs()
|
||||
{
|
||||
InitCheckedListBox(ListYellowPool, "yellow");
|
||||
@@ -78,9 +85,10 @@ namespace GrasscutterTools
|
||||
NUDGachaType.Value = banner.GachaType;
|
||||
NUDScheduleId.Value = banner.ScheduleId;
|
||||
CmbBannerType.SelectedIndex = (int)banner.BannerType;
|
||||
TxtPrefabPath.Text = banner.PrefabPath;
|
||||
TxtPreviewPrefabPath.Text = banner.PreviewPrefabPath;
|
||||
TxtTitlePath.Text = banner.TitlePath;
|
||||
if (string.IsNullOrEmpty(banner.TitlePath) || !int.TryParse(banner.TitlePath.Substring("UI_GACHA_SHOW_PANEL_A".Length, 3), out int prefabId))
|
||||
CmbPrefab.SelectedIndex = -1;
|
||||
else
|
||||
CmbPrefab.SelectedIndex = Array.IndexOf(GameData.GachaBannerPrefabs.Ids, prefabId);
|
||||
RbCostItem224.Checked = banner.CostItem == 224;
|
||||
RbCostItem223.Checked = banner.CostItem == 223;
|
||||
NUDBeginTime.Value = banner.BeginTime;
|
||||
@@ -97,7 +105,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("UI更新失败:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("UI更新失败:" + ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +113,16 @@ namespace GrasscutterTools
|
||||
{
|
||||
if (CmbBannerType.SelectedIndex < 0)
|
||||
{
|
||||
MessageBox.Show("请选择奖池类型", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("请选择奖池类型", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (CmbPrefab.SelectedIndex < 0)
|
||||
{
|
||||
MessageBox.Show("请选择奖池预制", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
int[] yellowIds;
|
||||
if (string.IsNullOrEmpty(TxtRateUpItems1.Text))
|
||||
yellowIds = new int[0];
|
||||
@@ -120,14 +135,15 @@ namespace GrasscutterTools
|
||||
else
|
||||
purpleIds = TxtRateUpItems2.Text.Split(',').Select(s => int.Parse(s.Trim())).ToArray();
|
||||
|
||||
var prefabId = GameData.GachaBannerPrefabs.Ids[CmbPrefab.SelectedIndex];
|
||||
GachaBanner banner = new GachaBanner
|
||||
{
|
||||
GachaType = (int)NUDGachaType.Value,
|
||||
ScheduleId = (int)NUDScheduleId.Value,
|
||||
BannerType = (BannerType)CmbBannerType.SelectedIndex,
|
||||
PrefabPath = TxtPrefabPath.Text,
|
||||
PreviewPrefabPath = TxtPreviewPrefabPath.Text,
|
||||
TitlePath = TxtTitlePath.Text,
|
||||
PrefabPath = $"GachaShowPanel_A{prefabId:000}",
|
||||
PreviewPrefabPath = $"UI_Tab_GachaShowPanel_A{prefabId:000}",
|
||||
TitlePath = $"UI_GACHA_SHOW_PANEL_A{prefabId:000}_TITLE",
|
||||
CostItem = RbCostItem224.Checked ? 224 : 223,
|
||||
BeginTime = (int)NUDBeginTime.Value,
|
||||
EndTime = (int)NUDEndTime.Value,
|
||||
@@ -186,7 +202,7 @@ namespace GrasscutterTools
|
||||
foreach (string item in list.CheckedItems)
|
||||
builder.Append(item.Substring(0, item.IndexOf(':')))
|
||||
.Append(", ");
|
||||
txt.Text = builder.ToString(0, builder.Length-2);
|
||||
txt.Text = builder.ToString(0, builder.Length - 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +223,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Json解析失败,错误消息:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Json解析失败,错误消息:" + ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -119,10 +119,10 @@
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="LblEventChanceTip.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>401, 318</value>
|
||||
<value>401, 262</value>
|
||||
</data>
|
||||
<data name="NUDEventChance.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>332, 316</value>
|
||||
<value>332, 260</value>
|
||||
</data>
|
||||
<data name="LblEventChance.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>83, 17</value>
|
||||
@@ -130,11 +130,14 @@
|
||||
<data name="LblEventChance.Text" xml:space="preserve">
|
||||
<value>Event chance</value>
|
||||
</data>
|
||||
<data name="LblSortId.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>72, 204</value>
|
||||
</data>
|
||||
<data name="LblSortId.Text" xml:space="preserve">
|
||||
<value>Sort</value>
|
||||
</data>
|
||||
<data name="LblBaseYellowWeight.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 318</value>
|
||||
<value>22, 262</value>
|
||||
</data>
|
||||
<data name="LblBaseYellowWeight.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>83, 17</value>
|
||||
@@ -143,7 +146,7 @@
|
||||
<value>5 star weight</value>
|
||||
</data>
|
||||
<data name="LblRateUpItems2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>45, 406</value>
|
||||
<value>44, 350</value>
|
||||
</data>
|
||||
<data name="LblRateUpItems2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>61, 17</value>
|
||||
@@ -152,7 +155,7 @@
|
||||
<value>4 star UP</value>
|
||||
</data>
|
||||
<data name="LblSoftPity.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>50, 347</value>
|
||||
<value>49, 291</value>
|
||||
</data>
|
||||
<data name="LblSoftPity.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>56, 17</value>
|
||||
@@ -173,7 +176,7 @@
|
||||
<value>End Time</value>
|
||||
</data>
|
||||
<data name="LblRateUpItems1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>45, 290</value>
|
||||
<value>44, 234</value>
|
||||
</data>
|
||||
<data name="LblRateUpItems1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>61, 17</value>
|
||||
@@ -182,7 +185,7 @@
|
||||
<value>5 star UP</value>
|
||||
</data>
|
||||
<data name="LblBeginTime.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>33, 231</value>
|
||||
<value>32, 175</value>
|
||||
</data>
|
||||
<data name="LblBeginTime.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>73, 17</value>
|
||||
@@ -191,7 +194,7 @@
|
||||
<value>Begin Time</value>
|
||||
</data>
|
||||
<data name="LblHardPity.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>43, 376</value>
|
||||
<value>42, 320</value>
|
||||
</data>
|
||||
<data name="LblHardPity.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>62, 17</value>
|
||||
@@ -200,7 +203,7 @@
|
||||
<value>Hard pity</value>
|
||||
</data>
|
||||
<data name="NUDEndTime.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>287, 230</value>
|
||||
<value>287, 174</value>
|
||||
</data>
|
||||
<data name="LblHardPityTip.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>17, 17</value>
|
||||
@@ -221,7 +224,7 @@
|
||||
<value>...</value>
|
||||
</data>
|
||||
<data name="LblBasePurpleWeight.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 434</value>
|
||||
<value>22, 378</value>
|
||||
</data>
|
||||
<data name="LblBasePurpleWeight.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>83, 17</value>
|
||||
@@ -253,15 +256,6 @@
|
||||
<data name="LblBannerType.Text" xml:space="preserve">
|
||||
<value>Banner Type</value>
|
||||
</data>
|
||||
<data name="LblTitlePath.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>45, 176</value>
|
||||
</data>
|
||||
<data name="LblTitlePath.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>61, 17</value>
|
||||
</data>
|
||||
<data name="LblTitlePath.Text" xml:space="preserve">
|
||||
<value>Title Path</value>
|
||||
</data>
|
||||
<data name="RbCostItem224.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>104, 21</value>
|
||||
</data>
|
||||
@@ -269,7 +263,7 @@
|
||||
<value>Acquaint Fate</value>
|
||||
</data>
|
||||
<data name="LblCostItem.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>42, 204</value>
|
||||
<value>41, 148</value>
|
||||
</data>
|
||||
<data name="LblCostItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>64, 17</value>
|
||||
@@ -278,25 +272,16 @@
|
||||
<value>Cost Item</value>
|
||||
</data>
|
||||
<data name="LblPrefabPath.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>31, 118</value>
|
||||
<value>59, 118</value>
|
||||
</data>
|
||||
<data name="LblPrefabPath.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 17</value>
|
||||
<value>46, 17</value>
|
||||
</data>
|
||||
<data name="LblPrefabPath.Text" xml:space="preserve">
|
||||
<value>Prefab Path</value>
|
||||
</data>
|
||||
<data name="LblPreviewPrefabPath.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 147</value>
|
||||
</data>
|
||||
<data name="LblPreviewPrefabPath.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>98, 17</value>
|
||||
</data>
|
||||
<data name="LblPreviewPrefabPath.Text" xml:space="preserve">
|
||||
<value>Pre Prefab Path</value>
|
||||
<value>Prefab</value>
|
||||
</data>
|
||||
<data name="RbCostItem223.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>222, 202</value>
|
||||
<value>222, 146</value>
|
||||
</data>
|
||||
<data name="RbCostItem223.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>119, 21</value>
|
||||
|
File diff suppressed because it is too large
Load Diff
351
Source/GrasscutterTools/FormMain.Designer.cs
generated
351
Source/GrasscutterTools/FormMain.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using GrasscutterTools.DispatchServer;
|
||||
using GrasscutterTools.Game;
|
||||
using GrasscutterTools.OpenCommand;
|
||||
using GrasscutterTools.Properties;
|
||||
|
||||
namespace GrasscutterTools
|
||||
@@ -26,10 +29,15 @@ namespace GrasscutterTools
|
||||
{
|
||||
MultiLanguage.LoadLanguage(this, typeof(FormMain));
|
||||
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
#if DEBUG
|
||||
Text += " - by jie65535 - v" + version.ToString(3) + "-debug";
|
||||
#else
|
||||
Text += " - by jie65535 - v" + version.ToString(3);
|
||||
#endif
|
||||
|
||||
GameData.LoadResources();
|
||||
|
||||
LoadCustomCommands();
|
||||
InitArtifactList();
|
||||
InitGameItemList();
|
||||
InitWeapons();
|
||||
@@ -45,8 +53,6 @@ namespace GrasscutterTools
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
private readonly string CustomCommandsFilePath = Path.Combine(Application.LocalUserAppDataPath, "CustomCommands.txt");
|
||||
|
||||
private readonly string[] LanguageNames = new string[] { "简体中文", "English" };
|
||||
private readonly string[] Languages = new string[] { "zh-CN", "en-US" };
|
||||
|
||||
@@ -60,16 +66,13 @@ namespace GrasscutterTools
|
||||
CmbLanguage.Items.AddRange(LanguageNames);
|
||||
CmbLanguage.SelectedIndex = Array.IndexOf(Languages, Settings.Default.DefaultLanguage);
|
||||
|
||||
if (File.Exists(CustomCommandsFilePath))
|
||||
LoadCustomCommands(File.ReadAllText(CustomCommandsFilePath));
|
||||
else
|
||||
LoadCustomCommands(Resources.CustomCommands);
|
||||
InitGiveItemRecord();
|
||||
InitSpawnRecord();
|
||||
InitOpenCommand();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("加载设置时异常:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.SettingLoadError + ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,13 +83,14 @@ namespace GrasscutterTools
|
||||
Settings.Default.AutoCopy = ChkAutoCopy.Checked;
|
||||
Settings.Default.Uid = NUDUid.Value;
|
||||
Settings.Default.Save();
|
||||
File.WriteAllText(CustomCommandsFilePath, SaveCustomCommands());
|
||||
SaveCustomCommands();
|
||||
SaveGiveItemRecord();
|
||||
SaveSpawnRecord();
|
||||
SaveOpenCommand();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("保存设置时异常:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.SettingSaveError + ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,8 +98,8 @@ namespace GrasscutterTools
|
||||
|
||||
#region - 主页 -
|
||||
|
||||
private FormGachaBannerEditor FormGachaBannerEditor;
|
||||
|
||||
FormGachaBannerEditor FormGachaBannerEditor;
|
||||
private void BtnOpenGachaBannerEditor_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (FormGachaBannerEditor == null || FormGachaBannerEditor.IsDisposed)
|
||||
@@ -110,7 +114,8 @@ namespace GrasscutterTools
|
||||
}
|
||||
}
|
||||
|
||||
FormTextMapBrowser FormTextMapBrowser;
|
||||
private FormTextMapBrowser FormTextMapBrowser;
|
||||
|
||||
private void BtnOpenTextMap_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (FormTextMapBrowser == null || FormTextMapBrowser.IsDisposed)
|
||||
@@ -135,15 +140,33 @@ namespace GrasscutterTools
|
||||
|
||||
#region - 自定义 -
|
||||
|
||||
private void LoadCustomCommands(string commands)
|
||||
private readonly string CustomCommandsFilePath = Path.Combine(Application.LocalUserAppDataPath, "CustomCommands.txt");
|
||||
|
||||
private bool CustomCommandsChanged;
|
||||
|
||||
private void LoadCustomCommands()
|
||||
{
|
||||
if (File.Exists(CustomCommandsFilePath))
|
||||
LoadCustomCommandControls(File.ReadAllText(CustomCommandsFilePath));
|
||||
else
|
||||
LoadCustomCommandControls(Resources.CustomCommands);
|
||||
}
|
||||
|
||||
private void LoadCustomCommandControls(string commands)
|
||||
{
|
||||
FLPCustomCommands.Controls.Clear();
|
||||
var lines = commands.Split('\n');
|
||||
for (int i = 0; i < lines.Length-1; i += 2)
|
||||
AddCustomCommand(lines[i].Trim(), lines[i+1].Trim());
|
||||
for (int i = 0; i < lines.Length - 1; i += 2)
|
||||
AddCustomCommand(lines[i].Trim(), lines[i + 1].Trim());
|
||||
}
|
||||
|
||||
private string SaveCustomCommands()
|
||||
private void SaveCustomCommands()
|
||||
{
|
||||
if (CustomCommandsChanged)
|
||||
File.WriteAllText(CustomCommandsFilePath, SaveCustomCommandControls());
|
||||
}
|
||||
|
||||
private string SaveCustomCommandControls()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
foreach (LinkLabel lnk in FLPCustomCommands.Controls)
|
||||
@@ -167,12 +190,12 @@ namespace GrasscutterTools
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(TxtCustomName.Text))
|
||||
{
|
||||
MessageBox.Show("命令标签不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.CommandTagCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(TxtCommand.Text))
|
||||
{
|
||||
MessageBox.Show("命令内容不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.CommandContentCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var name = TxtCustomName.Text.Trim();
|
||||
@@ -183,11 +206,13 @@ namespace GrasscutterTools
|
||||
if (lnk.Text == name)
|
||||
{
|
||||
lnk.Tag = command;
|
||||
CustomCommandsChanged = true;
|
||||
await ButtonComplete(BtnSaveCustomCommand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CustomCommandsChanged = true;
|
||||
AddCustomCommand(name, command);
|
||||
await ButtonComplete(BtnSaveCustomCommand);
|
||||
}
|
||||
@@ -208,16 +233,17 @@ namespace GrasscutterTools
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(TxtCustomName.Text))
|
||||
{
|
||||
MessageBox.Show("命令标签不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.CommandTagCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var name = TxtCustomName.Text.Trim();
|
||||
|
||||
foreach (LinkLabel lnk in FLPCustomCommands.Controls)
|
||||
{
|
||||
if (lnk.Text == name && MessageBox.Show("确认删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (lnk.Text == name && MessageBox.Show(Resources.AskConfirmDeletion, Resources.Tips, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
FLPCustomCommands.Controls.Remove(lnk);
|
||||
CustomCommandsChanged = true;
|
||||
//TxtCustomName.Text = "";
|
||||
//TxtCommand.Text = "";
|
||||
await ButtonComplete(BtnRemoveCustomCommand);
|
||||
@@ -225,7 +251,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show("未找到该命令", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.CommandNotFound, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private void BtnImport_Click(object sender, EventArgs e)
|
||||
@@ -239,7 +265,8 @@ namespace GrasscutterTools
|
||||
using (var stream = dialog.OpenFile())
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
LoadCustomCommands(reader.ReadToEnd());
|
||||
LoadCustomCommandControls(reader.ReadToEnd());
|
||||
CustomCommandsChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +283,7 @@ namespace GrasscutterTools
|
||||
using (var stream = dialog.OpenFile())
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
writer.Write(SaveCustomCommands());
|
||||
writer.Write(SaveCustomCommandControls());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,10 +350,9 @@ namespace GrasscutterTools
|
||||
|
||||
// 限制星级输入范围
|
||||
NUDArtifactStars.Minimum = GameData.Artifacts.Ids[beginIndex] / 100 % 10;
|
||||
NUDArtifactStars.Maximum = GameData.Artifacts.Ids[endIndex] / 100 % 10;
|
||||
NUDArtifactStars.Maximum = GameData.Artifacts.Ids[endIndex] / 100 % 10;
|
||||
|
||||
|
||||
var parts = GameData.Artifacts.Names.Skip(beginIndex).Take(endIndex-beginIndex+1).Distinct().ToArray();
|
||||
var parts = GameData.Artifacts.Names.Skip(beginIndex).Take(endIndex - beginIndex + 1).Distinct().ToArray();
|
||||
var i = CmbArtifactPart.SelectedIndex;
|
||||
CmbArtifactPart.Items.Clear();
|
||||
CmbArtifactPart.Items.AddRange(parts);
|
||||
@@ -336,7 +362,8 @@ namespace GrasscutterTools
|
||||
ArtifactInputChanged(sender, e);
|
||||
}
|
||||
|
||||
readonly string[] ArtifactPartLabels = new string[] { "空之杯", "死之羽", "理之冠", "生之花", "时之沙"};
|
||||
private readonly string[] ArtifactPartLabels = new string[] { "空之杯", "死之羽", "理之冠", "生之花", "时之沙" };
|
||||
|
||||
private void CmbArtifactPart_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (CmbArtifactPart.SelectedIndex < 0)
|
||||
@@ -360,7 +387,7 @@ namespace GrasscutterTools
|
||||
//var setId = GameData.ArtifactCats.Ids[CmbArtifactSet.SelectedIndex];
|
||||
//var part = CmbArtifactPart.SelectedIndex+1;
|
||||
//var index = Array.FindLastIndex(
|
||||
// GameData.Artifacts.Ids,
|
||||
// GameData.Artifacts.Ids,
|
||||
// it => it / 1000 == setId // 套装ID
|
||||
// //&& it / 100 % 10 == NUDArtifactStars.Value // 星级
|
||||
// && it / 10 % 10 == part // 部位
|
||||
@@ -381,7 +408,7 @@ namespace GrasscutterTools
|
||||
foreach (string item in ListSubAttributionChecked.Items)
|
||||
{
|
||||
var subId = item.Substring(0, item.IndexOf(':')).Trim();
|
||||
var times = int.Parse(item.Substring(item.LastIndexOf('x')+1));
|
||||
var times = int.Parse(item.Substring(item.LastIndexOf('x') + 1));
|
||||
if (subAttrDir.ContainsKey(subId))
|
||||
subAttrDir[subId] += times;
|
||||
else
|
||||
@@ -497,8 +524,9 @@ namespace GrasscutterTools
|
||||
|
||||
#region -- 物品记录 --
|
||||
|
||||
readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt");
|
||||
List<GameCommand> GiveItemCommands;
|
||||
private readonly string GiveItemCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "GiveItemCommands.txt");
|
||||
private List<GameCommand> GiveItemCommands;
|
||||
|
||||
private void InitGiveItemRecord()
|
||||
{
|
||||
if (File.Exists(GiveItemCommandsRecordPath))
|
||||
@@ -548,7 +576,8 @@ namespace GrasscutterTools
|
||||
ListGiveItemLogs.Items.RemoveAt(ListGiveItemLogs.SelectedIndex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion -- 物品记录 --
|
||||
|
||||
#endregion - 物品 -
|
||||
|
||||
@@ -646,8 +675,9 @@ namespace GrasscutterTools
|
||||
|
||||
#region -- 生成记录 --
|
||||
|
||||
readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt");
|
||||
List<GameCommand> SpawnCommands;
|
||||
private readonly string SpawnCommandsRecordPath = Path.Combine(Application.LocalUserAppDataPath, "SpawnCommands.txt");
|
||||
private List<GameCommand> SpawnCommands;
|
||||
|
||||
private void InitSpawnRecord()
|
||||
{
|
||||
if (File.Exists(SpawnCommandsRecordPath))
|
||||
@@ -660,6 +690,7 @@ namespace GrasscutterTools
|
||||
SpawnCommands = new List<GameCommand>();
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSpawnRecord()
|
||||
{
|
||||
File.WriteAllText(SpawnCommandsRecordPath, GetCommandsText(SpawnCommands));
|
||||
@@ -697,7 +728,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion -- 生成记录 --
|
||||
|
||||
#endregion - 生成 -
|
||||
|
||||
@@ -749,7 +780,7 @@ namespace GrasscutterTools
|
||||
LblStatPercent.Visible = stat.Percent;
|
||||
LblStatTip.Text = stat.Tip;
|
||||
|
||||
SetCommand("/setstats", $"{stat.ArgName} {NUDStat.Value}{(stat.Percent?"%":"")}");
|
||||
SetCommand("/setstats", $"{stat.ArgName} {NUDStat.Value}{(stat.Percent ? "%" : "")}");
|
||||
}
|
||||
|
||||
private void LnkSetTalentClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
@@ -773,7 +804,7 @@ namespace GrasscutterTools
|
||||
var perm = CmbPerm.Text.Trim();
|
||||
if (string.IsNullOrEmpty(perm))
|
||||
{
|
||||
MessageBox.Show("权限不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.PermissionCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
SetCommand($"/permission {(sender as Button).Tag} @{uid} {perm}");
|
||||
@@ -784,7 +815,7 @@ namespace GrasscutterTools
|
||||
var username = TxtAccountUserName.Text.Trim();
|
||||
if (string.IsNullOrEmpty(username))
|
||||
{
|
||||
MessageBox.Show("用户名不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(Resources.UsernameCannotBeEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
SetCommand($"/account {(sender as Button).Tag} {username} {(ChkAccountSetUid.Checked ? NUDAccountUid.Value.ToString() : "")}");
|
||||
@@ -802,13 +833,13 @@ namespace GrasscutterTools
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("浏览器打开失败,你可以通过以下链接手动访问:\n"
|
||||
+ "https://github.com/jie65535/GrasscutterCommandGenerator",
|
||||
"错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(Resources.BrowserOpenFailedTip
|
||||
+ "\n https://github.com/jie65535/GrasscutterCommandGenerator",
|
||||
Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion - 关于 -
|
||||
|
||||
#region - 命令 -
|
||||
|
||||
@@ -817,6 +848,8 @@ namespace GrasscutterTools
|
||||
TxtCommand.Text = command;
|
||||
if (ChkAutoCopy.Checked)
|
||||
CopyCommand();
|
||||
if (ModifierKeys == Keys.Control)
|
||||
OnOpenCommandInvoke();
|
||||
}
|
||||
|
||||
private void SetCommand(string command, string args)
|
||||
@@ -852,20 +885,33 @@ namespace GrasscutterTools
|
||||
btn.Enabled = true;
|
||||
}
|
||||
|
||||
private void FormMain_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.F5)
|
||||
{
|
||||
OnOpenCommandInvoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowTip(string message, Control control)
|
||||
{
|
||||
TTip.Show(message, control, 0, control.Size.Height, 3000);
|
||||
}
|
||||
|
||||
#endregion - 通用 -
|
||||
|
||||
#region - 命令记录 -
|
||||
|
||||
List<GameCommand> GetCommands(string commandsText)
|
||||
private List<GameCommand> GetCommands(string commandsText)
|
||||
{
|
||||
var lines = commandsText.Split('\n');
|
||||
List<GameCommand> commands = new List<GameCommand>(lines.Length/2);
|
||||
for (int i = 0; i < lines.Length-1; i += 2)
|
||||
commands.Add(new GameCommand(lines[i].Trim(), lines[i+1].Trim()));
|
||||
List<GameCommand> commands = new List<GameCommand>(lines.Length / 2);
|
||||
for (int i = 0; i < lines.Length - 1; i += 2)
|
||||
commands.Add(new GameCommand(lines[i].Trim(), lines[i + 1].Trim()));
|
||||
return commands;
|
||||
}
|
||||
|
||||
string GetCommandsText(List<GameCommand> commands)
|
||||
private string GetCommandsText(List<GameCommand> commands)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
foreach (var cmd in commands)
|
||||
@@ -876,20 +922,169 @@ namespace GrasscutterTools
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion - 命令记录 -
|
||||
|
||||
#region - 远程 -
|
||||
|
||||
private void InitOpenCommand()
|
||||
{
|
||||
NUDRemotePlayerId.Value = Settings.Default.RemoteUid;
|
||||
TxtHost.Text = Settings.Default.Host;
|
||||
}
|
||||
|
||||
private void SaveOpenCommand()
|
||||
{
|
||||
Settings.Default.RemoteUid = NUDRemotePlayerId.Value;
|
||||
Settings.Default.Host = TxtHost.Text;
|
||||
}
|
||||
|
||||
private OpenCommandAPI OC;
|
||||
|
||||
private async void BtnQueryServerStatus_Click(object sender, EventArgs e)
|
||||
{
|
||||
var btn = sender as Button;
|
||||
btn.Enabled = false;
|
||||
btn.Cursor = Cursors.WaitCursor;
|
||||
try
|
||||
{
|
||||
var status = await DispatchServerAPI.QueryServerStatus(TxtHost.Text);
|
||||
LblServerVersion.Text = status.Version;
|
||||
LblPlayerCount.Text = status.PlayerCount.ToString();
|
||||
|
||||
OC = new OpenCommandAPI(TxtHost.Text);
|
||||
if (await OC.Ping())
|
||||
{
|
||||
LblOpenCommandSupport.Text = "√";
|
||||
LblOpenCommandSupport.ForeColor = Color.Green;
|
||||
GrpRemoteCommand.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LblOpenCommandSupport.Text = "×";
|
||||
LblOpenCommandSupport.ForeColor = Color.Red;
|
||||
GrpRemoteCommand.Enabled = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btn.Cursor = Cursors.Default;
|
||||
btn.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void BtnSendVerificationCode_Click(object sender, EventArgs e)
|
||||
{
|
||||
var btn = sender as Button;
|
||||
var t = btn.Text;
|
||||
btn.Enabled = false;
|
||||
NUDRemotePlayerId.Enabled = false;
|
||||
try
|
||||
{
|
||||
btn.Text = Resources.CodeSending;
|
||||
await OC.SendCode((int)NUDRemotePlayerId.Value);
|
||||
BtnConnectOpenCommand.Enabled = true;
|
||||
NUDVerificationCode.Enabled = true;
|
||||
NUDVerificationCode.Focus();
|
||||
for (int i = 60; i > 0 && !OC.CanInvoke; i--)
|
||||
{
|
||||
btn.Text = string.Format(Resources.CodeResendTip, i);
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btn.Text = t;
|
||||
btn.Enabled = true;
|
||||
NUDRemotePlayerId.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void BtnConnectOpenCommand_Click(object sender, EventArgs e)
|
||||
{
|
||||
var btn = sender as Button;
|
||||
btn.Enabled = false;
|
||||
try
|
||||
{
|
||||
await OC.Verify((int)NUDVerificationCode.Value);
|
||||
GrpRemoteCommand.Enabled = false;
|
||||
BtnInvokeOpenCommand.Focus();
|
||||
ShowTip(Resources.ConnectedTip, BtnInvokeOpenCommand);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btn.Cursor = Cursors.Default;
|
||||
btn.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOpenCommandInvoke()
|
||||
{
|
||||
BtnInvokeOpenCommand_Click(BtnInvokeOpenCommand, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private async void BtnInvokeOpenCommand_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (OC == null || !OC.CanInvoke)
|
||||
{
|
||||
ShowTip(Resources.RequireOpenCommandTip, BtnInvokeOpenCommand);
|
||||
TCMain.SelectedTab = TPRemoteCall;
|
||||
return;
|
||||
}
|
||||
if (TxtCommand.Text.Length < 2)
|
||||
{
|
||||
ShowTip(Resources.CommandContentCannotBeEmpty, TxtCommand);
|
||||
return;
|
||||
}
|
||||
var cmd = TxtCommand.Text.Substring(1);
|
||||
var btn = sender as Button;
|
||||
btn.Enabled = false;
|
||||
try
|
||||
{
|
||||
var msg = await OC.Invoke(cmd);
|
||||
ShowTip(msg, btn);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
btn.Cursor = Cursors.Default;
|
||||
btn.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void LnkOpenCommandLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://github.com/jie65535/gc-opencommand-plugin");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show(Resources.BrowserOpenFailedTip
|
||||
+ "\n https://github.com/jie65535/gc-opencommand-plugin",
|
||||
Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private void LnkRCHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("TODO:正在开发中", "TODO");
|
||||
MessageBox.Show(Resources.OpenCommandHelp, Resources.Help, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void BtnPingHost_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("TODO:正在开发中", "TODO");
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion - 远程 -
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
@@ -55,7 +54,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -92,7 +91,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -137,7 +136,7 @@ namespace GrasscutterTools
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,7 +149,8 @@ namespace GrasscutterTools
|
||||
.Select(kv => new { Hash = kv.Key, Id = kv.Value, Text = data.TextMap[kv.Key] })
|
||||
.Concat(
|
||||
data.TextMap.Where(kv => r.Match(kv.Key).Success || r.Match(kv.Value).Success)
|
||||
.Select(kv => new {
|
||||
.Select(kv => new
|
||||
{
|
||||
Hash = kv.Key,
|
||||
Id = data.ManualTextMap.TryGetValue(kv.Key, out string id) ? id : "",
|
||||
Text = kv.Value
|
||||
@@ -179,6 +179,5 @@ namespace GrasscutterTools
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
BtnSearch_Click(sender, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GrasscutterTools.Game.Gacha
|
||||
namespace GrasscutterTools.Game.Gacha
|
||||
{
|
||||
public enum BannerType
|
||||
{
|
||||
STANDARD, EVENT, WEAPON
|
||||
}
|
||||
}
|
||||
}
|
@@ -117,6 +117,5 @@ namespace GrasscutterTools.Game.Gacha
|
||||
/// </summary>
|
||||
[JsonProperty("hardPity", DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(90)]
|
||||
public int HardPity { get; set; } = 90;
|
||||
|
||||
}
|
||||
}
|
@@ -4,12 +4,12 @@
|
||||
{
|
||||
public GameCommand(string name, string command)
|
||||
{
|
||||
Name=name;
|
||||
Command=command;
|
||||
Name = name;
|
||||
Command = command;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Command { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,6 +20,7 @@ namespace GrasscutterTools.Game
|
||||
Weapons = new ItemMap(Resources.Weapon);
|
||||
WeaponColors = new ItemMap(Resources.WeaponColor);
|
||||
Ornaments = new ItemMap(Resources.Ornament);
|
||||
GachaBannerPrefabs = new ItemMap(Resources.GachaBennerPrefab);
|
||||
}
|
||||
|
||||
public static ItemMap Animals { get; private set; }
|
||||
@@ -50,5 +51,6 @@ namespace GrasscutterTools.Game
|
||||
|
||||
public static ItemMap Ornaments { get; private set; }
|
||||
|
||||
public static ItemMap GachaBannerPrefabs { get; private set; }
|
||||
}
|
||||
}
|
@@ -19,7 +19,7 @@ namespace GrasscutterTools.Game
|
||||
var si = line.IndexOf(':');
|
||||
if (si > 0 && int.TryParse(line.Substring(0, si).Trim(), out int id))
|
||||
{
|
||||
var name = line.Substring(si+1).Trim();
|
||||
var name = line.Substring(si + 1).Trim();
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
//IdMap[id] = name;
|
||||
@@ -41,17 +41,16 @@ namespace GrasscutterTools.Game
|
||||
//List<int> IdList;
|
||||
//List<string> NameList;
|
||||
|
||||
|
||||
public int Count => Ids.Length;
|
||||
|
||||
//public string this[int id] => IdMap[id];
|
||||
|
||||
|
||||
//public int this[string name] => NameMap[name];
|
||||
|
||||
|
||||
public int[] Ids { get; }
|
||||
|
||||
public string[] Names { get; }
|
||||
|
||||
public string[] Lines { get; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text;
|
||||
|
||||
using GrasscutterTools.Properties;
|
||||
|
||||
@@ -13,9 +12,9 @@ namespace GrasscutterTools.Game
|
||||
{
|
||||
public Stat(string name, string argName, bool percent, string tip = "")
|
||||
{
|
||||
Name=name;
|
||||
ArgName=argName;
|
||||
Percent=percent;
|
||||
Name = name;
|
||||
ArgName = argName;
|
||||
Percent = percent;
|
||||
Tip = tip;
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -22,7 +19,7 @@ namespace GrasscutterTools.Game
|
||||
public string[] TextMapFilePaths;
|
||||
public string[] TextMapFiles;
|
||||
|
||||
void LoadManualTextMap(string manualTextMapPath)
|
||||
private void LoadManualTextMap(string manualTextMapPath)
|
||||
{
|
||||
using (var fs = File.OpenRead(manualTextMapPath))
|
||||
using (var sr = new StreamReader(fs))
|
||||
@@ -41,7 +38,7 @@ namespace GrasscutterTools.Game
|
||||
}
|
||||
}
|
||||
|
||||
void LoadTextMaps(string textMapDirPath)
|
||||
private void LoadTextMaps(string textMapDirPath)
|
||||
{
|
||||
TextMapFilePaths = Directory.GetFiles(textMapDirPath, "TextMap*.json");
|
||||
if (TextMapFilePaths.Length == 0)
|
||||
@@ -65,6 +62,5 @@ namespace GrasscutterTools.Game
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -192,6 +192,8 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DispatchServer\DispatchServerAPI.cs" />
|
||||
<Compile Include="DispatchServer\Model\ServerStatus.cs" />
|
||||
<Compile Include="FormGachaBannerEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -217,10 +219,11 @@
|
||||
<Compile Include="Game\ItemMap.cs" />
|
||||
<Compile Include="Game\SetStatsCommand.cs" />
|
||||
<Compile Include="Game\TextMapData.cs" />
|
||||
<Compile Include="MojoConsole\MojoConsole.cs" />
|
||||
<Compile Include="OpenCommand\OpenCommandAPI.cs" />
|
||||
<Compile Include="MultiLanguage.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils\HttpHelper.cs" />
|
||||
<EmbeddedResource Include="FormGachaBannerEditor.en-us.resx">
|
||||
<DependentUpon>FormGachaBannerEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -284,6 +287,7 @@
|
||||
<Content Include="Resources\en-us\ArtifactSubAttribution.txt" />
|
||||
<Content Include="Resources\en-us\Avatar.txt" />
|
||||
<Content Include="Resources\en-us\CustomCommands.txt" />
|
||||
<Content Include="Resources\en-us\GachaBennerPrefab.txt" />
|
||||
<Content Include="Resources\en-us\Item.txt" />
|
||||
<Content Include="Resources\en-us\Monster.txt" />
|
||||
<Content Include="Resources\en-us\NPC.txt" />
|
||||
@@ -304,6 +308,7 @@
|
||||
<Content Include="Resources\zh-cn\Avatar.txt" />
|
||||
<Content Include="Resources\zh-cn\CustomCommands.txt" />
|
||||
<Content Include="Resources\AvatarColor.txt" />
|
||||
<Content Include="Resources\zh-cn\GachaBennerPrefab.txt" />
|
||||
<Content Include="Resources\zh-cn\Item.txt" />
|
||||
<Content Include="Resources\zh-cn\Monster.txt" />
|
||||
<Content Include="Resources\zh-cn\NPC.txt" />
|
||||
@@ -321,7 +326,9 @@
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Fody.6.6.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.6.1\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Resource.Embedder.2.2.0\build\Resource.Embedder.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Resource.Embedder.2.2.0\build\Resource.Embedder.props'))" />
|
||||
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
|
||||
<Import Project="..\packages\Fody.6.6.1\build\Fody.targets" Condition="Exists('..\packages\Fody.6.6.1\build\Fody.targets')" />
|
||||
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
</Project>
|
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.MojoConsole
|
||||
{
|
||||
internal class MojoConsole
|
||||
{
|
||||
static readonly HttpClient httpClient = new HttpClient();
|
||||
|
||||
public string Host { get; set; }
|
||||
|
||||
private string API => Host + "/mojoplus/api";
|
||||
|
||||
public string Key { get; set; }
|
||||
|
||||
public async Task<string> Invoke(string payload)
|
||||
{
|
||||
var response = await DoRequest(new Request(Key, "invoke", payload));
|
||||
if (response.Code == 500)
|
||||
throw new InvokeException(response.Payload);
|
||||
return response.Payload;
|
||||
}
|
||||
|
||||
public async Task<bool> Ping()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await DoRequest(new Request(Key, "ping"));
|
||||
return response?.Code == 200;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<Response> DoRequest(Request request)
|
||||
{
|
||||
var content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
|
||||
var response = await httpClient.PostAsync(API, content);
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
return JsonConvert.DeserializeObject<Response>(responseString);
|
||||
}
|
||||
|
||||
public class Request
|
||||
{
|
||||
public Request(string k, string method, string payload = "")
|
||||
{
|
||||
K = k;
|
||||
Method = method;
|
||||
Payload = payload;
|
||||
}
|
||||
|
||||
[JsonProperty("k")]
|
||||
public string K { get; set; }
|
||||
|
||||
[JsonProperty("request")]
|
||||
public string Method { get; set; }
|
||||
|
||||
[JsonProperty("payload")]
|
||||
public string Payload { get; set; }
|
||||
}
|
||||
|
||||
public class Response
|
||||
{
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
[JsonProperty("code")]
|
||||
public int Code { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("payload")]
|
||||
public string Payload { get; set; }
|
||||
}
|
||||
|
||||
|
||||
internal class InvokeException : Exception
|
||||
{
|
||||
public InvokeException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,9 +3,8 @@ using System.Windows.Forms;
|
||||
|
||||
namespace GrasscutterTools
|
||||
{
|
||||
static class MultiLanguage
|
||||
internal static class MultiLanguage
|
||||
{
|
||||
|
||||
public static string DefaultLanguage = "zh-CN";
|
||||
|
||||
public static void SetDefaultLanguage(string lang)
|
||||
@@ -16,7 +15,6 @@ namespace GrasscutterTools
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载语言
|
||||
/// </summary>
|
||||
@@ -80,4 +78,4 @@ namespace GrasscutterTools
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
105
Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs
Normal file
105
Source/GrasscutterTools/OpenCommand/OpenCommandAPI.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using GrasscutterTools.Utils;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.OpenCommand
|
||||
{
|
||||
public class OpenCommandAPI
|
||||
{
|
||||
public OpenCommandAPI(string host)
|
||||
{
|
||||
Host = host;
|
||||
API = host + "/opencommand/api";
|
||||
}
|
||||
|
||||
public string Host { get; }
|
||||
|
||||
private readonly string API;
|
||||
|
||||
public string Token { get; set; }
|
||||
|
||||
public bool CanInvoke { get; private set; }
|
||||
|
||||
public async Task<bool> Ping()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await DoRequest("ping");
|
||||
return response.RetCode == 200;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendCode(int playerId)
|
||||
{
|
||||
var response = await DoRequest("sendCode", playerId);
|
||||
Token = response.Data as string;
|
||||
}
|
||||
|
||||
public async Task Verify(int code)
|
||||
{
|
||||
await DoRequest("verify", code);
|
||||
CanInvoke = true;
|
||||
}
|
||||
|
||||
public async Task<string> Invoke(string command)
|
||||
{
|
||||
var response = await DoRequest("command", command);
|
||||
return response.Data as string;
|
||||
}
|
||||
|
||||
private async Task<Response> DoRequest(string action, object data = null)
|
||||
{
|
||||
var response = await HttpHelper.PostAsync<Response>(API, new Request(Token, action, data));
|
||||
if (response.RetCode == 401)
|
||||
Token = "";
|
||||
if (response.RetCode != 200)
|
||||
throw new InvokeException(response.Message);
|
||||
return response;
|
||||
}
|
||||
|
||||
public class Request
|
||||
{
|
||||
public Request(string token, string action, object data)
|
||||
{
|
||||
Token = token;
|
||||
Action = action;
|
||||
Data = data;
|
||||
}
|
||||
|
||||
[JsonProperty("token")]
|
||||
public string Token { get; set; }
|
||||
|
||||
[JsonProperty("action")]
|
||||
public string Action { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
public object Data { get; set; }
|
||||
}
|
||||
|
||||
public class Response
|
||||
{
|
||||
[JsonProperty("retcode")]
|
||||
public int RetCode { get; set; }
|
||||
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
public object Data { get; set; }
|
||||
}
|
||||
|
||||
internal class InvokeException : Exception
|
||||
{
|
||||
public InvokeException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,22 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using GrasscutterTools.Properties;
|
||||
|
||||
namespace GrasscutterTools
|
||||
{
|
||||
static class Program
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
private static void Main()
|
||||
{
|
||||
//设置应用程序处理异常方式:ThreadException处理
|
||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||
//处理线程异常
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
//处理非UI线程异常
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
|
||||
#region - 全局异常处理 -
|
||||
|
||||
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
string str = GetExceptionMsg(e.Exception, e.ToString());
|
||||
MessageBox.Show(str, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
|
||||
MessageBox.Show(str, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成自定义异常消息
|
||||
/// </summary>
|
||||
/// <param name="ex">异常对象</param>
|
||||
/// <param name="backStr">备用异常消息:当ex为null时有效</param>
|
||||
/// <returns>异常字符串文本</returns>
|
||||
private static string GetExceptionMsg(Exception ex, string backStr)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("****************************异常文本****************************");
|
||||
sb.AppendLine("【出现时间】:" + DateTime.Now.ToString());
|
||||
if (ex != null)
|
||||
{
|
||||
sb.AppendLine("【异常类型】:" + ex.GetType().Name);
|
||||
sb.AppendLine("【异常信息】:" + ex.Message);
|
||||
#if DEBUG
|
||||
sb.AppendLine("【堆栈调用】:" + ex.StackTrace);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine("【未处理异常】:" + backStr);
|
||||
}
|
||||
sb.AppendLine("***************************************************************");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion - 全局异常处理 -
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,7 +21,7 @@ using System.Runtime.InteropServices;
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("b26333ff-5560-4cba-af3c-4b80db6f8025")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.10.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0")]
|
196
Source/GrasscutterTools/Properties/Resources.Designer.cs
generated
196
Source/GrasscutterTools/Properties/Resources.Designer.cs
generated
@@ -283,6 +283,15 @@ namespace GrasscutterTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 确认删除? 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string AskConfirmDeletion {
|
||||
get {
|
||||
return ResourceManager.GetString("AskConfirmDeletion", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 10000001: 凯特
|
||||
///10000002: 神里绫华
|
||||
@@ -385,6 +394,15 @@ namespace GrasscutterTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 浏览器打开失败,你可以通过以下链接手动访问: 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string BrowserOpenFailedTip {
|
||||
get {
|
||||
return ResourceManager.GetString("BrowserOpenFailedTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 无,晴天,多云,雨天,雷暴,雪天,雾天 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -394,6 +412,60 @@ namespace GrasscutterTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0} 秒后可重发 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string CodeResendTip {
|
||||
get {
|
||||
return ResourceManager.GetString("CodeResendTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 发送中... 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string CodeSending {
|
||||
get {
|
||||
return ResourceManager.GetString("CodeSending", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 命令内容不能为空 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string CommandContentCannotBeEmpty {
|
||||
get {
|
||||
return ResourceManager.GetString("CommandContentCannotBeEmpty", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 未找到该命令 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string CommandNotFound {
|
||||
get {
|
||||
return ResourceManager.GetString("CommandNotFound", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 命令标签不能为空 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string CommandTagCannotBeEmpty {
|
||||
get {
|
||||
return ResourceManager.GetString("CommandTagCannotBeEmpty", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 现在你可以远程执行命令了哦! 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ConnectedTip {
|
||||
get {
|
||||
return ResourceManager.GetString("ConnectedTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 无敌
|
||||
////godmode
|
||||
@@ -450,6 +522,67 @@ namespace GrasscutterTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 错误 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Error {
|
||||
get {
|
||||
return ResourceManager.GetString("Error", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 007: 初行者推荐祈愿
|
||||
///008: 奔行世间
|
||||
///009: 杯装之诗
|
||||
///010: 黎明巡礼
|
||||
///011: 南风之眷
|
||||
///012: 靖妖傩舞
|
||||
///013: 神铸赋形
|
||||
///015: 闪焰的驻足
|
||||
///016: 初行者推荐祈愿
|
||||
///017: 奔行世间
|
||||
///018: 闪焰的驻足
|
||||
///019: 杯装之诗
|
||||
///020: 神铸赋形
|
||||
///021: 神铸赋形
|
||||
///022: 奔行世间
|
||||
///023: 暂别冬都
|
||||
///024: 陵薮市朝
|
||||
///027: 深秘之息
|
||||
///028: 浮生孰来
|
||||
///031: 烟火之邀
|
||||
///032: 鱼龙灯昼
|
||||
///033: 赤团开时
|
||||
///036: 杯装之诗
|
||||
///037: 暂别冬都
|
||||
///040: 陵薮市朝
|
||||
///041: 浪涌之瞬
|
||||
///045: 叶落风随
|
||||
///048: 白鹭之庭
|
||||
///049: 焰色天河
|
||||
///052: 影寂天下人
|
||||
///053: 浮岳虹珠
|
||||
///061: 鬼门斗宴
|
||||
///065: 出尘入世
|
||||
///071: 华紫樱绯
|
||||
///076: 苍流踏花 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string GachaBennerPrefab {
|
||||
get {
|
||||
return ResourceManager.GetString("GachaBennerPrefab", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 帮助 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Help {
|
||||
get {
|
||||
return ResourceManager.GetString("Help", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
|
||||
/// </summary>
|
||||
@@ -611,6 +744,15 @@ namespace GrasscutterTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 1. 填写正确的UID\n2. 向玩家发送验证码\n3. 输入正确的验证码\n4. 连接\n5. 享受 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string OpenCommandHelp {
|
||||
get {
|
||||
return ResourceManager.GetString("OpenCommandHelp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 369101: 翠目猫
|
||||
///369102: 北地犬
|
||||
@@ -661,6 +803,15 @@ namespace GrasscutterTools.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 要设置的权限不能为空! 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string PermissionCannotBeEmpty {
|
||||
get {
|
||||
return ResourceManager.GetString("PermissionCannotBeEmpty", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 *
|
||||
///player.*
|
||||
@@ -701,6 +852,15 @@ namespace GrasscutterTools.Properties {
|
||||
return ResourceManager.GetString("Permissions", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 请先连接到支持[OpenCommand]的服务器 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string RequireOpenCommandTip {
|
||||
get {
|
||||
return ResourceManager.GetString("RequireOpenCommandTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 1 : BigWorld_LevelStreaming
|
||||
@@ -732,6 +892,42 @@ namespace GrasscutterTools.Properties {
|
||||
return ResourceManager.GetString("Scene", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 加载设置时异常: 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string SettingLoadError {
|
||||
get {
|
||||
return ResourceManager.GetString("SettingLoadError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 保存设置时异常: 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string SettingSaveError {
|
||||
get {
|
||||
return ResourceManager.GetString("SettingSaveError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 提示 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Tips {
|
||||
get {
|
||||
return ResourceManager.GetString("Tips", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 用户名不能为空! 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string UsernameCannotBeEmpty {
|
||||
get {
|
||||
return ResourceManager.GetString("UsernameCannotBeEmpty", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 11101: 无锋剑
|
||||
|
@@ -133,6 +133,9 @@
|
||||
<data name="ArtifactSubAttribution" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\ArtifactSubAttribution.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="AskConfirmDeletion" xml:space="preserve">
|
||||
<value>Are you sure you want to delete this command?</value>
|
||||
</data>
|
||||
<data name="Avatar" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\Avatar.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
@@ -142,12 +145,42 @@
|
||||
<data name="AvatarStats" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\AvatarStats.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="BrowserOpenFailedTip" xml:space="preserve">
|
||||
<value>The browser failed to open. You can manually access the following address:</value>
|
||||
</data>
|
||||
<data name="ClimateType" xml:space="preserve">
|
||||
<value>None,Sunny,Partly cloudy,Rain,Thunderstorm,Snow,Fog</value>
|
||||
</data>
|
||||
<data name="CodeResendTip" xml:space="preserve">
|
||||
<value>Resend in {0} seconds</value>
|
||||
</data>
|
||||
<data name="CodeSending" xml:space="preserve">
|
||||
<value>sending...</value>
|
||||
</data>
|
||||
<data name="CommandContentCannotBeEmpty" xml:space="preserve">
|
||||
<value>Command cannot be empty</value>
|
||||
</data>
|
||||
<data name="CommandNotFound" xml:space="preserve">
|
||||
<value>Command not found</value>
|
||||
</data>
|
||||
<data name="CommandTagCannotBeEmpty" xml:space="preserve">
|
||||
<value>Command tag cannot be empty</value>
|
||||
</data>
|
||||
<data name="ConnectedTip" xml:space="preserve">
|
||||
<value>Now you can execute commands remotely!</value>
|
||||
</data>
|
||||
<data name="CustomCommands" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\CustomCommands.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="Error" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="GachaBennerPrefab" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\GachaBennerPrefab.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="Help" xml:space="preserve">
|
||||
<value>Help</value>
|
||||
</data>
|
||||
<data name="IconGrasscutter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\IconGrasscutter.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -166,15 +199,36 @@
|
||||
<data name="NPC" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\NPC.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="OpenCommandHelp" xml:space="preserve">
|
||||
<value>1. Fill in the correct uid\n2. Send verification code to player\n3. Enter the correct verification code\n4. Connection\n5. Enjoy</value>
|
||||
</data>
|
||||
<data name="Ornament" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\Ornament.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="PermissionCannotBeEmpty" xml:space="preserve">
|
||||
<value>Permission cannot be empty!</value>
|
||||
</data>
|
||||
<data name="Permissions" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Permissions.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="RequireOpenCommandTip" xml:space="preserve">
|
||||
<value>Please connect to a server that supports [opencommand] first</value>
|
||||
</data>
|
||||
<data name="Scene" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\Scene.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="SettingLoadError" xml:space="preserve">
|
||||
<value>Settings load failed:</value>
|
||||
</data>
|
||||
<data name="SettingSaveError" xml:space="preserve">
|
||||
<value>Settings save failed:</value>
|
||||
</data>
|
||||
<data name="Tips" xml:space="preserve">
|
||||
<value>Tips</value>
|
||||
</data>
|
||||
<data name="UsernameCannotBeEmpty" xml:space="preserve">
|
||||
<value>Username cannot be empty!</value>
|
||||
</data>
|
||||
<data name="Weapon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\en-us\Weapon.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
|
@@ -133,6 +133,9 @@
|
||||
<data name="ArtifactSubAttribution" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\ArtifactSubAttribution.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="AskConfirmDeletion" xml:space="preserve">
|
||||
<value>确认删除?</value>
|
||||
</data>
|
||||
<data name="Avatar" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\Avatar.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
@@ -142,12 +145,42 @@
|
||||
<data name="AvatarStats" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\AvatarStats.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="BrowserOpenFailedTip" xml:space="preserve">
|
||||
<value>浏览器打开失败,你可以通过以下链接手动访问:</value>
|
||||
</data>
|
||||
<data name="ClimateType" xml:space="preserve">
|
||||
<value>无,晴天,多云,雨天,雷暴,雪天,雾天</value>
|
||||
</data>
|
||||
<data name="CodeResendTip" xml:space="preserve">
|
||||
<value>{0} 秒后可重发</value>
|
||||
</data>
|
||||
<data name="CodeSending" xml:space="preserve">
|
||||
<value>发送中...</value>
|
||||
</data>
|
||||
<data name="CommandContentCannotBeEmpty" xml:space="preserve">
|
||||
<value>命令内容不能为空</value>
|
||||
</data>
|
||||
<data name="CommandNotFound" xml:space="preserve">
|
||||
<value>未找到该命令</value>
|
||||
</data>
|
||||
<data name="CommandTagCannotBeEmpty" xml:space="preserve">
|
||||
<value>命令标签不能为空</value>
|
||||
</data>
|
||||
<data name="ConnectedTip" xml:space="preserve">
|
||||
<value>现在你可以远程执行命令了哦!</value>
|
||||
</data>
|
||||
<data name="CustomCommands" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\CustomCommands.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="Error" xml:space="preserve">
|
||||
<value>错误</value>
|
||||
</data>
|
||||
<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="Help" xml:space="preserve">
|
||||
<value>帮助</value>
|
||||
</data>
|
||||
<data name="IconGrasscutter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\IconGrasscutter.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -169,15 +202,36 @@
|
||||
<data name="NPC" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\NPC.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="OpenCommandHelp" xml:space="preserve">
|
||||
<value>1. 填写正确的UID\n2. 向玩家发送验证码\n3. 输入正确的验证码\n4. 连接\n5. 享受</value>
|
||||
</data>
|
||||
<data name="Ornament" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\Ornament.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="PermissionCannotBeEmpty" xml:space="preserve">
|
||||
<value>要设置的权限不能为空!</value>
|
||||
</data>
|
||||
<data name="Permissions" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Permissions.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="RequireOpenCommandTip" xml:space="preserve">
|
||||
<value>请先连接到支持[OpenCommand]的服务器</value>
|
||||
</data>
|
||||
<data name="Scene" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\Scene.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="SettingLoadError" xml:space="preserve">
|
||||
<value>加载设置时异常:</value>
|
||||
</data>
|
||||
<data name="SettingSaveError" xml:space="preserve">
|
||||
<value>保存设置时异常:</value>
|
||||
</data>
|
||||
<data name="Tips" xml:space="preserve">
|
||||
<value>提示</value>
|
||||
</data>
|
||||
<data name="UsernameCannotBeEmpty" xml:space="preserve">
|
||||
<value>用户名不能为空!</value>
|
||||
</data>
|
||||
<data name="Weapon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zh-cn\Weapon.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
|
@@ -82,5 +82,29 @@ namespace GrasscutterTools.Properties {
|
||||
this["TextMapFileName"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("10001")]
|
||||
public decimal RemoteUid {
|
||||
get {
|
||||
return ((decimal)(this["RemoteUid"]));
|
||||
}
|
||||
set {
|
||||
this["RemoteUid"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://127.0.0.1")]
|
||||
public string Host {
|
||||
get {
|
||||
return ((string)(this["Host"]));
|
||||
}
|
||||
set {
|
||||
this["Host"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,5 +17,11 @@
|
||||
<Setting Name="TextMapFileName" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">TextMapCHS</Value>
|
||||
</Setting>
|
||||
<Setting Name="RemoteUid" Type="System.Decimal" Scope="User">
|
||||
<Value Profile="(Default)">10001</Value>
|
||||
</Setting>
|
||||
<Setting Name="Host" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">https://127.0.0.1</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@@ -1,52 +1,52 @@
|
||||
无敌
|
||||
God Mode
|
||||
/godmode
|
||||
升到60级
|
||||
Level up to 60
|
||||
/give 102 1880200
|
||||
奶
|
||||
Heal
|
||||
/heal
|
||||
我全都要!
|
||||
Give me ALL!
|
||||
/giveall
|
||||
我在哪?
|
||||
Where am I?
|
||||
/position
|
||||
设置世界等级
|
||||
Set World Level
|
||||
/setworldlevel 8
|
||||
设置羁绊等级
|
||||
Set Fetter Level
|
||||
/setfetterlevel 1
|
||||
清空背包
|
||||
Clear Backpack(ALL)
|
||||
/clear all
|
||||
清空武器
|
||||
Clear Weapons
|
||||
/clear wp
|
||||
清空圣物
|
||||
Clear Artifacts
|
||||
/clear art
|
||||
清空材料
|
||||
Clear Materials
|
||||
/clear mat
|
||||
发送广播
|
||||
/broadcast 大家好啊~
|
||||
清空当前角色命之座(需重登)
|
||||
Broadcast
|
||||
/broadcast Hello everyone~
|
||||
Reset Current Constellation(Need Re-login)
|
||||
/resetconst
|
||||
清空全部角色命之座(需重登)
|
||||
Reset ALL Constellation(Need Re-login)
|
||||
/resetconst all
|
||||
一万纠缠
|
||||
100k Intertwined Fates
|
||||
/give 223 10000
|
||||
一万相遇
|
||||
100k Acquaint Fate
|
||||
/give 224 10000
|
||||
十万原石
|
||||
100k Primogem
|
||||
/give 201 100000
|
||||
十万摩拉
|
||||
100k Mora
|
||||
/give 202 100000
|
||||
速速集合!
|
||||
TP Everyone
|
||||
/tpall
|
||||
拔线
|
||||
Restart Server
|
||||
/restart
|
||||
私信
|
||||
Send PM
|
||||
/say <player> <message>
|
||||
进来吧你
|
||||
Pull in team
|
||||
/coop <playerId> <target playerId>
|
||||
自杀
|
||||
Suicide
|
||||
/killcharacter
|
||||
暗杀
|
||||
Kill Somebody
|
||||
/killcharacter <playerId>
|
||||
都有谁在?
|
||||
List ALL users
|
||||
/list uid
|
||||
重载服务配置
|
||||
Reload service config
|
||||
/reload
|
@@ -0,0 +1,35 @@
|
||||
007: Beginners' wish
|
||||
008: Wanderlust Invocation
|
||||
009: Ballad in Goblets
|
||||
010: Dawn Pilgrimage
|
||||
011: Grace of Southwind
|
||||
012: Bane of All Evil
|
||||
013: Epitome Invocation
|
||||
015: Sparkling Steps
|
||||
016: Beginners' wish
|
||||
017: Wanderlust Invocation
|
||||
018: Sparkling Steps
|
||||
019: Ballad in Goblets
|
||||
020: Epitome Invocation
|
||||
021: Epitome Invocation
|
||||
022: Wanderlust Invocation
|
||||
023: Farewell of Snezhnaya
|
||||
024: Gentry of Hermitage
|
||||
027: Secretum Secretorum
|
||||
028: Adrift in the Harbor
|
||||
031: Invitation to Mundane Life
|
||||
032: Dance of Lanterns
|
||||
033: Moment of Bloom
|
||||
036: Ballad in Goblets
|
||||
037: Farewell of Snezhnaya
|
||||
040: Gentry of Hermitage
|
||||
041: Born of Ocean Swell
|
||||
045: Leaves in the Wind
|
||||
048: The Heron's Court
|
||||
049: Tapestry of Golden Flames
|
||||
052: Reign of Serenity
|
||||
053: Drifting Luminescence
|
||||
061: Oni's Royale
|
||||
065: The Transcendent One Returns
|
||||
071: Everbloom Violet
|
||||
076: Azure Excursion
|
@@ -0,0 +1,35 @@
|
||||
007: 初行者推荐祈愿
|
||||
008: 奔行世间
|
||||
009: 杯装之诗
|
||||
010: 黎明巡礼
|
||||
011: 南风之眷
|
||||
012: 靖妖傩舞
|
||||
013: 神铸赋形
|
||||
015: 闪焰的驻足
|
||||
016: 初行者推荐祈愿
|
||||
017: 奔行世间
|
||||
018: 闪焰的驻足
|
||||
019: 杯装之诗
|
||||
020: 神铸赋形
|
||||
021: 神铸赋形
|
||||
022: 奔行世间
|
||||
023: 暂别冬都
|
||||
024: 陵薮市朝
|
||||
027: 深秘之息
|
||||
028: 浮生孰来
|
||||
031: 烟火之邀
|
||||
032: 鱼龙灯昼
|
||||
033: 赤团开时
|
||||
036: 杯装之诗
|
||||
037: 暂别冬都
|
||||
040: 陵薮市朝
|
||||
041: 浪涌之瞬
|
||||
045: 叶落风随
|
||||
048: 白鹭之庭
|
||||
049: 焰色天河
|
||||
052: 影寂天下人
|
||||
053: 浮岳虹珠
|
||||
061: 鬼门斗宴
|
||||
065: 出尘入世
|
||||
071: 华紫樱绯
|
||||
076: 苍流踏花
|
67
Source/GrasscutterTools/Utils/HttpHelper.cs
Normal file
67
Source/GrasscutterTools/Utils/HttpHelper.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GrasscutterTools.Utils
|
||||
{
|
||||
public static class HttpHelper
|
||||
{
|
||||
private static readonly HttpClient httpClient = new HttpClient();
|
||||
|
||||
static HttpHelper()
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback = (_, _1, _2, _3) => true;
|
||||
}
|
||||
|
||||
public static async Task<T> GetAsync<T>(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
var responseMessage = await httpClient.GetAsync(url);
|
||||
if (responseMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var responseString = await responseMessage.Content.ReadAsStringAsync();
|
||||
return JsonConvert.DeserializeObject<T>(responseString);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new HttpRequestException(responseMessage.ReasonPhrase);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.InnerException != null)
|
||||
throw ex.InnerException;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<T> PostAsync<T>(string url, object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
var content = new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/json");
|
||||
var responseMessage = await httpClient.PostAsync(url, content);
|
||||
if (responseMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var responseString = await responseMessage.Content.ReadAsStringAsync();
|
||||
return JsonConvert.DeserializeObject<T>(responseString);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new HttpRequestException(responseMessage.ReasonPhrase);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.InnerException != null)
|
||||
throw ex.InnerException;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
<package id="Fody" version="6.6.1" targetFramework="net48" developmentDependency="true" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net48" />
|
||||
<package id="NETStandard.Library" version="1.6.1" targetFramework="net48" />
|
||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||
<package id="Resource.Embedder" version="2.2.0" targetFramework="net48" />
|
||||
<package id="System.AppContext" version="4.3.0" targetFramework="net48" />
|
||||
|
Reference in New Issue
Block a user