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


C# BaseClient类代码示例

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


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

示例1: HandlePacket

 public int HandlePacket(BaseClient client, PacketIn packet)
 {
     LobbyClient cclient = client as LobbyClient;
     byte slotId = packet.GetUint8();
     Character Info = cclient.Characters.Get(slotId);
     MySqlCommand cmd = new MySqlCommand("DELETE FROM `clientstatus` WHERE `name` = @name", Connection.Instance);
     try
     {
         cmd.Prepare();
         cmd.Parameters.AddWithValue("@name", Info.Name);
         cmd.ExecuteNonQuery();
     }
     catch (MySqlException) { }
     finally { cmd.Dispose(); }
     PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_INFO);
     if (Info == null) Out.WriteUInt32Reverse((uint)ResponseCodes.RC_FAILED);
     else
     {
         Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
         Out.WriteByte(Info.Slot);
         Out.WriteByte(Info.Gender);
         Out.WriteUInt32Reverse(Info.Playtime);
         Out.WriteUInt32Reverse(Info.Rank);
         Out.WriteByte(Info.Threat);
         Out.WriteUInt32Reverse(Info.Money);
         Out.WriteParsedString("APB-EMU", 60);
         byte[] Custom = Info.getCustom();
         Out.Write(Custom, 0, Custom.Length);
     }
     cclient.Send(Out);
     return 0;
 }
开发者ID:harleyknd1,项目名称:rAPB,代码行数:32,代码来源:ASK_CHARACTER_INFO.cs

示例2: HandlePacket

 public int HandlePacket(BaseClient client, PacketIn packet)
 {
     LobbyClient cclient = client as LobbyClient;
     UInt32 WorldUid = packet.GetUint32Reversed();
     string Name = packet.GetParsedString();
     PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK);
     if (Databases.CharacterTable.Count(c => c.Name == Name) == 0)
     {
         cclient.Pending = new CharacterEntry();
         cclient.Pending.Index = Databases.CharacterTable.GenerateIndex();
         cclient.Pending.AccountIndex = cclient.Account.Index;
         cclient.Pending.Name = Name;
         cclient.Pending.World = (int)WorldUid;
         cclient.Pending.Rank = 1;
         cclient.Pending.Money = 0;
         cclient.Pending.Threat = 1;
         cclient.Pending.Playtime = 0;
         cclient.Pending.Clan = "APB-EMU";
         cclient.Pending.IsOnline = 0;
         cclient.Pending.DistrictID = 0;
         cclient.Pending.DistrictType = 0;
         cclient.Pending.LFG = 0;
         cclient.Pending.IsGroupPublic = 0;
         cclient.Pending.GroupInvite = 0;
         cclient.Pending.GroupStatus = 0;
         Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
     }
     else
     {
         cclient.Pending = default(CharacterEntry);
         Out.WriteUInt32Reverse((uint)ResponseCodes.RC_CHARACTER_NAME_CHECK_IN_USE);
     }
     cclient.Send(Out);
     return 0;
 }
开发者ID:fiki574,项目名称:rAPB,代码行数:35,代码来源:ASK_CHARACTER_NAME_CHECK.cs

示例3: F_INTERFACE_COMMAND

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

            if (cclient.Plr == null)
                return;

            byte CommandId = packet.GetUint8();

            switch (CommandId)
            {

                case 1: // ????
                    {
                    } break;

                case 2: // Resurrect Button
                    {
                        cclient.Plr.PreRespawnPlayer();
                        Log.Success("Interface Command", "Respawn Player");
                    } break;

                case 10: // Talisman Fuse
                    {
                    } break;

            };
        }
开发者ID:Necrosummon,项目名称:WarEmu,代码行数:28,代码来源:InterfaceHandlers.cs

示例4: F_USE_ITEM

        static public void F_USE_ITEM(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;
            if (!cclient.IsPlaying())
                return;

            Player Plr = cclient.Plr;

            ushort slot = packet.GetUint16();

            Item item = Plr.ItmInterface.GetItemInSlot(slot);

            if (Plr.Level < item.Info.MinRank)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_LEVEL_TOO_LOW);
                return;
            }
            else if (Plr.Rank < item.Info.MinRenown)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_RENOWN_TOO_LOW);
                return;
            }

            if (item.Info.Type == 31 && item.Info.ScriptName == "HealthPotion") // Potion
            {
                Plr.DealHeal(Plr, (uint)item.Info.MinRank * 100);
                Plr.ItmInterface.DeleteItem(slot, 1, true);
            }
            
        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:30,代码来源:InventoryHandlers.cs

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

示例6: F_BAG_INFO

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

            if (!cclient.IsPlaying())
                return;

            byte Type = packet.GetUint8();

            Player Plr = cclient.Plr;

            switch (Type)
            {
                case 3: // Toggle Pvp
                    Plr.CbtInterface.TogglePvp();
                    break;

                case 16: // Buy more bag space
                    byte Price = packet.GetUint8();
                    if (!Plr.ItmInterface.HasMaxBag())
                    {
                        if (Plr.HaveMoney(Plr.ItmInterface.GetBagPrice()))
                        {
                            if (Plr.RemoveMoney(Plr.ItmInterface.GetBagPrice()))
                            {
                                ++Plr.ItmInterface.BagBuy;
                                Plr.ItmInterface.SendMaxInventory(Plr);
                            }
                        }
                    }
                    break;
            }
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:33,代码来源:InventoryHandlers.cs

示例7: HandlePacket

 public int HandlePacket(BaseClient client, PacketIn packet)
 {
     WorldClient cclient = (WorldClient)client;
     UInt32 code = packet.GetUint32();
     cclient.Send(new ANS_DISTRICT_RESERVE(code, packet.GetUint32(), cclient.Character.LFG, cclient));
     return 0;
 }
开发者ID:fiki574,项目名称:rAPB,代码行数:7,代码来源:ASK_DISTRICT_RESERVE.cs

示例8: CMSG_VerifyProtocolReq

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

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

            byte[] IV_HASH1 = { 0x01, 0x53, 0x21, 0x4d, 0x4a, 0x04, 0x27, 0xb7, 0xb4, 0x59, 0x0f, 0x3e, 0xa7, 0x9d, 0x29, 0xe9 };
            byte[] IV_HASH2 = { 0x49, 0x18, 0xa1, 0x2a, 0x64, 0xe1, 0xda, 0xbd, 0x84, 0xd9, 0xf4, 0x8a, 0x8b, 0x3c, 0x27, 0x20 };
            
            ByteString iv1 = ByteString.CopyFrom(IV_HASH1);
            ByteString iv2 = ByteString.CopyFrom(IV_HASH2);
            VerifyProtocolReply.Builder verify = VerifyProtocolReply.CreateBuilder();
            verify.SetResultCode(VerifyProtocolReply.Types.ResultCode.RES_SUCCESS);

            verify.SetIv1(ByteString.CopyFrom(IV_HASH1));
            verify.SetIv2(ByteString.CopyFrom(IV_HASH2));


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

            cclient.SendTCPCuted(Out);

        }
开发者ID:dzikun,项目名称:WarEmu,代码行数:25,代码来源:AuthentificationHandlers.cs

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

示例10: HandlePacket

 public int HandlePacket(BaseClient client, PacketIn packet)
 {
     LobbyClient cclient = (LobbyClient)client;
     Byte slotId = packet.GetUint8();
     Character character = cclient.Characters.Get(slotId);
     if (character == null) Log.Error(cclient.Account.Email, "Wrong slot specified!");
     World.World info = null;
     lock (Program.worldListener.Worlds)
     {
         Program.worldListener.Worlds.TryGetValue(character.WorldId, out info);
     }
     PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER);
     if (info == null) Out.WriteUInt32Reverse(1);
     else
     {
         info.Send(new AccountEnter(cclient.Account.Id, character.Id, cclient.SessionId));
         Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
         Out.WriteByte(info.IP1);
         Out.WriteByte(info.IP2);
         Out.WriteByte(info.IP3);
         Out.WriteByte(info.IP4);
         Out.WriteUInt16Reverse((UInt16)info.Port);
         Out.WriteInt64Reverse(TCPManager.GetTimeStamp());
     }
     cclient.Send(Out);
     return 0;
 }
开发者ID:harleyknd1,项目名称:rAPB,代码行数:27,代码来源:ASK_WORLD_ENTER.cs

示例11: HandlePacket

 public int HandlePacket(BaseClient client, PacketIn packet)
 {
     LobbyClient cclient = (LobbyClient)client;
     Byte slotId = packet.GetUint8();
     CharacterEntry character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == cclient.Account.Index && c.Slot == slotId);
     if (character.Index < 1) Log.Error(cclient.Account.Username, "Wrong slot specified!");
     World.World info = null;
     lock (Program.worldListener.Worlds)
     {
         Program.worldListener.Worlds.TryGetValue((uint)character.World, out info);
     }
     PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER);
     if (info == null) Out.WriteUInt32Reverse(1);
     else
     {
         info.Send(new AccountEnter((uint)cclient.Account.Index, (uint)character.Index, cclient.SessionId));
         Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS);
         Out.WriteByte(info.IP1);
         Out.WriteByte(info.IP2);
         Out.WriteByte(info.IP3);
         Out.WriteByte(info.IP4);
         Out.WriteUInt16Reverse((UInt16)info.Port);
         Out.WriteInt64Reverse(TCPManager.GetTimeStamp());
     }
     cclient.Send(Out);
     return 0;
 }
开发者ID:fiki574,项目名称:rAPB,代码行数:27,代码来源:ASK_WORLD_ENTER.cs

示例12: HandlePacket

 public int HandlePacket(BaseClient client, PacketIn packet)
 {
     LobbyClient cclient = client as LobbyClient;
     byte[] clientModulus = new byte[64];
     for (int i = 0; i < 64; ++i) clientModulus[i] = packet.GetUint8();
     cclient.clientModulus = new FrameWork.NetWork.Crypto.BigInteger(1, clientModulus);
     UInt16 unk = packet.GetUint16();
     byte[] Proof = new byte[20];
     for (int i = 0; i < 20; ++i) Proof[i] = packet.GetUint8();
     cclient.Proof = Proof;
     if (IsBanned(cclient))
     {
         ANS_LOGIN_FAILED.Send(cclient, (int)ResponseCodes.RC_LOGIN_ACCOUNT_BLOCKED);
         cclient.Disconnect();
     }
     else
     {
         if (IsValid(cclient))
         {
             ANS_LOGIN_SUCCES.Send(cclient);
             cclient.ECrypt = new TCP.Encryption(cclient.SessionId);
             ANS_CHARACTER_INFO.Send(cclient);
         }
         else
         {
             ANS_LOGIN_FAILED.Send(cclient, (int)ResponseCodes.RC_LOGIN_INVALID_ACCOUNT);
             cclient.Disconnect();
         }
     }
     return 0;
 }
开发者ID:fiki574,项目名称:rAPB,代码行数:31,代码来源:LOGIN_PROOF.cs

示例13: HandlePacket

        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = (LobbyClient)client;

            UInt32 WorldUid = packet.GetUint32R();
            string Name = packet.GetUnicodeString();

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK);

            if (CheckName(Name) == 0)
            {
                cclient.CreateChar = new DBCharacter();
                cclient.CreateChar.AcctId = cclient.Account.Id;
                cclient.CreateChar.Name = Name;

                if (cclient.Account.WorldId != WorldUid)
                    Program.CharMgr.SetAccountWorld(cclient.Account.Id, (int)WorldUid);

                Out.WriteUInt32(0);
            }
            else
            {
                cclient.CreateChar = null;
                Out.WriteUInt32(1);
            }

            cclient.SendTCP(Out);
        }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:28,代码来源:ASK_CHARACTER_NAME_CHECK.cs

示例14: HandlePacket

        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = client as LobbyClient;

            byte freeslot = Program.CharMgr.GetFreeSlot(cclient.Account.Id);

            if (freeslot == 0 || cclient.CreateChar == null)
                ANS_CHARACTER_CREATE.Send(cclient);
            else
            {
                cclient.CreateChar.SlotId = freeslot;
                cclient.CreateChar.Faction = packet.GetUint8();
                cclient.CreateChar.Gender = packet.GetUint8();
                cclient.CreateChar.Version = (int)packet.GetUint32R();
                cclient.CreateChar.Seconds = (int)packet.GetUint32R();

                byte[] Custom = new byte[packet.Length - packet.Position];
                packet.Read(Custom, 0, Custom.Length);

                cclient.CreateChar.Custom = BitConverter.ToString(Custom);

                Program.CharMgr.CreateCharacter(cclient.CreateChar);
                ANS_CHARACTER_CREATE.Send(cclient);
            }
        }
开发者ID:Novo,项目名称:apbprivateserver,代码行数:25,代码来源:ASK_CHARACTER_CREATE.cs

示例15: F_FLIGHT

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

            UInt16 TargetOID = packet.GetUint16();
            UInt16 State = packet.GetUint16();

            Log.Info("F_FLIGHT", "TargetOid = " + TargetOID + ",State=" + State);

            if (State == 20) // Flight Master
            {
                Object Obj = cclient.Plr.Zone.GetObject(TargetOID);
                if (Obj == null || !Obj.IsCreature())
                {
                    Log.Error("F_FLIGHT", "Invalid Creature OID : " + TargetOID);
                    return;
                }

                UInt16 FlyID = packet.GetUint16();

                List<Zone_Taxi> Taxis = WorldMgr.GetTaxis(cclient.Plr);
                if (Taxis.Count <= FlyID - 1)
                    return;

                if (!cclient.Plr.RemoveMoney(Taxis[FlyID - 1].Info.Price))
                {
                    cclient.Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
                    return;
                }

                cclient.Plr.Teleport(Taxis[FlyID - 1].ZoneID, Taxis[FlyID - 1].WorldX, Taxis[FlyID - 1].WorldY, Taxis[FlyID - 1].WorldZ, Taxis[FlyID - 1].WorldO);
            }
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:33,代码来源:MovementHandlers.cs


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