本文整理汇总了C#中Packet.ReadBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ReadBoolean方法的具体用法?C# Packet.ReadBoolean怎么用?C# Packet.ReadBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.ReadBoolean方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleChat
public static void HandleChat(TNLConnection conn, Packet packet)
{
var type = (ChatType) packet.ReadUInteger();
var isGm = packet.ReadBoolean();
var recipient = packet.ReadUtf8StringOn(17);
var sender = packet.ReadUtf8StringOn(17);
packet.ReadPadding(1);
var msglen = packet.ReadUShort();
var msg = packet.ReadUtf8StringOn(msglen);
if (msg.StartsWith("/"))
{
if (msg.Equals("/save"))
conn.CurrentCharacter.SaveToDB();
return;
}
var pack = ConstructChatPacket(type, isGm, recipient, sender, msg);
switch (type)
{
default:
Logger.WriteLog("Unhandled ChatType in HandleChat: {0}", LogType.Error, type);
break;
}
}
示例2: HandleCreatureQueryResponse
public static void HandleCreatureQueryResponse(Packet packet)
{
Creature c = new Creature();
var entry = packet.ReadEntryKey("Entry");
if (entry.Value)
return;
c.Entry = entry.Key;
for (var i = 0; i < 4; i++)
c.Name[i] = packet.ReadCString("Name " + i);
for (var i = 0; i < 4; i++)
c.Name[i] = packet.ReadCString("Unk string " + i);
c.SubName = packet.ReadCString("Sub Name");
c.IconName = packet.ReadCString("Icon Name");
c.TypeFlags = packet.ReadEnum<CreatureTypeFlag>("Type Flags");
c.Type = packet.ReadEnum<CreatureType>("Type");
c.Family = packet.ReadEnum<CreatureFamily>("Family");
int val = packet.ReadInt32("Unk int");
c.Rank = packet.ReadEnum<CreatureRank>("Rank");
c.KillCredit1 = packet.ReadInt32("Kill Credit 1");
c.KillCredit2 = packet.ReadInt32("Kill Credit 2");
for (var i = 0; i < 4; i++)
c.DisplayIDs[i] = packet.ReadInt32("Display ID " + i);
c.HealthModifier = packet.ReadSingle("Health Modifier");
c.ManaModifier = packet.ReadSingle("Mana Modifier");
c.RacialLeader = packet.ReadBoolean("Racial Leader");
for (var i = 0; i < 6; i++)
c.QuestItems[i] = packet.ReadInt32("Quest Item " + i);
c.MovementID = packet.ReadInt32("Movement ID");
c.Exp = packet.ReadInt32("Expansion ID");
CreatureStorage.GetSingleton().Add(c);
}
示例3: HandleBroadcast
public static void HandleBroadcast(TNLConnection conn, Packet packet)
{
var type = (ChatType) packet.ReadUInteger();
var sendercoid = packet.ReadLong();
var isGm = packet.ReadBoolean();
packet.ReadPadding(1);
var msglen = packet.ReadUShort();
var sender = packet.ReadUtf8StringOn(17);
var msg = packet.ReadUtf8StringOn(msglen);
if (msg.StartsWith("/"))
{
if (msg.Equals("/save"))
conn.CurrentCharacter.SaveToDB();
return;
}
conn.CurrentCharacter.GetMap().BroadcastChat(type, ConstructBroadcastPacket(type, isGm, sender, sendercoid, msg), conn.CurrentCharacter);
}
示例4: HandleDestroyObject
public static void HandleDestroyObject(Packet packet)
{
packet.ReadGuid("GUID");
packet.ReadBoolean("Despawn Animation");
}
示例5: HandleReadyRound
private void HandleReadyRound(TcpSession session, Packet p)
{
var isReady = p.ReadBoolean();
//_logger.Debug("-C_READYROUND_REQ- IsReady: {0}", isReady);
Player player;
if (!Players.TryGetValue(session.Guid, out player))
{
session.StopListening();
return;
}
var room = player.Room;
if (room == null)
return;
if (_pluginManager.OnBeginRound(player, room)) return;
player.IsReady = isReady;
var ack = new Packet(EGamePacket.SRoomReadyAck);
ack.Write(player.AccountID);
ack.Write(isReady);
room.Broadcast(ack);
}
示例6: HandleCreateRoom
private void HandleCreateRoom(TcpSession session, Packet p)
{
Player player;
if (!Players.TryGetValue(session.Guid, out player))
{
session.StopListening();
return;
}
if (player.Channel == null || player.PublicIP == 0)
return;
var room = new Room(Rooms);
var roomID = Rooms.CreateRoomID(player.Channel.ID);
var tunnelID = Rooms.CreateTunnelID();
room.MasterID = player.AccountID;
room.ID = roomID;
room.TunnelID = tunnelID;
room.Channel = player.Channel;
room.Name = p.ReadCStringBuffer(31);
room.MatchKey = p.ReadBytes(4);
room.TimeLimit = p.ReadByte();
room.TimeLimit *= 60 * 1000;
room.ScoreLimit = p.ReadByte();
room.Unk = p.ReadInt32();
room.Password = p.ReadUInt32();
room.IsFriendly = p.ReadBoolean();
room.IsBalanced = p.ReadBoolean();
room.MinLevel = p.ReadByte();
room.MaxLevel = p.ReadByte();
room.EquipLimit = p.ReadByte();
room.IsNoIntrusion = p.ReadBoolean();
room.State = EGameRuleState.Waiting;
var cont = _pluginManager.OnCreateRoom(player, room);
Packet ack;
//_logger.Debug("-CCreateRoom- MapID: {0} Mode: {1}", room.MapID, (int)room.GameRule);
if (!GameDatabase.Instance.IsValidMapID(room.MapID))
{
Logger.Error("-CCreateRoom HAX- NOT ALLOWED MapID: {0} Mode: {1}", room.MapID, (int)room.GameRule);
ack = new Packet(EGamePacket.SResultAck);
ack.Write((uint)EServerResult.FailedToRequestTask);
session.Send(ack);
return;
}
if (room.GameRule != EGameRule.Touchdown && room.GameRule != EGameRule.Deathmatch && room.GameRule != EGameRule.Survival && cont)
{
ack = new Packet(EGamePacket.SResultAck);
ack.Write((uint)EServerResult.FailedToRequestTask);
session.Send(ack);
return;
}
Rooms.TryAdd(tunnelID, room);
ack = new Packet(EGamePacket.SDeployRoomAck);
ack.Write(room.ID);
ack.Write(room.MatchKey);
ack.Write((byte)room.State);
ack.Write(room.GetPing());
ack.WriteStringBuffer(room.Name, 31);
ack.Write(room.PublicType);
ack.Write(room.TimeLimit);
ack.Write(room.ScoreLimit);
ack.Write(room.IsFriendly);
ack.Write(room.IsBalanced);
ack.Write(room.MinLevel);
ack.Write(room.MaxLevel);
ack.Write(room.EquipLimit);
ack.Write(room.IsNoIntrusion);
player.Channel.Broadcast(ack);
room.Join(player);
}
示例7: HandleNameQueryResponse
public static void HandleNameQueryResponse(Packet packet)
{
packet.ReadPackedGuid("GUID");
var end = packet.ReadBoolean("Name Found");
if (end)
return;
packet.ReadCString("Name");
packet.ReadCString("Realm Name");
var race = packet.ReadEnum<Race>("Race");
var gender = packet.ReadEnum<Gender>("Gender");
var cClass = packet.ReadEnum<Class>("Class");
var decline = packet.ReadBoolean("Name Declined");
if (!decline)
return;
for (var i = 0; i < 5; i++)
packet.ReadCString("Declined Name " + i);
}
示例8: HandleMove
public override void HandleMove(Packet packet)
{
base.HandleMove(packet);
Acceleration = packet.ReadSingle();
Steering = packet.ReadSingle();
TurretDirection = packet.ReadSingle();
var vehFlags = packet.ReadUInteger();
var firing = packet.ReadBoolean();
var target = packet.ReadPadding(2).ReadTFID();
var targetObj = GetMap().GetObject(target);
if (targetObj != null)
SetTargetObject(targetObj);
}
示例9: ParseMonsterMovePackets
public static void ParseMonsterMovePackets(Packet packet)
{
var guid = packet.ReadPackedGuid("GUID");
if (packet.GetOpcode() == (ushort)Opcode.SMSG_MONSTER_MOVE_TRANSPORT)
{
packet.ReadPackedGuid("Transport GUID");
packet.ReadByte("Transport Seat");
}
packet.ReadBoolean("Unk Boolean");
var pos = packet.ReadVector3("Position");
packet.ReadInt32("Move Ticks");
var type = packet.ReadEnum<SplineType>("Spline Type");
switch (type)
{
case SplineType.FacingSpot:
{
packet.ReadVector3("Facing Spot");
break;
}
case SplineType.FacingTarget:
{
packet.ReadGuid("Facing GUID");
break;
}
case SplineType.FacingAngle:
{
packet.ReadSingle("Facing Angle");
break;
}
case SplineType.Stop:
{
return;
}
}
var flags = packet.ReadEnum<SplineFlag>("Spline Flags");
if (flags.HasFlag(SplineFlag.Unknown3)) {
packet.ReadEnum<MoveAnimationState>("Animation State");
packet.ReadInt32("Unk Int32 1");
}
packet.ReadInt32("Move Time");
if (flags.HasFlag(SplineFlag.Trajectory)) {
packet.ReadSingle("Unk Single");
packet.ReadInt32("Unk Int32 2");
}
var waypoints = packet.ReadInt32("Waypoints");
var newpos = packet.ReadVector3("Waypoint 0");
if (flags.HasFlag(SplineFlag.Flying) || flags.HasFlag(SplineFlag.CatmullRom)) {
for (var i = 0; i < waypoints - 1; i++) {
packet.ReadVector3("Waypoint " + (i + 1));
}
}
else {
var mid = new Vector3();
mid.X = (pos.X + newpos.X) * 0.5f;
mid.Y = (pos.Y + newpos.Y) * 0.5f;
mid.Z = (pos.Z + newpos.Z) * 0.5f;
for (var i = 0; i < waypoints - 1; i++) {
var vec = packet.ReadPackedVector3();
vec.X += mid.X;
vec.Y += mid.Y;
vec.Z += mid.Z;
Console.WriteLine("Waypoint " + (i + 1) + ": " + vec);
}
}
}
示例10: HandleMove
public virtual void HandleMove(Packet packet)
{
var fidObject = packet.ReadPadding(4).ReadTFID();
Debug.Assert(fidObject == GetTFID(), "A TFID nem egyezik?");
Position = new Vector3(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
Velocity = new Vector3(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
Rotation = new Vector4(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
AngularVelocity = new Vector3(packet.ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
Console.WriteLine("Pos: {0} | {1} | {2} ", Position.X, Position.Y, Position.Z);
Console.WriteLine("Rot: {0} | {1} | {2} | {3}", Rotation.X, Rotation.Y, Rotation.Z, Rotation.W);
var absolute = packet.ReadBoolean();
var tarLoc = new Vector3(packet.ReadPadding(3).ReadSingle(), packet.ReadSingle(), packet.ReadSingle());
packet.ReadPadding(4);
//if (GhostObject != null)
//GhostObject.SetMaskBits(2UL);
}