當前位置: 首頁>>代碼示例>>C#>>正文


C# Packet.ReadShort方法代碼示例

本文整理匯總了C#中ServerEngine.PacketEngine.Packet.ReadShort方法的典型用法代碼示例。如果您正苦於以下問題:C# Packet.ReadShort方法的具體用法?C# Packet.ReadShort怎麽用?C# Packet.ReadShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ServerEngine.PacketEngine.Packet的用法示例。


在下文中一共展示了Packet.ReadShort方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RecvBuyItem

        public static BuyItemInfo RecvBuyItem(Packet p)
        {
            p.Skip(2);
            int npcid = p.ReadInt();
            short wref = p.ReadShort();
            p.Skip(2);
            short amount = p.ReadShort();
            p.Skip(2);
            byte bag = p.ReadByte();

            BuyItemInfo i = new BuyItemInfo
            {
                NpcID = npcid,
                ReferenceID = wref,
                Amount = amount,
                Bag = bag
            };

            return i;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:20,代碼來源:PacketManager.cs

示例2: RecvStopMoving

        public static MovementInfo RecvStopMoving(Packet p)
        {
            p.Skip(2);
            int charid = p.ReadInt();

            short from_x = p.ReadShort();
            short from_y = p.ReadShort();
            byte from_z = p.ReadByte();

            MovementInfo mi = new MovementInfo
            {
                PacketID = 3,
                CharacterID = charid,
                FromX = from_x,
                FromY = from_y,
                FromZ = from_z,
            };

            return mi;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:20,代碼來源:PacketManager.cs

示例3: RecvUnitLogin

        /// <summary>
        /// Generates the unit server login information from packet
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public static UnitLogin RecvUnitLogin(Packet p)
        {
            p.Skip(2);
            string account = p.ReadString();
            int hash = p.ReadShort();
            int map = p.ReadShort();
            int channel = p.ReadByte();
            p.Skip(6);
            int characterID = p.ReadInt();

            UnitLogin u = new UnitLogin()
            {
                Account = account,
                AccountID = hash,
                Channel = channel,
                CharacterID = characterID
            };

            return u;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:25,代碼來源:PacketManager.cs

示例4: RecvPickItem

        public static PickItemInfo RecvPickItem(Packet p)
        {
            p.Skip(2);
            int mapid = p.ReadInt();
            int itemid = p.ReadInt();
            short fromx = p.ReadShort();
            short fromy = p.ReadShort();
            byte fromz = p.ReadByte();
            int mapitemid = p.ReadInt();
            short amount = p.ReadShort();

            PickItemInfo pi = new PickItemInfo
            {
                MapID = mapid,
                ItemID = itemid,
                FromX = fromx,
                FromY = fromy,
                FromZ = fromz,
                MapItemID = mapitemid,
                Amount = amount
            };

            return pi;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:24,代碼來源:PacketManager.cs

示例5: RecvStartMoving

        public static MovementInfo RecvStartMoving(Packet p)
        {
            p.Skip(2);
            int charid = p.ReadInt();

            short from_x = p.ReadShort();
            short from_y = p.ReadShort();
            byte from_z = p.ReadByte();

            short to_x = p.ReadShort();
            short to_y = p.ReadShort();
            byte to_z = p.ReadByte();
            short direction = p.ReadShort();

            MovementInfo mi = new MovementInfo
            {
                PacketID = 1,
                CharacterID = charid,
                FromX = from_x,
                FromY = from_y,
                FromZ = from_z,
                ToX = to_x,
                ToY = to_y,
                ToZ = to_z,
                Rotation = direction
            };

            return mi;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:29,代碼來源:PacketManager.cs

示例6: RecvDropItem

        public static DropItemInfo RecvDropItem(Packet p)
        {
            p.Skip(2);
            byte frombag = p.ReadByte();
            byte fromslot = p.ReadByte();
            int itemid = p.ReadInt();
            short tox = p.ReadShort();
            short toy = p.ReadShort();
            byte toz = p.ReadByte();
            int something = p.ReadInt();

            DropItemInfo drop = new DropItemInfo
            {
                FromBag = frombag,
                FromSlot = fromslot,
                ItemID = itemid,
                ToX = tox,
                ToY = toy,
                ToZ = toz,
                Something = something
            };

            return drop;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:24,代碼來源:PacketManager.cs

示例7: RecvGameLogin

        /// <summary>
        /// Handle Game Login packet from client
        /// </summary>
        /// <param name="p"></param>
        /// <param name="c"></param>
        public static GameLogin RecvGameLogin(Packet p)
        {
            p.Skip(2);
            string account = p.ReadString();
            string hash = p.ReadString();
            int version = p.ReadShort();

            GameLogin g = new GameLogin
            {
                AccountName = account,
                HashCode = hash,
                Version = version
            };

            return g;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:21,代碼來源:PacketManager.cs

示例8: HandlePacket

        private void HandlePacket(Packet p)
        {
            int curByte = 0;
            int maxByte = p.Length;

            while (curByte < maxByte)
            {
                int parsedLength = p.ReadShort((curByte + 2)) + 4;
                byte[] parsed = new byte[parsedLength];

                // read bytes from buffer to parsed packets.
                for (int i = 0; i < parsed.Length; i++)
                {
                    parsed[i] = p.GetBuffer()[i + curByte];
                }

                // decrypt those bytes as a new real deal parsed packet
                Packet Parsed = Packet.Decrypt(new Packet(parsed), key);
                curByte += parsedLength;

                PacketIds PI = (PacketIds)Parsed.ReadShort();
                switch (PI)
                {
                    #region Login Recvs
                    case PacketIds.Recv_GameLogin:
                        HandleRecvGameLogin(Parsed);
                        break;

                    case PacketIds.Recv_ConnectWorld:
                        HandleRecvConnectWorld(Parsed);
                        break;

                    #endregion

                    #region World Recvs

                    case PacketIds.RecvUnitLogin:
                        HandleRecvUnitLogin(Parsed);
                        break;

                    case PacketIds.RecvCreateCharacter:
                        HandleRecvCreateCharacter(Parsed);
                        break;

                    case PacketIds.RecvChannelRequest:
                        HandleRecvChannelRequest(Parsed);
                        break;

                    #endregion

                    #region Channel Recvs
                    case PacketIds.RecvPing:
                        // needs check if too fast or so :I
                        break;

                    case PacketIds.RecvChannelLogin:
                        HandleRecvChannelLogin(Parsed);
                        break;

                    case PacketIds.RecvChannelChange:
                        HandleRecvChannelChange(Parsed);
                        break;

                    case PacketIds.RecvChannelSomething:
                        HandleRecvChannelStuff(Parsed);
                        break;

                    case PacketIds.RecvLoadMap:
                        HandleRecvMapRequest(Parsed);
                        break;

                    case PacketIds.RecvRequestSkillList:
                        HandleRecvSkillRequest(Parsed);
                        break;

                    case PacketIds.RecvRequestInventory:
                        HandleRecvInventoryRequest(Parsed);
                        break;

                    case PacketIds.RecvMoveItem:
                        HandleRecvMoveItem(Parsed);
                        break;

                    case PacketIds.RecvDropItem:
                        HandleRecvDropItem(Parsed);
                        break;

                    case PacketIds.RecvPickItem:
                        HandleRecvPickItem(Parsed);
                        break;

                    case PacketIds.RecvImbueItem:
                        HandleRecvImbueItem(Parsed);
                        break;

                    case PacketIds.RecvAcceptImbueItem:
                        HandleRecvAcceptImbueItem(Parsed);
                        break;

                    case PacketIds.RecvNpcTrade:
//.........這裏部分代碼省略.........
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:101,代碼來源:Client.cs

示例9: RecvChannelLogin

        public static ChannelLogin RecvChannelLogin(Packet p)
        {
            p.Skip(2);
            int characterID = p.ReadInt();
            int accountID = p.ReadShort();
            int channelID = p.ReadShort();
            int worldID = p.ReadByte();

            ChannelLogin u = new ChannelLogin()
            {
                CharacterID = characterID,
                AccountID = accountID,
                ChannelID = channelID,
                WorldID = worldID
            };

            return u;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:18,代碼來源:PacketManager.cs

示例10: RecvCastSkill2

        public static CastSkillInfo RecvCastSkill2(Packet p)
        {
            p.Skip(2);
            int skillid = p.ReadInt();
            byte castertype = p.ReadByte();
            int casterid = p.ReadInt();
            short casterx = p.ReadShort();
            short castery = p.ReadShort();
            byte casterz = p.ReadByte();
            byte targettype = p.ReadByte();
            int targetid = p.ReadInt();
            short targetx = p.ReadShort();
            short targety = p.ReadShort();
            byte targetz = p.ReadByte();

            CastSkillInfo i = new CastSkillInfo
            {
                PacketID = 2,
                SkillID = skillid,
                CasterType = castertype,
                CasterID = casterid,
                CasterX = casterx,
                CasterY = castery,
                CasterZ = casterz,
                TargetType = targettype,
                TargetID = targetid,
                TargetX = targetx,
                TargetY = targety,
                TargetZ = targetz
            };

            return i;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:33,代碼來源:PacketManager.cs

示例11: RecvAttack2

        public static AttackInfo RecvAttack2(Packet p)
        {
            p.Skip(2);
            byte attackertype = p.ReadByte();
            int attackerid = p.ReadInt();
            short targetx = p.ReadShort();
            short targety = p.ReadShort();
            byte targetz = p.ReadByte();
            byte targettype = p.ReadByte();
            int targetid = p.ReadInt();

            AttackInfo i = new AttackInfo
            {
                PacketID = 2,
                AttackerType = attackertype,
                AttackerID = attackerid,
                TargetX = targetx,
                TargetY = targety,
                TargetZ = targetz,
                TargetType = targettype,
                TargetID = targetid
            };

            return i;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:25,代碼來源:PacketManager.cs

示例12: RecvUpdateQuickSlot

        public static UpdateQuickSlotInfo RecvUpdateQuickSlot(Packet p)
        {
            p.Skip(2);
            short valueId = p.ReadShort();
            p.Skip(2);
            byte slot = p.ReadByte();
            byte page = p.ReadByte();

            UpdateQuickSlotInfo i = new UpdateQuickSlotInfo
            {
                ValueID = valueId,
                Slot = slot,
                Page = page
            };

            return i;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:17,代碼來源:PacketManager.cs

示例13: RecvTradeAdditem

        public static TradeAddItemInfo RecvTradeAdditem(Packet p)
        {
            p.Skip(2);
            byte frombag = p.ReadByte();
            byte fromslot = p.ReadByte();
            byte tobag = p.ReadByte();
            byte toslot = p.ReadByte();
            int itemid = p.ReadInt();
            short amount = p.ReadShort();
            p.Skip(2);
            int charid = p.ReadInt();

            TradeAddItemInfo i = new TradeAddItemInfo
            {
                FromBag = frombag,
                FromSlot = fromslot,
                ToBag = tobag,
                ToSlot = toslot,
                ItemID = itemid,
                Amount = amount,
                PlayerID = charid
            };

            return i;
        }
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:25,代碼來源:PacketManager.cs

示例14: HandlePacket

        private void HandlePacket(Packet p)
        {
            int curByte = 0;
            int maxByte = p.Length;

            while (curByte < maxByte)
            {
                int parsedLength = p.ReadShort((curByte + 2)) + 4;
                byte[] parsed = new byte[parsedLength];

                // read bytes from buffer to parsed packets.
                for (int i = 0; i < parsed.Length; i++)
                {
                    parsed[i] = p.GetBuffer()[i + curByte];
                }

                // decrypt those bytes as a new real deal parsed packet
                Packet Parsed = Packet.Decrypt(new Packet(parsed), key);
                curByte += parsedLength;

                PacketIds PI = (PacketIds)Parsed.ReadShort();
                switch (PI)
                {
                    #region Login Recvs
                    case PacketIds.Recv_GameLogin:
                        HandleRecvGameLogin(Parsed);
                        break;

                    case PacketIds.Recv_ConnectWorld:
                        HandleRecvConnectWorld(Parsed);
                        break;

                    #endregion

                    #region World Recvs

                    case PacketIds.RecvUnitLogin:
                        HandleRecvUnitLogin(Parsed);
                        break;

                    case PacketIds.RecvCreateCharacter:
                        HandleRecvCreateCharacter(Parsed);
                        break;

                    case PacketIds.RecvChannelRequest:
                        HandleRecvChannelRequest(Parsed);
                        break;

                    #endregion

                    #region Channel Recvs
                    case PacketIds.RecvPing:
                        // needs check if too fast or so :I
                        break;

                    case PacketIds.RecvChannelLogin:
                        HandleRecvChannelLogin(Parsed);
                        break;

                    case PacketIds.RecvChannelChange:
                        HandleRecvChannelChange(Parsed);
                        break;

                    case PacketIds.RecvChannelSomething:
                        HandleRecvChannelStuff(Parsed);
                        break;

                    case PacketIds.RecvLoadMap:
                        HandleRecvMapRequest(Parsed);
                        break;

                    case PacketIds.RecvRequestSkillList:
                        HandleRecvSkillRequest(Parsed);
                        break;

                    case PacketIds.RecvRequestInventory:
                        HandleRecvInventoryRequest(Parsed);
                        break;

                    case PacketIds.RecvRequestOpenWarehouse:
                        HandleRecvOpenWarehouse(Parsed);
                        break;

                    case PacketIds.RecvMoveWarehouseItemToBag:
                        HandleRecvMoveWarehouseItemToBag(Parsed);
                        break;

                    case PacketIds.RecvAddItemToWarehouse:
                        HandleRecvAddItemToWarehouse(Parsed);
                        break;

                    case PacketIds.RecvMoveWarehouseItem:
                        HandleRecvMoveWarehouseItem(Parsed);
                        break;

                    case PacketIds.RecvMoveItem:
                        HandleRecvMoveItem(Parsed);
                        break;

                    case PacketIds.RecvDropItem:
//.........這裏部分代碼省略.........
開發者ID:zarut,項目名稱:xiah-gcf-emulator,代碼行數:101,代碼來源:Client.cs


注:本文中的ServerEngine.PacketEngine.Packet.ReadShort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。