当前位置: 首页>>代码示例>>C#>>正文


C# PacketIn.GetUint8方法代码示例

本文整理汇总了C#中FrameWork.PacketIn.GetUint8方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.GetUint8方法的具体用法?C# PacketIn.GetUint8怎么用?C# PacketIn.GetUint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrameWork.PacketIn的用法示例。


在下文中一共展示了PacketIn.GetUint8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: F_INTERACT

        public static void F_INTERACT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            Log.Dump("F_INTERACT", packet.ToArray(), 0, packet.ToArray().Length);

            InteractMenu Menu = new InteractMenu();
            Menu.Unk = packet.GetUint16();
            Menu.Oid = packet.GetUint16();
            Menu.Menu = packet.GetUint16();
            Menu.Page = packet.GetUint8();
            Menu.Num = packet.GetUint8();
            Menu.SellCount = packet.GetUint16();
            Menu.Count = packet.GetUint16();

            Object Obj = cclient.Plr.Region.GetObject(Menu.Oid);
            if (Obj == null)
                return;

            if (Obj.GetDistanceTo(cclient.Plr) > 20)
            {
                Log.Error("F_INTERACT", "Distance = " + Obj.GetDistanceTo(cclient.Plr));
                return;
            }

            Obj.SendInteract(cclient.Plr, Menu);
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:30,代码来源:CombatHandlers.cs

示例2: HandlePacket

        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = client as LobbyClient;

            byte freeslot = Program.CharMgr.GetFreeSlot(cclient.Account.Id);

            if (freeslot == 0 || cclient.CreateChar == null)
                ANS_CHARACTER_CREATE.Send(cclient);
            else
            {
                cclient.CreateChar.SlotId = freeslot;
                cclient.CreateChar.Faction = packet.GetUint8();
                cclient.CreateChar.Gender = packet.GetUint8();
                cclient.CreateChar.Version = (int)packet.GetUint32R();
                cclient.CreateChar.Seconds = (int)packet.GetUint32R();

                byte[] Custom = new byte[packet.Length - packet.Position];
                packet.Read(Custom, 0, Custom.Length);

                cclient.CreateChar.Custom = BitConverter.ToString(Custom);

                Program.CharMgr.CreateCharacter(cclient.CreateChar);
                ANS_CHARACTER_CREATE.Send(cclient);
            }
        }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:25,代码来源:ASK_CHARACTER_CREATE.cs

示例3: F_BAG_INFO

        public static void F_BAG_INFO(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying())
                return;

            byte Type = packet.GetUint8();

            Player Plr = cclient.Plr;

            switch (Type)
            {
                case 3: // Toggle Pvp
                    Plr.CbtInterface.TogglePvp();
                    break;

                case 16: // Buy more bag space
                    byte Price = packet.GetUint8();
                    if (!Plr.ItmInterface.HasMaxBag())
                    {
                        if (Plr.HaveMoney(Plr.ItmInterface.GetBagPrice()))
                        {
                            if (Plr.RemoveMoney(Plr.ItmInterface.GetBagPrice()))
                            {
                                ++Plr.ItmInterface.BagBuy;
                                Plr.ItmInterface.SendMaxInventory(Plr);
                            }
                        }
                    }
                    break;
            }
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:33,代码来源:InventoryHandlers.cs

示例4: OnReceive

        protected override void OnReceive(byte[] Packet)
        {
            lock (this)
            {
                PacketIn packet = new PacketIn(Packet, 0, Packet.Length);
                long byteLeft = packet.Length;

                while (byteLeft > 0)
                {
                    if (!m_expectData)
                    {
                        long StartPos = packet.Position;
                        m_expectSize = packet.DecodeMythicSize();
                        long EndPos = packet.Position;

                        long Diff = EndPos - StartPos;
                        byteLeft -= Diff;
                        if (m_expectSize <= 0)
                        {
                            packet.Opcode = packet.GetUint8();
                            packet.Size = (ulong)m_expectSize;
                            _srvr.HandlePacket(this, packet);
                            return;
                        }

                        if (byteLeft <= 0)
                            return;

                        Opcode = packet.GetUint8();
                        byteLeft -= 1;

                        m_expectData = true;
                    }
                    else
                    {
                        m_expectData = false;
                        if (byteLeft >= m_expectSize)
                        {
                            long Pos = packet.Position;

                            packet.Opcode = Opcode;
                            packet.Size = (ulong)m_expectSize;

                            _srvr.HandlePacket(this, packet);

                            byteLeft -= m_expectSize;
                            packet.Position = Pos;
                            packet.Skip(m_expectSize);
                        }
                        else
                        {
                            Log.Error("OnReceive", "Data count incorrect :" + byteLeft + " != " + m_expectSize);
                        }
                    }
                }

                packet.Dispose();
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:59,代码来源:Client.cs

示例5: F_PLAYER_INFO

        static public void F_PLAYER_INFO(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            packet.GetUint16();
            UInt16 Oid = packet.GetUint16();
            byte Unk = packet.GetUint8();
            byte TargetType = packet.GetUint8();
            cclient.Plr.CbtInterface.SetTarget(Oid, (GameData.TargetTypes)TargetType);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:13,代码来源:CombatHandlers.cs

示例6: F_INTERFACE_COMMAND

        public static void F_INTERFACE_COMMAND(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null)
                return;

            byte CommandId = packet.GetUint8();

            switch (CommandId)
            {

                case 1: // ????
                    {
                    } break;

                case 2: // Resurrect Button
                    {
                        cclient.Plr.PreRespawnPlayer();
                        Log.Success("Interface Command", "Respawn Player");
                    } break;

                case 10: // Talisman Fuse
                    {
                    } break;

            };
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:28,代码来源:InterfaceHandlers.cs

示例7: CL_CHECK

        static public void CL_CHECK(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;
            uint Version = packet.GetUint32();

            Log.Debug("CL_CHECK", "Launcher Version : " + Version);

            PacketOut Out = new PacketOut((byte)Opcodes.LCR_CHECK);

            if (Version != Program.Version)
            {
                Out.WriteByte((byte)CheckResult.LAUNCHER_VERSION); // Version incorrect + message
                Out.WriteString(Program.Message);
                client.SendPacket(Out);

                cclient.Disconnect();
                return;
            }

            byte File = packet.GetUint8();
            UInt64 Len = 0;

            if (File >= 1)
                Len = packet.GetUint64();

            if ((long)Len != Program.Info.Length)
            {
                Out.WriteByte((byte)CheckResult.LAUNCHER_FILE);
                Out.WriteString(Program.StrInfo);
            }
            else
                Out.WriteByte((byte)CheckResult.LAUNCHER_OK);

            cclient.SendPacket(Out);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:35,代码来源:Packets.cs

示例8: HandlePacket

        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = client as LobbyClient;
            Program.CharMgr.DeleteCharacter(cclient.Account.Id, packet.GetUint8());

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_DELETE);
            Out.WriteUInt32R(0);
            cclient.SendTCP(Out);
        }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:9,代码来源:ASK_CHARACTER_DELETE.cs

示例9: F_TEXT

        static public void F_TEXT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null)
                return;

            byte Unk = packet.GetUint8();
            string Text = packet.GetString((int)(packet.Length - packet.Position));

            CommandMgr.HandleText(cclient.Plr, Text);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:12,代码来源:TchatHandlers.cs

示例10: F_BAG_INFO

        public static void F_BAG_INFO(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying())
                return;

            byte SlotCount = packet.GetUint8();
            byte Price = packet.GetUint8();

            Player Plr = cclient.Plr;

            if (!Plr.ItmInterface.HasMaxBag())
                if (Plr.HaveMoney(Plr.ItmInterface.GetBagPrice()))
                {
                    if (Plr.RemoveMoney(Plr.ItmInterface.GetBagPrice()))
                    {
                        ++Plr.ItmInterface.BagBuy;
                        Plr.ItmInterface.SendMaxInventory(Plr);
                    }
                }
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:22,代码来源:InventoryHandlers.cs

示例11: OnReceive

        protected override void OnReceive(byte[] Packet)
        {
            lock (this)
            {
                PacketIn pack = new PacketIn(Packet, 0, Packet.Length);
                pack.Size = pack.GetUint32();
                pack.Opcode = pack.GetUint8();

                if (!Enum.IsDefined(typeof(Opcodes), (byte)pack.Opcode))
                {
                    Log.Error("OnReceive", "Opcode invalide : " + pack.Opcode);
                    return;
                }

                Server.HandlePacket((BaseClient)this, pack);
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:17,代码来源:Client.cs

示例12: F_SOCIAL_NETWORK

        static public void F_SOCIAL_NETWORK(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            byte Type = packet.GetUint8();

            switch (Type)
            {
                case 11: // Inspection
                    {
                        Player Target = Plr.CbtInterface.GetTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ALLY) as Player;
                        if (Target == null)
                            Plr.SendLocalizeString("", GameData.Localized_text.TEXT_SN_LISTS_ERR_PLAYER_NOT_FOUND);
                        else
                            Target.ItmInterface.SendInspect(Plr);
                    }
                    break;
                case 8:
                    {
                        packet.Skip(1);
                        byte NameSize = packet.GetUint8();
                        packet.Skip(1);
                        string Name = packet.GetString(NameSize);
                        byte GuildSize = packet.GetUint8();
                        packet.Skip(1);
                        string GuildName = packet.GetString(GuildSize);
                        packet.Skip(1);
                        UInt16 Career = packet.GetUint16();
                        packet.Skip(4);
                        UInt16 ZoneId = packet.GetUint16();

                        while (ZoneId > 256)
                            ZoneId -= 256;

                        while (packet.GetUint8() != 0xFF) ;

                        packet.Skip(2 + (ZoneId == 255 ? 0 : 1));

                        byte MinLevel = packet.GetUint8();
                        byte MaxLevel = packet.GetUint8();

                        Plr.SocInterface.SendPlayers(Player.GetPlayers(Name, GuildName, Career, ZoneId, MinLevel, MaxLevel));

                    } break;

            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:52,代码来源:SocialHandlers.cs

示例13: HandlePacket

        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = (LobbyClient)client;

            byte FileId = packet.GetUint8();
            UInt32 Version = packet.GetUint32R();

            byte[] File = new byte[packet.Length - packet.Position];
            packet.Read(File, 0, File.Length);

            File = ZlibMgr.Decompress(File);

            Log.Debug("ConfigSave", "Config saved : fileid=" + FileId + ", Version=" + Version + ",Size=" + File.Length);

            Program.FileMgr.SaveInfo(cclient.Account.Id, FileId, File);

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE);
            Out.WriteUInt32R(0);
            Out.WriteByte(FileId);
            Out.Write(File, 0, File.Length);
            cclient.SendTCP(Out);
        }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:22,代码来源:ASK_CONFIGFILE_SAVE.cs

示例14: F_GROUP_COMMAND

        static public void F_GROUP_COMMAND(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            packet.GetUint32(); // UNK
            byte State = packet.GetUint8();

            switch (State)
            {
                case 2: // Accept invitation
                    if (Plr.Invitation == null)
                        return;
                    Plr.Invitation.AcceptInvitation();
                    break;
                case 6: // Decline invitation
                    if (Plr.Invitation == null)
                        return;
                    Plr.Invitation.DeclineInvitation();
                    break;
                case 3: // Leave group
                    if (Plr.GetGroup() == null)
                        return;
                    Plr.GetGroup().RemoveMember(Plr);
                    Plr.SetGroup(null);
                    break;
                case 17: // Make main
                    break;
                default:
                    Log.Error("GroupHandler", "Unsupported type: " + State);
                    break;
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:37,代码来源:GroupHandlers.cs

示例15: HandlePacket

        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = (LobbyClient)client;

            byte sloid = packet.GetUint8();
            Program.CharMgr.SetEnter(cclient.Account.Id, sloid);

            WorldInfo Info = Program.CharMgr.GetWorldInfo(cclient.Account.WorldId);

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER);

            if (Info == null)
                Out.WriteUInt32R(1);
            else
            {
                Out.WriteUInt32R(0);

                Out.WriteInt32R(Info.Ip); // WorldServerIp
                Out.WriteUInt16R((UInt16)Info.Port); // Port
                Out.WriteInt64R(TCPManager.GetTimeStamp());
            }

            cclient.SendTCP(Out);
        }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:24,代码来源:ASK_WORLD_ENTER.cs


注:本文中的FrameWork.PacketIn.GetUint8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。