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


C# Packet.GetString方法代码示例

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


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

示例1: Prepare

		/// <summary>
		/// Prepares the skill, called after entering the MML,
		/// goes straight to Use.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		public bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			var scrollId = packet.GetLong();
			var title = packet.GetString();
			var author = packet.GetString();
			var mml = packet.GetString();
			var song = packet.GetString(); // [180300, NA166 (18.09.2013)] Singing
			var hidden = packet.GetByte(); // bool, but the meta data is a byte

			// Get item
			var item = creature.Inventory.GetItem(scrollId);
			if (item == null) goto L_Fail;

			// Get all parts of the MML (Melody, Haromony 1+2)
			var mmlParts = mml.Split(',');

			// Check lengths
			if (mml.Length > MmlMaxLength || song.Length > MmlMaxLength) goto L_Fail; // Total
			if (mmlParts.Length > 0 && mmlParts[0].Length > skill.RankData.Var1) goto L_Fail; // Melody
			if (mmlParts.Length > 1 && mmlParts[1].Length > skill.RankData.Var2) goto L_Fail; // Harmony 1
			if (mmlParts.Length > 2 && mmlParts[2].Length > skill.RankData.Var3) goto L_Fail; // Harmony 2

			// Score level = Musical Knowledge rank
			var level = SkillRank.Novice;
			var knowledge = creature.Skills.Get(SkillId.MusicalKnowledge);
			if (knowledge != null) level = knowledge.Info.Rank;

			// Update item and send skill complete from Complete
			creature.Skills.Callback(SkillId.Composing, () =>
			{
				// Skill training
				if (skill.Info.Rank == SkillRank.Novice)
					skill.Train(1); // Try the skill.

				// Scroll information
				item.MetaData1.SetString("TITLE", title);
				item.MetaData1.SetString("AUTHOR", author);
				item.MetaData1.SetString("SCORE", MabiZip.Compress(mml));
				item.MetaData1.SetString("SCSING", MabiZip.Compress(song)); // [180300, NA166 (18.09.2013)] Singing
				item.MetaData1.SetByte("HIDDEN", hidden);
				item.MetaData1.SetShort("LEVEL", (short)level);

				// Update
				Send.ItemUpdate(creature, item);
				Send.SkillCompleteEntity(creature, skill.Info.Id, item.EntityId);
			});

			// Finish
			Send.SkillUseEntity(creature, skill.Info.Id, scrollId);
			skill.State = SkillState.Used;
			return true;

		L_Fail:
			return false;
		}
开发者ID:aura-project,项目名称:aura,代码行数:62,代码来源:Composing.cs

示例2: Complete

		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var str = packet.GetString();
			var dict = new MabiDictionary(str);

			var hwEntityId = dict.GetLong("ITEMID");
			if (hwEntityId == 0)
				goto L_End;

			var hw = creature.Inventory.GetItemSafe(hwEntityId);
			if (!hw.HasTag("/large_blessing_potion/"))
				goto L_End;

			// TODO: Check loading time

			var items = creature.Inventory.GetEquipment();
			foreach (var item in items)
			{
				var blessable = (item.HasTag("/equip/") && !item.HasTag("/not_bless/"));

				if (blessable)
					item.OptionInfo.Flags |= ItemFlags.Blessed;
			}

			creature.Inventory.Decrement(hw, 1);
			Send.ItemBlessed(creature, items);

		L_End:
			Send.UseMotion(creature, 14, 0);
			Send.SkillComplete(creature, skill.Info.Id, str);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:31,代码来源:BigBlessingWaterKit.cs

示例3: Start

		public void Start(Creature creature, Skill skill, Packet packet)
		{
			// Get parameters
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else
				unkByte = packet.GetByte();

			// Run skill
			var result = this.Start(creature, skill, dict);

			if (result == StartStopResult.Fail)
			{
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			skill.Activate(SkillFlags.InUse);

			Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

			if (stringParam)
				Send.SkillStart(creature, skill, dict.ToString());
			else
				Send.SkillStart(creature, skill, unkByte);
		}
开发者ID:aura-project,项目名称:aura,代码行数:30,代码来源:StartStopSkillHandler.cs

示例4: Prepare

		public bool Prepare(Creature creature, Skill skill, Packet packet)
		{
			var dict = packet.GetString();

			Send.SkillUse(creature, skill.Info.Id, dict);

			return true;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:8,代码来源:BigBlessingWaterKit.cs

示例5: Start

		public void Start(Creature creature, Skill skill, Packet packet)
		{
			// Check mana and stamina
			if (!this.CheckMana(creature, skill))
			{
				Send.SystemMessage(creature, Localization.Get("Insufficient Mana"));
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}
			if (!this.CheckStamina(creature, skill))
			{
				Send.SystemMessage(creature, Localization.Get("Insufficient Stamina"));
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			// Get parameters
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else
				unkByte = packet.GetByte();

			// Run skill
			var result = this.Start(creature, skill, dict);

			if (result == StartStopResult.Fail)
			{
				Send.SkillStartSilentCancel(creature, skill.Info.Id);
				return;
			}

			skill.Activate(SkillFlags.InUse);

			// Use mana/stamina
			this.UseMana(creature, skill);
			this.UseStamina(creature, skill);

			Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana, Stat.Stamina);

			if (stringParam)
				Send.SkillStart(creature, skill, dict.ToString());
			else
				Send.SkillStart(creature, skill, unkByte);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:48,代码来源:StartStopSkillHandler.cs

示例6: Stop

		public void Stop(Creature creature, Skill skill, Packet packet)
		{
			var stringParam = packet.NextIs(PacketElementType.String);
			var dict = new MabiDictionary();
			byte unkByte = 0;

			if (stringParam)
				dict.Parse(packet.GetString());
			else if (packet.NextIs(PacketElementType.Byte))
				unkByte = packet.GetByte();

			var result = this.Stop(creature, skill, dict);

			skill.Deactivate(SkillFlags.InUse);

			if (result == StartStopResult.Fail)
				Send.SkillStopSilentCancel(creature, skill.Info.Id);
			else if (stringParam)
				Send.SkillStop(creature, skill, dict.ToString());
			else
				Send.SkillStop(creature, skill, unkByte);
		}
开发者ID:aura-project,项目名称:aura,代码行数:22,代码来源:StartStopSkillHandler.cs

示例7: Complete

		public void Complete(Creature creature, Skill skill, Packet packet)
		{
			var str = packet.GetString();
			var dict = new MabiDictionary(str);

			var hwEntityId = dict.GetLong("ITEMID");
			if (hwEntityId == 0)
				goto L_End;

			var hw = creature.Inventory.GetItemSafe(hwEntityId);
			if (!hw.HasTag("/large_blessing_potion/"))
				goto L_End;

			// TODO: Check loading time

			var items = creature.Inventory.GetEquipment(a => a.IsBlessable);
			creature.Bless(items);
			creature.Inventory.Decrement(hw, 1);

		L_End:
			Send.UseMotion(creature, 14, 0);
			Send.SkillComplete(creature, skill.Info.Id, str);
		}
开发者ID:aura-project,项目名称:aura,代码行数:23,代码来源:BigBlessingWaterKit.cs


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