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


C# GSPacketIn.ReadString方法代码示例

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


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

示例1: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			lock (this)
			{
				string dllName = packet.ReadString(16);
				packet.Position = 0x50;
				uint upTime = packet.ReadInt();
				string text = string.Format("Client crash ({0}) dll:{1} clientUptime:{2}sec", client.ToString(), dllName, upTime);
				if (log.IsInfoEnabled)
					log.Info(text);

				if (log.IsDebugEnabled)
				{
					log.Debug("Last client sent/received packets (from older to newer):");
					
					foreach (IPacket prevPak in client.PacketProcessor.GetLastPackets())
					{
						log.Info(prevPak.ToHumanReadable());
					}
				}
					
				//Eden
				if(client.Player!=null)
				{
					GamePlayer player = client.Player;
					client.Out.SendPlayerQuit(true);
					client.Player.SaveIntoDatabase();
					client.Player.Quit(true);
					client.Disconnect();
				}
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:32,代码来源:ClientCrashPacketHandler.cs

示例2: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string name=packet.ReadString(30);
			//TODO do bad name checks here from some database with
			//bad names, this is just a temp testthing here
			bool bad = false;

			ArrayList names = GameServer.Instance.InvalidNames;

			foreach(string s in names)
			{
				if(name.ToLower().IndexOf(s) != -1)
				{
					bad = true;
					break;
				}
			}

			//if(bad)
			//DOLConsole.WriteLine(String.Format("Name {0} is bad!",name));
			//else
			//DOLConsole.WriteLine(String.Format("Name {0} seems to be a good name!",name));

			client.Out.SendBadNameCheckReply(name,bad);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:25,代码来源:BadNameCheckRequestHandler.cs

示例3: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string localIP = packet.ReadString(22);
			ushort localPort = packet.ReadShort();
			client.LocalIP = localIP;
			client.Out.SendUDPInitReply();
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:7,代码来源:UDPInitRequestHandler.cs

示例4: HandlePacket

 /// <summary>
 /// Called when the packet has been received
 /// </summary>
 /// <param name="client">Client that sent the packet</param>
 /// <param name="packet">Packet data</param>
 /// <returns>Non zero if function was successfull</returns>
 public void HandlePacket(GameClient client, GSPacketIn packet)
 {
     string localIP = packet.ReadString(22);
     ushort localPort = packet.ReadShort();
     // TODO check changed localIP
     client.LocalIP = localIP;
     client.UdpPingTime = DateTime.Now.Ticks;
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:14,代码来源:UDPPingRequestHandler.cs

示例5: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string name = packet.ReadString(30);
			string select = string.Format("Name = '{0}'", GameServer.Database.Escape(name));
			DOLCharacters character = GameServer.Database.SelectObject<DOLCharacters>(select);
			bool nameExists = (character != null);

			client.Out.SendDupNameCheckReply(name, nameExists);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:9,代码来源:DuplicateNameCheckRequestHandler.cs

示例6: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			if (client == null || client.Player == null)
				return;

			if ((client.Player.TargetObject is IGameInventoryObject) == false)
				return;

			MarketSearch.SearchData search = new MarketSearch.SearchData();

			search.name = packet.ReadString(64);
			search.slot = (int)packet.ReadInt();
			search.skill = (int)packet.ReadInt();
			search.resist = (int)packet.ReadInt();
			search.bonus = (int)packet.ReadInt();
			search.hp = (int)packet.ReadInt();
			search.power = (int)packet.ReadInt();
			search.proc = (int)packet.ReadInt();
			search.qtyMin = (int)packet.ReadInt();
			search.qtyMax = (int)packet.ReadInt();
			search.levelMin = (int)packet.ReadInt();
			search.levelMax = (int)packet.ReadInt();
			search.priceMin = (int)packet.ReadInt();
			search.priceMax = (int)packet.ReadInt();
			search.visual = (int)packet.ReadInt();
			search.page = (byte)packet.ReadByte();
			byte unk1 = (byte)packet.ReadByte();
			short unk2 = (short)packet.ReadShort();
			byte unk3 = 0;
			byte unk4 = 0;
			byte unk5 = 0;
			byte unk6 = 0;
			byte unk7 = 0;
			byte unk8 = 0;

			if (client.Version >= GameClient.eClientVersion.Version198)
			{
				// Dunnerholl 2009-07-28 Version 1.98 introduced new options to Market search. 12 Bytes were added, but only 7 are in usage so far in my findings.
				// update this, when packets change and keep in mind, that this code reflects only the 1.98 changes
				search.armorType = search.page; // page is now used for the armorType (still has to be logged, i just checked that 2 means leather, 0 = standard
				search.damageType = (byte)packet.ReadByte(); // 1=crush, 2=slash, 3=thrust
				unk3 = (byte)packet.ReadByte();
				unk4 = (byte)packet.ReadByte();
				unk5 = (byte)packet.ReadByte();
				search.playerCrafted = (byte)packet.ReadByte(); // 1 = show only Player crafted, 0 = all
				// 3 bytes unused
				packet.Skip(3);
				search.page = (byte)packet.ReadByte(); // page is now sent here
				unk6 = (byte)packet.ReadByte();
				unk7 = (byte)packet.ReadByte();
				unk8 = (byte)packet.ReadByte();
			}

			search.clientVersion = client.Version.ToString();

			(client.Player.TargetObject as IGameInventoryObject).SearchInventory(client.Player, search);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:57,代码来源:PlayerMarketSearchRequestHandler.cs

示例7: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string localIP = packet.ReadString(22);
			ushort localPort = packet.ReadShort();
			client.LocalIP = localIP;
			client.Out.SendUDPInitReply();
		    if (client.Account.PrivLevel > 1 && ServerProperties.Properties.ENABLE_DEBUG)
		        client.Out.SendDebugMessage("local IP:{0} port:{1}", localIP, localPort);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:9,代码来源:UDPInitRequestHandler.cs

示例8: HandlePacket

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

			//TODO do bad name checks here from some database with
			//bad names, this is just a temp testthing here
			var bad = GameServer.Instance.PlayerManager.InvalidNames[name];

			client.Out.SendBadNameCheckReply(name,bad);
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:10,代码来源:BadNameCheckRequestHandler.cs

示例9: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			packet.Skip(8);
			string cmdLine = packet.ReadString(255);
			if(!ScriptMgr.HandleCommand(client, cmdLine))
			{
				if (cmdLine[0] == '&')
				{
					cmdLine = '/' + cmdLine.Remove(0, 1);
				}
				client.Out.SendMessage("No such command ("+cmdLine+")",eChatType.CT_System,eChatLoc.CL_SystemWindow);
			}
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:13,代码来源:PlayerCommandHandler.cs

示例10: HandlePacket

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

			var character = GameServer.Database.SelectObjects<DOLCharacters>("`Name` = @Name", new QueryParameter("@Name", name)).FirstOrDefault();
			
			var nameExists = (character != null);
			
			// Bad Name check.
			if (!nameExists)
				nameExists = GameServer.Instance.PlayerManager.InvalidNames[name];
			
			client.Out.SendDupNameCheckReply(name, nameExists);
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:14,代码来源:DuplicateNameCheckRequestHandler.cs

示例11: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string charName = packet.ReadString(30);
			DOLCharacters[] chars = client.Account.Characters;

			if (chars == null)
				return;
			
			var foundChar = chars.FirstOrDefault(ch => ch.Name.Equals(charName, StringComparison.OrdinalIgnoreCase));
			
			if (foundChar != null)
			{
				var slot = foundChar.AccountSlot;
				
				CharacterCreateRequestHandler.CheckForDeletedCharacter(foundChar.AccountName, client, slot);
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:17,代码来源:CharacterDeleteRequestHandler.cs

示例12: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			string name = packet.ReadString(30);
			string select = string.Format("Name = '{0}'", GameServer.Database.Escape(name));
			DOLCharacters character = GameServer.Database.SelectObject<DOLCharacters>(select);
			bool nameExists = (character != null);
			
			// Bad Name check.
			ArrayList invalidNames = GameServer.Instance.InvalidNames;

			foreach(string invalidName in invalidNames)
			{
				if(invalidName.StartsWith("/") && invalidName.EndsWith("/"))
				{
					// Regex matching
					string re = invalidName.Replace("/", "");
					Match match = Regex.Match(name.ToLower(), re, RegexOptions.IgnoreCase);
					if (match.Success)
					{
						nameExists = true;
						break;
					}
				}
				else
				{
					// "Normal" complete partial match
					if(name.ToLower().Contains(invalidName.ToLower()))
					{
						nameExists = true;
						break;
					}
				}
			}

			client.Out.SendDupNameCheckReply(name, nameExists);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:36,代码来源:DuplicateNameCheckRequestHandler.cs

示例13: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int packetVersion;
			switch (client.Version)
			{
				case GameClient.eClientVersion.Version168:
				case GameClient.eClientVersion.Version169:
				case GameClient.eClientVersion.Version170:
				case GameClient.eClientVersion.Version171:
				case GameClient.eClientVersion.Version172:
				case GameClient.eClientVersion.Version173:
					packetVersion = 168;
					break;
				default:
					packetVersion = 174;
					break;
			}

			packet.Skip(4); //Skip the first 4 bytes
			if (packetVersion == 174)
			{
				packet.Skip(1);
			}

			string charName = packet.ReadString(28);

            // WHRIA START
            if (charName.Length >= 5)
            {
                if (charName.Substring(0, 4) == "slot")
                {
                    int iSelected = 0;
                    if (charName.Substring(4, 1) == "a") iSelected = 0;
                    if (charName.Substring(4, 1) == "b") iSelected = 1;
                    if (charName.Substring(4, 1) == "c") iSelected = 2;
                    if (charName.Substring(4, 1) == "d") iSelected = 3;
                    if (charName.Substring(4, 1) == "e") iSelected = 4;
                    if (charName.Substring(4, 1) == "f") iSelected = 5;
                    if (charName.Substring(4, 1) == "g") iSelected = 6;
                    if (charName.Substring(4, 1) == "h") iSelected = 7;
                    if (charName.Substring(4, 1) == "i") iSelected = 8;
                    if (charName.Substring(4, 1) == "j") iSelected = 9;

                    int sizeOfCharacter = client.Account.Characters.Length;

                    for (int j = 0; j < sizeOfCharacter; j++)
                    {
                        int iSlot = client.Account.Characters[j].AccountSlot;
                        if (iSlot >= 300) iSlot -= 300; if (iSlot >= 200) iSlot -= 200; if (iSlot >= 100) iSlot -= 100;

                        if (iSlot == iSelected)
                        {
                            Regex nameCheck = new Regex("^[A-Z][a-zA-Z]");
                            if (!nameCheck.IsMatch(client.Account.Characters[j].Name)
                                && client.Account.Characters[j] != null)
                            {
                                charName = client.Account.Characters[j].Name;
                            }
                        }
                    }
                }
            }
            //  END


			//TODO Character handling 
			if (charName.Equals("noname"))
			{
				client.Out.SendSessionID();
			}
			else
			{
				// SH: Also load the player if client player is NOT null but their charnames differ!!!
				// only load player when on charscreen and player is not loaded yet
				// packet is sent on every region change (and twice after "play" was pressed)
				if (
					(
						(client.Player == null && client.Account.Characters != null)
						|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
					) && client.ClientState == GameClient.eClientState.CharScreen)
				{
					bool charFound = false;
					for (int i = 0; i < client.Account.Characters.Length; i++)
					{
						if (client.Account.Characters[i] != null
						    && client.Account.Characters[i].Name == charName)
						{
							charFound = true;
							// Notify Character Selection Event, last hope to fix any bad data before Loading.
							GameEventMgr.Notify(DatabaseEvent.CharacterSelected, new CharacterEventArgs(client.Account.Characters[i], client));
							client.LoadPlayer(i);
							break;
						}
					}
					if (charFound == false)
					{
						client.Player = null;
						client.ActiveCharIndex = -1;
					}
					else
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:CharacterSelectRequestHandler.cs

示例14: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int packetVersion;
			switch (client.Version)
			{
				case GameClient.eClientVersion.Version168:
				case GameClient.eClientVersion.Version169:
				case GameClient.eClientVersion.Version170:
				case GameClient.eClientVersion.Version171:
				case GameClient.eClientVersion.Version172:
				case GameClient.eClientVersion.Version173:
					packetVersion = 168;
					break;
				default:
					packetVersion = 174;
					break;
			}

			packet.Skip(4); //Skip the first 4 bytes
			if (packetVersion == 174)
			{
				packet.Skip(1);
			}

			string charName = packet.ReadString(28);

			//TODO Character handling 
			if (charName.Equals("noname"))
			{
				client.Out.SendSessionID();
			}
			else
			{
				// SH: Also load the player if client player is NOT null but their charnames differ!!!
				// only load player when on charscreen and player is not loaded yet
				// packet is sent on every region change (and twice after "play" was pressed)
				if (
					(
						(client.Player == null && client.Account.Characters != null)
						|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
					) && client.ClientState == GameClient.eClientState.CharScreen)
				{
					bool charFound = false;
					for (int i = 0; i < client.Account.Characters.Length; i++)
					{
						if (client.Account.Characters[i] != null
						    && client.Account.Characters[i].Name == charName)
						{
							charFound = true;
							// Notify Character Selection Event, last hope to fix any bad data before Loading.
							GameEventMgr.Notify(DatabaseEvent.CharacterSelected, new CharacterEventArgs(client.Account.Characters[i], client));
							client.LoadPlayer(i);
							break;
						}
					}
					if (charFound == false)
					{
						client.Player = null;
						client.ActiveCharIndex = -1;
					}
					else
					{
						// Log character play
						AuditMgr.AddAuditEntry(client, AuditType.Character, AuditSubtype.CharacterLogin, "", charName);
					}
				}

				client.Out.SendSessionID();
			}
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:70,代码来源:CharacterSelectRequestHandler.cs

示例15: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            int packetVersion;
            switch (client.Version)
            {
                case GameClient.eClientVersion.Version168:
                case GameClient.eClientVersion.Version169:
                case GameClient.eClientVersion.Version170:
                case GameClient.eClientVersion.Version171:
                case GameClient.eClientVersion.Version172:
                case GameClient.eClientVersion.Version173:
                    packetVersion = 168;
                    break;
                default:
                    packetVersion = 174;
                    break;
            }

            packet.Skip(4); //Skip the first 4 bytes
            if (packetVersion == 174)
            {
                packet.Skip(1);
            }

            string charName = packet.ReadString(28);

            //TODO Character handling
            if (charName.Equals("noname"))
            {
                client.Out.SendSessionID();
            }
            else
            {
                // SH: Also load the player if client player is NOT null but their charnames differ!!!
                // only load player when on charscreen and player is not loaded yet
                // packet is sent on every region change (and twice after "play" was pressed)
                if (
                    (
                        (client.Player == null && client.Account.Characters != null)
                        || (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
                    ) && client.ClientState == GameClient.eClientState.CharScreen)
                {
                    bool charFound = false;
                    for (int i = 0; i < client.Account.Characters.Length; i++)
                    {
                        if (client.Account.Characters[i] != null
                            && client.Account.Characters[i].Name == charName)
                        {
                            charFound = true;
                            client.LoadPlayer(i);
                            break;
                        }
                    }
                    if (charFound == false)
                    {
                        client.Player = null;
                        client.ActiveCharIndex = -1;
                    }
                    else
                    {
                        // Log character play
                        AuditMgr.AddAuditEntry(client, AuditType.Character, AuditSubtype.CharacterLogin, "", charName);
                    }
                }

                if (client.Player == null)
                {
                    // client keeps sending the name of the deleted char even if new one was created, correct name only after "play" button pressed
                    //client.Server.Error(new Exception("ERROR, active character not found!!! name="+charName));
                }

                client.Out.SendSessionID();
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:74,代码来源:CharacterSelectRequestHandler.cs


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