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


C# PacketOut.WriteInt32方法代码示例

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


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

示例1: BuildCharactersList

        public static byte[] BuildCharactersList(int AccountId)
        {
            Log.Debug("BuildCharactersList", "AcocuntId = " + AccountId);
            Character[] Chars = GetAccountChar(AccountId)._Chars;
            int count = 0;

            PacketOut Out = new PacketOut(0);
            Out.Position = 0;

            Character Char = null;
            for (int k = 0; k < MAX_SLOT; ++k)
            {
                Char = Chars[k];
                if (Char != null)
                {
                    List<Character_items> Items = CharMgr.GetItemChar(Char.CharacterId);

                    /****  char slot start ****/
                    Out.FillString(Char.Name, 48); // name
                    Out.WriteByte(Char.Value[0].Level); // Level
                    Out.WriteByte(Char.Career); //career
                    Out.WriteByte(Char.Realm); // realm
                    Out.WriteByte(Char.Sex); // gender
                    Out.WriteUInt16R(Char.ModelId); //model id
                    Out.WriteUInt16R(Char.Value[0].ZoneId); // zone id
                    Out.Fill(0, 12); // unk

                    Character_items Item = null;
                    for (UInt16 SlotId = 14; SlotId < 30; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);

                        if (Item == null)
                        {
                            Out.WriteInt32(0);
                            Out.WriteInt32(0);
                        }
                        else
                        {

                            Out.WriteInt32((int)Item.ModelId);
                            Out.WriteUInt16R(0); // primary dye
                            Out.WriteUInt16R(0); // secondary dye
                        }
                    }
                    Out.WriteUInt32(0x00); // 0x00000000
                    for (int i = 0; i < 4; i++)
                    {
                        Out.WriteUInt32(0xFF000000);
                        Out.WriteUInt32(0x00);
                    }
                    Out.WriteUInt32(0xFF000000);

                    //weapons
                    for (UInt16 SlotId = 10; SlotId < 13; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);

                        if (Item == null)
                            Out.WriteUInt32(0);
                        else
                        {
                            Out.WriteUInt16R((ushort)Item.ModelId);
                            Out.WriteUInt16(0);
                        }
                    }
                    Out.Fill(0, 8);
                    Out.WriteUInt16(0xFF00);
                    Out.WriteByte(0);
                    Out.WriteByte(Char.Race); // char slot position
                    Out.WriteUInt16(0x00); //unk

                   /* //Traits [8 bytes]
                    Out.WriteByte(1); //face
                    Out.WriteByte(4); //jewel
                    Out.WriteByte(4); //scar
                    Out.WriteByte(0); //hair
                    Out.WriteByte(3); //hair color
                    Out.WriteByte(2); //skin color
                    Out.WriteByte(0); //eye color
                    Out.WriteByte(5); //metal color
                    */
                    Out.Write(Char.bTraits, 0, Char.bTraits.Length);

                    Out.Fill(0, 14); //unk

                    count++;
                }
            }

            for (int i = 0; i < (MAX_SLOT - count); ++i)
                Out.Write(new byte[284], 0, 284);

            return Out.ToArray();
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:95,代码来源:CharMgr.cs


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