本文整理汇总了C#中PacketIn.GetUint32Reversed方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.GetUint32Reversed方法的具体用法?C# PacketIn.GetUint32Reversed怎么用?C# PacketIn.GetUint32Reversed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketIn
的用法示例。
在下文中一共展示了PacketIn.GetUint32Reversed方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decrypt
public PacketIn Decrypt(PacketIn packet)
{
byte[] data = packet.ToArray();
decryption.Process(data, 4, data.Length - 4);
PacketIn result = new PacketIn(data, 0, data.Length);
result.Size = result.GetUint32Reversed();
result.Opcode = result.GetUint32Reversed();
Log.Info("[CLIENT POST-ENCRYPT]", this.DumpData(data));
return result;
}
示例2: Decrypt
public PacketIn Decrypt(PacketIn packet)
{
byte[] data = packet.ToArray();
decryption.Process(data, 4, data.Length - 4);
PacketIn result = new PacketIn(data, 0, data.Length);
result.Size = result.GetUint32Reversed();
result.Opcode = result.GetUint32Reversed();
Console.Write("Dcrptd:");
for (int i = 0; i < result.ToArray().Length; i++) Console.Write(" "+ result.ToArray()[i]);
Console.WriteLine();
return result;
}
示例3: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
LobbyClient cclient = client as LobbyClient;
UInt32 WorldUid = packet.GetUint32Reversed();
string Name = packet.GetParsedString();
PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK);
if (Databases.CharacterTable.Count(c => c.Name == Name) == 0)
{
cclient.Pending = new CharacterEntry();
cclient.Pending.Index = Databases.CharacterTable.GenerateIndex();
cclient.Pending.AccountIndex = cclient.Account.Index;
cclient.Pending.Name = Name;
cclient.Pending.World = (int)WorldUid;
cclient.Pending.Rank = 1;
cclient.Pending.Money = 0;
cclient.Pending.Threat = 1;
cclient.Pending.Playtime = 0;
cclient.Pending.Clan = "APB-EMU";
cclient.Pending.IsOnline = 0;
cclient.Pending.DistrictID = 0;
cclient.Pending.DistrictType = 0;
cclient.Pending.LFG = 0;
cclient.Pending.IsGroupPublic = 0;
cclient.Pending.GroupInvite = 0;
cclient.Pending.GroupStatus = 0;
Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
}
else
{
cclient.Pending = default(CharacterEntry);
Out.WriteUInt32Reverse((uint)ResponseCodes.RC_CHARACTER_NAME_CHECK_IN_USE);
}
cclient.Send(Out);
return 0;
}
示例4: Decrypt
public PacketIn Decrypt(PacketIn packet)
{
byte[] data = packet.ToArray();
decryption.Process(data, 4, data.Length - 4);
PacketIn result = new PacketIn(data, 0, data.Length);
result.Size = result.GetUint32Reversed();
result.Opcode = result.GetUint32Reversed();
/*
Console.Write("Dcrptd: ");
for (int i = 0; i < result.ToArray().Length; i++) Console.Write(" "+ result.ToArray()[i]);
Console.WriteLine();
*/
Log.Info("[CLIENT POST-ENCRYPT]", this.DumpData(data));
return result;
}
示例5: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
WorldClient cclient = (WorldClient)client;
UInt32 whisperuid = packet.GetUint32Reversed();
String charname = packet.GetParsedString();
String message = packet.GetParsedString();
(client as WorldClient).Send(new ANS_CHAT_WHISPER(cclient, whisperuid, charname, message));
//cclient.Send(new CHAT_WHISPER(cclient.CharacterId, 1, message));
return 0;
}
示例6: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
LobbyClient cclient = client as LobbyClient;
Byte freeSlot = GetFreeSlot(cclient);
if (freeSlot == 0) ANS_CHARACTER_CREATE.Send(cclient);
else
{
cclient.Pending.Slot = freeSlot;
cclient.Pending.Faction = packet.GetUint8();
cclient.Pending.Gender = packet.GetUint8();
cclient.Pending.Version = (Byte)packet.GetUint32Reversed();
packet.GetUint32Reversed();
Byte[] Custom = new Byte[packet.Length - packet.Position];
packet.Read(Custom, 0, Custom.Length);
cclient.Pending.Appearance = BitConverter.ToString(Custom);
Databases.CharacterTable.Add(cclient.Pending);
ANS_CHARACTER_CREATE.Send(cclient);
}
return 0;
}
示例7: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
WorldClient cclient = (WorldClient)client;
UInt32 accountId = packet.GetUint32Reversed();
Log.Debug("AskWorldEnter", "New client! Account = " + accountId);
cclient.Account = Databases.AccountTable.SingleOrDefault(a => a.Index == accountId);
cclient.Character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == accountId);
lock (Program.expectingAccounts)
{
Program.expectingAccounts.TryGetValue(accountId, out cclient.account);
}
PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER);
if (cclient.account == null) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED);
else
{
Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS);
Out.WriteUInt32Reverse(cclient.account.Character);
Out.WriteUInt32Reverse((uint)cclient.Account.RTW_Points);
Out.WriteByte(cclient.Account.IsAdmin);
Out.WriteInt64Reverse(TCPManager.GetTimeStamp());
Out.WriteFloat(5.00f);
Out.WriteByte(0);
Out.WriteByte(0);
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 1, false, Program.WorldName, cclient.account.Character.ToString()));
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 2, false, Program.WorldName, cclient.account.Character.ToString()));
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 3, false, Program.WorldName, cclient.account.Character.ToString()));
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 4, false, Program.WorldName, cclient.account.Character.ToString()));
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 5, false, Program.WorldName, cclient.account.Character.ToString()));
Out.WriteByte(1);
Out.WriteByte(cclient.Character.LFG);
}
cclient.Crypto = new TCP.Encryption(cclient.account.SessionId);
cclient.Send(new DISTRICT_LIST());
cclient.Send(Out);
lock (Program.expectingAccounts)
{
foreach (KeyValuePair<uint, Acc> a in Program.expectingAccounts)
{
if (a.Value == cclient.account)
{
Program.expectingAccounts.Remove(a.Key);
break;
}
}
}
return 0;
}
示例8: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
LobbyClient cclient = (LobbyClient)client;
byte FileId = packet.GetUint8();
UInt32 Version = packet.GetUint32Reversed();
byte[] File = new byte[packet.Length - packet.Position];
packet.Read(File, 0, File.Length);
File = ZlibMgr.Decompress(File);
Log.Debug("ConfigSave", "Config saved! FileId = " + FileId + " | Version = " + Version + " | Size = " + File.Length);
Program.FileMgr.SaveInfo((int)cclient.Account.Index, FileId, File);
PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE);
Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
Out.WriteByte(FileId);
Out.Write(File, 0, File.Length);
cclient.Send(Out);
return 0;
}
示例9: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
LobbyClient cclient = client as LobbyClient;
UInt32 WorldUid = packet.GetUint32Reversed();
string Name = packet.GetParsedString();
PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK);
if (isValid(Name) && !cclient.Characters.Exists(Name))
{
cclient.Pending = new Character();
cclient.Pending.Name = Name;
cclient.Pending.WorldId = WorldUid;
Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
}
else
{
cclient.Pending = null;
Out.WriteUInt32Reverse((uint)ResponseCodes.RC_CHARACTER_NAME_CHECK_IN_USE);
}
cclient.Send(Out);
return 0;
}
示例10: OnReceive
protected override void OnReceive(PacketIn packet)
{
lock (this)
{
if (Crypto != null)
{
PacketIn decrypted;
decrypted = Crypto.Decrypt(packet);
Server.HandlePacket(this, decrypted);
}
else
{
packet.Size = packet.GetUint32Reversed();
packet = DeCrypt(packet);
packet.Opcode = packet.GetUint32Reversed();
Server.HandlePacket(this, packet);
}
}
}
示例11: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
WorldClient cclient = (WorldClient)client;
UInt32 accountId = packet.GetUint32Reversed();
cclient.AccountId = accountId;
Log.Debug("AskWorldEnter", "New client! Account = " + accountId);
Acc account = null;
lock (Program.expectingAccounts) Program.expectingAccounts.TryGetValue(accountId, out account);
#region Character stuff
MySqlCommand cmd = new MySqlCommand("SELECT * FROM `characters` WHERE `id` = @id", WorldServer.Database.Connection.Instance);
try
{
cmd.Prepare();
cmd.Parameters.AddWithValue("@id", account.Character.ToString());
cmd.ExecuteNonQuery();
MySqlDataReader reader = cmd.ExecuteReader();
try
{
while (reader.Read())
{
cclient.CharacterId = getID(reader);
cclient.Name = getName(reader);
cclient.Faction = getFaction(reader);
cclient.Gender = getGender(reader);
cclient.Rank = getRank(reader);
cclient.Money = getMoney(reader);
cclient.Threat = getThreat(reader);
cclient.Playtime = getPlayTime(reader);
cclient.Clan = getClan(reader);
cclient.districtID = 0;
cclient.districtType = 0;
cclient.groupInvite = 0;
cclient.groupStatus = 0;
cclient.groupPublic = 0;
}
}
catch (MySqlException e) { Log.Error("MySQL", e.ToString()); }
finally { reader.Dispose(); }
}
catch (MySqlException e) { Log.Error("MySQL", e.ToString()); }
finally { cmd.Dispose(); }
#endregion
#region Account stuff
MySqlCommand cmd2 = new MySqlCommand("SELECT * FROM `accounts` WHERE `id` = @id", WorldServer.Database.Connection.Instance);
try
{
cmd2.Prepare();
cmd2.Parameters.AddWithValue("@id", accountId.ToString());
cmd2.ExecuteNonQuery();
MySqlDataReader reader2 = cmd2.ExecuteReader();
try
{
while (reader2.Read())
{
cclient.Email = getEmail(reader2);
cclient.isGM = getGm(reader2);
cclient.isBanned = getBanned(reader2);
cclient.Points = getPoints(reader2);
}
}
catch (MySqlException e) { Log.Error("MySQL", e.ToString()); }
finally { reader2.Dispose(); }
}
catch (MySqlException e) { Log.Error("MySQL", e.ToString()); }
finally { cmd2.Dispose(); }
#endregion
#region Client status
MySqlCommand cmd3 = new MySqlCommand("INSERT INTO `clientstatus` VALUES(@name, 0, 0, 1, 0, 0, 0, 0)", WorldServer.Database.Connection.Instance);
try
{
cmd3.Prepare();
cmd3.Parameters.AddWithValue("@name", cclient.Name);
cmd3.ExecuteNonQuery();
}
catch (MySqlException e) { Log.Error("MySQL", e.ToString()); }
finally { cmd3.Dispose(); }
#endregion
PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER);
if (account == null) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED);
else
{
Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS);
Out.WriteUInt32Reverse(account.Character);
Out.WriteUInt32Reverse(cclient.Points);
Out.WriteByte(cclient.isGM);
Out.WriteInt64Reverse(TCPManager.GetTimeStamp());
Out.WriteFloat(5.00f);
Out.WriteByte(0);
Out.WriteByte(0);
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 1, false, Program.WorldName, account.Character.ToString()));
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 2, false, Program.WorldName, account.Character.ToString()));
Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 3, false, Program.WorldName, account.Character.ToString()));
//.........这里部分代码省略.........
示例12: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
(client as WorldClient).Send(new ANS_FRIENDLIST_STATE(packet.GetUint32Reversed(), (client as WorldClient)));
return 0;
}
示例13: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
WorldClient cclient = (WorldClient)client;
(client as WorldClient).Send(new ANS_NAME_QUERY(packet.GetUint16Reversed(), packet.GetUint32Reversed(), packet.GetPascalString(), cclient));
return 0;
}
示例14: HandlePacket
public int HandlePacket(BaseClient client, PacketIn packet)
{
(client as WorldClient).Send(new ANS_IGNORELIST_REMOVE(packet.GetUint32Reversed()));
return 0;
}