Added Ban Command

Added TopMast CheckBox
Added GC Version CheckBox
This commit is contained in:
2022-06-28 22:14:57 +08:00
parent cae6f73eeb
commit f678b10171
10 changed files with 1485 additions and 584 deletions

View File

@@ -22,6 +22,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -89,6 +90,8 @@ namespace GrasscutterTools.Forms
{
ChkAutoCopy.Checked = Settings.Default.AutoCopy;
NUDUid.Value = Settings.Default.Uid;
ChkTopMost.Checked = Settings.Default.IsTopMost;
ChkNewCommand.Checked = Settings.Default.CommandVersion == "1.2.2";
CmbLanguage.Items.AddRange(LanguageNames);
CmbLanguage.SelectedIndex = Array.IndexOf(Languages, Settings.Default.DefaultLanguage);
@@ -110,6 +113,8 @@ namespace GrasscutterTools.Forms
{
Settings.Default.AutoCopy = ChkAutoCopy.Checked;
Settings.Default.Uid = NUDUid.Value;
Settings.Default.IsTopMost = ChkTopMost.Checked;
Settings.Default.CommandVersion = ChkNewCommand.Checked ? "1.2.2" : string.Empty;
SaveCustomCommands();
SaveGiveItemRecord();
SaveSpawnRecord();
@@ -200,6 +205,11 @@ namespace GrasscutterTools.Forms
FormMain_Load(this, EventArgs.Empty);
}
private void ChkTopMost_CheckedChanged(object sender, EventArgs e)
{
TopMost = ChkTopMost.Checked;
}
#endregion - -
#region - -
@@ -842,11 +852,15 @@ namespace GrasscutterTools.Forms
SetCommand("/changescene", id.ToString());
}
static readonly string[] climateTypes = { "none", "sunny", "cloudy", "rain", "thunderstorm", "snow", "mist" };
private void CmbClimateType_SelectedIndexChanged(object sender, EventArgs e)
{
if (CmbClimateType.SelectedIndex < 0)
return;
SetCommand("/weather", $"0 {CmbClimateType.SelectedIndex}");
if (ChkNewCommand.Checked)
SetCommand("/weather", CmbClimateType.SelectedIndex < climateTypes.Length ? climateTypes[CmbClimateType.SelectedIndex] : "none");
else
SetCommand("/weather", $"0 {CmbClimateType.SelectedIndex}");
}
private void BtnTeleport_Click(object sender, EventArgs e)
@@ -888,7 +902,7 @@ namespace GrasscutterTools.Forms
#endregion - -
#region - -
#region - -
private void InitPermList()
{
@@ -919,7 +933,23 @@ namespace GrasscutterTools.Forms
SetCommand($"/account {(sender as Button).Tag} {username} {(ChkAccountSetUid.Checked ? NUDAccountUid.Value.ToString() : "")}");
}
#endregion - -
private void BtnBan_Click(object sender, EventArgs e)
{
var uid = NUDBanUID.Value;
var endTime = DTPBanEndTime.Value;
var command = $"/ban @{uid} {new DateTimeOffset(endTime).ToUnixTimeSeconds()}";
var reaseon = Regex.Replace(TxtBanReason.Text.Trim(), @"\s+", "-");
if (!string.IsNullOrEmpty(reaseon))
command += $" {reaseon}";
SetCommand(command);
}
private void BtnUnban_Click(object sender, EventArgs e)
{
SetCommand($"/unban @{NUDBanUID.Value}");
}
#endregion - -
#region - -