• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Packets.PacketWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HandleRequestUITime

        public static void HandleRequestUITime(ref PacketReader packet, ref WorldClass session)
        {
            PacketWriter uiTime = new PacketWriter(LegacyMessage.UITime);

            uiTime.WriteUnixTime();
            session.Send(uiTime);
        }
开发者ID:Gargash,项目名称:Arctium,代码行数:7,代码来源:TimeHandler.cs


示例2: HandleLogoutComplete

        public static void HandleLogoutComplete(ref PacketReader packet, ref WorldClass session)
        {
            WorldMgr.DeleteSession(session.Character.Guid);

            PacketWriter logoutComplete = new PacketWriter(LegacyMessage.LogoutComplete);
            session.Send(logoutComplete);
        }
开发者ID:thundergod221,项目名称:Arctium,代码行数:7,代码来源:LogoutHandler.cs


示例3: BroadcastToAllPacket

 public void BroadcastToAllPacket(ref PacketWriter packet)
 {
     foreach (WorldClass session in Globals.WorldMgr.Sessions.Values)
     {
         session.Send(ref packet);
     }
 }
开发者ID:Mathias1000,项目名称:Arctium,代码行数:7,代码来源:WorldClass.cs


示例4: HandleSendKnownSpells

        public static void HandleSendKnownSpells(ref WorldClass session)
        {
            Character pChar = session.Character;

            var specializationSpells = SpecializationMgr.GetSpecializationSpells(pChar);
            var specializationSpellCount = ((specializationSpells != null) ? specializationSpells.Count : 0);

            var talentSpells = SpecializationMgr.GetTalentSpells(pChar, pChar.ActiveSpecGroup);
            var talentSpellCount = ((talentSpells != null) ? talentSpells.Count : 0);

            int count = pChar.SpellList.Count + specializationSpellCount + talentSpellCount;

            PacketWriter writer = new PacketWriter(ServerMessage.SendKnownSpells);
            BitPack BitPack = new BitPack(writer);

            BitPack.Write(1);
            BitPack.Write(count, 22);
            BitPack.Flush();

            pChar.SpellList.ForEach(spell =>
                writer.WriteUInt32(spell.SpellId));

            if (specializationSpells != null)
                specializationSpells.ForEach(spell => writer.WriteUInt32(spell.Spell));

            if (talentSpells != null)
                talentSpells.ForEach(spell => writer.WriteUInt32(spell));

            session.Send(ref writer);
        }
开发者ID:RashKim,项目名称:Arctium,代码行数:30,代码来源:SpellHandler.cs


示例5: HandleAuthLogonChallenge

        public void HandleAuthLogonChallenge(RealmClass session, PacketReader data)
        {
            Log.Message(LogType.NORMAL, "AuthLogonChallenge");

            data.Skip(10);
            ushort ClientBuild = data.ReadUInt16();
            data.Skip(8);
            account.Language = data.ReadStringFromBytes(4);
            data.Skip(4);

            account.IP = data.ReadIPAddress();
            account.Name = data.ReadAccountName();

            SQLResult result = DB.Realms.Select("SELECT id, name, password, expansion, gmlevel, securityFlags FROM accounts WHERE name = '{0}'", account.Name);

            PacketWriter logonChallenge = new PacketWriter();
            logonChallenge.WriteUInt8((byte)ClientLink.CMD_AUTH_LOGON_CHALLENGE);
            logonChallenge.WriteUInt8(0);

            if (result.Count != 0)
            {
                account.Id = result.Read<Int32>(0, "id");
                account.Expansion = result.Read<Byte>(0, "expansion");
                account.SecurityFlags = result.Read<Byte>(0, "securityFlags");

                DB.Realms.Execute("UPDATE accounts SET ip = '{0}', language = '{1}' WHERE id = {2}", account.IP, account.Language, account.Id);

                byte[] username = Encoding.ASCII.GetBytes(result.Read<String>(0, "name").ToUpper());
                byte[] password = Encoding.ASCII.GetBytes(result.Read<String>(0, "password").ToUpper());

                // WoW 5.1.0.16173 (5.1.0 PTR)
                if (ClientBuild == 16173)
                {
                    session.SecureRemotePassword.CalculateX(username, password);
                    byte[] buf = new byte[0x10];
                    SRP6.RAND_bytes(buf, 0x10);

                    logonChallenge.WriteUInt8((byte)AuthResults.WOW_SUCCESS);
                    logonChallenge.WriteBytes(session.SecureRemotePassword.B);
                    logonChallenge.WriteUInt8(1);
                    logonChallenge.WriteUInt8(session.SecureRemotePassword.g[0]);
                    logonChallenge.WriteUInt8(0x20);
                    logonChallenge.WriteBytes(session.SecureRemotePassword.N);
                    logonChallenge.WriteBytes(session.SecureRemotePassword.salt);
                    logonChallenge.WriteBytes(buf);

                    // Security flags
                    logonChallenge.WriteUInt8(account.SecurityFlags);

                    // Enable authenticator
                    if ((account.SecurityFlags & 4) != 0)
                        logonChallenge.WriteUInt8(1);
                }
            }
            else
                logonChallenge.WriteUInt8((byte)AuthResults.WOW_FAIL_UNKNOWN_ACCOUNT);

            session.Send(logonChallenge);
        }
开发者ID:Gargash,项目名称:Arctium,代码行数:59,代码来源:RealmClass.cs


示例6: HandleTutorialFlags

        public static void HandleTutorialFlags(ref WorldClass session)
        {
            PacketWriter tutorialFlags = new PacketWriter(LegacyMessage.TutorialFlags);
            for (int i = 0; i < 8; i++)
                tutorialFlags.WriteUInt32(0);

            session.Send(ref tutorialFlags);
        }
开发者ID:MrAndis,项目名称:Arctium,代码行数:8,代码来源:TutorialHandler.cs


示例7: HandleCacheVersion

        public static void HandleCacheVersion(ref WorldClass session)
        {
            PacketWriter cacheVersion = new PacketWriter(ServerMessage.CacheVersion);

            cacheVersion.WriteUInt32(0);

            session.Send(ref cacheVersion);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:8,代码来源:MiscHandler.cs


示例8: HandleUpdateClientCacheVersion

        public static void HandleUpdateClientCacheVersion(ref WorldClass session)
        {
            PacketWriter cacheVersion = new PacketWriter(LegacyMessage.UpdateClientCacheVersion);

            cacheVersion.WriteUInt32(0);

            session.Send(cacheVersion);
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:8,代码来源:MiscHandler.cs


示例9: HandleUITimeRequest

        public static void HandleUITimeRequest(ref PacketReader packet, WorldClass session)
        {
            PacketWriter uiTime = new PacketWriter(ServerMessage.UITime);

            uiTime.WriteUnixTime();

            session.Send(ref uiTime);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:8,代码来源:TimeHandler.cs


示例10: HandleObjectDestroy

        public static void HandleObjectDestroy(ref WorldClass session)
        {
            PacketWriter objectDestroy = new PacketWriter(LegacyMessage.ObjectDestroy);

            objectDestroy.WriteUInt64(session.Character.Guid);
            objectDestroy.WriteUInt8(0);

            session.Send(objectDestroy);
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:9,代码来源:ObjectHandler.cs


示例11: OnConnect

        public void OnConnect()
        {
            PacketWriter TransferInitiate = new PacketWriter(Message.TransferInitiate);
            TransferInitiate.WriteCString("RLD OF WARCRAFT CONNECTION - SERVER TO CLIENT");

            Send(TransferInitiate);

            clientSocket.BeginReceive(DataBuffer, 0, DataBuffer.Length, SocketFlags.None, Receive, null);
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:9,代码来源:WorldClass.cs


示例12: HandleObjectDestroy

        public static PacketWriter HandleObjectDestroy(ref WorldClass session, ulong guid)
        {
            PacketWriter objectDestroy = new PacketWriter(LegacyMessage.ObjectDestroy);

            objectDestroy.WriteUInt64(guid);
            objectDestroy.WriteUInt8(0);

            return objectDestroy;
        }
开发者ID:owner-gamers,项目名称:Arctium,代码行数:9,代码来源:ObjectHandler.cs


示例13: HandlePong

        public static void HandlePong(ref PacketReader packet, ref WorldClass session)
        {
            uint sequence = packet.ReadUInt32();
            uint latency = packet.ReadUInt32();

            PacketWriter pong = new PacketWriter(JAMCCMessage.Pong);
            pong.WriteUInt32(sequence);

            session.Send(pong);
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:10,代码来源:MiscHandler.cs


示例14: HandleMessageOfTheDay

        public static void HandleMessageOfTheDay(ref WorldClass session)
        {
            PacketWriter motd = new PacketWriter(LegacyMessage.MessageOfTheDay);
            motd.WriteUInt32(3);

            motd.WriteCString("Arctium MoP test");
            motd.WriteCString("Welcome to our MoP server test.");
            motd.WriteCString("Your development team =)");
            session.Send(ref motd);
        }
开发者ID:Kinivus,项目名称:Arctium,代码行数:10,代码来源:MiscHandler.cs


示例15: HandleLogoutComplete

        public static void HandleLogoutComplete(ref PacketReader packet, ref WorldClass session)
        {
            var pChar = session.Character;

            ObjectMgr.SavePositionToDB(pChar);
            WorldMgr.DeleteSession(pChar.Guid);

            PacketWriter logoutComplete = new PacketWriter(LegacyMessage.LogoutComplete);
            session.Send(logoutComplete);
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:10,代码来源:LogoutHandler.cs


示例16: HandleCreateCharacter

        public static void HandleCreateCharacter(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            var hairStyle = packet.ReadByte();
            var gender = packet.ReadByte();
            var race = packet.ReadByte();
            var hairColor = packet.ReadByte();
            var pClass = packet.ReadByte();
            var facialHair = packet.ReadByte();
            packet.ReadByte();                      // Always 0
            var skin = packet.ReadByte();
            var face       = packet.ReadByte();

            var nameLength = BitUnpack.GetBits<uint>(7);
            var name = Character.NormalizeName(packet.ReadString(nameLength));

            var result = DB.Characters.Select("SELECT * from characters WHERE name = ?", name);
            var createChar = new PacketWriter(ServerMessage.CreateChar);

            if (result.Count != 0)
            {
                // Name already in use
                createChar.WriteUInt8(0x32);
                session.Send(ref createChar);
                return;
            }

            result = DB.Characters.Select("SELECT map, zone, posX, posY, posZ, posO FROM character_creation_data WHERE race = ? AND class = ?", race, pClass);
            if (result.Count == 0)
            {
                createChar.WriteUInt8(0x31);
                session.Send(ref createChar);
                return;
            }

            var map  = result.Read<uint>(0, "map");
            var zone = result.Read<uint>(0, "zone");
            var posX = result.Read<float>(0, "posX");
            var posY = result.Read<float>(0, "posY");
            var posZ = result.Read<float>(0, "posZ");
            var posO = result.Read<float>(0, "posO");

            // Allow declined names for now
            var characterFlags = CharacterFlag.Decline;

            DB.Characters.Execute("INSERT INTO characters (name, accountid, realmId, race, class, gender, skin, zone, map, x, y, z, o, face, hairstyle, haircolor, facialhair, characterFlags) VALUES (" +
                                  "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                                  name, session.Account.Id, WorldConfig.RealmId, race, pClass, gender, skin, zone, map, posX, posY, posZ, posO, face, hairStyle, hairColor, facialHair, characterFlags);

            // Success
            createChar.WriteUInt8(0x2F);
            session.Send(ref createChar);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:54,代码来源:CharacterHandler.cs


示例17: HandleLogoutCancel

        public static void HandleLogoutCancel(ref PacketReader packet, WorldClass session)
        {
            cts.Cancel();

            MoveHandler.HandleMoveUnroot(session);

            PacketWriter LogoutCancelAck = new PacketWriter(ServerMessage.LogoutCancelAck);
            session.Send(ref LogoutCancelAck);

            session.Character.setStandState(0);
        }
开发者ID:mansemino,项目名称:Arctium,代码行数:11,代码来源:LogoutHandler.cs


示例18: HandleTalkToGossip

        public static void HandleTalkToGossip(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 3, 1, 7, 4, 6, 0, 2, 5 };
            byte[] guidBytes = { 0, 1, 7, 6, 5, 2, 4, 3 };

            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
            var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
                BitPack BitPack = new BitPack(gossipMessage, guid);

                BitPack.WriteGuidMask(0, 1);
                BitPack.Write(0, 19);           // gossipData.QuestsCount
                BitPack.WriteGuidMask(2);
                BitPack.Write(0, 20);           // gossipData.OptionsCount

                // QuestsCount not supported.
                // for (int i = 0; i < gossipData.QuestsCount; i++)

                BitPack.WriteGuidMask(3);

                // OptionsCount not supported.
                // for (int i = 0; i < gossipData.OptionsCount; i++)

                BitPack.WriteGuidMask(5, 4, 6, 7);

                BitPack.Flush();

                BitPack.WriteGuidBytes(6);

                // OptionsCount not supported.
                // for (int i = 0; i < gossipData.OptionsCount; i++)

                BitPack.WriteGuidBytes(0);

                // QuestsCount not supported.
                // for (int i = 0; i < gossipData.QuestsCount; i++)

                gossipMessage.WriteInt32(gossipData.Id);

                BitPack.WriteGuidBytes(4, 3);

                gossipMessage.WriteInt32(gossipData.FriendshipFactionID);
                gossipMessage.WriteInt32(gossipData.TextID);

                BitPack.WriteGuidBytes(7, 1, 5, 1);

                session.Send(ref gossipMessage);
            }
        }
开发者ID:OakCore,项目名称:Arctium,代码行数:54,代码来源:GossipHandler.cs


示例19: HandleLoginSetTimeSpeed

        public static void HandleLoginSetTimeSpeed(ref WorldClass session)
        {
            PacketWriter loginSetTimeSpeed = new PacketWriter(ServerMessage.LoginSetTimeSpeed);

            loginSetTimeSpeed.WriteInt32(1);
            loginSetTimeSpeed.WriteInt32(1);
            loginSetTimeSpeed.WriteFloat(0.01666667f);
            loginSetTimeSpeed.WritePackedTime();
            loginSetTimeSpeed.WritePackedTime();

            session.Send(ref loginSetTimeSpeed);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:12,代码来源:TimeHandler.cs


示例20: HandleRealmSplitStateResponse

        public static void HandleRealmSplitStateResponse(ref PacketReader packet, ref WorldClass session)
        {
            uint realmSplitState = 0;

            PacketWriter realmSplitStateResp = new PacketWriter(LegacyMessage.RealmSplitStateResponse);

            realmSplitStateResp.WriteUInt32(packet.ReadUInt32());
            realmSplitStateResp.WriteUInt32(realmSplitState);
            realmSplitStateResp.WriteCString("01/01/01");

            session.Send(ref realmSplitStateResp);
        }
开发者ID:jesus01,项目名称:Arctium,代码行数:12,代码来源:TimeHandler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ObjectDefines.ObjectMovementValues类代码示例发布时间:2022-05-26
下一篇:
C# Packets.PacketReader类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap