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
}
selected.Add(card);
trysum += card.Level;
//Logger.WriteLine(card.Id + "");
//Logger.WriteLine(trysum + " selected " + sum);
//Logger.DebugWriteLine(card.Id + "");
//Logger.DebugWriteLine(trysum + " selected " + sum);
if (trysum == sum)
{
return selected;
......@@ -384,8 +384,8 @@ namespace WindBot.Game
// try level sub
selected2.Remove(card);
trysum -= card.Level;
//Logger.WriteLine(card.Id + "");
//Logger.WriteLine(trysum + " selected2 " + sum);
//Logger.DebugWriteLine(card.Id + "");
//Logger.DebugWriteLine(trysum + " selected2 " + sum);
if (trysum == sum)
{
return selected2;
......
......@@ -146,7 +146,7 @@ namespace WindBot.Game
private void OnPlayerEnter(BinaryReader packet)
{
string name = packet.ReadUnicode(Program.PlayerNameSize);
string name = packet.ReadUnicode(20);
int pos = packet.ReadByte();
if (pos < 8)
_room.Names[pos] = name;
......@@ -230,6 +230,7 @@ namespace WindBot.Game
private void OnRetry(BinaryReader packet)
{
Connection.Close();
throw new Exception("Got MSG_RETRY.");
}
......
......@@ -16,19 +16,21 @@ namespace WindBot.Game
private string _serverHost;
private int _serverPort;
private string _roomInfos;
private short _proVersion;
private string _roomInfo;
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;
Deck = deck;
Dialog = dialog;
_serverHost = serverHost;
_serverPort = serverPort;
_roomInfos = roomInfos;
Username = Info.Name;
Deck = Info.Deck;
Dialog = Info.Dialog;
_serverHost = Info.Host;
_serverPort = Info.Port;
_roomInfo = Info.HostInfo;
_proVersion = (short)Info.Version;
}
public void Start()
......@@ -45,14 +47,14 @@ namespace WindBot.Game
private void OnConnected()
{
BinaryWriter packet = GamePacketFactory.Create(CtosMessage.PlayerInfo);
packet.WriteUnicode(Username, Program.PlayerNameSize);
packet.WriteUnicode(Username, 20);
Connection.Send(packet);
byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
packet = GamePacketFactory.Create(CtosMessage.JoinGame);
packet.Write(Program.ProVersion);
packet.Write(_proVersion);
packet.Write(junk);
packet.WriteUnicode(_roomInfos, 30);
packet.WriteUnicode(_roomInfo, 30);
Connection.Send(packet);
}
......
......@@ -8,6 +8,11 @@ namespace WindBot
{
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)
{
Console.Error.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + message);
......
This diff is collapsed.
......@@ -95,6 +95,7 @@
<Compile Include="Logger.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindBotInfo.cs" />
</ItemGroup>
<ItemGroup>
<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