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


C# FrameWork.PacketIn类代码示例

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


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

示例1: F_USE_ITEM

        static public void F_USE_ITEM(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;
            if (!cclient.IsPlaying())
                return;

            Player Plr = cclient.Plr;

            ushort slot = packet.GetUint16();

            Item item = Plr.ItmInterface.GetItemInSlot(slot);

            if (Plr.Level < item.Info.MinRank)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_LEVEL_TOO_LOW);
                return;
            }
            else if (Plr.Rank < item.Info.MinRenown)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_RENOWN_TOO_LOW);
                return;
            }

            if (item.Info.Type == 31 && item.Info.ScriptName == "HealthPotion") // Potion
            {
                Plr.DealHeal(Plr, (uint)item.Info.MinRank * 100);
                Plr.ItmInterface.DeleteItem(slot, 1, true);
            }
            
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:30,代码来源:InventoryHandlers.cs

示例2: HandlePacket

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

            UInt32 WorldUid = packet.GetUint32R();
            string Name = packet.GetUnicodeString();

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

            if (CheckName(Name) == 0)
            {
                cclient.CreateChar = new DBCharacter();
                cclient.CreateChar.AcctId = cclient.Account.Id;
                cclient.CreateChar.Name = Name;

                if (cclient.Account.WorldId != WorldUid)
                    Program.CharMgr.SetAccountWorld(cclient.Account.Id, (int)WorldUid);

                Out.WriteUInt32(0);
            }
            else
            {
                cclient.CreateChar = null;
                Out.WriteUInt32(1);
            }

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

示例3: 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

示例4: F_FLIGHT

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

            UInt16 TargetOID = packet.GetUint16();
            UInt16 State = packet.GetUint16();

            Log.Info("F_FLIGHT", "TargetOid = " + TargetOID + ",State=" + State);

            if (State == 20) // Flight Master
            {
                Object Obj = cclient.Plr.Zone.GetObject(TargetOID);
                if (Obj == null || !Obj.IsCreature())
                {
                    Log.Error("F_FLIGHT", "Invalid Creature OID : " + TargetOID);
                    return;
                }

                UInt16 FlyID = packet.GetUint16();

                List<Zone_Taxi> Taxis = WorldMgr.GetTaxis(cclient.Plr);
                if (Taxis.Count <= FlyID - 1)
                    return;

                if (!cclient.Plr.RemoveMoney(Taxis[FlyID - 1].Info.Price))
                {
                    cclient.Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
                    return;
                }

                cclient.Plr.Teleport(Taxis[FlyID - 1].ZoneID, Taxis[FlyID - 1].WorldX, Taxis[FlyID - 1].WorldY, Taxis[FlyID - 1].WorldZ, Taxis[FlyID - 1].WorldO);
            }
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:33,代码来源:MovementHandlers.cs

示例5: CMSG_VerifyProtocolReq

        static public void CMSG_VerifyProtocolReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

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

            byte[] IV_HASH1 = { 0x01, 0x53, 0x21, 0x4d, 0x4a, 0x04, 0x27, 0xb7, 0xb4, 0x59, 0x0f, 0x3e, 0xa7, 0x9d, 0x29, 0xe9 };
            byte[] IV_HASH2 = { 0x49, 0x18, 0xa1, 0x2a, 0x64, 0xe1, 0xda, 0xbd, 0x84, 0xd9, 0xf4, 0x8a, 0x8b, 0x3c, 0x27, 0x20 };
            
            ByteString iv1 = ByteString.CopyFrom(IV_HASH1);
            ByteString iv2 = ByteString.CopyFrom(IV_HASH2);
            VerifyProtocolReply.Builder verify = VerifyProtocolReply.CreateBuilder();
            verify.SetResultCode(VerifyProtocolReply.Types.ResultCode.RES_SUCCESS);

            verify.SetIv1(ByteString.CopyFrom(IV_HASH1));
            verify.SetIv2(ByteString.CopyFrom(IV_HASH2));


            
            Out.Write(verify.Build().ToByteArray());
   

            cclient.SendTCPCuted(Out);

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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: F_SWITCH_ATTACK_MODE

        static public void F_SWITCH_ATTACK_MODE(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;
            if (!cclient.HasPlayer())
                return;

            cclient.Plr.CbtInterface.Attacking = true;
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:8,代码来源:CombatHandlers.cs

示例12: F_TRADE_STATUS

        public static void F_TRADE_STATUS(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;
            if (!cclient.IsPlaying())
                return;

            cclient.Plr.ItmInterface.HandleTrade(packet);
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:8,代码来源:InventoryHandlers.cs

示例13: F_INTERRUPT

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

            if (cclient.Plr == null)
                return;

            cclient.Plr.AbtInterface.StopCast();
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:9,代码来源:CombatHandlers.cs

示例14: 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

示例15: CMSG_GetAcctPropListReq

        static public void CMSG_GetAcctPropListReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

            PacketOut Out = new PacketOut((byte)Opcodes.SMSG_GetAcctPropListReply);
            byte[] val = { 0x08, 0x00 };
            Out.Write(val);
            cclient.SendTCPCuted(Out);

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


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