本文整理汇总了C#中UltimaXNA.Core.Network.PacketReader.ReadUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadUInt16方法的具体用法?C# PacketReader.ReadUInt16怎么用?C# PacketReader.ReadUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UltimaXNA.Core.Network.PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadUInt16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjectInfoPacket
public ObjectInfoPacket(PacketReader reader)
: base(0x1A, "ObjectInfoPacket")
{
Serial = reader.ReadInt32();
ItemID = reader.ReadUInt16();
Amount = (ushort)(((Serial & 0x80000000) == 0x80000000) ? reader.ReadUInt16() : 0);
X = reader.ReadInt16();
Y = reader.ReadInt16();
Direction = (byte)(((X & 0x8000) == 0x8000) ? reader.ReadByte() : 0);
Z = reader.ReadSByte();
Hue = (ushort)(((Y & 0x8000) == 0x8000) ? reader.ReadUInt16() : 0);
Flags = (byte)(((Y & 0x4000) == 0x4000) ? reader.ReadByte() : 0);
// sanitize values
Serial = (int)(Serial & 0x7FFFFFFF);
ItemID = (ushort)(ItemID & 0x7FFF);
X = (short)(X & 0x7FFF);
Y = (short)(Y & 0x3FFF);
}
示例2: OpenContainerPacket
public OpenContainerPacket(PacketReader reader)
: base(0x24, "Open Container")
{
m_serial = reader.ReadInt32();
m_gumpId = reader.ReadUInt16();
reader.ReadUInt16();
}
示例3: ObjectPropertyListPacket
public ObjectPropertyListPacket(PacketReader reader)
: base(0xD6, "Object Property List")
{
reader.ReadInt16(); // Always 0x0001
m_serial = reader.ReadInt32();
reader.ReadInt16(); // Always 0x0000
m_hash = reader.ReadInt32();
m_clilocs = new List<int>();
m_arguments = new List<string>();
// Loop of all the item/creature's properties to display in the order to display them. The name is always the first entry.
int clilocId = reader.ReadInt32();
while (clilocId != 0)
{
m_clilocs.Add(clilocId);
int textLength = reader.ReadUInt16();
string args = string.Empty;
if (textLength > 0)
{
args = reader.ReadUnicodeStringReverse(textLength / 2);
}
m_arguments.Add(args);
clilocId = reader.ReadInt32();
}
}
示例4: ContainerContentPacket
public ContainerContentPacket(PacketReader reader)
: base(0x3C, "Container ContentPacket")
{
int itemCount = reader.ReadUInt16();
List<ItemInContainer> items = new List<ItemInContainer>(itemCount);
bool PacketIsPre6017 = (reader.Buffer.Length == 5 + (19 * itemCount));
for (int i = 0; i < itemCount; i++)
{
Serial serial = reader.ReadInt32();
int iItemID = reader.ReadUInt16();
int iUnknown = reader.ReadByte(); // signed, itemID offset. always 0 in RunUO.
int iAmount = reader.ReadUInt16();
int iX = reader.ReadInt16();
int iY = reader.ReadInt16();
int iGridLocation = 0;
if (!PacketIsPre6017)
iGridLocation = reader.ReadByte(); // always 0 in RunUO.
int iContainerSerial = reader.ReadInt32();
int iHue = reader.ReadUInt16();
items.Add(new ItemInContainer(serial, iItemID, iAmount, iX, iY, iGridLocation, iContainerSerial, iHue));
}
m_items = items.ToArray();
}
示例5: ContainerContentPacket
public ContainerContentPacket(PacketReader reader)
: base(0x3C, "Container ContentPacket")
{
int itemCount = reader.ReadUInt16();
List<ContentItem> items = new List<ContentItem>(itemCount);
for (int i = 0; i < itemCount; i++)
{
Serial serial = reader.ReadInt32();
int iItemID = reader.ReadUInt16();
int iUnknown = reader.ReadByte(); // signed, itemID offset. always 0 in RunUO.
int iAmount = reader.ReadUInt16();
int iX = reader.ReadInt16();
int iY = reader.ReadInt16();
int iGridLocation = 0;
if (!NextContainerContentsIsPre6017)
iGridLocation = reader.ReadByte(); // always 0 in RunUO.
int iContainerSerial = reader.ReadInt32();
int iHue = reader.ReadUInt16();
items.Add(new ContentItem(serial, iItemID, iAmount, iX, iY, iGridLocation, iContainerSerial, iHue));
}
m_items = items.ToArray();
if (NextContainerContentsIsPre6017)
NextContainerContentsIsPre6017 = false;
}
示例6: SpellBookContentsInfo
public SpellBookContentsInfo(PacketReader reader)
{
ushort unknown = reader.ReadUInt16(); // always 1
Serial serial = reader.ReadInt32();
ushort itemID = reader.ReadUInt16();
ushort spellbookType = reader.ReadUInt16(); // 1==regular, 101=necro, 201=paladin, 401=bushido, 501=ninjitsu, 601=spellweaving
ulong spellBitfields = reader.ReadUInt32() + (((ulong)reader.ReadUInt32()) << 32); // first bit of first byte = spell #1, second bit of first byte = spell #2, first bit of second byte = spell #8, etc
Spellbook = new SpellbookData(serial, itemID, spellbookType, spellBitfields);
}
示例7: VendorSellItem
public VendorSellItem(PacketReader reader)
{
ItemSerial = reader.ReadInt32();
ItemID = reader.ReadUInt16();
Hue = reader.ReadUInt16();
Amount = reader.ReadUInt16();
Price = reader.ReadUInt16();
ushort nameLength = reader.ReadUInt16();
Name = reader.ReadString(nameLength);
}
示例8: ContainerContentUpdatePacket
public ContainerContentUpdatePacket(PacketReader reader)
: base(0x25, "Add Single Item")
{
m_serial = reader.ReadInt32();
m_itemId = reader.ReadUInt16();
reader.ReadByte(); // unknown
m_amount = reader.ReadUInt16();
m_x = reader.ReadInt16();
m_y = reader.ReadInt16();
m_gridLocation = reader.ReadByte(); // always 0 in RunUO.
m_parentSerial = (Serial)reader.ReadInt32();
m_hue = reader.ReadUInt16();
}
示例9: ContainerContentUpdatePacket
public ContainerContentUpdatePacket(PacketReader reader)
: base(0x25, "Add Single Item")
{
Serial = reader.ReadInt32();
ItemId = reader.ReadUInt16();
reader.ReadByte(); // unknown
Amount = reader.ReadUInt16();
X = reader.ReadInt16();
Y = reader.ReadInt16();
GridLocation = reader.ReadByte(); // always 0 in RunUO.
ContainerSerial = (Serial)reader.ReadInt32();
Hue = reader.ReadUInt16();
}
示例10: SupportedFeaturesPacket
public SupportedFeaturesPacket(PacketReader reader)
: base(0xB9, "Enable Features")
{
if (reader.Buffer.Length == 3)
Flags = (FeatureFlags)reader.ReadUInt16();
else if (reader.Buffer.Length == 5)
Flags = (FeatureFlags)reader.ReadUInt32();
else
{
Flags = (FeatureFlags)reader.ReadUInt16();
Tracer.Error("Bad feature flag size in SupportedFeaturesPacket; expected 16 or 32 bit features, received {0} bits.", (reader.Buffer.Length - 1) * 8);
}
}
示例11: MobileMovingPacket
public MobileMovingPacket(PacketReader reader)
: base(0x77, "Mobile Moving")
{
this.serial = reader.ReadInt32();
this.bodyid = reader.ReadUInt16();
this.x = reader.ReadInt16();
this.y = reader.ReadInt16();
this.z = reader.ReadSByte();
this.direction = reader.ReadByte();
this.hue = reader.ReadUInt16();
this.Flags = new MobileFlags(reader.ReadByte());
this.notoriety = reader.ReadByte();
}
示例12: MobileMovingPacket
public MobileMovingPacket(PacketReader reader)
: base(0x77, "Mobile Moving")
{
serial = reader.ReadInt32();
bodyid = reader.ReadUInt16();
x = reader.ReadInt16();
y = reader.ReadInt16();
z = reader.ReadSByte();
direction = reader.ReadByte();
hue = reader.ReadUInt16();
Flags = new MobileFlags((MobileFlag)reader.ReadByte());
notoriety = reader.ReadByte();
}
示例13: AddSingleItemToContainerPacket
public AddSingleItemToContainerPacket(PacketReader reader)
: base(0x25, "Add Single Item")
{
Serial = reader.ReadInt32();
ItemId = reader.ReadUInt16();
reader.ReadByte(); // unknown
Amount = reader.ReadUInt16();
X = reader.ReadInt16();
Y = reader.ReadInt16();
if (reader.Buffer.Length == 21)
GridLocation = reader.ReadByte(); // always 0 in RunUO.
else
GridLocation = 0;
ContainerSerial = (Serial)reader.ReadInt32();
Hue = reader.ReadUInt16();
}
示例14: ContextMenuInfo
public ContextMenuInfo(PacketReader reader)
{
reader.ReadByte(); // unknown, always 0x00
int subcommand = reader.ReadByte(); // 0x01 for 2D, 0x02 for KR
Menu = new ContextMenuData(reader.ReadInt32());
int contextMenuChoiceCount = reader.ReadByte();
for (int i = 0; i < contextMenuChoiceCount; i++) {
int iUniqueID = reader.ReadUInt16();
int iClilocID = reader.ReadUInt16() + 3000000;
int iFlags = reader.ReadUInt16(); // 0x00=enabled, 0x01=disabled, 0x02=arrow, 0x20 = color
int iColor = 0;
if ((iFlags & 0x20) == 0x20) {
iColor = reader.ReadUInt16();
}
Menu.AddItem(iUniqueID, iClilocID, iFlags, iColor);
}
}
示例15: WorldItemPacket
public WorldItemPacket(PacketReader reader)
: base(0x1A, "ObjectInfo")
{
Serial serial = reader.ReadInt32();
ushort itemId = reader.ReadUInt16();
m_amount = 0;
if ((serial & 0x80000000) == 0x80000000)
{
m_amount = reader.ReadInt16();
}
// Doesn't exist this thing in the packet
/*byte iIncrement = 0;
if ((iItemID & 0x8000) == 0x8000)
{
iIncrement = reader.ReadByte();
iObjectSerial += iIncrement;
}*/
ushort x = reader.ReadUInt16();
ushort y = reader.ReadUInt16();
m_direction = 0;
if ((x & 0x8000) == 0x8000)
m_direction = reader.ReadByte();
m_z = reader.ReadSByte();
m_hue = 0;
if ((y & 0x8000) == 0x8000)
m_hue = reader.ReadUInt16();
m_flags = 0;
if ((y & 0x4000) == 0x4000)
m_flags = reader.ReadByte();
m_serial = (int)(serial &= 0x7FFFFFFF);
m_itemid = (short)(itemId &= 0x7FFF);
m_x = (short)(x &= 0x7FFF);
m_y = (short)(y &= 0x3FFF);
}