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


C# PacketWriter.Float方法代码示例

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


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

示例1: ObjectSpawn

        //Monster spawns
        public static byte[] ObjectSpawn(obj o)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();
            //Add opcode
            Writer.Create(Systems.SERVER_SOLO_SPAWN);
            //Add dword object id
            Writer.DWord(o.ID);
            //Add dword object world id
            Writer.DWord(o.UniqueID);
            //Add x and y sector for object
            Writer.Byte(o.xSec);
            Writer.Byte(o.ySec);
            //Add float x y z for object
            Writer.Float(Formule.packetx((float)o.x, o.xSec));
            Writer.Float(o.z);
            Writer.Float(Formule.packety((float)o.y, o.ySec));
            //Switch on spawn type
            switch (Data.ObjectBase[o.ID].Object_type)
            {
                //Normal monsters
                case Global.objectdata.NamdedType.MONSTER:

                    Writer.Word(0);
                    Writer.Word(1);
                    Writer.Byte(o.xSec);
                    Writer.Byte(o.ySec);

                    if (!File.FileLoad.CheckCave(o.xSec, o.ySec))
                    {
                        Writer.Word(Formule.packetx((float)(o.x + o.wx), o.xSec));
                        Writer.Word(o.z);
                        Writer.Word(Formule.packety((float)(o.y + o.wy), o.ySec));
                    }
                    else
                    {
                        if (o.x < 0)
                        {
                            Writer.Word(Formule.cavepacketx((float)(o.x + o.wx)));
                            Writer.Word(0xFFFF);
                        }
                        else
                        {
                            Writer.DWord(Formule.cavepacketx((float)(o.x + o.wx)));
                        }

                        Writer.DWord(o.z);

                        if (o.y < 0)
                        {
                            Writer.Word(Formule.cavepackety((float)(o.y + o.wy)));
                            Writer.Word(0xFFFF);
                        }
                        else
                        {
                            Writer.DWord(Formule.cavepackety((float)(o.y + o.wy)));
                        }
                    }

                    Writer.Byte(0);
                    Writer.Byte(o.Walking == true ? 2 : 0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.Float(o.SpeedWalk);// Walk speed
                    Writer.Float(o.SpeedRun);// Run speed
                    Writer.Float(o.SpeedZerk);// Berserk speed
                    Writer.Byte(0);
                    Writer.Byte(2);
                    Writer.Byte(1);
                    Writer.Byte(5);
                    Writer.Byte(o.Type);
                    Writer.Byte(4);
                    break;

                case Global.objectdata.NamdedType.NPC:
                    Writer.Word(o.rotation);
                    Writer.Byte(0);
                    Writer.Byte(1);
                    Writer.Byte(0);
                    Writer.Word(o.rotation);
                    Writer.Byte(1);//Non static
                    Writer.Byte(0);//Non static
                    Writer.Byte(0);//Non static
                    Writer.Byte(0);
                    Writer.Byte(0);
                    Writer.DWord(0);
                    Writer.DWord(0);
                    Writer.Float(100);
                    Writer.Byte(0);
                    Writer.Byte(2);
                    Writer.Byte(0);//Static
                    Writer.Byte(1);//Non static
                    break;

                case Global.objectdata.NamdedType.TELEPORT:
                    Writer.Word(0);
                    Writer.Byte(1);
                    Writer.Byte(0);
//.........这里部分代码省略.........
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:101,代码来源:SpawnPackets.cs

示例2: ObjectSpawnJob

        public static byte[] ObjectSpawnJob(character c)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(Systems.SERVER_SOLO_SPAWN);

            /////////////////////////////////////////////////////// Character basic info
            #region Basic info
            Writer.DWord(c.Information.Model);
            Writer.Byte(c.Information.Volume);                      //Char Volume
            Writer.Byte(c.Information.Title);                       //Char Title
            Writer.Byte(c.Information.Pvpstate);                    //Pvp state
            if (c.Information.Pvpstate != 0) c.Information.PvP = true;
            Writer.Bool((c.Information.Level < 20 ? true : false)); //Beginners Icon

            Writer.Byte(c.Information.Slots);                       // Amount of items
            #endregion
            /////////////////////////////////////////////////////// Item info
            #region Item info
            Function.Items.PrivateItemPacket(Writer, c.Information.CharacterID, 8, 0,true);
            Writer.Byte(5);
            Function.Items.PrivateItemPacket(Writer, c.Information.CharacterID, 5, 1,true);
            Writer.Byte(0);
            #endregion
            /////////////////////////////////////////////////////// Character Location / id
            #region Location info / state
            Writer.DWord(c.Information.UniqueID);
            Writer.Byte(c.Position.xSec);
            Writer.Byte(c.Position.ySec);
            Writer.Float(Formule.packetx(c.Position.x, c.Position.xSec));
            Writer.Float(c.Position.z);
            Writer.Float(Formule.packety(c.Position.y, c.Position.ySec));
            Writer.Word(0);//angle
            Writer.Bool(c.Position.Walking);
            Writer.Byte(1); // walk:0 run:1 ;)

            if (c.Position.Walking)
            {
                Writer.Byte(c.Position.packetxSec);
                Writer.Byte(c.Position.packetySec);

                if (!DarkEmu_GameServer.File.FileLoad.CheckCave(c.Position.packetxSec, c.Position.packetySec))
                {
                    Writer.Word(c.Position.packetX);
                    Writer.Word(c.Position.packetZ);
                    Writer.Word(c.Position.packetY);
                }
                else
                {
                    if (c.Position.packetX < 0)
                    {
                        Writer.Word(c.Position.packetX);
                        Writer.Word(0xFFFF);
                    }
                    else
                    {
                        Writer.DWord(c.Position.packetX);
                    }

                    Writer.DWord(c.Position.packetZ);

                    if (c.Position.packetY < 0)
                    {
                        Writer.Word(c.Position.packetY);
                        Writer.Word(0xFFFF);
                    }
                    else
                    {
                        Writer.DWord(c.Position.packetY);
                    }
                }
            }
            else
            {
                Writer.Byte(1);
                Writer.Word(0);//angle
            }

            Writer.Byte((byte)(c.State.LastState == 128 ? 2 : 1));
            Writer.Byte(0);
            Writer.Byte(3);
            Writer.Byte((byte)(c.Information.Berserking ? 1 : 0));

            Writer.Float(c.Speed.WalkSpeed);
            Writer.Float(c.Speed.RunSpeed);
            Writer.Float(c.Speed.BerserkSpeed);

            Writer.Byte(c.Action.Buff.count);
            for (byte b = 0; b < c.Action.Buff.SkillID.Length; b++)
            {
                if (c.Action.Buff.SkillID[b] != 0)
                {
                    Writer.DWord(c.Action.Buff.SkillID[b]);
                    Writer.DWord(c.Action.Buff.OverID[b]);
                }
            }
            #endregion
            /////////////////////////////////////////////////////// Character Job information / name
            #region Job information & name
            Writer.Text(c.Job.Jobname);
            Writer.Byte(1);
//.........这里部分代码省略.........
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:101,代码来源:SpawnPackets.cs

示例3: SpawnPortal

 ///////////////////////////////////////////////////////////////////////////
 public static byte[] SpawnPortal(obj o, character c, int itemid)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_SOLO_SPAWN);
     Writer.DWord(o.ID);
     Writer.DWord(o.UniqueID);
     Writer.Byte(o.xSec);
     Writer.Byte(o.ySec);
     Writer.Float(Formule.packetx((float)o.x, o.xSec));
     Writer.Float(o.z);
     Writer.Float(Formule.packety((float)o.y, o.ySec));
     Writer.Word(0);
     Writer.Byte(1);
     Writer.Byte(0);
     Writer.Byte(1);
     Writer.Byte(6);
     Writer.Text(c.Information.Name);
     Writer.DWord(itemid);
     Writer.Byte(1);
     return Writer.GetBytes();
 }
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:22,代码来源:SpawnPackets.cs

示例4: Load


//.........这里部分代码省略.........
            /////////////////////////////////////////////////////// Skills
            #region Skill
            Writer.Byte(2);
            Writer.Byte(0);
                for (int i = 1; i <= c.Stat.Skill.AmountSkill; i++)
                {
                    Writer.Byte(1);
                    Writer.DWord(c.Stat.Skill.Skill[i]);
                    Writer.Byte(1);
                }
            Writer.Byte(2);
            #endregion
            /////////////////////////////////////////////////////// Quests
            #region Quest
            Writer.Word(1); // how many Quest ids completed/aborted
            Writer.DWord(1);// Quest id
            Writer.Byte(0);//number of Quests that are live
            #endregion
            Writer.Byte(0);//? for now
            /////////////////////////////////////////////////////// Talisman
            #region Talisman
            Writer.DWord(1);//new
            Writer.DWord(1);//new
            Writer.DWord(0);//? for now
            Writer.DWord(0x0C);//new
            #endregion
            /////////////////////////////////////////////////////// Position + id + speed
            #region Character id / Position / Speed
            Writer.DWord(c.Information.UniqueID);
            Writer.Byte(c.Position.xSec);
            Writer.Byte(c.Position.ySec);
            if (!File.FileLoad.CheckCave(c.Position.xSec, c.Position.ySec))
            {
                Writer.Float(Formule.packetx(c.Position.x, c.Position.xSec));
                Writer.Float(c.Position.z);
                Writer.Float(Formule.packety(c.Position.y, c.Position.ySec));
            }
            else
            {
                Writer.Float(Formule.cavepacketx(c.Position.x));// Added for cave Coords
                Writer.Float(c.Position.z);
                Writer.Float(Formule.cavepackety(c.Position.y));// Added for cave Coords

            }
            Writer.Word(0);							// Angle
            Writer.Byte(0);
            Writer.Byte(1);
            Writer.Byte(0);
            Writer.Word(0);							// Angle
            Writer.Word(0);
            Writer.Byte(0);
            Writer.Bool(false); //berserk

            Writer.Byte(0);//new ?

            Writer.Float(c.Speed.WalkSpeed);
            Writer.Float(c.Speed.RunSpeed);
            Writer.Float(c.Speed.BerserkSpeed);
            #endregion
            /////////////////////////////////////////////////////// Premium Tickets
            #region Premium ticket
            Writer.Byte(0); //ITEM_MALL_GOLD_TIME_SERVICE_TICKET_4W
            #endregion
            /////////////////////////////////////////////////////// GM Check + Name
            #region GM Check + Name
            Writer.Text(c.Information.Name);
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:67,代码来源:CharacterLoad.cs

示例5: SetSpeed

 public static byte[] SetSpeed(int id, float speed1, float speed2)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_SETSPEED);
     Writer.DWord(id);
     Writer.Float(speed1);
     Writer.Float(speed2);
     return Writer.GetBytes();
 }
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:9,代码来源:PlayerActionPackets.cs

示例6: MovementOnPickup

 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Movement Pickup
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public static byte[] MovementOnPickup(DarkEmu_GameServer.Global.vektor p)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_PICKUPITEM_MOVE);
     Writer.DWord(p.ID);
     Writer.Byte(p.xSec);
     Writer.Byte(p.ySec);
     Writer.Float(p.x);
     Writer.Float(p.z);
     Writer.Float(p.y);
     Writer.Word(0);
     return Writer.GetBytes();
 }
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:16,代码来源:MovementPackets.cs


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