本文整理汇总了C#中SharpTibiaProxy.Network.InMessage.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# InMessage.ReadByte方法的具体用法?C# InMessage.ReadByte怎么用?C# InMessage.ReadByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpTibiaProxy.Network.InMessage
的用法示例。
在下文中一共展示了InMessage.ReadByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseClientSay
private void ParseClientSay(InMessage message)
{
string receiver = null;
ushort channelId = 0;
MessageClasses type = (MessageClasses)message.ReadByte();
switch (type)
{
case MessageClasses.PRIVATE_TO:
case MessageClasses.GAMEMASTER_PRIVATE_TO:
receiver = message.ReadString();
break;
case MessageClasses.CHANNEL:
case MessageClasses.CHANNEL_HIGHLIGHT:
case MessageClasses.GAMEMASTER_CHANNEL:
channelId = message.ReadUShort();
break;
default:
break;
}
string text = message.ReadString();
client.Chat.OnPlayerSpeak(receiver, channelId, type, text);
}
示例2: OpenTibiaDecrypt
public static void OpenTibiaDecrypt(InMessage msg)
{
if (msg.Size - msg.ReadPosition != 128)
throw new Exception("Invalid message size.");
var decrypted = openTibiaDecryptEngine.ProcessBlock(msg.Buffer, msg.ReadPosition, 128);
var padSize = 128 - decrypted.Length;
if (padSize > 0)
Array.Clear(msg.Buffer, msg.ReadPosition, padSize);
else
padSize = 0;
Array.Copy(decrypted, 0, msg.Buffer, msg.ReadPosition + padSize, decrypted.Length);
if (msg.ReadByte() != 0)
throw new Exception("Invalid decrypted message.");
msg.Encrypted = false;
}
示例3: ParseClientMessage
public void ParseClientMessage(InMessage message)
{
var packetStart = 0;
try
{
packetStart = message.ReadPosition;
byte cmd = message.ReadByte();
switch (cmd)
{
case 0x96:
ParseClientSay(message);
break;
}
}
catch (Exception ex)
{
Trace.TraceWarning(ex.Message + "\nPacket Bytes: " + message.Buffer.ToHexString(packetStart, message.ReadPosition - packetStart));
}
}
示例4: ParseClientMessage
public void ParseClientMessage(InMessage message)
{
var packetStart = 0;
try
{
packetStart = message.ReadPosition;
byte cmd = message.ReadByte();
switch (cmd)
{
case 0x96:
ParseClientSay(message);
break;
case 0xF4://244
ParseClientMarketLeave(message);
break;
case 0xF5://245
ParseClientMarketBrowse(message);
break;
case 0xF6://246
ParseClientMarketCreate(message);
break;
case 0xF7://247
ParseClientMarketCancel(message);
break;
case 0xF8://248
ParseClientMarketAccept(message);
break;
}
}
catch (Exception ex)
{
Trace.TraceWarning(ex.Message + "\nPacket Bytes: " + message.Buffer.ToHexString(packetStart, message.ReadPosition - packetStart));
}
}
示例5: ParseServerInventoryResetSlot
private void ParseServerInventoryResetSlot(InMessage message)
{
var slot = message.ReadByte();
}
示例6: ParseServerCloseContainer
private void ParseServerCloseContainer(InMessage message)
{
var cid = message.ReadByte();
}
示例7: ParseServerHouseTextWindow
private void ParseServerHouseTextWindow(InMessage message)
{
var unk = message.ReadByte();
var windowId = message.ReadUInt();
var text = message.ReadString();
}
示例8: ParseInitialize
private void ParseInitialize(InMessage message)
{
if (minorVersion >= 10)
message.ReadByte(); //?
int count = message.ReadUShort();
for (int i = 0; i < count; i++)
{
var creature = new Creature(message.ReadUInt());
creature.Type = (CreatureType)message.ReadByte();
creature.Name = message.ReadString();
//Trace.WriteLine(String.Format("Creature[{0}]: {1}", i, creature.Name));
creature.Health = message.ReadByte();
var direction = (Direction)message.ReadByte();
creature.LookDirection = direction;
creature.TurnDirection = direction;
//Outfit
creature.Outfit = message.ReadOutfit();
creature.LightLevel = message.ReadByte();
creature.LightColor = message.ReadByte();
creature.Speed = message.ReadUShort();
creature.Skull = message.ReadByte();
creature.Shield = message.ReadByte();
creature.Emblem = message.ReadByte();
creature.IsImpassable = message.ReadByte() == 0x01;
//10.20+ includes an extra 4 bytes per creature
//These bytes could alter the read order, but since I don't know what they are for yet, I'll read them out of the way.
message.ReadUInt();
//speech category?
if (client.Version.Number >= ClientVersion.Version1036.Number)
message.ReadByte();
client.BattleList.AddCreature(creature);
}
ParseTibiaPackets(message);
}
示例9: ParseTibiaPacket
private void ParseTibiaPacket(InMessage message)
{
var cmd = message.ReadByte();
switch (cmd)
{
case 0x6C:
case 0x6D:
var location = message.ReadLocation();
var stack = message.ReadByte();
if (location.IsCreature && !client.BattleList.ContainsCreature(location.GetCretureId(stack)))
return;
break;
}
message.ReadPosition = 0;
client.ProtocolWorld.ParseServerMessage(message);
}
示例10: ParseServerMarketBrowser
private void ParseServerMarketBrowser(InMessage message)
{
ushort num = message.ReadUShort();
if (num == 65535)
{
var count = message.ReadUInt();
for (int i = 0; i < count; i++)
{
message.ReadUInt();
message.ReadUShort();
message.ReadUShort();
message.ReadUShort();
message.ReadUInt();
message.ReadByte();
}
count = message.ReadUInt();
for (int j = 0; j <= count; j++)
{
message.ReadUInt();
message.ReadUShort();
message.ReadUShort();
message.ReadUShort();
message.ReadUInt();
message.ReadByte();
}
}
else if (num == 65534)
{
var count = message.ReadUInt();
for (int k = 0; k <= count; k++)
{
message.ReadUInt();
message.ReadUShort();
message.ReadUShort();
message.ReadUShort();
message.ReadUInt();
}
count = message.ReadUInt();
for (int l = 0; l <= count; l++)
{
message.ReadUInt();
message.ReadUShort();
message.ReadUShort();
message.ReadUShort();
message.ReadUInt();
}
}
else
{
var count = message.ReadUInt();
for (int m = 0; m < count; m++)
{
message.ReadUInt();
message.ReadUShort();
message.ReadUShort();
message.ReadUInt();
message.ReadString();
}
count = message.ReadUInt();
for (int n = 0; n < count; n++)
{
message.ReadUInt();
message.ReadUShort();
message.ReadUShort();
message.ReadUInt();
message.ReadString();
}
}
}
示例11: ParseServerMarketEnter
private void ParseServerMarketEnter(InMessage message)
{
message.ReadUInt();
message.ReadByte();
var num = message.ReadUShort();
for (int i = 0; i < num; i++)
message.ReadUInt();
}
示例12: ParseServerCreatureMove
private void ParseServerCreatureMove(InMessage message)
{
Location oldLocation = message.ReadLocation();
var oldStack = message.ReadByte();
Location newLocation = message.ReadLocation();
if (oldLocation.IsCreature)
{
var creatureId = oldLocation.GetCretureId(oldStack);
Creature creature = client.BattleList.GetCreature(creatureId);
if (creature == null)
throw new Exception("[ParseServerCreatureMove] Creature not found on battle list.");
var tile = client.Map.GetTile(newLocation);
if (tile == null)
throw new Exception("[ParseServerCreatureMove] New tile not found.");
tile.AddThing(creature);
client.Map.SetTile(tile);
}
else
{
Tile tile = client.Map.GetTile(oldLocation);
if (tile == null)
throw new Exception("[ParseServerCreatureMove] Old tile not found.");
Thing thing = tile.GetThing(oldStack);
Creature creature = thing as Creature;
if (creature == null)
return; //The client will send update tile.
tile.RemoveThing(oldStack);
client.Map.SetTile(tile);
tile = client.Map.GetTile(newLocation);
if (tile == null)
throw new Exception("[ParseServerCreatureMove] New tile not found.");
tile.AddThing(creature);
client.Map.SetTile(tile);
//update creature direction
if (oldLocation.X > newLocation.X)
{
creature.LookDirection = Direction.DIRECTION_WEST;
creature.TurnDirection = Direction.DIRECTION_WEST;
}
else if (oldLocation.X < newLocation.X)
{
creature.LookDirection = Direction.DIRECTION_EAST;
creature.TurnDirection = Direction.DIRECTION_EAST;
}
else if (oldLocation.Y > newLocation.Y)
{
creature.LookDirection = Direction.DIRECTION_NORTH;
creature.TurnDirection = Direction.DIRECTION_NORTH;
}
else if (oldLocation.Y < newLocation.Y)
{
creature.LookDirection = Direction.DIRECTION_SOUTH;
creature.TurnDirection = Direction.DIRECTION_SOUTH;
}
}
}
示例13: ParseServerCreaturePassable
private void ParseServerCreaturePassable(InMessage message)
{
var creatureID = message.ReadUInt();
var impassable = message.ReadByte();
}
示例14: ParseServerCreatureHealth
private void ParseServerCreatureHealth(InMessage message)
{
var creatureID = message.ReadUInt();
var percent = message.ReadByte();
}
示例15: ParseServerCreatureLight
private void ParseServerCreatureLight(InMessage message)
{
var creatureID = message.ReadUInt();
var level = message.ReadByte();
var color = message.ReadByte();
}