Commit 09b9678c authored by mercury233's avatar mercury233

update 4 ways to run WindBot

parent ad74a5cc
This diff is collapsed.
...@@ -366,8 +366,8 @@ namespace WindBot.Game ...@@ -366,8 +366,8 @@ namespace WindBot.Game
} }
selected.Add(card); selected.Add(card);
trysum += card.Level; trysum += card.Level;
//Logger.WriteLine(card.Id + ""); //Logger.DebugWriteLine(card.Id + "");
//Logger.WriteLine(trysum + " selected " + sum); //Logger.DebugWriteLine(trysum + " selected " + sum);
if (trysum == sum) if (trysum == sum)
{ {
return selected; return selected;
...@@ -384,8 +384,8 @@ namespace WindBot.Game ...@@ -384,8 +384,8 @@ namespace WindBot.Game
// try level sub // try level sub
selected2.Remove(card); selected2.Remove(card);
trysum -= card.Level; trysum -= card.Level;
//Logger.WriteLine(card.Id + ""); //Logger.DebugWriteLine(card.Id + "");
//Logger.WriteLine(trysum + " selected2 " + sum); //Logger.DebugWriteLine(trysum + " selected2 " + sum);
if (trysum == sum) if (trysum == sum)
{ {
return selected2; return selected2;
......
...@@ -146,7 +146,7 @@ namespace WindBot.Game ...@@ -146,7 +146,7 @@ namespace WindBot.Game
private void OnPlayerEnter(BinaryReader packet) private void OnPlayerEnter(BinaryReader packet)
{ {
string name = packet.ReadUnicode(Program.PlayerNameSize); string name = packet.ReadUnicode(20);
int pos = packet.ReadByte(); int pos = packet.ReadByte();
if (pos < 8) if (pos < 8)
_room.Names[pos] = name; _room.Names[pos] = name;
...@@ -230,6 +230,7 @@ namespace WindBot.Game ...@@ -230,6 +230,7 @@ namespace WindBot.Game
private void OnRetry(BinaryReader packet) private void OnRetry(BinaryReader packet)
{ {
Connection.Close();
throw new Exception("Got MSG_RETRY."); throw new Exception("Got MSG_RETRY.");
} }
......
...@@ -16,19 +16,21 @@ namespace WindBot.Game ...@@ -16,19 +16,21 @@ namespace WindBot.Game
private string _serverHost; private string _serverHost;
private int _serverPort; private int _serverPort;
private short _proVersion;
private string _roomInfos;
private string _roomInfo;
private GameBehavior _behavior; private GameBehavior _behavior;
public GameClient(string username = "Windbot", string deck = "Blue-Eyes", string serverHost = "127.0.0.1", int serverPort = 7911, string dialog = "default", string roomInfos = "") public GameClient(WindBotInfo Info)
{ {
Username = username; Username = Info.Name;
Deck = deck; Deck = Info.Deck;
Dialog = dialog; Dialog = Info.Dialog;
_serverHost = serverHost; _serverHost = Info.Host;
_serverPort = serverPort; _serverPort = Info.Port;
_roomInfos = roomInfos; _roomInfo = Info.HostInfo;
_proVersion = (short)Info.Version;
} }
public void Start() public void Start()
...@@ -45,14 +47,14 @@ namespace WindBot.Game ...@@ -45,14 +47,14 @@ namespace WindBot.Game
private void OnConnected() private void OnConnected()
{ {
BinaryWriter packet = GamePacketFactory.Create(CtosMessage.PlayerInfo); BinaryWriter packet = GamePacketFactory.Create(CtosMessage.PlayerInfo);
packet.WriteUnicode(Username, Program.PlayerNameSize); packet.WriteUnicode(Username, 20);
Connection.Send(packet); Connection.Send(packet);
byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 }; byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
packet = GamePacketFactory.Create(CtosMessage.JoinGame); packet = GamePacketFactory.Create(CtosMessage.JoinGame);
packet.Write(Program.ProVersion); packet.Write(_proVersion);
packet.Write(junk); packet.Write(junk);
packet.WriteUnicode(_roomInfos, 30); packet.WriteUnicode(_roomInfo, 30);
Connection.Send(packet); Connection.Send(packet);
} }
......
...@@ -8,6 +8,11 @@ namespace WindBot ...@@ -8,6 +8,11 @@ namespace WindBot
{ {
Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message); Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message);
} }
public static void DebugWriteLine(string message)
{
if (Program.DebugMode)
Console.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message);
}
public static void WriteErrorLine(string message) public static void WriteErrorLine(string message)
{ {
Console.Error.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message); Console.Error.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message);
......
This diff is collapsed.
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
<Compile Include="Logger.cs" /> <Compile Include="Logger.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindBotInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
......
using System;
namespace WindBot
{
public class WindBotInfo
{
public string Name { get; set; }
public string Deck { get; set; }
public string Dialog { get; set; }
public string Host { get; set; }
public int Port { get; set; }
public string HostInfo { get; set; }
public int Version { get; set; }
public WindBotInfo()
{
Name = "WindBot";
Deck = "Blue-Eyes";
Dialog = "default";
Host = "127.0.0.1";
Port = 7911;
HostInfo = "";
Version = 0x133A;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment