本文整理汇总了C#中Aura.Shared.Network.Packet.PutUShort方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.PutUShort方法的具体用法?C# Packet.PutUShort怎么用?C# Packet.PutUShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Shared.Network.Packet
的用法示例。
在下文中一共展示了Packet.PutUShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SkillComplete
/// <summary>
/// Sends SkillComplete to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="skillId"></param>
public static void SkillComplete(Creature creature, SkillId skillId)
{
var packet = new Packet(Op.SkillComplete, creature.EntityId);
packet.PutUShort((ushort)skillId);
creature.Client.Send(packet);
}
示例2: RankUp
/// <summary>
/// Broadcasts RankUp in range of creature.
/// </summary>
/// <remarks>
/// The second parameter is the rank, but doesn't seem to be necessary.
/// </remarks>
/// <param name="creature"></param>
/// <param name="skillId">Excluded if 0</param>
public static void RankUp(Creature creature, SkillId skillId = 0)
{
var packet = new Packet(Op.RankUp, creature.EntityId);
if (skillId > 0)
packet.PutUShort((ushort)skillId);
packet.PutShort(1); // Rank
creature.Region.Broadcast(packet, creature);
}
示例3: Effect
/// <summary>
/// Broadcasts Effect in range of creature, with the given packet id.
/// </summary>
/// <remarks>
/// Parameters have to be casted to the proper type, use carefully!
/// </remarks>
/// <param name="id"></param>
/// <param name="entity"></param>
/// <param name="effectId"></param>
/// <param name="parameters"></param>
public static void Effect(long id, Entity entity, int effectId, params object[] parameters)
{
var packet = new Packet(Op.Effect, id);
packet.PutInt(effectId);
foreach (var p in parameters)
{
if (p is byte) packet.PutByte((byte)p);
else if (p is bool) packet.PutByte((bool)p);
else if (p is short) packet.PutShort((short)p);
else if (p is ushort) packet.PutUShort((ushort)p);
else if (p is int) packet.PutInt((int)p);
else if (p is uint) packet.PutUInt((uint)p);
else if (p is long) packet.PutLong((long)p);
else if (p is ulong) packet.PutULong((ulong)p);
else if (p is float) packet.PutFloat((float)p);
else if (p is string) packet.PutString((string)p);
else
throw new Exception("Unsupported effect parameter: " + p.GetType());
}
entity.Region.Broadcast(packet, entity);
}
示例4: SkillStop
/// <summary>
/// Sends SkillStop to creature's client or broadcasts it if skill is
/// of type "BroadcastStartStop".
/// </summary>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="unkByte"></param>
public static void SkillStop(Creature creature, Skill skill, byte unkByte)
{
var packet = new Packet(Op.SkillStop, creature.EntityId);
packet.PutUShort((ushort)skill.Info.Id);
packet.PutByte(unkByte);
if (skill.Data.Type != SkillType.BroadcastStartStop)
creature.Client.Send(packet);
else
creature.Region.Broadcast(packet, creature);
}
示例5: RemoveKeyword
/// <summary>
/// Sends RemoveKeyword to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="keywordId"></param>
public static void RemoveKeyword(Creature creature, ushort keywordId)
{
var packet = new Packet(Op.RemoveKeyword, creature.EntityId);
packet.PutUShort(keywordId);
creature.Client.Send(packet);
}
示例6: ItemAmount
/// <summary>
/// Sends ItemAmount to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="item"></param>
public static void ItemAmount(Creature creature, Item item)
{
var packet = new Packet(Op.ItemAmount, creature.EntityId);
packet.PutLong(item.EntityId);
packet.PutUShort(item.Info.Amount);
packet.PutByte(2); // ? (related to the 2 in move item?)
creature.Client.Send(packet);
}
示例7: SkillUsePlayingInstrument
/// <summary>
/// Broadcasts Effect in range of creature.
/// </summary>
/// <param name="creature"></param>
/// <param name="skillId"></param>
/// <param name="instrument"></param>
/// <param name="compressedMML"></param>
/// <param name="rndScore"></param>
public static void SkillUsePlayingInstrument(Creature creature, SkillId skillId, InstrumentType instrument, string compressedMML, int rndScore)
{
var packet = new Packet(Op.SkillUse, creature.EntityId);
packet.PutUShort((ushort)skillId);
packet.PutLong(0);
packet.PutByte(compressedMML != null); // has scroll
if (compressedMML != null)
packet.PutString(compressedMML);
else
packet.PutInt(rndScore);
packet.PutByte((byte)instrument);
packet.PutByte(1);
packet.PutByte(0);
creature.Client.Send(packet);
}
示例8: SkillUseDye
/// <summary>
/// Sends SkillUse to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="skillId"></param>
/// <param name="part"></param>
/// <param name="unkByte"></param>
public static void SkillUseDye(Creature creature, SkillId skillId, int part, byte unkByte)
{
var packet = new Packet(Op.SkillUse, creature.EntityId);
packet.PutUShort((ushort)skillId);
packet.PutInt(part);
packet.PutByte(unkByte);
creature.Client.Send(packet);
}
示例9: SkillUse
/// <summary>
/// Sends SkillUse to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="skillId"></param>
/// <param name="entityId"></param>
/// <param name="unk1"></param>
/// <param name="unk2"></param>
public static void SkillUse(Creature creature, SkillId skillId, long entityId, byte unk1, string unk2)
{
var packet = new Packet(Op.SkillUse, creature.EntityId);
packet.PutUShort((ushort)skillId);
packet.PutLong(entityId);
packet.PutByte(unk1);
packet.PutString(unk2);
creature.Client.Send(packet);
}
示例10: SkillCompleteUnk
/// <summary>
/// Sends SkillComplete to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="skillId"></param>
/// <param name="entityId"></param>
/// <param name="unkInt"></param>
/// <param name="unkShort"></param>
public static void SkillCompleteUnk(Creature creature, SkillId skillId, long entityId, int unkInt, short unkShort)
{
var packet = new Packet(Op.SkillCompleteUnk, creature.EntityId);
packet.PutUShort((ushort)skillId);
packet.PutLong(entityId);
packet.PutInt(unkInt);
packet.PutShort(unkShort);
creature.Client.Send(packet);
}
示例11: SharpMind
/// <summary>
/// Sends SharpMind to all creatures in range of user.
/// </summary>
/// <param name="user"></param>
/// <param name="target"></param>
/// <param name="skillId"></param>
/// <param name="state"></param>
public static void SharpMind(Creature user, Creature target, SkillId skillId, SharpMindStatus state)
{
var packet = new Packet(Op.SharpMind, target.EntityId);
packet.PutLong(user.EntityId);
packet.PutByte(1);
packet.PutByte(1);
packet.PutUShort((ushort)skillId);
packet.PutInt((int)state);
target.Client.Send(packet);
}
示例12: ResetCooldown
/// <summary>
/// Sends ResetCooldown to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="skillId"></param>
public static void ResetCooldown(Creature creature, SkillId skillId)
{
var packet = new Packet(Op.ResetCooldown, creature.EntityId);
packet.PutUShort((ushort)skillId);
packet.PutByte(0); // end of list?
creature.Client.Send(packet);
}
示例13: ProductionSuccessRequestR
/// <summary>
/// Sends ProductionSuccessRequestR to creature's client, informing it
/// about the success rate it requested.
/// </summary>
/// <remarks>
/// This version of the packet is used for Tailoring and Blacksmithing.
/// </remarks>
/// <param name="creature"></param>
/// <param name="skillId">Skill the rate is used for.</param>
/// <param name="successRate">
/// Bonus success rate, added to the value calculated by the client,
/// or the total success rate to use, if totalSuccess is true.
/// </param>
/// <param name="totalSuccess">
/// If true, the client will display the given successRate, if it's false,
/// it will calculate the default rate itself and add successRate as bonus.
/// </param>
public static void ProductionSuccessRequestR(Creature creature, SkillId skillId, float successRate, bool totalSuccess, float unkFloat)
{
var gp = new Packet(Op.ProductionSuccessRequestR, creature.EntityId);
gp.PutByte(1);
gp.PutUShort((ushort)skillId);
gp.PutShort(6);
gp.PutFloat(successRate);
gp.PutByte(0);
gp.PutByte(totalSuccess);
gp.PutFloat(unkFloat);
creature.Client.Send(gp);
}
示例14: TitleUpdate
/// <summary>
/// Broadcasts TitleUpdate in creature's range.
/// </summary>
/// <param name="creature"></param>
public static void TitleUpdate(Creature creature)
{
var packet = new Packet(Op.TitleUpdate, creature.EntityId);
packet.PutUShort(creature.Titles.SelectedTitle);
packet.PutUShort(creature.Titles.SelectedOptionTitle);
creature.Region.Broadcast(packet, creature);
}
示例15: AddTitle
/// <summary>
/// Sends AddTitle(Knowledge) to creature's client,
/// depending on state.
/// </summary>
/// <param name="creature"></param>
/// <param name="titleId"></param>
/// <param name="state"></param>
public static void AddTitle(Creature creature, ushort titleId, TitleState state)
{
var op = (state == TitleState.Known ? Op.AddTitleKnowledge : Op.AddTitle);
var packet = new Packet(op, creature.EntityId);
packet.PutUShort(titleId);
packet.PutInt(0);
creature.Client.Send(packet);
}