本文整理汇总了C#中Framework.Network.Packets.PacketReader.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadUInt32方法的具体用法?C# PacketReader.ReadUInt32怎么用?C# PacketReader.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework.Network.Packets.PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePong
public static void HandlePong(ref PacketReader packet, ref WorldClass session)
{
uint sequence = packet.ReadUInt32();
uint latency = packet.ReadUInt32();
PacketWriter pong = new PacketWriter(JAMCCMessage.Pong);
pong.WriteUInt32(sequence);
session.Send(ref pong);
}
示例2: HandleSetSpecialization
//[Opcode(ClientMessage.SetSpecialization, "16357")]
public static void HandleSetSpecialization(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
uint specGroupId = packet.ReadUInt32();
uint specId = SpecializationMgr.GetSpecIdByGroup(pChar, (byte)specGroupId);
// check if new spec is primary or secondary
if (pChar.SpecGroupCount == 1 && pChar.PrimarySpec == 0)
{
pChar.ActiveSpecGroup = 0;
pChar.PrimarySpec = (ushort)specId;
}
else
{
pChar.ActiveSpecGroup = 1;
pChar.SecondarySpec = (ushort)specId;
pChar.SpecGroupCount = (byte)(pChar.SpecGroupCount + 1);
}
SpecializationMgr.SaveSpecInfo(pChar);
SendSpecializationSpells(ref session);
HandleTalentUpdate(ref session);
pChar.SetUpdateField<Int32>((int)PlayerFields.CurrentSpecID, (int)pChar.GetActiveSpecId());
ObjectHandler.HandleUpdateObjectValues(ref session);
Log.Message(LogType.DEBUG, "Character (Guid: {0}) choosed spectialization {1} for spec group {2}.", pChar.Guid, pChar.GetActiveSpecId(), pChar.ActiveSpecGroup);
}
示例3: HandleCreateCharacter
public static void HandleCreateCharacter(ref PacketReader packet, WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
packet.Skip(1);
var facialHair = packet.ReadByte();
var skin = packet.ReadByte();
var race = packet.ReadByte();
var hairStyle = packet.ReadByte();
var pClass = packet.ReadByte();
var face = packet.ReadByte();
var gender = packet.ReadByte();
var hairColor = packet.ReadByte();
var nameLength = BitUnpack.GetBits<uint>(6);
var hasUnknown = BitUnpack.GetBit();
var name = Character.NormalizeName(packet.ReadString(nameLength));
if (hasUnknown)
packet.ReadUInt32();
var result = DB.Characters.Select("SELECT * from characters WHERE name = ?", name);
var createChar = new PacketWriter(ServerMessage.CreateChar);
if (result.Count != 0)
{
// Name already in use
createChar.WriteUInt8(0x32);
session.Send(ref createChar);
return;
}
result = DB.Characters.Select("SELECT map, zone, posX, posY, posZ, posO FROM character_creation_data WHERE race = ? AND class = ?", race, pClass);
if (result.Count == 0)
{
createChar.WriteUInt8(0x31);
session.Send(ref createChar);
return;
}
var map = result.Read<uint>(0, "map");
var zone = result.Read<uint>(0, "zone");
var posX = result.Read<float>(0, "posX");
var posY = result.Read<float>(0, "posY");
var posZ = result.Read<float>(0, "posZ");
var posO = result.Read<float>(0, "posO");
// Allow declined names for now
var characterFlags = CharacterFlag.Decline;
DB.Characters.Execute("INSERT INTO characters (name, accountid, realmId, race, class, gender, skin, zone, map, x, y, z, o, face, hairstyle, haircolor, facialhair, characterFlags) VALUES (" +
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
name, session.Account.Id, WorldConfig.RealmId, race, pClass, gender, skin, zone, map, posX, posY, posZ, posO, face, hairStyle, hairColor, facialHair, characterFlags);
// Success
createChar.WriteUInt8(0x2F);
session.Send(ref createChar);
}
示例4: HandleLoadingScreenNotify
public static void HandleLoadingScreenNotify(ref PacketReader packet, ref WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
uint mapId = packet.ReadUInt32();
bool loadingScreenState = BitUnpack.GetBit();
Log.Message(LogType.DEBUG, "Loading screen for map '{0}' is {1}.", mapId, loadingScreenState ? "enabled" : "disabled");
}
示例5: HandleAreatrigger
public static void HandleAreatrigger(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
uint triggerId = packet.ReadUInt32();
AreaTrigger areaTrigger = DBCStorage.AreaTriggerStorage[triggerId];
Log.Message(LogType.DEBUG, "Character (Guid: {0}) reached Areatrigger Id: {1}.", pChar.Guid, areaTrigger.Id);
}
示例6: HandleItemItemNameQuery
public static void HandleItemItemNameQuery(ref PacketReader packet, ref WorldClass session)
{
uint itemID = packet.ReadUInt32();//this from old structure
Item pItem = Globals.ItemMgr.FindData(itemID);
if (pItem != null)
{
SendItemNameQueryResponse(session,pItem);
}
}
示例7: HandleDisconnectReason
public static void HandleDisconnectReason(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
uint disconnectReason = packet.ReadUInt32();
if (pChar != null)
WorldMgr.DeleteSession(pChar.Guid);
DB.Realms.Execute("UPDATE accounts SET online = 0 WHERE id = ?", session.Account.Id);
Log.Message(LogType.DEBUG, "Account with Id {0} disconnected. Reason: {1}", session.Account.Id, disconnectReason);
}
示例8: HandleRealmSplitStateResponse
public static void HandleRealmSplitStateResponse(ref PacketReader packet, ref WorldClass session)
{
uint realmSplitState = 0;
PacketWriter realmSplitStateResp = new PacketWriter(LegacyMessage.RealmSplitStateResponse);
realmSplitStateResp.WriteUInt32(packet.ReadUInt32());
realmSplitStateResp.WriteUInt32(realmSplitState);
realmSplitStateResp.WriteCString("01/01/01");
session.Send(ref realmSplitStateResp);
}
示例9: HandleAreatrigger
public static void HandleAreatrigger(ref PacketReader packet, ref WorldClass session)
{
var pChar = session.Character;
uint triggerId = packet.ReadUInt32();
AreaTrigger areaTrigger = DBCStorage.AreaTriggerStorage[triggerId];
Areatrigger_Teleport tele = Globals.DataMgr.FindAreatrigger_Tele((int)triggerId);
if (tele != null)
{
//todo check level and more
session.Character.session.Character.TeleportTo(tele.Target_Pos, tele.TargetMap);
}
Log.Message(LogType.DEBUG, "Character (Guid: {0}) reached Areatrigger Id: {1}.", pChar.Guid, areaTrigger.Id);
}
示例10: HandleDBQueryBulk
public static void HandleDBQueryBulk(ref PacketReader packet, ref WorldClass session)
{
var type = (DBTypes)packet.ReadUInt32();
var unknown = packet.ReadInt32();
var id = packet.ReadInt32();
switch (type)
{
case DBTypes.BroadcastText:
{
var broadCastText = GossipMgr.GetBroadCastText<Creature>(id);
PacketWriter dbReply = new PacketWriter(JAMCMessage.DBReply);
BitPack BitPack = new BitPack(dbReply);
var textLength = broadCastText.Text.Length;
var alternativeTextLength = broadCastText.AlternativeText.Length;
var size = 48;
if (textLength == 0 || alternativeTextLength == 0)
size += 1;
size += textLength + alternativeTextLength;
dbReply.WriteUInt32((uint)size);
dbReply.WriteInt32(broadCastText.Id);
dbReply.WriteInt32(broadCastText.Language);
dbReply.WriteUInt16((ushort)broadCastText.Text.Length);
dbReply.WriteString(broadCastText.Text);
dbReply.WriteUInt16((ushort)broadCastText.AlternativeText.Length);
dbReply.WriteString(broadCastText.AlternativeText);
broadCastText.Emotes.ForEach(emote => dbReply.WriteInt32(emote));
dbReply.WriteUInt32(1);
dbReply.WriteUInt32(0); // UnixTime, last change server side
dbReply.WriteUInt32((uint)DBTypes.BroadcastText);
dbReply.WriteInt32(broadCastText.Id);
session.Send(ref dbReply);
break;
}
}
}
示例11: HandleRealmCache
public static void HandleRealmCache(ref PacketReader packet, ref WorldClass session)
{
Character pChar = session.Character;
uint realmId = packet.ReadUInt32();
SQLResult result = DB.Realms.Select("SELECT name FROM realms WHERE id = '{0}'", WorldConfig.RealmId);
string realmName = result.Read<string>(0, "Name");
PacketWriter nameCache = new PacketWriter(LegacyMessage.RealmCache);
nameCache.WriteUInt32(realmId);
nameCache.WriteUInt8(0); // < 0 => End of packet
nameCache.WriteUInt8(1); // Unknown
nameCache.WriteCString(realmName);
nameCache.WriteCString(realmName);
session.Send(nameCache);
}
示例12: HandleNameCache
public static void HandleNameCache(ref PacketReader packet, ref WorldClass session)
{
Character pChar = session.Character;
ulong guid = packet.ReadUInt64();
uint realmId = packet.ReadUInt32();
PacketWriter nameCache = new PacketWriter(LegacyMessage.NameCache);
nameCache.WriteGuid(guid);
nameCache.WriteUInt8(0);
nameCache.WriteCString(pChar.Name);
nameCache.WriteUInt32(realmId);
nameCache.WriteUInt8(pChar.Race);
nameCache.WriteUInt8(pChar.Gender);
nameCache.WriteUInt8(pChar.Class);
nameCache.WriteUInt8(0);
session.Send(nameCache);
}
示例13: HandleRealmSplit
public static void HandleRealmSplit(ref PacketReader packet, ref WorldClass session)
{
uint realmSplitState = 0;
var date = "01/01/01";
PacketWriter realmSplit = new PacketWriter(ServerMessage.RealmSplit);
BitPack BitPack = new BitPack(realmSplit);
realmSplit.WriteUInt32(packet.ReadUInt32());
realmSplit.WriteUInt32(realmSplitState);
BitPack.Write(date.Length, 15);
realmSplit.WriteString(date);
session.Send(ref realmSplit);
// Crash!!!
// Wrong data sent...
// AddonMgr.WriteAddonData(ref session);
}
示例14: HandleNameCache
public static void HandleNameCache(ref PacketReader packet, ref WorldClass session)
{
ulong guid = packet.ReadUInt64();
uint realmId = packet.ReadUInt32();
var pSession = WorldMgr.GetSession(guid);
if (pSession != null)
{
var pChar = pSession.Character;
if (pChar != null)
{
PacketWriter nameCache = new PacketWriter(LegacyMessage.NameCache);
nameCache.WriteGuid(guid);
nameCache.WriteUInt8(0);
nameCache.WriteCString(pChar.Name);
nameCache.WriteUInt32(realmId);
nameCache.WriteUInt8(pChar.Race);
nameCache.WriteUInt8(pChar.Gender);
nameCache.WriteUInt8(pChar.Class);
nameCache.WriteUInt8(0);
session.Send(ref nameCache);
}
}
}
示例15: HandleMoveStopTurn
public static void HandleMoveStopTurn(ref PacketReader packet, ref WorldClass session)
{
ObjectMovementValues movementValues = new ObjectMovementValues();
BitUnpack BitUnpack = new BitUnpack(packet);
bool[] guidMask = new bool[8];
byte[] guidBytes = new byte[8];
Vector4 vector = new Vector4()
{
X = packet.ReadFloat(),
Z = packet.ReadFloat(),
Y = packet.ReadFloat()
};
bool HasTime = !BitUnpack.GetBit();
guidMask[5] = BitUnpack.GetBit();
bool Unknown = BitUnpack.GetBit();
movementValues.IsTransport = BitUnpack.GetBit();
bool Unknown2 = BitUnpack.GetBit();
guidMask[3] = BitUnpack.GetBit();
bool HasSplineElevation = !BitUnpack.GetBit();
guidMask[0] = BitUnpack.GetBit();
bool HasPitch = !BitUnpack.GetBit();
uint counter = BitUnpack.GetBits<uint>(24);
guidMask[1] = BitUnpack.GetBit();
guidMask[7] = BitUnpack.GetBit();
movementValues.HasMovementFlags = !BitUnpack.GetBit();
movementValues.IsAlive = !BitUnpack.GetBit();
guidMask[2] = BitUnpack.GetBit();
guidMask[6] = BitUnpack.GetBit();
movementValues.HasRotation = !BitUnpack.GetBit();
bool Unknown3 = BitUnpack.GetBit();
movementValues.HasMovementFlags2 = !BitUnpack.GetBit();
bool Unknown4 = BitUnpack.GetBit();
guidMask[4] = BitUnpack.GetBit();
/*if (movementValues.IsTransport)
{
}
if (IsInterpolated)
{
}*/
if (movementValues.HasMovementFlags)
movementValues.MovementFlags = (MovementFlag)BitUnpack.GetBits<uint>(30);
if (movementValues.HasMovementFlags2)
movementValues.MovementFlags2 = (MovementFlag2)BitUnpack.GetBits<uint>(13);
if (guidMask[6]) guidBytes[6] = (byte)(packet.ReadUInt8() ^ 1);
if (guidMask[0]) guidBytes[0] = (byte)(packet.ReadUInt8() ^ 1);
if (guidMask[5]) guidBytes[5] = (byte)(packet.ReadUInt8() ^ 1);
for (int i = 0; i < counter; i++)
packet.ReadUInt32();
if (guidMask[1]) guidBytes[1] = (byte)(packet.ReadUInt8() ^ 1);
if (guidMask[7]) guidBytes[7] = (byte)(packet.ReadUInt8() ^ 1);
if (guidMask[3]) guidBytes[3] = (byte)(packet.ReadUInt8() ^ 1);
if (guidMask[4]) guidBytes[4] = (byte)(packet.ReadUInt8() ^ 1);
if (guidMask[2]) guidBytes[2] = (byte)(packet.ReadUInt8() ^ 1);
/*if (movementValues.IsTransport)
{
}*/
if (movementValues.HasRotation)
vector.W = packet.ReadFloat();
if (movementValues.IsAlive)
movementValues.Time = packet.ReadUInt32();
/*if (IsInterpolated)
{
}*/
if (HasPitch)
//.........这里部分代码省略.........