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


C# PacketIn.GetUint32方法代码示例

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


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

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

示例2: F_DO_ABILITY

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

            if (cclient.Plr == null)
                return;

            UInt32 Unk, Unk2, Unk3 = 0;
            UInt16 AbilityID = 0;

            Unk = packet.GetUint32();
            Unk2 = packet.GetUint32();
            Unk3 = packet.GetUint32();
            AbilityID = packet.GetUint16();

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

示例3: F_PING

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

            uint Timestamp = packet.GetUint32();

            PacketOut Out = new PacketOut((byte)Opcodes.S_PONG);
            Out.WriteUInt32(Timestamp);
            Out.WriteUInt64((UInt64)TCPManager.GetTimeStamp());
            Out.WriteUInt32((UInt32)(cclient.SequenceID+1));
            Out.WriteUInt32(0);
            cclient.SendPacket(Out);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:13,代码来源:AuthentificationHandlers.cs

示例4: F_CONNECT

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

            packet.Skip(8);
            UInt32 Tag = packet.GetUint32();
            string Token = packet.GetString(80);
            packet.Skip(21);
            string Username = packet.GetString(23);

            // TODO
            AuthResult Result = Program.AcctMgr.CheckToken(Username, Token);
            if (Result != AuthResult.AUTH_SUCCESS)
            {
                Log.Error("F_CONNECT", "Invalid Token =" + Username);
                cclient.Disconnect();
            }
            else
            {
                cclient._Account = Program.AcctMgr.GetAccount(Username);
                if (cclient._Account == null)
                {
                    Log.Error("F_CONNECT", "Invalid Account =" + Username);
                    cclient.Disconnect();
                }
                else
                {
                    //Log.Success("F_CONNECT", "MeId=" + cclient.Id);

                    GameClient Other = (cclient.Server as TCPServer).GetClientByAccount(cclient, cclient._Account.AccountId);
                    if (Other != null)
                        Other.Disconnect();

                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.S_CONNECTED);
                        Out.WriteUInt32(0);
                        Out.WriteUInt32(Tag);
                        Out.WriteByte(Program.Rm.RealmId);
                        Out.WriteUInt32(1);
                        Out.WritePascalString(Username);
                        Out.WritePascalString(Program.Rm.Name);
                        Out.WriteByte(0);
                        Out.WriteUInt16(0);
                        cclient.SendPacket(Out);
                    }
                }
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:48,代码来源:AuthentificationHandlers.cs

示例5: F_EMOTE

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

            if (cclient.Plr == null)
                return;

            UInt32 emote = packet.GetUint32();

            PacketOut Out = new PacketOut((byte)Opcodes.F_EMOTE);
            Out.WriteUInt16(cclient.Plr.Oid);
            Out.WriteUInt16((UInt16)emote);
            if (cclient.Plr.CbtInterface.HasTarget())
                Out.WriteUInt16(cclient.Plr.CbtInterface.CurrentTarget.Target.Oid);
            cclient.Plr.DispatchPacket(Out, false);
            cclient.Plr.SendPacket(Out);
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:17,代码来源:TchatHandlers.cs

示例6: OnReceive

        protected override void OnReceive(byte[] Packet)
        {
            lock (this)
            {
                PacketIn pack = new PacketIn(Packet, 0, Packet.Length);
                pack.Size = pack.GetUint32();
                pack.Opcode = pack.GetUint8();

                if (!Enum.IsDefined(typeof(Opcodes), (byte)pack.Opcode))
                {
                    Log.Error("OnReceive", "Opcode invalide : " + pack.Opcode);
                    return;
                }

                Server.HandlePacket((BaseClient)this, pack);
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:17,代码来源:Client.cs

示例7: F_DUMP_STATICS

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

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

            UInt32 Unk1 = packet.GetUint32();
            UInt16 Unk2 = packet.GetUint16();
            UInt16 OffX = packet.GetUint16();
            UInt16 Unk3 = packet.GetUint16();
            UInt16 OffY = packet.GetUint16();

            Log.Success("F_DUMP_STATIC", "X=" + OffX + ",Y=" + OffY);

            cclient.Plr.SetOffset(OffX, OffY);
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:17,代码来源:MovementHandlers.cs

示例8: F_EMOTE

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

            if (cclient.Plr == null)
                return;

            UInt32 emote = packet.GetUint32();

            PacketOut Out = new PacketOut((byte)Opcodes.F_EMOTE);
            Out.WriteUInt16(cclient.Plr.Oid);
            Out.WriteUInt16((UInt16)emote);
            if (cclient.Plr.CbtInterface.HasTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ALLY))
                Out.WriteUInt16(cclient.Plr.CbtInterface.Targets[(int)GameData.TargetTypes.TARGETTYPES_TARGET_ALLY]);
            cclient.Plr.DispatchPacket(Out, false);
            cclient.Plr.SendPacket(Out);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:17,代码来源:TchatHandlers.cs

示例9: F_ZONEJUMP

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

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

            //Log.Dump("Jump", packet, true);
            UInt32 Id = packet.GetUint32();
            Log.Info("Jump", "Jump to :" + Id);

            Zone_jump Jump = WorldMgr.GetZoneJump(Id);
            if (Jump != null)
            {
                cclient.Plr.Teleport(Jump.ZoneID, Jump.WorldX, Jump.WorldY, Jump.WorldZ, Jump.WorldO);
            }
            else
                Log.Error("Jump", "Invalid Jump");
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:19,代码来源:MovementHandlers.cs

示例10: CL_START

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

            string Username = packet.GetString();
            UInt32 Len = packet.GetUint32();
            byte[] Password = packet.Read((int)Len);

            bool result = Program.AcctMgr.CheckAccount(Username, Password);
            Log.Debug("CL_START", "Lancement du client : " + Username + " " + result);

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

            if (result == true)
            {
                Out.WriteByte(0);
                Out.WriteString(Program.AcctMgr.GenerateToken(Username));
            }
            else 
                Out.WriteByte(1);

            cclient.SendPacket(Out);
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:23,代码来源:Packets.cs

示例11: F_GROUP_COMMAND

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

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            packet.GetUint32(); // UNK
            byte State = packet.GetUint8();

            switch (State)
            {
                case 2: // Accept invitation
                    if (Plr.Invitation == null)
                        return;
                    Plr.Invitation.AcceptInvitation();
                    break;
                case 6: // Decline invitation
                    if (Plr.Invitation == null)
                        return;
                    Plr.Invitation.DeclineInvitation();
                    break;
                case 3: // Leave group
                    if (Plr.GetGroup() == null)
                        return;
                    Plr.GetGroup().RemoveMember(Plr);
                    Plr.SetGroup(null);
                    break;
                case 17: // Make main
                    break;
                default:
                    Log.Error("GroupHandler", "Unsupported type: " + State);
                    break;
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:37,代码来源:GroupHandlers.cs

示例12: HandleTrade

        public void HandleTrade(PacketIn packet)
        {
            TradingUpdated = false;

            byte Status = packet.GetUint8();
            byte Unk = packet.GetUint8();
            UInt16 Oid = packet.GetUint16();

            if (!_Owner.IsInWorld())
                return;

            if (!_Owner.IsPlayer())
                return;

            Player Plr = _Owner.GetPlayer();

            if (Oid <= 0)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_NO_TARGET);
                SendTradeClose(Oid);
                return;
            }

            if (Oid == _Owner.Oid)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_CANT_TRADE_WITH_YOURSELF);
                SendTradeClose(Oid);
                return;
            }

            Log.Success("HandleTrade", "Status=" + Status + ",Oid=" + Oid);

            Trading = Plr.Region.GetPlayer(Oid);

            if (Trading == null)
            {
                SendTradeClose(Oid);
                return;
            }

            if (Status == 0 && TradingAccepted == 0) // Nouveau Trade
            {
                if (!CanTrading(Trading))
                {
                    Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_TARGET_ALREADY_TRADING);
                    CloseTrade();
                    return;
                }

                SendTradeInfo(this);
                Trading.ItmInterface.SendTradeInfo(this);
                TradingAccepted = 1;
            }
            else if (Status == 1 && IsTrading()) // Trade mis a jours
            {
                uint Money = packet.GetUint32();
                byte Update = packet.GetUint8();
                byte ItemCounts = packet.GetUint8();

                //Log.Info("Trade", "Money=" + Money + ",Update=" + Update + ",Items=" + ItemCounts);

                Trading.ItmInterface.TradingAccepted = 1;
                TradingAccepted = 1;

                TradingMoney = Money;
                if (TradingMoney > Plr.GetMoney())
                {
                    TradingMoney = Plr.GetMoney();
                    Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_INSUFFICIENT_MONEY);
                    SendTradeInfo(this);
                    Trading.ItmInterface.SendTradeInfo(this);
                    return;
                }

                SendTradeInfo(Trading.ItmInterface);
                Trading.ItmInterface.SendTradeInfo(this);
            }
            else if (Status == 2 && IsTrading()) // J'accept le trade
            {
                TradingAccepted = 2;

                Trading.ItmInterface.SendTradeInfo(this);

                if (TradingAccepted == 2 && Trading.ItmInterface.TradingAccepted == 2)
                    Trade(Trading.ItmInterface);
            }
            else if (Status == 3 && IsTrading()) // Je Ferme le Trade
            {
                Trading.ItmInterface.SendTradeClose(_Owner.Oid);
                SendTradeClose(Oid);
            }
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:92,代码来源:ItemsInterface.cs

示例13: BuildMail

        public void BuildMail(PacketIn packet)
        {
            Player Plr = GetPlayer();
            if (Plr == null)
                return;

            if (nextSend >= TCPServer.GetTimeStamp())
            {
                SendResult(GameData.MailResult.TEXT_MAIL_RESULT6);
                return;
            }

            // Recipient read
            packet.Skip(1);
            byte NameSize = packet.GetUint8();
            string Name = packet.GetString(NameSize);

            Character Receiver = CharMgr.GetCharacter(Name);

            if (Receiver == null)
            {
                SendResult(GameData.MailResult.TEXT_MAIL_RESULT7);
                return;
            }

            if (Receiver.Name == Plr.Name) // You cannot mail yourself
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_PLAYER_CANT_MAIL_YOURSELF);
                return;
            }

            // Subject
            byte SubjectSize = packet.GetUint8();
            packet.Skip(1);
            string Subject = packet.GetString(SubjectSize);

            // Message
            byte MessageSize = packet.GetUint8();
            packet.Skip(1);
            string Message = packet.GetString(MessageSize);

            // Money
            UInt32 money = ByteOperations.ByteSwap.Swap(packet.GetUint32());

            // COD?
            byte cr = packet.GetUint8();

            // Item
            byte itemcounts = packet.GetUint8();

            if (!Plr.RemoveMoney((cr == 0 ? money : 0) + MAIL_PRICE))
            {
                SendResult(MailResult.TEXT_MAIL_RESULT8);
                return;
            }

            // Make a Mail
            Character_mail CMail = new Character_mail();
            CMail.Guid = CharMgr.GenerateMailGUID();
            CMail.CharacterId = Receiver.CharacterId;
            CMail.CharacterIdSender = Plr._Info.CharacterId;
            CMail.SenderName = Plr._Info.Name;
            CMail.ReceiverName = Name;
            CMail.Title = Subject;
            CMail.Content = Message;
            CMail.Money = money;
            CMail.Cr = true;
            CMail.Opened = false;

            Log.Debug("Mail", "Itemcount: " + itemcounts + "");

            for (byte i = 0; i < itemcounts; ++i)
            {
                UInt16 itmslot = ByteOperations.ByteSwap.Swap(packet.GetUint16());
                packet.Skip(2);

                ByteOperations.ByteSwap.Swap(itmslot);

                Item itm = Plr.ItmInterface.GetItemInSlot(itmslot);
                if (itm != null)
                {
                    CMail.ItemsReqInfo.Add(itm.CharItem);
                    Plr.ItmInterface.DeleteItem(itmslot, itm.CharItem.Counts, false);
                    itm.Owner = null;
                }

            }

            SendResult(MailResult.TEXT_MAIL_RESULT4);
            CharMgr.Database.AddObject(CMail);

            //If player exists let them know they have mail.
            Player mailToPlayer = Player.GetPlayer(Name);
            if (mailToPlayer != null)
                mailToPlayer.MlInterface.AddMail(CMail);

            nextSend = (uint)TCPServer.GetTimeStamp() + 5;
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:98,代码来源:MailInterface.cs

示例14: F_MAIL

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

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            byte Type = packet.GetUint8();

            switch (Type)
            {
                case 0: // Mailbox closed
                    {

                    } break;
                case 1: // Mail sent
                    {
                        Plr.MlInterface.BuildMail(packet);
                    } break;
                case 2: // Open mail
                case 3: // Return mail
                case 4: // Delete mail
                case 5: // Mark as read/unread
                case 7: // Take Item
                case 8: // Take money
                    {
                        byte Page = packet.GetUint8();
                        UInt32 Guid = ByteOperations.ByteSwap.Swap(packet.GetUint32());

                        Character_mail Mail = Plr.MlInterface.GetMail(Guid);

                        switch (Type)
                        {
                            case 2:
                                if (!Mail.Opened)
                                {
                                    Mail.Opened = true;
                                    CharMgr.SaveMail(Mail);
                                    Plr.MlInterface.SendMailCounts();
                                    Plr.MlInterface.SendMailBox();
                                }
                                Plr.MlInterface.SendMail(Mail);
                                break;
                            case 3:
                                //TODO
                                Plr.MlInterface.SendResult(GameData.MailResult.TEXT_MAIL_RESULT11);
                                break;
                            case 4:
                                Plr.MlInterface.RemoveMail(Mail);
                                Plr.MlInterface.SendMailCounts();
                                Plr.MlInterface.SendMailBox();
                                break;
                            case 5:
                                packet.Skip(4);
                                Mail.Opened = (packet.GetUint8() == 1);
                                CharMgr.SaveMail(Mail);
                                Plr.MlInterface.SendMailCounts();
                                Plr.MlInterface.SendMailBox();
                                break;
                            case 7:
                                packet.Skip(4);
                                byte itemnum = packet.GetUint8();
                                if (Mail.ItemsReqInfo.Count < itemnum + 1)
                                    return;

                                UInt16 FreeSlot = Plr.ItmInterface.GetFreeInventorySlot();
                                if (FreeSlot == 0)
                                {
                                    Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS);
                                    return;
                                }

                                Character_items item = Mail.ItemsReqInfo.ElementAt(itemnum);
                                Plr.ItmInterface.CreateItem(item.Entry, item.Counts);
                                Mail.ItemsReqInfo.Remove(item);

                                CharMgr.SaveMail(Mail);
                                Plr.MlInterface.SendMailUpdate(Mail);
                                Plr.MlInterface.SendMail(Mail);
                                break;
                            case 8:
                                if (Mail.Money > 0)
                                {
                                    Plr.AddMoney(Mail.Money);
                                    Mail.Money = 0;
                                }
                                // Take as many items as you can before inventory is full
                                foreach (Character_items curritem in Mail.ItemsReqInfo.ToArray())
                                {
                                    UInt16 Slot = Plr.ItmInterface.GetFreeInventorySlot();
                                    if (Slot == 0)
                                    {
                                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS);
                                        break;
                                    }
                                    Plr.ItmInterface.CreateItem(curritem.Entry, curritem.Counts);
                                    Mail.ItemsReqInfo.Remove(curritem);
                                }
//.........这里部分代码省略.........
开发者ID:JeFawk,项目名称:WarEmu,代码行数:101,代码来源:MailHandlers.cs

示例15: F_DUMP_STATICS

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

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

            UInt32 Unk1 = packet.GetUint32();
            UInt16 Unk2 = packet.GetUint16();
            UInt16 OffX = packet.GetUint16();
            UInt16 Unk3 = packet.GetUint16();
            UInt16 OffY = packet.GetUint16();

            cclient.Plr.SetOffset(OffX, OffY);

            if (!cclient.Plr.IsActive)
            {
                cclient.Plr.IsActive = true;
            }
        }
开发者ID:nalgol,项目名称:WarEmu,代码行数:20,代码来源:MovementHandlers.cs


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