本文整理汇总了C#中MabiPacket.PutFloat方法的典型用法代码示例。如果您正苦于以下问题:C# MabiPacket.PutFloat方法的具体用法?C# MabiPacket.PutFloat怎么用?C# MabiPacket.PutFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MabiPacket
的用法示例。
在下文中一共展示了MabiPacket.PutFloat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TurnTo
/// <summary>
/// Lets the creature face the target.
/// </summary>
/// <param name="creature"></param>
/// <param name="target"></param>
/// <returns></returns>
public static MabiPacket TurnTo(MabiEntity creature, MabiEntity target)
{
var cpos = creature.GetPosition();
var tpos = target.GetPosition();
var p = new MabiPacket(Op.TurnTo, creature.Id);
p.PutFloat((float)tpos.X - (float)cpos.X);
p.PutFloat((float)tpos.Y - (float)cpos.Y);
return p;
}
示例2: StatUpdate
public static MabiPacket StatUpdate(MabiCreature creature, StatUpdateType type, params Stat[] stats)
{
var packet = new MabiPacket((type & StatUpdateType.Public) != 0 ? Op.StatUpdatePublic : Op.StatUpdatePrivate, creature.Id);
packet.PutByte((byte)type);
// Stats
packet.PutSInt(stats.Length);
foreach (var stat in stats)
{
packet.PutInt((uint)stat);
switch (stat)
{
case Stat.Height: packet.PutFloat(creature.Height); break;
case Stat.Weight: packet.PutFloat(creature.Weight); break;
case Stat.Upper: packet.PutFloat(creature.Upper); break;
case Stat.Lower: packet.PutFloat(creature.Lower); break;
case Stat.CombatPower: packet.PutFloat(creature.CombatPower); break;
case Stat.Level: packet.PutShort(creature.Level); break;
case Stat.AbilityPoints: packet.PutShort(creature.AbilityPoints); break;
case Stat.Experience: packet.PutLong(MabiData.ExpDb.CalculateRemaining(creature.Level, creature.Experience) * 1000); break;
case Stat.Life: packet.PutFloat(creature.Life); break;
case Stat.LifeMax: packet.PutFloat(creature.LifeMaxBaseTotal); break;
case Stat.LifeMaxMod: packet.PutFloat(creature.StatMods.GetMod(Stat.LifeMaxMod)); break;
case Stat.LifeInjured: packet.PutFloat(creature.LifeInjured); break;
case Stat.Mana: packet.PutFloat(creature.Mana); break;
case Stat.ManaMax: packet.PutFloat(creature.ManaMaxBaseTotal); break;
case Stat.ManaMaxMod: packet.PutFloat(creature.StatMods.GetMod(Stat.ManaMaxMod)); break;
case Stat.Stamina: packet.PutFloat(creature.Stamina); break;
case Stat.Food: packet.PutFloat(creature.StaminaHunger); break;
case Stat.StaminaMax: packet.PutFloat(creature.StaminaMaxBaseTotal); break;
case Stat.StaminaMaxMod: packet.PutFloat(creature.StatMods.GetMod(Stat.StaminaMaxMod)); break;
case Stat.StrMod: packet.PutFloat(creature.StatMods.GetMod(Stat.StrMod)); break;
case Stat.DexMod: packet.PutFloat(creature.StatMods.GetMod(Stat.DexMod)); break;
case Stat.IntMod: packet.PutFloat(creature.StatMods.GetMod(Stat.IntMod)); break;
case Stat.LuckMod: packet.PutFloat(creature.StatMods.GetMod(Stat.LuckMod)); break;
case Stat.WillMod: packet.PutFloat(creature.StatMods.GetMod(Stat.WillMod)); break;
case Stat.Str: packet.PutFloat(creature.StrBaseTotal); break;
case Stat.Int: packet.PutFloat(creature.IntBaseTotal); break;
case Stat.Dex: packet.PutFloat(creature.DexBaseTotal); break;
case Stat.Will: packet.PutFloat(creature.WillBaseTotal); break;
case Stat.Luck: packet.PutFloat(creature.LuckBaseTotal); break;
case Stat.DefenseBaseMod: packet.PutShort((ushort)creature.DefensePassive); break;
case Stat.ProtectBaseMod: packet.PutFloat(creature.ProtectionPassive * 100); break;
case Stat.DefenseMod: packet.PutShort((ushort)creature.StatMods.GetMod(Stat.DefenseMod)); break;
case Stat.ProtectMod: packet.PutFloat(creature.StatMods.GetMod(Stat.ProtectMod)); break;
// Client might crash with a mismatching value,
// take a chance and put an int by default.
default: packet.PutInt(1); break;
}
}
// (New?) Stat regens
packet.PutSInt(creature.StatRegens.Count);
foreach (var mod in creature.StatRegens)
mod.AddToPacket(packet);
// Stat mod ids to remove?
packet.PutInt(0);
packet.PutInt(0); // ?
if (type == StatUpdateType.Public)
{
packet.PutInt(0); // ?
// Stat mod ids to remove?
packet.PutInt(0);
packet.PutInt(0); // ?
}
return packet;
}
示例3: GetWeatherPacket
public MabiPacket GetWeatherPacket(uint region, float from, float to, uint transitionTime = Transition)
{
var p = new MabiPacket(Op.Weather, Id.Broadcast);
p.PutByte(0);
p.PutInt(region);
p.PutByte(2);
p.PutByte(0);
p.PutByte(1);
p.PutString("constant_smooth");
p.PutFloat(to);
p.PutLong(DateTime.Now);
p.PutLong(DateTime.MinValue);
p.PutFloat(from);
p.PutFloat(from);
p.PutLong(transitionTime);
p.PutByte(false);
p.PutLong(DateTime.MinValue);
p.PutInt(2);
p.PutByte(0);
return p;
}
示例4: SkillRankUp
public static void SkillRankUp(Client client, MabiCreature creature, MabiSkill skill)
{
var packet = new MabiPacket(Op.SkillRankUp, creature.Id);
packet.PutByte(1);
packet.PutBin(skill.Info);
packet.PutFloat(0);
client.Send(packet);
}
示例5: AddToPacket
public void AddToPacket(MabiPacket packet)
{
packet.PutInt(this.ModId);
packet.PutFloat(this.ChangePerSecond);
packet.PutInt(this.TimeLeft);
packet.PutInt((uint)this.Stat);
packet.PutByte(0); // ?
packet.PutFloat(this.MaxValue);
}
示例6: CharacterInfo
/// <summary>
/// Sends character info.
/// </summary>
/// <param name="client"></param>
/// <param name="character"></param>
public static void CharacterInfo(LoginClient client, uint op, Character character, IEnumerable<Item> items)
{
var packet = new MabiPacket(op, Id.Login);
if (character != null)
{
packet.PutByte(true);
packet.PutString(character.Server);
packet.PutLong(character.Id);
packet.PutByte(1);
packet.PutString(character.Name);
packet.PutString("");
packet.PutString("");
packet.PutInt(character.Race);
packet.PutByte(character.SkinColor);
packet.PutByte(character.Eye);
packet.PutByte(character.EyeColor);
packet.PutByte(character.Mouth);
packet.PutInt(0);
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(character.Color1);
packet.PutInt(character.Color2);
packet.PutInt(character.Color3);
packet.PutFloat(0.0f);
packet.PutString("");
packet.PutFloat(49.0f);
packet.PutFloat(49.0f);
packet.PutFloat(0.0f);
packet.PutFloat(49.0f);
packet.PutInt(0);
packet.PutInt(0);
packet.PutShort(0);
packet.PutLong(0);
packet.PutString("");
packet.PutByte(0);
packet.PutSInt(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
}
else
{
packet.PutByte(false);
}
client.Send(packet);
}