本文整理汇总了C#中Aura.Shared.Network.Packet.PutFloat方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.PutFloat方法的具体用法?C# Packet.PutFloat怎么用?C# Packet.PutFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Shared.Network.Packet
的用法示例。
在下文中一共展示了Packet.PutFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HittingProp
/// <summary>
/// Broadcasts HittingProp in range of creature.
/// </summary>
/// <param name="creature"></param>
/// <param name="propEntityId"></param>
/// <param name="stunTime"></param>
public static void HittingProp(Creature creature, long propEntityId, int stunTime)
{
var pos = creature.GetPosition();
var packet = new Packet(Op.HittingProp, creature.EntityId);
packet.PutLong(propEntityId);
packet.PutInt(stunTime);
packet.PutFloat(pos.X);
packet.PutFloat(pos.Y);
creature.Region.Broadcast(packet, creature);
}
示例2: BlacksmithingMiniGame
/// <summary>
/// Sends BlacksmithingMiniGame to creature's client, which starts
/// the Blacksmithing mini-game.
/// </summary>
/// <remarks>
/// The position of the dots is relative to the upper left of the
/// field. They land exactly on those spots after "wavering" for a
/// moment. This wavering is randomized on the client side and
/// doesn't affect anything.
///
/// The time bar is always the same, but the time it takes to fill
/// up changes based on the "time displacement". The lower the value,
/// the longer it takes to fill up. Using values that are too high
/// or too low mess up the calculations and cause confusing results.
/// The official range seems to be between ~0.81 and ~0.98.
/// </remarks>
/// <param name="creature"></param>
/// <param name="prop"></param>
/// <param name="item"></param>
/// <param name="dots"></param>
/// <param name="deviation"></param>
public static void BlacksmithingMiniGame(Creature creature, Prop prop, Item item, List<BlacksmithDot> dots, int deviation)
{
if (dots == null || dots.Count != 5)
throw new ArgumentException("5 dots required.");
var packet = new Packet(Op.BlacksmithingMiniGame, creature.EntityId);
// Untested if this is actually the deviation/cursor size,
// but Tailoring does something very similar. Just like with
// Tailoring, wrong values cause failed games.
packet.PutShort((short)deviation);
foreach (var dot in dots)
{
packet.PutShort((short)dot.X);
packet.PutShort((short)dot.Y);
packet.PutFloat(dot.TimeDisplacement);
packet.PutShort((short)dot.Deviation);
}
packet.PutLong(prop.EntityId);
packet.PutInt(0);
packet.PutLong(item.EntityId);
packet.PutInt(0);
creature.Client.Send(packet);
}
示例3: EntrustmentChanceUpdate
/// <summary>
/// Sends EntrustmentChanceUpdate to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="chance"></param>
/// <param name="unkShort"></param>
public static void EntrustmentChanceUpdate(Creature creature, float chance, SkillRank skillRank)
{
var packet = new Packet(Op.EntrustmentChanceUpdate, creature.EntityId);
packet.PutFloat(chance);
packet.PutShort((short)skillRank);
creature.Client.Send(packet);
}
示例4: Weather
/// <summary>
/// Sends Weather.
/// </summary>
private static void Weather(Action<Packet> sender, IWeatherProvider provider)
{
var packet = new Packet(Op.Weather, MabiId.Broadcast);
packet.PutByte(0);
packet.PutInt(provider.RegionId);
if (provider is IWeatherProviderTable)
{
var table = (IWeatherProviderTable)provider;
packet.PutByte(0);
packet.PutInt(table.GroupId);
packet.PutByte(2);
packet.PutByte(1);
packet.PutString("table");
packet.PutString(table.Name);
packet.PutLong(0);
packet.PutByte(0);
}
else if (provider is IWeatherProviderConstant)
{
var constant = (IWeatherProviderConstant)provider;
// Packet structure is guessed, even though it works,
// based on constant_smooth.
packet.PutByte(2);
packet.PutByte(0);
packet.PutByte(1);
packet.PutString("constant");
packet.PutFloat(constant.Weather);
packet.PutLong(0);
packet.PutByte(0);
}
else if (provider is IWeatherProviderConstantSmooth)
{
var constantSmooth = (IWeatherProviderConstantSmooth)provider;
packet.PutByte(2);
packet.PutByte(0);
packet.PutByte(1);
packet.PutString("constant_smooth");
packet.PutFloat(constantSmooth.Weather);
packet.PutLong(DateTime.Now); // Start
packet.PutLong(DateTime.MinValue); // End
packet.PutFloat(constantSmooth.WeatherBefore);
packet.PutFloat(constantSmooth.WeatherBefore);
packet.PutLong(constantSmooth.TransitionTime);
packet.PutByte(false); // bool? Is table appended? byte? Appended type?
packet.PutLong(DateTime.MinValue); // End
packet.PutInt(2);
// Append a table packet here to go back to that after end
packet.PutByte(0);
}
sender(packet);
}
示例5: SkillRankUp
/// <summary>
/// Sends SkillRankUp to creature's client.
/// </summary>
/// <param name="client"></param>
/// <param name="creature"></param>
/// <param name="skill"></param>
public static void SkillRankUp(Creature creature, Skill skill)
{
var packet = new Packet(Op.SkillRankUp, creature.EntityId);
packet.PutByte(1);
packet.PutBin(skill.Info);
packet.PutFloat(0);
creature.Client.Send(packet);
}
示例6: Effect
/// <summary>
/// Broadcasts Effect in range of creature.
/// </summary>
/// <remarks>
/// Parameters have to be casted to the proper type, use carefully!
/// </remarks>
/// <param name="creature"></param>
/// <param name="parameters"></param>
public static void Effect(Creature creature, int effectId, params object[] parameters)
{
var packet = new Packet(Op.Effect, creature.EntityId);
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 int) packet.PutInt((int)p);
else if (p is long) packet.PutLong((long)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());
}
creature.Region.Broadcast(packet, creature);
}
示例7: QuestUpdate
/// <summary>
/// Sends QuestUpdate to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="quest"></param>
public static void QuestUpdate(Creature creature, Quest quest)
{
var progress = quest.GetList();
var packet = new Packet(Op.QuestUpdate, creature.EntityId);
packet.PutLong(quest.UniqueId);
packet.PutByte(1);
packet.PutInt(progress.Count);
foreach (var p in progress)
{
packet.PutInt(p.Count);
// [180600, NA187 (25.06.2014)] ?
{
packet.PutFloat(0);
}
packet.PutByte(p.Done);
packet.PutByte(p.Unlocked);
}
packet.PutByte(0);
packet.PutByte(0);
creature.Client.Send(packet);
}
示例8: CharacterInfoRequestR
/// <summary>
/// Sends xInfoRequestR to client.
/// </summary>
/// <param name="client"></param>
/// <param name="op"></param>
/// <param name="character"></param>
/// <param name="items"></param>
public static void CharacterInfoRequestR(LoginClient client, int op, Character character, List<Item> items)
{
var packet = new Packet(op, MabiId.Login);
packet.PutByte(character != null);
if (character != null)
{
packet.PutString(character.Server);
packet.PutLong(character.EntityId);
packet.PutByte(1);
packet.PutString(character.Name);
packet.PutString("");
packet.PutString("");
packet.PutInt(character.Race);
packet.PutByte(character.SkinColor);
packet.PutShort(character.EyeType);
packet.PutByte(character.EyeColor);
packet.PutByte(character.MouthType);
packet.PutUInt((uint)character.State);
packet.PutFloat(character.Height);
packet.PutFloat(character.Weight);
packet.PutFloat(character.Upper);
packet.PutFloat(character.Lower);
packet.PutInt(0);
packet.PutInt(0);
packet.PutInt(0);
packet.PutByte(0);
packet.PutInt(0);
packet.PutByte(0);
packet.PutInt((int)character.Color1);
packet.PutInt((int)character.Color2);
packet.PutInt((int)character.Color3);
packet.PutFloat(0.0f);
packet.PutString("");
packet.PutFloat(49.0f);
packet.PutFloat(49.0f);
packet.PutFloat(0.0f);
packet.PutFloat(49.0f);
// [180800, NA196 (14.10.2014)] ?
{
packet.PutShort(0);
}
packet.PutInt(0);
packet.PutInt(0);
packet.PutShort(0);
packet.PutLong(0);
packet.PutString("");
packet.PutByte(0);
packet.PutInt(items.Count);
foreach (var item in items)
{
packet.PutLong(item.Id);
packet.PutBin(item.Info);
}
packet.PutInt(0); // PetRemainingTime
packet.PutLong(0); // PetLastTime
packet.PutLong(0); // PetExpireTime
}
client.Send(packet);
}
示例9: SpawnEffect
/// <summary>
/// Broadcasts spawn effect (Effect, Spawn) in range of sendFrom.
/// </summary>
/// <param name="spawnEffect"></param>
/// <param name="regionId"></param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="sender"></param>
/// <param name="sendFrom">Falls back to sender if null</param>
public static void SpawnEffect(SpawnEffect spawnEffect, int regionId, int x, int y, Creature sender, Creature sendFrom = null)
{
if (sendFrom == null)
sendFrom = sender;
var packet = new Packet(Op.Effect, sender.EntityId);
packet.PutInt(E.Spawn);
packet.PutInt(regionId);
packet.PutFloat((float)x);
packet.PutFloat((float)y);
packet.PutByte((byte)spawnEffect);
sender.Region.Broadcast(packet, sendFrom);
}
示例10: TurnTo
/// <summary>
/// Broadcasts TurnTo in range of creature.
/// </summary>
/// <param name="creature"></param>
/// <param name="x"></param>
/// <param name="y"></param>
public static void TurnTo(Creature creature, float x, float y)
{
var packet = new Packet(Op.TurnTo, creature.EntityId);
packet.PutFloat(x);
packet.PutFloat(y);
creature.Region.Broadcast(packet, creature);
}
示例11: SpinColorWheelR
public static void SpinColorWheelR(Creature creature, float result)
{
var packet = new Packet(Op.SpinColorWheelR, creature.EntityId);
packet.PutFloat(result);
creature.Client.Send(packet);
}
示例12: CollectAnimation
/// <summary>
/// Broadcasts CollectAnimation in creature's range.
/// </summary>
/// <param name="creature"></param>
/// <param name="entityId"></param>
/// <param name="collectId"></param>
/// <param name="pos"></param>
public static void CollectAnimation(Creature creature, long entityId, int collectId, Position pos)
{
var packet = new Packet(Op.CollectAnimation, creature.EntityId);
packet.PutLong(entityId);
packet.PutInt(collectId);
packet.PutFloat(pos.X);
packet.PutFloat(pos.Y);
packet.PutFloat(1);
creature.Region.Broadcast(packet, creature);
}
示例13: SkillTrainingUp
/// <summary>
/// Sends SkillTrainingUp to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="skill"></param>
/// <param name="exp">Exp gained</param>
public static void SkillTrainingUp(Creature creature, Skill skill, float exp, string bonus = "")
{
var packet = new Packet(Op.SkillTrainingUp, creature.EntityId);
packet.PutBin(skill.Info);
packet.PutFloat(exp);
packet.PutByte(1);
packet.PutString(bonus); // (Specialized Skill Bonus: x2)
creature.Client.Send(packet);
}
示例14: 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);
}
示例15: FishingActionRequired
/// <summary>
/// Sends FishingActionRequired to creature's client.
/// </summary>
/// <param name="creature"></param>
/// <param name="catchSize"></param>
/// <param name="time">The time you have to react.</param>
/// <param name="fishSpeed">Fish speed for manual catching, 0 = no movement, 3+ = pretty challenging.</param>
public static void FishingActionRequired(Creature creature, CatchSize catchSize, int time, float fishSpeed)
{
var packet = new Packet(Op.FishingActionRequired, creature.EntityId);
packet.PutByte((byte)catchSize);
packet.PutInt(time);
packet.PutFloat(fishSpeed);
creature.Client.Send(packet);
}