本文整理汇总了C#中Aura.Shared.Network.Packet.GetByte方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.GetByte方法的具体用法?C# Packet.GetByte怎么用?C# Packet.GetByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Shared.Network.Packet
的用法示例。
在下文中一共展示了Packet.GetByte方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Complete
/// <summary>
/// Completes skill, warping to destination.
/// </summary>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="packet"></param>
public void Complete(Creature creature, Skill skill, Packet packet)
{
var destination = (Continent)packet.GetByte();
int regionId, x, y;
switch (destination)
{
case Continent.Uladh:
if (creature.Keywords.Has("portal_dunbarton"))
{
regionId = 14; x = 41598; y = 36010; // Dun
}
else
{
regionId = 1; x = 12789; y = 38399; // Tir
}
break;
case Continent.Iria:
regionId = 3001; x = 164837; y = 170144; // Qilla
break;
case Continent.Belvast:
regionId = 4005; x = 41760; y = 26924; // Belvast
break;
default:
Send.Notice(creature, "Unknown destination.");
Send.SkillCancel(creature);
return;
}
creature.Warp(regionId, x, y);
Send.SkillComplete(creature, skill.Info.Id, (byte)destination);
}
示例2: 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);
}
示例3: Use
/// <summary>
/// Handles skill usage, called when a destination was selected.
/// </summary>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="packet"></param>
public void Use(Creature creature, Skill skill, Packet packet)
{
var destination = (Continent)packet.GetByte();
// TODO: Check destination?
Send.SkillUse(creature, skill.Info.Id, (byte)destination);
}
示例4: 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;
}
示例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);
}
示例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);
}
示例7: UseFixed
/// <summary>
/// Handles usage of the skill if it's a fixed dye.
/// </summary>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="packet"></param>
/// <param name="part"></param>
private void UseFixed(Creature creature, Skill skill, Packet packet, int part)
{
var unk = packet.GetByte();
Send.SkillUseDye(creature, skill.Info.Id, part, unk);
}