本文整理汇总了C#中LeagueSharp.Common.GamePacket.ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C# GamePacket.ReadFloat方法的具体用法?C# GamePacket.ReadFloat怎么用?C# GamePacket.ReadFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LeagueSharp.Common.GamePacket
的用法示例。
在下文中一共展示了GamePacket.ReadFloat方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameOnOnGameProcessPacket
/// <summary>
/// Detects the spells that have missile and are casted from fow.
/// </summary>
public static void GameOnOnGameProcessPacket(GamePacketEventArgs args)
{
//Gets received when a projectile is created.
if (args.PacketData[0] == 0x3B)
{
var packet = new GamePacket(args.PacketData) { Position = 1 };
packet.ReadFloat(); //Missile network ID
var missilePosition = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
var unitPosition = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
packet.Position = packet.Size() - 119;
var missileSpeed = packet.ReadFloat();
packet.Position = 65;
var endPos = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
packet.Position = 112;
var id = packet.ReadByte();
packet.Position = packet.Size() - 83;
var unit = ObjectManager.GetUnitByNetworkId<Obj_AI_Hero>(packet.ReadInteger());
if ((!unit.IsValid || unit.Team == ObjectManager.Player.Team))
{
return;
}
var spellData = SpellDatabase.GetBySpeed(unit.ChampionName, (int) missileSpeed, id);
if (spellData == null)
{
return;
}
if (spellData.SpellName != "Laser")
{
return;
}
var castTime = Environment.TickCount - Game.Ping / 2 - spellData.Delay -
(int)
(1000 * Geometry.SwitchYZ(missilePosition).To2D().Distance(Geometry.SwitchYZ(unitPosition)) /
spellData.MissileSpeed);
//Trigger the skillshot detection callbacks.
TriggerOnDetectSkillshot(
DetectionType.RecvPacket, spellData, castTime, unitPosition.SwitchYZ().To2D(),
endPos.SwitchYZ().To2D(), unit);
}
}
示例2: Game_OnGameProcessPacket
private static void Game_OnGameProcessPacket(GamePacketEventArgs args)
{
var packet = new GamePacket(args.PacketData);
Camp camp;
switch (packet.Header)
{
case 0xC3:
packet.Position = 5;
var UnitNetworkId = packet.ReadInteger();
var CampId = packet.ReadInteger();
var EmptyType = packet.ReadByte();
var BuffHash = packet.ReadInteger();
var respawnTime = packet.ReadFloat();
camp = Camps[CampId];
if (camp != null)
camp.Kill(respawnTime);
break;
case 0xE9:
packet.Position = 21;
var campId = packet.ReadByte();
camp = Camps[campId];
if (camp != null)
camp.Spawn();
break;
}
}
示例3: Game_OnGameProcessPacket
public static void Game_OnGameProcessPacket(GamePacketEventArgs args)
{
if (!Config.Item("comboWreset").GetValue<bool>() || args.PacketData[0] != 0x65 || !MasterYi.W.IsReady() ||
LxOrbwalker.CurrentMode != LxOrbwalker.Mode.Combo)
{
return;
}
// LogPacket(args);
var gp = new GamePacket(args.PacketData) {Position = 1};
var dmg = Packet.S2C.Damage.Decoded(args.PacketData);
var targetId = gp.ReadInteger();
int dType = gp.ReadByte();
int unknown = gp.ReadShort();
var damageAmount = gp.ReadFloat();
var targetNetworkIdCopy = gp.ReadInteger();
var sourceNetworkId = gp.ReadInteger();
var dmga =
(float)
MasterYi.Player.GetAutoAttackDamage(
ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(targetId));
if (dmga - 10 > damageAmount || dmga + 10 < damageAmount)
{
return;
}
if (MasterYi.Player.NetworkId != dmg.SourceNetworkId && MasterYi.Player.NetworkId == targetId)
{
return;
}
var targ = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(dmg.TargetNetworkId);
if ((int) dmg.Type != 12 && (int) dmg.Type != 4 && (int) dmg.Type != 3)
{
return;
}
if (MasterYi.W.IsReady() && LxOrbwalker.InAutoAttackRange(targ))
{
MasterYi.W.Cast(targ.Position);
// LXOrbwalker.ResetAutoAttackTimer();
}
// Console.WriteLine("dtyoe: " + dType);
}
示例4: OnGameProcessPacket
public static void OnGameProcessPacket(GamePacketEventArgs args)
{
try
{
if (Talon.orbwalker.ActiveMode.ToString() == "Combo" || Config.Item("harHard").GetValue<KeyBind>().Active)
{
if (args.PacketData[0] == 101 && Talon.Q.IsReady())
{
Packet.S2C.Damage.Struct dmg = Packet.S2C.Damage.Decoded(args.PacketData);
// LogPacket(args);
GamePacket gp = new GamePacket(args.PacketData);
gp.Position = 1;
int targetID = gp.ReadInteger();
int dType = (int)gp.ReadByte();
int Unknown = gp.ReadShort();
float DamageAmount = gp.ReadFloat();
int TargetNetworkIdCopy = gp.ReadInteger();
int SourceNetworkId = gp.ReadInteger();
if (Talon.Player.NetworkId != dmg.SourceNetworkId)
return;
Obj_AI_Hero targ = ObjectManager.GetUnitByNetworkId<Obj_AI_Hero>(targetID);
if (targ != null)
{
Talon.sumItems.cast(SummonerItems.ItemIds.Ghostblade);
Talon.Q.Cast();
useQ = true;
Orbwalking.ResetAutoAttackTimer();
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
示例5: Game_OnGameProcessPacket
static void Game_OnGameProcessPacket(GamePacketEventArgs args)
{
if (args.PacketData[0] == Packet.S2C.EmptyJungleCamp.Header)
{
Packet.S2C.EmptyJungleCamp.Struct camp = Packet.S2C.EmptyJungleCamp.Decoded(args.PacketData);
Console.WriteLine("disable camp: "+camp.CampId);
jTimer.disableCamp((byte)camp.CampId);
}
if (args.PacketData[0] == 0xE9)
{
GamePacket gp = new GamePacket(args.PacketData);
gp.Position = 21;
byte campID = gp.ReadByte();
Console.WriteLine("Enable camp: "+campID);
jTimer.enableCamp(campID);
}
//AfterAttack
if (args.PacketData[0] == 0x65 && Config.Item("doJungle").GetValue<KeyBind>().Active)
{
GamePacket gp = new GamePacket(args.PacketData);
gp.Position = 1;
Packet.S2C.Damage.Struct dmg = Packet.S2C.Damage.Decoded(args.PacketData);
int targetID = gp.ReadInteger();
int dType = (int)gp.ReadByte();
int Unknown = gp.ReadShort();
float DamageAmount = gp.ReadFloat();
int TargetNetworkIdCopy = gp.ReadInteger();
int SourceNetworkId = gp.ReadInteger();
float dmga = (float)player.GetAutoAttackDamage(ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(targetID));
if (dmga - 10 > DamageAmount || dmga + 10 < DamageAmount)
return;
if (player.NetworkId != dmg.SourceNetworkId || player.NetworkId == targetID || player.NetworkId == TargetNetworkIdCopy)
return;
Obj_AI_Base targ = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(dmg.TargetNetworkId);
if ((int) dmg.Type == 12 || (int) dmg.Type == 4 || (int) dmg.Type == 3)
{
Console.WriteLine("dmg: " + DamageAmount + " : " + dmga);
JungleClearer.jungler.doAfterAttack(targ);
}
}
}
示例6: Decoded
/// <summary>
/// Decodes the specified data.
/// </summary>
/// <param name="data">The data.</param>
/// <returns>Struct.</returns>
public static Struct Decoded(byte[] data)
{
var packet = new GamePacket(data);
var result = new Struct();
result.ReceivingNetworkId = packet.ReadInteger(5);
result.ReceivingUnit = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(result.ReceivingNetworkId);
result.SourceNetworkId = packet.ReadInteger();
result.SourceUnit = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(result.SourceNetworkId);
result.Gold = packet.ReadFloat();
return result;
}
示例7: PacketHandler
private static void PacketHandler(GamePacketEventArgs args)
{
var packet = new GamePacket(args.PacketData);
if (OnGainBuff != null)
{
if (args.PacketData[0] == 0xB7)
{
packet.Position = 1;
var targetbuff =
ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(packet.ReadInteger());
int buffSlot = packet.ReadByte();
int bufftype = packet.ReadByte();
int stackCount = packet.ReadByte();
int visible = packet.ReadByte();
int buffID = packet.ReadInteger();
int targetID = packet.ReadInteger();
int unknown = packet.ReadInteger();
float duration = packet.ReadFloat();
float starttime = Game.Time;
float endtime = Game.Time + duration;
var sourceNetworkId = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(BitConverter.ToInt32(args.PacketData, 24));
OnGainBuff(targetbuff, sourceNetworkId,
new OnGainBuffArgs { Slot = buffSlot + 1, Type = bufftype, Count = stackCount, Visible = visible, BuffID = buffID, TargetID = targetID, Duration = duration, StartTime = starttime, EndTime = endtime });
};
};
if (OnLoseBuff != null)
{
if (args.PacketData[0] == 0x7B)
{
packet.Position = 1;
var targetbuff = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(packet.ReadInteger());
int buffSlot = packet.ReadByte();
int buffID = packet.ReadInteger();
if (targetbuff == null)
return;
OnLoseBuff(targetbuff, targetbuff,
new OnGainBuffArgs { Slot = buffSlot + 1, Count = 0, BuffID = buffID });
};
};
if (OnUpdateBuff != null)
{
if (args.PacketData[0] == 0x2F)
{
Console.WriteLine("Update BUFF PACKET");
var targetbuff = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(packet.ReadInteger());
int buffSlot = packet.ReadByte();
float timeBuffAlreadyOnTarget = packet.ReadFloat();
float duration = packet.ReadFloat();
float starttime = Game.Time;
float endtime = Game.Time + duration;
var source = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(packet.ReadInteger());
if (targetbuff == null)
return;
OnUpdateBuff(source, targetbuff,
new OnGainBuffArgs { Slot = buffSlot + 1, Count = 1, Duration = duration, EndTime = endtime });
};
if (args.PacketData[0] == 0x1C)
{
Console.WriteLine("Update BUFF PACKET2");
var targetbuff = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(packet.ReadInteger());
int buffSlot = packet.ReadByte();
int stackCount = packet.ReadByte();
float duration = packet.ReadFloat();
float timeBuffAlreadyOnTarget = packet.ReadFloat();
float starttime = Game.Time;
float endtime = Game.Time + duration;
var source = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(packet.ReadInteger());
if (targetbuff == null)
return;
OnUpdateBuff(source, targetbuff,
new OnGainBuffArgs { Slot = buffSlot + 1, Count = stackCount, Duration = duration, EndTime = endtime });
};
};
}
示例8: Decoded
public static Struct Decoded(byte[] data)
{
var packet = new GamePacket(data);
var result = new Struct();
packet.Position = 1;
result.UnitNetworkId = packet.ReadInteger();
packet.ReadShort();
result.MaxHealth = packet.ReadFloat();
result.CurrentHealth = packet.ReadFloat();
return result;
}
示例9: GameOnOnGameProcessPacket
/// <summary>
/// Detects the spells that have missile and are casted from fow.
/// </summary>
public static void GameOnOnGameProcessPacket(GamePacketEventArgs args)
{
//Gets received when a projectile is created.
if (args.PacketData[0] == 0x3B)
{
var packet = new GamePacket(args.PacketData) {Position = 1};
packet.ReadFloat(); //Missile network ID
var missilePosition = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
var unitPosition = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
packet.Position = packet.Size() - 119;
var missileSpeed = packet.ReadFloat();
packet.Position = 65;
var endPos = new Vector3(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
packet.Position = 112;
var id = packet.ReadByte();
packet.Position = packet.Size() - 83;
var unit = ObjectManager.GetUnitByNetworkId<AIHeroClient>((uint) packet.ReadInteger());
if (!unit.IsValid<AIHeroClient>())
{
return; // only valid hero
}
var spellData = SpellDatabase.GetBySpeed(unit.ChampionName, (int) missileSpeed, id);
if (spellData == null)
{
return; // only if database contains skillshot
}
if (spellData.SpellName != "Laser")
{
return; // ingore lasers
}
var castTime = System.Environment.TickCount - Game.Ping/2 - spellData.Delay -
(int)
(1000*missilePosition.SwitchYZ().LSTo2D().LSDistance(unitPosition.SwitchYZ())/
spellData.MissileSpeed);
//Trigger the skillshot detection callbacks.
TriggerOnDetectSkillshot(
DetectionType.RecvPacket, spellData, castTime, unitPosition.SwitchYZ().LSTo2D(),
endPos.SwitchYZ().LSTo2D(), unit);
}
}
示例10: OnGameSendPacket
private void OnGameSendPacket(GamePacketEventArgs args)
{
if (!PacketCast) return;
if (args.PacketData[0] == 153)
{
var PacketData = new GamePacket(args.PacketData[0]);
PacketData.Position = 1;
if (PacketData.ReadFloat() != Player.NetworkId) return;
if (PacketData.ReadByte() != 0) return;
switch (Config.Item(Name + "cancelAni").GetValue<StringList>().SelectedIndex)
{
case 0:
Packet.C2S.Emote.Encoded(new Packet.C2S.Emote.Struct(0));
break;
case 1:
Packet.C2S.Emote.Encoded(new Packet.C2S.Emote.Struct(1));
break;
case 2:
if (targetObj != null)
{
var pos = targetObj.Position + Vector3.Normalize(Player.Position - targetObj.Position) * (Player.Distance(targetObj) + 50);
Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(pos.X, pos.Y)).Process();
}
break;
}
}
}
示例11: OnGameProcessPacket
public static void OnGameProcessPacket(GamePacketEventArgs args)
{
return;
if (Config.Item("comboWreset").GetValue<bool>() && args.PacketData[0] == 0x65 && MasterYi.W.IsReady() && LXOrbwalker.CurrentMode == LXOrbwalker.Mode.Combo)
{
// LogPacket(args);
GamePacket gp = new GamePacket(args.PacketData);
gp.Position = 1;
Packet.S2C.Damage.Struct dmg = Packet.S2C.Damage.Decoded(args.PacketData);
int targetID = gp.ReadInteger();
int dType = (int) gp.ReadByte();
int Unknown = gp.ReadShort();
float DamageAmount = gp.ReadFloat();
int TargetNetworkIdCopy = gp.ReadInteger();
int SourceNetworkId = gp.ReadInteger();
float dmga =
(float)
MasterYi.player.GetAutoAttackDamage(
ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(targetID));
if (dmga - 10 > DamageAmount || dmga + 10 < DamageAmount)
return;
if (MasterYi.player.NetworkId != dmg.SourceNetworkId && MasterYi.player.NetworkId == targetID)
return;
Obj_AI_Base targ = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(dmg.TargetNetworkId);
if ((int) dmg.Type == 12 || (int) dmg.Type == 4 || (int) dmg.Type == 3 )
{
if (MasterYi.W.IsReady() && LXOrbwalker.InAutoAttackRange(targ))
{
MasterYi.W.Cast(targ.Position);
// LXOrbwalker.ResetAutoAttackTimer();
}
}
// Console.WriteLine("dtyoe: " + dType);
}
}