Zepheus.FiestaLib.Networking.Packet.TryReadUShort C# (CSharp) Method

TryReadUShort() public method

public TryReadUShort ( ushort &pValue ) : bool
pValue ushort
return bool
        public bool TryReadUShort(out ushort pValue)
        {
            pValue = 0;
            if (Remaining < 2) return false;
            pValue = this.reader.ReadUInt16();
            return true;
        }

Usage Example

Ejemplo n.º 1
0
        public static void SelectObjectHandler(ZoneClient client, Packet packet)
        {
            ushort id;
            if (!packet.TryReadUShort(out id))
            {
                Log.WriteLine(LogLevel.Warn, "Could not read entity select request.");
                return;
            }

            MapObject mo;
            // Try to see if there is a map object with this ID
            if (!client.Character.Map.Objects.TryGetValue(id, out mo))
            {
                client.Character.CharacterInTarget = mo;
                return; // Nothing found. Just return lawl
            }

            mo.SelectedBy.Add(client.Character);

            if (mo is ZoneCharacter || mo is Mob)
            {
                client.Character.SelectedObject = mo;
                SendStatsUpdate(mo, client, false);
            }
        }
All Usage Examples Of Zepheus.FiestaLib.Networking.Packet::TryReadUShort