|
|
@@ -5,8 +5,8 @@ using System.Globalization;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
using BossCommand;
|
|
|
-using BossBase;
|
|
|
-using Helper;
|
|
|
+using BossBase;
|
|
|
+using Helper;
|
|
|
using Log;
|
|
|
using Microsoft.Practices.Prism.Events;
|
|
|
using Microsoft.Practices.Prism.ViewModel;
|
|
|
@@ -21,12 +21,11 @@ namespace Modules.Robot
|
|
|
|
|
|
private string errorInfo = "";
|
|
|
private int findTypeIndex;
|
|
|
- private string account = "";
|
|
|
+ private string account = "";
|
|
|
private string findType = "egametang@126.com";
|
|
|
private string name = "";
|
|
|
private string guid = "";
|
|
|
- private string command = "";
|
|
|
- private string forbiddenLoginTime = "";
|
|
|
+ private string command = "";
|
|
|
private bool isGMEnable;
|
|
|
private Visibility dockPanelVisiable = Visibility.Hidden;
|
|
|
private readonly BossClient.BossClient bossClient = new BossClient.BossClient();
|
|
|
@@ -162,40 +161,6 @@ namespace Modules.Robot
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public bool IsGMEnable
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return this.isGMEnable;
|
|
|
- }
|
|
|
- set
|
|
|
- {
|
|
|
- if (this.isGMEnable == value)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.isGMEnable = value;
|
|
|
- this.RaisePropertyChanged("IsGMEnable");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public string ForbiddenLoginTime
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return this.forbiddenLoginTime;
|
|
|
- }
|
|
|
- set
|
|
|
- {
|
|
|
- if (this.forbiddenLoginTime == value)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.forbiddenLoginTime = value;
|
|
|
- this.RaisePropertyChanged("ForbiddenLoginTime");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public string Command
|
|
|
{
|
|
|
get
|
|
|
@@ -274,27 +239,28 @@ namespace Modules.Robot
|
|
|
bossCommand.DoAsync();
|
|
|
}
|
|
|
|
|
|
- public async void GetCharacterInfo()
|
|
|
+ public async Task GetCharacterInfo()
|
|
|
{
|
|
|
ABossCommand bossCommand = new BCGetCharacterInfo(this.IMessageChannel)
|
|
|
{
|
|
|
FindTypeIndex = this.FindTypeIndex,
|
|
|
FindType = this.FindType
|
|
|
- };
|
|
|
- var result = await bossCommand.DoAsync();
|
|
|
- if (result == null)
|
|
|
- {
|
|
|
- this.ErrorInfo = string.Format("获取玩家信息失败");
|
|
|
- return;
|
|
|
- }
|
|
|
- this.ErrorInfo = "获取玩家信息成功";
|
|
|
- var characterInfo = (CharacterInfo)result;
|
|
|
- this.Account = characterInfo.Account;
|
|
|
- this.Name = characterInfo.Name;
|
|
|
- this.Guid = characterInfo.Guid.ToString();
|
|
|
+ };
|
|
|
+ var result = await bossCommand.DoAsync();
|
|
|
+ if (result == null)
|
|
|
+ {
|
|
|
+ this.ErrorInfo = string.Format("获取玩家信息失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var characterInfo = (CharacterInfo)result;
|
|
|
+
|
|
|
+ this.ErrorInfo = "获取玩家信息成功";
|
|
|
+ this.Account = characterInfo.Account;
|
|
|
+ this.Name = characterInfo.Name;
|
|
|
+ this.Guid = characterInfo.Guid.ToString();
|
|
|
}
|
|
|
|
|
|
- public async Task ForbiddenBuy()
|
|
|
+ public async Task ForbidCharacter(string forbiddenCommand, string forbiddenTime)
|
|
|
{
|
|
|
if (this.Guid == "")
|
|
|
{
|
|
|
@@ -302,95 +268,66 @@ namespace Modules.Robot
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- ABossCommand bossCommand = new BCForbiddenBuy(this.IMessageChannel)
|
|
|
+ int time = 0;
|
|
|
+ if (!int.TryParse(forbiddenTime, out time))
|
|
|
+ {
|
|
|
+ this.ErrorInfo = "时间请输入数字";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ABossCommand bossCommand = new BCForbiddenCharacter(this.IMessageChannel)
|
|
|
{
|
|
|
- Guid = this.Guid
|
|
|
+ Guid = this.Guid,
|
|
|
+ Command = forbiddenCommand,
|
|
|
+ ForbiddenTime = forbiddenTime
|
|
|
};
|
|
|
var result = await bossCommand.DoAsync();
|
|
|
|
|
|
- var errorCode = (int)result;
|
|
|
+ var errorCode = (uint)result;
|
|
|
|
|
|
if (errorCode == ErrorCode.RESPONSE_SUCCESS)
|
|
|
{
|
|
|
- this.ErrorInfo = "禁止交易成功";
|
|
|
+ this.ErrorInfo = string.Format(
|
|
|
+ "{0} {1} {2} Succeed!", forbiddenCommand, this.Guid, forbiddenTime);
|
|
|
return;
|
|
|
}
|
|
|
- this.ErrorInfo = string.Format("禁止交易失败, error code: {0}", errorCode);
|
|
|
+ this.ErrorInfo = string.Format("{0} Fail, error code: {1}", forbiddenCommand, errorCode);
|
|
|
}
|
|
|
|
|
|
- public async Task AllowBuy()
|
|
|
+ public async Task ForbiddenLogin(
|
|
|
+ string forbiddenCommand, string forbiddenContent, string forbiddenTime)
|
|
|
{
|
|
|
- if (this.Guid == "")
|
|
|
+ int time = 0;
|
|
|
+ if (!int.TryParse(forbiddenTime, out time))
|
|
|
{
|
|
|
- this.ErrorInfo = "请先指定玩家";
|
|
|
+ this.ErrorInfo = "时间请输入数字";
|
|
|
return;
|
|
|
}
|
|
|
- ABossCommand bossCommand = new BCAllowBuy(this.IMessageChannel)
|
|
|
+
|
|
|
+ ABossCommand bossCommand = new BCForbidLogin(this.IMessageChannel)
|
|
|
{
|
|
|
- Guid = this.Guid
|
|
|
+ Command = forbiddenCommand,
|
|
|
+ Content = forbiddenContent,
|
|
|
+ ForbiddenLoginTime = forbiddenTime
|
|
|
};
|
|
|
var result = await bossCommand.DoAsync();
|
|
|
- var errorCode = (uint) result;
|
|
|
+
|
|
|
+ var errorCode = (uint)result;
|
|
|
+
|
|
|
if (errorCode == ErrorCode.RESPONSE_SUCCESS)
|
|
|
{
|
|
|
- this.ErrorInfo = "允许交易成功";
|
|
|
+ this.ErrorInfo = string.Format(
|
|
|
+ "{0} {1} {2} Succeed!", forbiddenCommand, forbiddenContent, forbiddenTime);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- this.ErrorInfo = errorCode.ToString();
|
|
|
- }
|
|
|
-
|
|
|
- public async Task ForbiddenAccountLogin()
|
|
|
- {
|
|
|
- int time = 0;
|
|
|
- if (!int.TryParse(this.ForbiddenLoginTime, out time))
|
|
|
- {
|
|
|
- this.ErrorInfo = "禁止时间请输入数字";
|
|
|
- return;
|
|
|
- }
|
|
|
- if (time < 0)
|
|
|
- {
|
|
|
- this.ErrorInfo = "禁止时间必须>=0";
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- ABossCommand bossCommand = new BCForbiddenAccountLogin(this.IMessageChannel)
|
|
|
- { Account = this.Account, ForbiddenLoginTime = this.ForbiddenLoginTime };
|
|
|
- var result = await bossCommand.DoAsync();
|
|
|
-
|
|
|
- var errorCode = (uint)result;
|
|
|
-
|
|
|
- if (errorCode == ErrorCode.RESPONSE_SUCCESS)
|
|
|
- {
|
|
|
- this.ErrorInfo = "禁止帐号登录成功";
|
|
|
- return;
|
|
|
- }
|
|
|
- this.ErrorInfo = string.Format("禁止帐号登录失败, error code: {0}", errorCode);
|
|
|
- }
|
|
|
-
|
|
|
- public async Task AllowAccountLogin()
|
|
|
- {
|
|
|
- ABossCommand bossCommand = new BCForbiddenAccountLogin(this.IMessageChannel)
|
|
|
- {
|
|
|
- Account = this.Account, ForbiddenLoginTime = "-1"
|
|
|
- };
|
|
|
- var result = await bossCommand.DoAsync();
|
|
|
-
|
|
|
- var errorCode = (uint)result;
|
|
|
-
|
|
|
- if (errorCode == ErrorCode.RESPONSE_SUCCESS)
|
|
|
- {
|
|
|
- this.ErrorInfo = "允许帐号登录成功";
|
|
|
- return;
|
|
|
- }
|
|
|
- this.ErrorInfo = string.Format("允许帐号登录失败, error code: {0}", errorCode);
|
|
|
+ this.ErrorInfo = string.Format("{0}, error code: {1}", forbiddenCommand, errorCode);
|
|
|
}
|
|
|
|
|
|
public async Task SendCommand()
|
|
|
- {
|
|
|
- if (this.Command.StartsWith("gm ", true, CultureInfo.CurrentCulture))
|
|
|
- {
|
|
|
- this.Command = this.Command.Substring(3);
|
|
|
+ {
|
|
|
+ if (this.Command.StartsWith("gm ", true, CultureInfo.CurrentCulture))
|
|
|
+ {
|
|
|
+ this.Command = this.Command.Substring(3);
|
|
|
}
|
|
|
ABossCommand bossCommand = new BCCommand(this.IMessageChannel)
|
|
|
{ Command = this.Command };
|
|
|
@@ -404,7 +341,7 @@ namespace Modules.Robot
|
|
|
{
|
|
|
Logger.Trace(e.ToString());
|
|
|
return;
|
|
|
- }
|
|
|
+ }
|
|
|
var smsgBossCommandResponse = (SMSG_Boss_Command_Response)result;
|
|
|
this.ErrorInfo = string.Format(" send command: {0}, error code: {1}",
|
|
|
commandString, JsonHelper.ToString(smsgBossCommandResponse));
|