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


C# RealmPacketIn.ReadCString方法代码示例

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


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

示例1: WhoListRequest

		public static void WhoListRequest(IRealmClient client, RealmPacketIn packet)
		{
			var search = new WhoSearch {
				MaxResultCount = WhoList.MaxResultCount,
				Faction = client.ActiveCharacter.Faction.Group,
				MinLevel = (byte)packet.ReadUInt32(),
				MaxLevel = (byte)packet.ReadUInt32(),
				Name = packet.ReadCString(),
				GuildName = packet.ReadCString(),
				RaceMask = (RaceMask2)packet.ReadUInt32(),
				ClassMask = (ClassMask2)packet.ReadUInt32()
			};

			uint zoneCount = packet.ReadUInt32();
			if (zoneCount > 0 && zoneCount <= 10)
			{
				for (int i = 0; i < zoneCount; i++)
					search.Zones.Add((ZoneId)packet.ReadUInt32());
			}

			uint nameCount = packet.ReadUInt32();
			if (nameCount > 0 && nameCount <= 10)
			{
				for (int i = 0; i < nameCount; i++)
					search.Names.Add(packet.ReadCString().ToLower());
			}

			//Performs the search and retrieves matching characters
			var characters = search.RetrieveMatchedCharacters();

			//Send the character list to the client
			SendWhoList(client, characters);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:33,代码来源:WhoHandler.cs

示例2: AddFriendRequest

        public static void AddFriendRequest(IRealmClient client, RealmPacketIn packet)
        {
            string relCharacterName = packet.ReadCString();
			string note = packet.ReadCString();

            RelationMgr.Instance.AddRelation(client.ActiveCharacter, relCharacterName, note, 
                                             CharacterRelationType.Friend);
        }
开发者ID:pallmall,项目名称:WCell,代码行数:8,代码来源:RelationHandler.cs

示例3: HandleSendMail

		public static void HandleSendMail(IRealmClient client, RealmPacketIn packet)
		{
			var chr = client.ActiveCharacter;

			var mailboxId = packet.ReadEntityId();

			if (!CheckMailBox(chr, chr.Region.GetObject(mailboxId) as GameObject))
			{
				return;
			}

			var recipientName = packet.ReadCString();
			var subject = packet.ReadCString();
			var msg = packet.ReadCString();

			var stationary = (MailStationary)Enum.ToObject(typeof(MailStationary), packet.ReadUInt32());
			var unkowwn1 = packet.ReadUInt32();			// 4 unknown bytes

			var itemCount = packet.ReadByte();
			if (itemCount > MailMgr.MaxStoredItems)
				return;

			var items = new List<Item>(itemCount);
			for (var i = 0; i < itemCount; i++)
			{
				var slot = packet.ReadByte();
				var itemId = packet.ReadEntityId();
				var item = chr.Mail.GetItemToMail(itemId);

				if (item != null)
				{
					items.Add(item);
				}
				else
				{
					// invalid item
					return;
				}
			}

			var money = packet.ReadUInt32();
			var cod = packet.ReadUInt32();

			var unknown2 = packet.ReadUInt32();
			var unknown3 = packet.ReadUInt32();
			var unknown4 = packet.ReadByte();

			chr.Mail.SendMail(recipientName, subject, msg, stationary, items, money, cod);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:49,代码来源:MailHandler.cs

示例4: GroupInviteRequest

        public static void GroupInviteRequest(IRealmClient client, RealmPacketIn packet)
        {
            var inviteeName = packet.ReadCString();

            var inviter = client.ActiveCharacter;
            var group = inviter.Group;

            Character invitee;
            if (Group.CheckInvite(inviter, out invitee, inviteeName) == GroupResult.NoError)
            {
                var listInvitees = Singleton<RelationMgr>.Instance.GetRelations(inviter.EntityId.Low,
                                                                                CharacterRelationType.GroupInvite);

                if (group == null || listInvitees.Count < group.InvitesLeft)
                {
                    BaseRelation inviteRelation = RelationMgr.CreateRelation(inviter.EntityId.Low,
                                                                             invitee.EntityId.Low, CharacterRelationType.GroupInvite);

                    Singleton<RelationMgr>.Instance.AddRelation(inviteRelation);

                    // Target has been invited
                    Group.SendResult(inviter.Client, GroupResult.NoError, inviteeName);
                    SendGroupInvite(invitee.Client, inviter.Name);
                }
            }
        }
开发者ID:Stika,项目名称:WCell,代码行数:26,代码来源:GroupHandler.cs

示例5: HandleCreateTicketPacket

		public static void HandleCreateTicketPacket(IRealmClient client, RealmPacketIn packet)
		{
			var chr = client.ActiveCharacter;
			if (chr.Ticket == null)
			{
				var map = (MapId)packet.ReadUInt32();
				var x = packet.ReadFloat();
				var y = packet.ReadFloat();
				var z = packet.ReadFloat();
				var msg = packet.ReadCString();
				var type = (TicketType)packet.ReadUInt32(); // prev. unk0

				var unk1 = packet.ReadByte(); // unk1, 1
				var unk2 = packet.ReadUInt32(); // unk2, 0
				var unk3 = packet.ReadUInt32(); // unk3, 0

				var ticket = new Ticket(chr, msg, type);

				TicketMgr.Instance.AddTicket(ticket);
				chr.Ticket = ticket;
				SendCreateResponse(client, TicketInfoResponse.Saved);
			}
			else
			{
				SendCreateResponse(client, TicketInfoResponse.Fail);
			}
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:27,代码来源:TicketHandler.cs

示例6: HandleJoin

		public static void HandleJoin(IRealmClient client, RealmPacketIn packet)
		{
			var roles = packet.ReadUInt32();
			packet.SkipBytes(2);

			var dungeonsCount = packet.ReadByte();
			if (dungeonsCount == 0)
				return;

			for (byte i = 0; i < dungeonsCount; ++i)
			{
				// dungeons id/type
				var packedDungeon = packet.ReadUInt32(); 
				var id = packedDungeon & 0x00FFFFFF;
				var type = packedDungeon & 0xFF000000;
			}

			byte counter2 = packet.ReadByte();
			packet.SkipBytes(counter2); // lua: GetLFGInfoLocal

			string comment = packet.ReadCString();

			//SendLfgJoinResult();
			//SendLfgUpdate();
		}
开发者ID:KroneckerX,项目名称:WCell,代码行数:25,代码来源:LFGHandler.cs

示例7: HandleGossipSelectOption

		public static void HandleGossipSelectOption(IRealmClient client, RealmPacketIn packet)
		{
			var targetEntityId = packet.ReadEntityId();
			var unknown = packet.ReadUInt32();				// usually Zero, sometimes in the thousands for quest givers, Same as the first int sent in SMSG_GOSSIP_MESSAGE
			var selectedOption = packet.ReadUInt32();

		    string extra = string.Empty;
			if (packet.Position < packet.Length)
			{
				extra = packet.ReadCString();
			}

			var chr = client.ActiveCharacter;
			var worldObject = chr.Region.GetObject(targetEntityId);

			if (worldObject == null)
				return;

			var conversation = chr.GossipConversation;

			if (conversation == null || conversation.Speaker != worldObject)
				return;

			conversation.HandleSelectedItem(selectedOption, extra);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:25,代码来源:GossipHandler.cs

示例8: AddIgnoreRequest

        public static void AddIgnoreRequest(IRealmClient client, RealmPacketIn packet)
        {
            string relCharacterName = packet.ReadCString();

            RelationMgr.Instance.AddRelation(client.ActiveCharacter, relCharacterName, 
											 string.Empty, CharacterRelationType.Ignored);
        }
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:RelationHandler.cs

示例9: SetRelationNoteRequest

        public static void SetRelationNoteRequest(IRealmClient client, RealmPacketIn packet)
        {
			EntityId characterId = packet.ReadEntityId();
			string note = packet.ReadCString();

			RelationMgr.Instance.SetRelationNote(client.ActiveCharacter.EntityId.Low, characterId.Low, 
												note, CharacterRelationType.Friend);
        }
开发者ID:pallmall,项目名称:WCell,代码行数:8,代码来源:RelationHandler.cs

示例10: HandleAddFriend

        public static void HandleAddFriend(IRealmClient client, RealmPacketIn packet)
        {
            Assert.AreEqual(packet.ReadBoolean(), true);
            Assert.AreEqual(packet.ReadCString(), "abc");
            Assert.AreEqual(packet.ReadUInt32(), (uint)345);
            Assert.AreEqual(packet.ReadByte(), 0xFF);

            sentPackets++;
        }
开发者ID:KroneckerX,项目名称:WCell,代码行数:9,代码来源:FakeClientTest.cs

示例11: ChangeInfo

        public static void ChangeInfo(IRealmClient client, RealmPacketIn packet)
        {
            var newInfo = packet.ReadCString();
            var guild = Guild.CheckPrivs(client.ActiveCharacter, GuildCommandId.INVITE, GuildPrivileges.EGUILDINFO);

            if (guild != null)
            {
                guild.Info = newInfo;
            }
        }
开发者ID:Zakkgard,项目名称:WCell,代码行数:10,代码来源:GuildHandler.cs

示例12: HandleLeaveChannel

		public static void HandleLeaveChannel(IRealmClient client, RealmPacketIn packet)
		{
			var channelNumber = packet.ReadUInt32(); // unk
			var channelName = packet.ReadCString();

			var chan = ChatChannelGroup.RetrieveChannel(client.ActiveCharacter, channelName);

			if (chan != null)
			{
				chan.Leave(client.ActiveCharacter, false);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:12,代码来源:ChannelHandler.cs

示例13: AddRank

        public static void AddRank(IRealmClient client, RealmPacketIn packet)
        {
            var rankName = packet.ReadCString().Trim();
            if (rankName.Length < 2 || rankName.Length > GuildMgr.MaxGuildRankNameLength)
                return;

            var guild = Guild.CheckPrivs(client.ActiveCharacter, GuildCommandId.CREATE, GuildPrivileges.ALL);
            if (guild != null)
            {
                guild.AddRank(rankName, GuildPrivileges.DEFAULT, true);
            }
        }
开发者ID:Zakkgard,项目名称:WCell,代码行数:12,代码来源:GuildHandler.cs

示例14: HandleJoinChannel

		public static void HandleJoinChannel(IRealmClient client, RealmPacketIn packet)
		{
			//int channelNumber = packet.ReadInt32();
			uint channelId = packet.ReadUInt32(); // used for lookup in dbc for flags

			byte unk = packet.ReadByte(); // Unknown
            byte unk2 = packet.ReadByte(); // Unknown

		    string channelName = packet.ReadCString();
			string password = packet.ReadCString();

			var group = ChatChannelGroup.GetGroup(client.ActiveCharacter.Faction.Group);
			if (group == null)
				return;

			if (string.IsNullOrEmpty(channelName))
				return;

			var chan = group.GetChannel(channelName, channelId, true);

			chan.TryJoin(client.ActiveCharacter, password, false);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:22,代码来源:ChannelHandler.cs

示例15: CharacterRenameRequest

        public static void CharacterRenameRequest(IRealmClient client, RealmPacketIn packet)
        {
            if (client.Account == null || client.ActiveCharacter != null)
                return;

            var guid = packet.ReadEntityId();
            var newName = packet.ReadCString();
            var record = client.Account.GetCharacterRecord(guid.Low);

            if (record == null)
            {
                log.Error(WCell_RealmServer.IllegalRenameAttempt, guid.ToString(), client);
            }
            else
            {
                if (record.CharacterFlags.HasFlag(CharEnumFlags.NeedsRename))
                {
                    // their character isn't flagged to be renamed, what do they think they're doing? ;)
                    client.Disconnect();
                }
                else
                {
                    LoginErrorCode errorCode = IsNameValid(ref newName);

                    if (errorCode != LoginErrorCode.RESPONSE_SUCCESS)
                    {
                        SendCharacterRenameError(client, errorCode);
                    }
                    else
                    {
                        log.Debug(WCell_RealmServer.RenamingCharacter, record.Name, newName);

                        record.Name = newName;

                        var charRenameTask =
                            new Message4<IRealmClient, CharacterRecord, string, EntityId>(CharacterRenameCallback)
                            {
                                Parameter1 = client,
                                Parameter2 = record,
                                Parameter3 = newName,
                                Parameter4 = guid
                            };

                        // only enqueue to IO Queue if we are in a map context?
                        RealmServer.IOQueue.AddMessage(charRenameTask);
                    }
                }
            }
        }
开发者ID:Zakkgard,项目名称:WCell,代码行数:49,代码来源:CharacterHandler.cs


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