Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PBServer 11.69 Source C###

Status
Not open for further replies.
Newbie Spellweaver
Joined
Jul 6, 2012
Messages
96
Reaction score
6
PBServer 11.69 Source C###


With Bomb Tutorial Fixed
For those who understand a little of Microsoft Visual Studio will leave a information for those who want to try to fix
MAP BOMB
Simple every server that has launched the PBTroll has BOMB map fixed but is missing some information and they are in flat files if you are willing to see this here as the files that u need to start
This and the file that has the MAP BOMB GameClient.cs Fixed
Now you are trying to compare with GameClient.cs your server and set equal Just that.
Good job to all who are trying !!


using System.Net.Sockets;
using System.Threading;

namespace PBServer
{
public class GameClient
{
private int _channelID = -1;
private int player_id = 0;
private bool _prepareToClose = false;
public bool networkDebug = true;
private static bool _isConnectedAviable = true;
public EndPoint _address;
public TcpClient _client;
public NetworkStream _stream;
private byte[] _buffer;
private string IPClient;

public int CRYPT_KEY { get; set; }

static GameClient()
{
}

public GameClient(TcpClient tcpClient)
{
Console.WriteLine("[GAME]: Client connected. ");
this._client = tcpClient;
this._stream = tcpClient.GetStream();
this._address = tcpClient.Client.RemoteEndPoint;
this._stream.ReadTimeout = 10000;
this.IPClient = this._address.ToString();
new Thread(new ThreadStart(this.init)).Start();
new Thread(new ThreadStart(this.read)).Start();
}

~GameClient()
{
this.close();
}

public void setAccount(int playerid)
{
this.player_id = playerid;
}

public Account getPlayer()
{
return AccountManager.getInstance().getAccountInObjectId(this.player_id) ?? (Account) null;
}

public int getPlayerId()
{
return this.player_id;
}

public void setChannelId(int id)
{
CLogger.getInstance().warning("[Game]: SET CHANNEL ID=" + id.ToString());
this._channelID = id;
}

public int getChannelId()
{
return this._channelID;
}

public void init()
{
this.sendPacket((SendBaseGamePacket) new PROTOCOL_BASE_GET_CHANNELLIST_ACK(this));
}

public string getIPString()
{
return IPAddress.Parse(this.IPClient.Split(new char[1]
{
':'
})[0]).ToString();
}

public int getCryptKey()
{
return 29890;
}

public int getID()
{
return 5404;
}

public Account restoreAccount(string acc)
{
Account account = AccountManager.getInstance().get(acc);
if (account == null)
return (Account) null;
account.setConnected(true);
this.setAccount(account.player_id);
return account;
}

public void sendPacket(SendBaseGamePacket bp)
{
try
{
if (this._prepareToClose || this._stream == null)
return;
bp.write();
byte[] numArray1 = bp.ToByteArray();
short num = Convert.ToInt16(numArray1.Length - 2);
List<byte> list = new List<byte>(numArray1.Length + 2);
list.AddRange((IEnumerable<byte>) BitConverter.GetBytes(num));
list.AddRange((IEnumerable<byte>) numArray1);
byte[] buffer = list.ToArray();
byte[] numArray2 = new byte[2]
{
buffer[2],
buffer[3]
};
if (this.networkDebug)
;
if (buffer.Length > 0)
this._stream.BeginWrite(buffer, 0, buffer.Length, new AsyncCallback(this.EndSendStaticPacket), (object) null);
}
catch (Exception ex)
{
CLogger.getInstance().info("[GAME]: read() Exception: \n" + (object) ex);
this.close();
}
}

public void EndSendStaticPacket(IAsyncResult result)
{
try
{
this._stream.EndWrite(result);
}
catch
{
}
}

public void read()
{
try
{
if (this._prepareToClose || (this._stream == null || !this._client.Connected || !this._stream.CanRead))
return;
this._buffer = new byte[2];
this._stream.BeginRead(this._buffer, 0, 2, new AsyncCallback(this.OnReceiveCallbackStatic), (object) null);
}
catch (Exception ex)
{
CLogger.getInstance().info("[GAME]: read() Exception: \n" + (object) ex);
this.close();
}
}

private void OnReceiveCallbackStatic(IAsyncResult result)
{
try
{
if (this._prepareToClose || this._stream == null || this._stream.EndRead(result) <= 0)
return;
byte num = this._buffer[0];
if (this._stream.DataAvailable)
{
this._buffer = new byte[(int) num + 2];
this._stream.BeginRead(this._buffer, 0, (int) num + 2, new AsyncCallback(this.OnReceiveCallback), result.AsyncState);
}
}
catch (Exception ex)
{
CLogger.getInstance().warning(string.Concat(new object[4]
{
(object) "[GAME]: ",
(object) this._address,
(object) " was closed by force: ",
(object) ex
}));
this.close();
}
}

public void close()
{
this._prepareToClose = true;
try
{
AccountManager.getInstance().get(this.getPlayer().name).setOnlineStatus(false);
if (this.getPlayer() != null)
{
if (this.getPlayer().getRoom() != null)
{
UdpHandler.getInstance().RemovePlayerInRoom(this.getPlayer());
ChannelInfoHolder.getChannel(this.getChannelId()).getRooms()[this.getPlayer().getRoom().getRoomId()].removePlayer(this.getPlayer());
this.getPlayer().setRoom((Room) null);
}
if (this.getChannelId() >= 0)
ChannelInfoHolder.getChannel(this.getChannelId()).removePlayer(this.getPlayer());
}
AccountManager.getInstance().get(this.getPlayer().name).setClient((GameClient) null);
GameClientManager.getInstance().removeClient(this);
if (this._client.Connected)
{
this._client.Close();
this._stream = (NetworkStream) null;
}
CLogger.getInstance().info("[GAME]: Player disconnected.");
}
catch (Exception ex)
{
CLogger.getInstance().warning(ex.ToString());
}
}

private void OnReceiveCallback(IAsyncResult result)
{
try
{
this._stream.EndRead(result);
byte[] data = new byte[this._buffer.Length];
this._buffer.CopyTo((Array) data, 0);
if (data.Length >= 2)
this.handlePacket(this.decryptC(data, data.Length));
new Thread(new ThreadStart(this.read)).Start();
}
catch
{
}
}

public void setShift(int key)
{
this.CRYPT_KEY = key;
}

public int getShift()
{
return this.CRYPT_KEY;
}

public byte[] decryptC(byte[] data, int length)
{
int id = this.getID();
int cryptKey = this.getCryptKey();
int num = this.getShift();
if (num <= 0)
{
num = (id + cryptKey) % 7 + 1;
this.setShift(num);
}
byte[] numArray = data;
byte[] data1 = new byte[data.Length];
Array.Copy((Array) numArray, 0, (Array) data1, 0, data1.Length);
return GameClient.decrypt(data1, num);
}

public static byte[] decrypt(byte[] data, int shift)
{
byte num = data[data.Length - 1];
for (int index = data.Length - 1; index > 0; --index)
data[index] = (byte) (((int) data[index - 1] & (int) byte.MaxValue) << 8 - shift | ((int) data[index] & (int) byte.MaxValue) >> shift);
data[0] = (byte) ((int) num << 8 - shift | ((int) data[0] & (int) byte.MaxValue) >> shift);
return data;
}

private void handlePacket(byte[] buff)
{
ushort num1 = BitConverter.ToUInt16(new byte[2]
{
buff[0],
buff[1]
}, 0);
BitConverter.ToString(buff).Replace("-", " ");
if (this.networkDebug)
{
string[] strArray = BitConverter.ToString(buff).Split('-', ',', '.', ':', '\t');
string str1 = "";
foreach (string str2 in strArray)
str1 = str1 + "0x" + str2 + " ";
}
List<ReceiveBaseGamePacket> list = new List<ReceiveBaseGamePacket>();
if (!GameClient._isConnectedAviable)
return;
ushort num2 = num1;
if ((uint) num2 <= 3075U)
{
if ((uint) num2 <= 2627U)
{
if ((uint) num2 <= 1451U)
{
switch (num2)
{
case (ushort) 544:
list.Add((ReceiveBaseGamePacket)new PROTOCOL_WINDOW_ACTIVE_REQ(this, buff));
goto label_67;
case (ushort) 1416:
list.Add((ReceiveBaseGamePacket)new PROTOCOL_WINDOW_ACTIVE_REQ(this, buff));
goto label_67;
case (ushort) 1441:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_CS_CLAN_LOGIN_REQ(this, buff));
goto label_67;
case (ushort)1451:
list.Add((ReceiveBaseGamePacket)new PBServer.network.Game.packets.clientpackets.opcode_1451_REQ(this, buff));
goto label_67;
case (ushort) 1443:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_CS_CLAN_LOGOUT_REQ(this, buff));
goto label_67;
case (ushort)1446:
list.Add((ReceiveBaseGamePacket)new opcode_1446_REQ(this, buff));
goto label_67;
case (ushort)1447:
list.Add((ReceiveBaseGamePacket)new opcode_1447_REQ(this, buff));
goto label_67;

}
}
else
{
switch (num2)
{
case (ushort)2568:
list.Add((ReceiveBaseGamePacket)new opcode_2568_REQ(this, buff));
goto label_67;
case (ushort) 2571:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BASE_ENTER_CHANNELSELECT_REQ(this, buff));
goto label_67;
case (ushort) 2573:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_SERVER_MESSAGE_ANNOUNCE_REQ(this, buff));
goto label_67;
case (ushort) 2575:
case (ushort) 2581:
goto label_67;
case (ushort) 2579:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BASE_USER_ENTER_REQ(this, buff));
goto label_67;
case (ushort) 2627:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_CHATTING_REQ(this, buff));
goto label_67;
}
}
}
else if ((uint) num2 <= 2819U)
{
switch (num2)
{
case (ushort) 2641:
goto label_67;
case (ushort) 2653:
list.Add((ReceiveBaseGamePacket) new opcode_2653_REQ(this, buff));
goto label_67;

case (ushort) 2817:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_ENTER_REQ(this, buff));
goto label_67;
case (ushort) 2819:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_GET_ROOMLIST_REQ(this, buff));
goto label_67;
}
}
else
{
switch (num2)
{
case (ushort) 2825:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_CREATE_ROOM_REQ(this, buff));
goto label_67;
case (ushort) 2827:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_JOIN_ROOM_REQ(this, buff));
goto label_67;
case (ushort) 2829:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_LEAVE_REQ(this, buff));
goto label_67;
case (ushort) 2831:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_CREATE_NICK_NAME_REQ(this, buff));
goto label_67;
case (ushort) 2835:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_GET_ROOMINFO_REQ(this, buff));
goto label_67;
case (ushort) 3073:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_INVENTORY_ENTER_REQ(this, buff));
goto label_67;
case (ushort) 3075:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_INVENTORY_LEAVE_REQ(this, buff));
goto label_67;
}
}
}
else if ((uint) num2 <= 3650U)
{
if ((uint) num2 <= 3600U)
{
switch (num2)
{
case (ushort) 3329:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_SHOP_ENTER_REQ(this, buff));
//list.Add((ReceiveBaseGamePacket) new unk_REQ_1(this, buff));
goto label_67;
case (ushort) 3331:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_SHOP_LEAVE_REQ(this, buff));
goto label_67;
case (ushort) 3333:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_LOBBY_SHOP_LIST_REQ(this, buff));
goto label_67;
case (ushort) 3593:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_ROOM_CHANGE_PASS_REQ(this, buff));
goto label_67;
case (ushort) 3595:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_ROOM_CLOSE_SLOT_REQ(this, buff));
goto label_67;
case (ushort) 3600:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_ROOM_CHANGE_TEAM_REQ(this, buff));
goto label_67;
}
}
else
{
switch (num2)
{
case (ushort) 3610:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BASE_ENTER_PROFILE_REQ(this, buff));
goto label_67;
case (ushort) 3612:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BASE_LEAVE_PROFILE_REQ(this, buff));
goto label_67;
case (ushort) 3632:
goto label_67;
case (ushort) 3650:
list.Add((ReceiveBaseGamePacket) new opcode_3650_REQ(this, buff));
goto label_67;
}
}
}
else if ((uint) num2 <= 3860U)
{
switch (num2)
{
case (ushort) 3843:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_READYBATTLE_REQ(this, buff));
goto label_67;
case (ushort) 3845:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_PRESTARTBATTLE_REQ(this, buff));
goto label_67;
case (ushort) 3847:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_STARTBATTLE_REQ(this, buff));
goto label_67;
case (ushort) 3849:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_ENDBATTLE_REQ(this, buff));
goto label_67;
case (ushort) 3853:
list.Add((ReceiveBaseGamePacket) new opcode_3853_REQ(this, buff));
goto label_67;
case (ushort) 3855:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_RESPAWN_REQ(this, buff));
goto label_67;
case (ushort) 3860:
list.Add((ReceiveBaseGamePacket) new opcode_3860_REQ(this, buff));
goto label_67;
}
}
else if ((uint) num2 <= 3884U)
{
switch (num2)
{
case (ushort) 3870:
list.Add((ReceiveBaseGamePacket) new opcode_3870_REQ(this, buff));<---BOMB MAP
goto label_67;
case (ushort) 3872:
list.Add((ReceiveBaseGamePacket) new opcode_3872_REQ(this, buff));<---BOMB MAP
goto label_67;
case (ushort) 3884:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_TIMERSYNC_REQ(this, buff));
goto label_67;
}
}
else
{
switch (num2)
{
case (ushort) 3890:
list.Add((ReceiveBaseGamePacket) new opcode_3890_REQ(this, buff));
goto label_67;
case (ushort) 3892:
list.Add((ReceiveBaseGamePacket) new PROTOCOL_BATTLE_GIVEUPBATTLE_REQ(this, buff));
goto label_67;
case (ushort) 3906:
list.Add((ReceiveBaseGamePacket) new opcode_3906_REQ(this, buff));
goto label_67;
}
}
CLogger.getInstance().warning("[GAME]: received unk request " + (object) num1);
label_67:
if (list == null || list.ToArray().Length <= 0)
return;
foreach (ReceiveBaseGamePacket receiveBaseGamePacket in list)
ThreadManager.runNewThread(new Thread(new ThreadStart(receiveBaseGamePacket.run)));
}
}
}
 
Newbie Spellweaver
Joined
Dec 25, 2014
Messages
74
Reaction score
11
pvp 8x8 working? and link please... :closedeyes:
 
Status
Not open for further replies.
Back
Top