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


C# GSPacketIn.ReadIntLowEndian方法代码示例

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


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

示例1: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            string accountName = packet.ReadString(24);

            log.Debug("CharacterCreateRequestHandler for account " + accountName + " using version " + client.Version);

            if (!accountName.StartsWith(client.Account.Name))// TODO more correctly check, client send accountName as account-S, -N, -H (if it not fit in 20, then only account)
            {
                if (ServerProperties.Properties.BAN_HACKERS)
                {
                    DBBannedAccount b = new DBBannedAccount();
                    b.Author = "SERVER";
                    b.Ip = client.TcpEndpointAddress;
                    b.Account = client.Account.Name;
                    b.DateBan = DateTime.Now;
                    b.Type = "B";
                    b.Reason = String.Format("Autoban wrong Account '{0}'", GameServer.Database.Escape(accountName));
                    GameServer.Database.AddObject(b);
                    GameServer.Database.SaveObject(b);
                    GameServer.Instance.LogCheatAction(b.Reason + ". Account: " + b.Account);
                }

                client.Disconnect();
                return;
            }

            if (client.Version >= GameClient.eClientVersion.Version1104)
            {
                packet.ReadIntLowEndian(); //unk - probably indicates customize or create
            }

            int charsCount = client.Version < GameClient.eClientVersion.Version173 ? 8 : 10;
            for (int i = 0; i < charsCount; i++)
            {
                string charName = packet.ReadString(24);

                //log.DebugFormat("Character[{0}] = {1}", i, charName);

                if (charName.Length == 0)
                {
                    // 1.104+  if character is not in list but is in DB then delete the character
                    if (client.Version >= GameClient.eClientVersion.Version1104)
                    {
                        CheckForDeletedCharacter(accountName, client, i);
                    }

                    //If the charname is empty, skip the other bytes
                    packet.Skip(160);
                    if (client.Version >= GameClient.eClientVersion.Version199)
                    {
                        // skip 4 bytes added in 1.99
                        packet.Skip(4);
                    }
                }
                else
                {
                    // Graveen: changed the following to allow GMs to have special chars in their names (_,-, etc..)
                    Regex nameCheck = new Regex("^[A-Z][a-zA-Z]");
                    if (charName.Length < 3 || !nameCheck.IsMatch(charName))
                    {
                        if (client.Account.PrivLevel == 1)
                        {
                            if (ServerProperties.Properties.BAN_HACKERS)
                            {
                                DBBannedAccount b = new DBBannedAccount();
                                b.Author = "SERVER";
                                b.Ip = client.TcpEndpointAddress;
                                b.Account = client.Account.Name;
                                b.DateBan = DateTime.Now;
                                b.Type = "B";
                                b.Reason = String.Format("Autoban bad CharName '{0}'", GameServer.Database.Escape(charName));
                                GameServer.Database.AddObject(b);
                                GameServer.Database.SaveObject(b);
                                GameServer.Instance.LogCheatAction(b.Reason + ". Account: " + b.Account);
                            }

                            client.Disconnect();
                            return;
                        }
                    }

                    String select = String.Format("Name = '{0}'", GameServer.Database.Escape(charName));
                    DOLCharacters character = GameServer.Database.SelectObject<DOLCharacters>(select);
                    if (character != null)
                    {
                        if (character.AccountName != client.Account.Name)
                        {
                            if (Properties.BAN_HACKERS == true)
                            {
                                DBBannedAccount b = new DBBannedAccount();
                                b.Author = "SERVER";
                                b.Ip = client.TcpEndpointAddress;
                                b.Account = client.Account.Name;
                                b.DateBan = DateTime.Now;
                                b.Type = "B";
                                b.Reason = String.Format("Autoban CharName '{0}' on wrong Account '{1}'", GameServer.Database.Escape(charName), GameServer.Database.Escape(client.Account.Name));
                                GameServer.Database.AddObject(b);
                                GameServer.Database.SaveObject(b);
                                GameServer.Instance.LogCheatAction(string.Format(b.Reason + ". Client Account: {0}, DB Account: {1}", client.Account.Name, character.AccountName));
                            }
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:101,代码来源:CharacterCreateRequestHandler.cs


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