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


C# PacketIn.ToArray方法代码示例

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


在下文中一共展示了PacketIn.ToArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CMSG_AuthSessionTokenReq

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

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

            AuthSessionTokenReq.Builder authReq = AuthSessionTokenReq.CreateBuilder();
            authReq.MergeFrom(packet.ToArray());

            string session = Encoding.ASCII.GetString(authReq.SessionToken.ToByteArray());
           // Log.Debug("AuthSession", "session " + session);
            cclient.Username = "";                                  //username is not important anymore in 1.4.8
            cclient.Token = session;



            AuthSessionTokenReply.Builder authReply = AuthSessionTokenReply.CreateBuilder();
            authReply.SetResultCode(AuthSessionTokenReply.Types.ResultCode.RES_SUCCESS);

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

            cclient.SendTCPCuted(Out);
       
            
        /*   //TODO: need auth check

            if (Result != AuthResult.AUTH_SUCCESS)
                cclient.Disconnect();
            else
            {
                cclient.Username = Username;
                cclient.Token = Token;
            }*/
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:36,代码来源:AuthentificationHandlers.cs

示例3: F_PLAYER_STATE2

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

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

            Player Plr = cclient.Plr;

            long Pos = packet.Position;

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
            Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
            Out.WriteByte(0);
            Plr.DispatchPacket(Out, false);

            packet.Position = Pos;

            UInt16 Key = packet.GetUint16();

            byte Type = packet.GetUint8();
            byte MoveingState = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte Strafe = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();
            byte zmod = packet.GetUint8();

            //    Log.Success("zMod ",""+zmod);
            // zmod is somewhat strange what i found out so far
            // z mod is 255 while standing
            // z mod is 0 while running and z is below 65535
            // z mod is 1 while running and z is above 65535
            // z mod can be  113 / 97 / 115 / 99 while running and z is below 65535 and enemy in target
            // z mod is 99 / 100 / 116  while running and z is above 65535 and enemy in target

            // z mod is 4 while running in water
            // z mod is 68 while swimming in water
            // z mod is ticking with 255 7 times then 68 while standing in deep water
            // z mod is 12 while running in water (that should lower your health / kill you and reduce movement speed)
            // z mod is ticking with 255 7 times then 12 while standing in lava

            if (packet.Size < 10)
                return;

            int z_temp = Z;

            Heading /= 8;
            X /= 2;
            Y /= 2;

            // z update if z is higher then 65535

            if (zmod != 0 && zmod != 97 && zmod != 113 && zmod != 99 && zmod != 115)
                z_temp += 65535;

            if (Type != (byte)MovementTypes.NotMoving)
                Plr.IsMoving = true;
            else
                Plr.IsMoving = false;

             //   Log.Success("Movement Before ", X + "," + Y + "," + Z + "  ztemp"+ z_temp);
            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                z_temp /= 16;

                // combat offset z

                if (Plr._ZoneMgr.ZoneId == 161 || Plr._ZoneMgr.ZoneId == 162)
                {
                    z_temp += 12288;
                }
                else
                    z_temp += 4096;

            }
            else
//.........这里部分代码省略.........
开发者ID:nalgol,项目名称:WarEmu,代码行数:101,代码来源:MovementHandlers.cs

示例4: F_REQUEST_INIT_PLAYER

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

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

            if (cclient.Plr == null)
                return;

            foreach (Player Obj in cclient.Plr._PlayerRanged)
                Obj.SendMeTo(cclient.Plr);
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:12,代码来源:MovementHandlers.cs

示例5: F_PLAYER_STATE2

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

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

            Player Plr = cclient.Plr;

            try
            {
                long Pos = packet.Position;

                PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
                Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
                Out.WriteByte(0);
                Plr.DispatchPacket(Out, false);

                packet.Position = Pos;
            }
            catch (Exception e)
            {
                Log.Error("F_PLAYER_STATE2", e.ToString());
            }

            if (packet.Size < 17)
            {
                Plr.IsMoving = false;
                return;
            }

            UInt16 Key = packet.GetUint16();

            byte MoveByte = packet.GetUint8();
            byte UnkByte = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte RotateByte = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();
            //byte Unk2 = packet.GetUint8();

            Heading /= 8;
            X /= 2;
            Y /= 2;
            Z /= 2;

            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                Z += 32768;
                Z /= 4;
            }
            else
            {
                if (Plr.LastX != 0 && Plr.LastY != 0)
                {
                    if (Plr.LastX > 24576 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (Plr.LastX < 4096 && X > 24576)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastY > 24576 && Y < 4096)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Plr.LastY < 4096 && Y > 24576)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));

                }

                Plr.LastX = X;
                Plr.LastY = Y;

                X = Plr.Zone.CalculPin(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false);
            }

            Plr.SetPosition(X, Y, Z, Heading);
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:99,代码来源:MovementHandlers.cs

示例6: F_PLAYER_STATE2

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

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

            Player Plr = cclient.Plr;

            long Pos = packet.Position;

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
            Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
            Out.WriteByte(0);
            Plr.DispatchPacket(Out, false);

            packet.Position = Pos;

            UInt16 Key = packet.GetUint16();

            byte Type = packet.GetUint8();
            byte MoveingState = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte Strafe = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();

            if (packet.Size < 10)
                return;

            Heading /= 8;
            X /= 2;
            Y /= 2;
            Z /= 2;

            if (Type != (byte)MovementTypes.NotMoving)
                Plr.IsMoving = true;
            else
                Plr.IsMoving = false;

            //Log.Success("Movement Before ", X + "," + Y + "," + Z);
            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                Z += 32768;
                Z /= 4;
                Z /= 2;
            }
            else
            {
                if (Plr.LastX != 0 && Plr.LastY != 0)
                {
                    if (Plr.LastX > 24576 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (Plr.LastX < 4096 && X > 24576)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastY > 24576 && Y < 4096)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Plr.LastY < 4096 && Y > 24576)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));

                }

                Plr.LastX = X;
                Plr.LastY = Y;

                X = Plr.Zone.CalculPin(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false);
                Z /= 2;
            }

            if (Plr.IsInWorld() && Plr.Zone.ZoneId == 161)
                Z += 16384;

            //Log.Success("Movement after", "X=" + X + ",Y=" + Y + ",Z=" + Z + "," + Type + "," + Unk1 + "," + CombatByte);
            Plr.SetPosition(X, Y, Z, Heading);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:100,代码来源:MovementHandlers.cs


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