Skip to content

Commit

Permalink
PopBlanc - Update
Browse files Browse the repository at this point in the history
- Update SDK
- Fix unloads
- Fix farm
  • Loading branch information
tr33s committed Feb 21, 2017
1 parent 2f5a268 commit 7453b78
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 43 deletions.
43 changes: 42 additions & 1 deletion PopBlanc/PopBlanc/LPPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ enum eLeagueEvents
kEventOnEnterVisible,
kEventOnExitVisible,
kEventOnUpdateChargedSpell,
kEventOnPlayAnimation
kEventOnPlayAnimation,
kEventOnPauseAnimation
};

enum eTargetPriority
Expand Down Expand Up @@ -243,6 +244,7 @@ enum eCollisionFlags
kCollidesWithHeroes = (1 << 2), // Spell collides with enemy champions
kCollidesWithYasuoWall = (1 << 3), // Spell collides with Yasuo wall
kCollidesWithWalls = (1 << 4), // Spell collides with walls
kCollidesWithAllies = (1 << 5) // Spell collides with ally champions
};

enum eOrbwalkingMode
Expand All @@ -256,6 +258,45 @@ enum eOrbwalkingMode
kModeNone
};

enum eGameUnitClass
{
kClassUnknown,
kNeutralMinionCamp,
kObj_AI_Base,
kFollowerObject,
kFollowerObjectWithLerpMovement,
kObj_AI_Hero,
kObj_AI_Marker,
kObj_AI_Minion,
kLevelPropAI,
kObj_AI_Turret,
kObj_GeneralParticleEmitter,
kObj_SpellChainMissile,
kObj_SpellCircleMissile,
kObj_SpellLineMissile,
kObj_SpellMissile,
kMissile,
kMissileClient,
kDrawFX,
kUnrevealedTarget,
kObj_LampBulb,
kObj_Barracks,
kObj_BarracksDampener,
kObj_AnimatedBuilding,
kObj_Building,
kObj_Levelsizer,
kObj_NavPoint,
kObj_SpawnPoint,
kObj_Lake,
kObj_HQ,
kObj_InfoPoint,
kLevelPropGameObject,
kLevelPropSpawnerPoint,
kObj_Shop,
kObj_Turret,
kGrassObject
};

enum ePingCategory
{
kPingNormal = 0,
Expand Down
23 changes: 23 additions & 0 deletions PopBlanc/PopBlanc/PluginData.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@ enum ePredictionChance
kHitChanceImmobile
};

struct AdvPredictionInput
{
Vec3 FromPosition; // Start position for casting
Vec3 RangeCheckFromPosition; // Start position for prediction range checks
bool IsAoE; // True for area of effect spells
bool AddBoundingRadius; // Adds target bounding radius to prediction
int CollisionFlags; // (Example kCollidesWithMinions|kCollidesWithYasuoWall)
float Delay; // Delay in seconds for cast (e.g WindupTime)
float Radius; // Radius of the spell
float Range; // Range of the spell
float Speed; // Speed of the spell
int Type; // Type of the spell (e.g kLineCast)
IUnit* Target; // Unit to run prediction for
};

struct AdvPredictionOutput
{
int HitChance; // Odds of hitting target (e.g kHitChanceHigh)
Vec3 CastPosition; // Predicted position of where you should cast
Vec3 TargetPosition; // Predicted position of unit when spell will land
std::vector<IUnit*> AoETargetsHit; // Vector of all targets hit when using AoE prediction
};

struct NavigationPath
{
int CurrentWaypoint_;
Expand Down
29 changes: 15 additions & 14 deletions PopBlanc/PopBlanc/PluginSDK.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#include "PluginSDK.h"

IPluginSDK* GPluginSDK = 0;
IEventManager* GEventManager = 0;
IRender* GRender = 0;
IEntityList* GEntityList = 0;
IGame* GGame = 0;
IDamage* GDamage = 0;
IPrediction* GPrediction = 0;
IHealthPrediction* GHealthPrediction = 0;
ITargetSelector* GTargetSelector = 0;
IOrbwalking* GOrbwalking = 0;
ISpellData* GSpellData = 0;
IBuffData* GBuffData = 0;
IMissileData* GMissileData = 0;
INavMesh* GNavMesh = 0;
IPluginSDK* GPluginSDK = nullptr;
IEventManager* GEventManager = nullptr;
IRender* GRender = nullptr;
IEntityList* GEntityList = nullptr;
IGame* GGame = nullptr;
IDamage* GDamage = nullptr;
IPrediction* GPrediction = nullptr;
IHealthPrediction* GHealthPrediction = nullptr;
ITargetSelector* GTargetSelector = nullptr;
IOrbwalking* GOrbwalking = nullptr;
ISpellData* GSpellData = nullptr;
IBuffData* GBuffData = nullptr;
IMissileData* GMissileData = nullptr;
INavMesh* GNavMesh = nullptr;
IUtility* GUtility = nullptr;

54 changes: 40 additions & 14 deletions PopBlanc/PopBlanc/PluginSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define PLUGIN_EVENTD(T) T __cdecl

#define PluginSetup(x) \
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved) { return true; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved) { return TRUE; }

#define PluginSDKSetup(x) \
GPluginSDK = x; \
Expand All @@ -24,7 +24,8 @@
GSpellData = x->GetSpellDataReader(); \
GBuffData = x->GetBuffDataReader(); \
GMissileData = x->GetMissileDataReader(); \
GNavMesh = x->GetNavMesh();
GNavMesh = x->GetNavMesh(); \
GUtility = x->GetUtility();

class IFont
{
Expand Down Expand Up @@ -73,7 +74,7 @@ class IEntityList
{
public:
virtual int NumberOfEntities() = 0;
virtual IUnit* GetEntityAt(int) = 0;
virtual IUnit* GetEntityAt(int Idx) = 0;
virtual IUnit* Player() = 0;
virtual std::vector<IUnit*> GetAllHeros(bool Friendly, bool Enemy) = 0;
virtual std::vector<IUnit*> GetAllMinions(bool Friendly, bool Enemy, bool Neutral) = 0;
Expand All @@ -84,6 +85,8 @@ class IEntityList
virtual IUnit* GetEnemyNexus() = 0;
virtual IUnit* GetTeamNexus() = 0;
virtual bool DoesObjectExist(IUnit* Source) = 0;
virtual IUnit* GetEntityByNetworkId(int NetworkId) = 0;
virtual IUnit* GetEntityByTargetId(int TargetId) = 0;
};

class IGame
Expand All @@ -95,8 +98,8 @@ class IGame
virtual int Status() = 0;
virtual float Time() = 0;
virtual Vec3 const& CursorPosition() = 0;
virtual void IssueOrder(IUnit* Source, eGameObjectOrder Order, Vec3 const& Position) = 0;
virtual void IssueOrder(IUnit* Source, eGameObjectOrder Order, IUnit* Target) = 0;
virtual bool IssueOrder(IUnit* Source, eGameObjectOrder Order, Vec3 const& Position) = 0;
virtual bool IssueOrder(IUnit* Source, eGameObjectOrder Order, IUnit* Target) = 0;
virtual float IntervalPerTick() = 0;
virtual void PrintChatEx(const char* Message, Vec3 const& Color) = 0;
virtual bool WorldToMinimap(Vec3 const& World, Vec2& Minimap) = 0;
Expand All @@ -118,6 +121,7 @@ class IGame
virtual bool Projection(Vec3 const&, Vec3*) = 0;
virtual int TickCount() = 0;
virtual int CurrentTick() = 0;
virtual bool IsChatOpen() = 0;
};

class IDamage
Expand Down Expand Up @@ -151,6 +155,7 @@ class IPrediction
virtual int GetCollisionFlagsForPoint(Vec3 const& Position) = 0;
virtual bool IsPointWall(Vec3 const& Position) = 0;
virtual bool IsPointGrass(Vec3 const& Position) = 0;
virtual void RunPrediction(AdvPredictionInput* Input, AdvPredictionOutput* Output, uint32_t PredictionVersion = 1) = 0;
};

class IMenuOption
Expand All @@ -169,12 +174,12 @@ class IMenuOption
class IMenu
{
public:
virtual IMenu* AddMenu(const char*) = 0;
virtual IMenuOption* CheckBox(const char*, bool) = 0;
virtual IMenuOption* AddInteger(const char*, int, int, int) = 0;
virtual IMenuOption* AddFloat(const char*, float, float, float) = 0;
virtual IMenuOption* AddColor(const char*, DWORD) = 0;
virtual IMenuOption* AddColor(const char*, float, float, float, float) = 0;
virtual IMenu* AddMenu(const char* Title) = 0;
virtual IMenuOption* CheckBox(const char* Name, bool Value) = 0;
virtual IMenuOption* AddInteger(const char* Name, int MinValue, int MaxValue, int Value) = 0;
virtual IMenuOption* AddFloat(const char* Name, float MinValue, float MaxValue, float Value) = 0;
virtual IMenuOption* AddColor(const char* Name, DWORD Value) = 0;
virtual IMenuOption* AddColor(const char* Name, float R, float G, float B, float A) = 0;
virtual void SaveSettings() = 0;
virtual void Remove() = 0;
virtual IMenuOption* GetOption(const char* Name) = 0;
Expand Down Expand Up @@ -220,13 +225,13 @@ class ISpell2
{
public:
virtual bool CastOnTarget(IUnit* Target, int MinimumHitChance = kHitChanceHigh) = 0;
virtual bool CastOnTargetAoE(IUnit* Target, int MinimumChampionsTohit = 2, int MinimumHitChance = kHitChanceHigh) = 0;
virtual bool CastOnTargetAoE(IUnit* Target, int MinimumChampionsLanded = 2, int MinimumHitChance = kHitChanceHigh) = 0;
virtual bool LastHitMinion() = 0;
virtual bool AttackMinions(int MinimumEnemiesToHit = 3) = 0;
virtual bool AttackMinions(int MinimumEnemiesLanded = 3) = 0;
virtual bool CastOnPlayer() = 0;
virtual bool CastOnPosition(Vec3 const& Position) = 0;
virtual bool CastOnUnit(IUnit* Target) = 0;
virtual void FindBestCastPosition(bool IncludeMinions, bool IncludeHeroes, Vec3& CastPosition, int& EnemiesFound) = 0;
virtual void FindBestCastPosition(bool IncludeMinions, bool IncludeHeroes, Vec3& CastPosition, int& EnemiesLanded) = 0;
virtual IUnit* FindTarget(eDamageType DamageType) = 0;
virtual bool IsReady() = 0;
virtual float ManaCost() = 0;
Expand All @@ -244,6 +249,11 @@ class ISpell2
virtual void StartCharging() = 0;
virtual void StartCharging(Vec3 const& Position) = 0;
virtual float GetChargePercent() = 0;
virtual int GetSlot() = 0;
virtual void SetFrom(Vec3 const& Position) = 0;
virtual void SetRangeCheckFrom(Vec3 const& Position) = 0;
virtual bool RunPrediction(IUnit* Target, bool IsAoE, int CollisionFlags, AdvPredictionOutput* Output, uint32_t PredictionVersion = 1) = 0;
virtual bool CastFrom(Vec3 const& StartPosition, Vec3 const& EndPosition) = 0;
};

class IOrbwalking
Expand Down Expand Up @@ -371,6 +381,7 @@ class IMissileData
virtual float GetBaseDamage(void* Data) = 0;
virtual float GetRange(void* Data) = 0;
virtual float GetSpellCastTime(void* Data) = 0;
virtual bool IsAutoAttack(void* Data) = 0;
};

class INavMesh
Expand All @@ -383,6 +394,19 @@ class INavMesh
virtual float GetHeightForPoint(Vec2 const& Position) = 0;
};

class IUtility
{
public:
virtual bool IsLeagueWindowFocused() = 0;
virtual bool IsPositionInFountain(Vec3 const& Source, bool CheckTeamFountain = true, bool CheckEnemyFountain = false) = 0;
virtual bool IsPositionUnderTurret(Vec3 const& Source, bool CheckTeamTurrets = false, bool CheckEnemyTurrets = true) = 0;
virtual void CreateDebugConsole() = 0;
virtual void DestroyDebugConsole() = 0;
virtual void LogConsole(const char* Fmt, ...) = 0;
virtual void LogFile(const char* Filename, const char* Fmt, ...) = 0;
virtual void ClearLogFile(const char* Filename) = 0;
};

class IPluginSDK
{
public:
Expand Down Expand Up @@ -410,6 +434,7 @@ class IPluginSDK
virtual void UnRegisterPluginInterface(std::string const& Name) = 0;
virtual PVOID FindPluginInterface(std::string const& Name) = 0;
virtual INavMesh* GetNavMesh() = 0;
virtual IUtility* GetUtility() = 0;
};

extern IPluginSDK* GPluginSDK;
Expand All @@ -426,6 +451,7 @@ extern ISpellData* GSpellData;
extern IBuffData* GBuffData;
extern IMissileData* GMissileData;
extern INavMesh* GNavMesh;
extern IUtility* GUtility;

#endif // PluginSDK_h__

Expand Down
29 changes: 17 additions & 12 deletions PopBlanc/PopBlanc/PopBlanc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <map>
#include "PluginSDK.h"
#include "Utility.h"
#include <string>
PluginSetup("PopBlanc - Trees");

IMenu* MainMenu;
Expand Down Expand Up @@ -61,7 +62,7 @@ IUnit* GetTarget()

for (auto enemy : GEntityList->GetAllHeros(false, true))
{
if (enemy == nullptr || !enemy->IsValidObject() || !enemy->IsValidTarget(Player, range))
if (!Utility::IsValidUnit(enemy) || !enemy->IsValidTarget(Player, range))
{
continue;
}
Expand Down Expand Up @@ -94,7 +95,7 @@ bool IsFirstR()

bool IsRActive()
{
return strcmp(Player->GetSpellBook()->GetName(kSlotR), "LeblancR") == 0;
return Player->GetSpellBook()->GetLevel(kSlotR) > 0 && strcmp(Player->GetSpellBook()->GetName(kSlotR), "LeblancR") == 0;
}

bool CastSecondW()
Expand All @@ -117,8 +118,13 @@ bool CastRSpell(IUnit* target)
return true;
}

if (!bCastSpell(Q, target))
{
return false;
}

auto hasBuff = target->HasBuff(QBuff);
if ((target->GetHealth() < GDamage->GetSpellDamage(Player, target, kSlotQ, hasBuff ? 1 : 0) || hasBuff) && bCastSpell(Q, target) && Q->CastOnTarget(target))
if ((target->GetHealth() < GDamage->GetSpellDamage(Player, target, kSlotQ, hasBuff ? 1 : 0) || hasBuff) && Q->CastOnTarget(target))
{
return true;
}
Expand Down Expand Up @@ -201,14 +207,13 @@ void Harass()
return;
}

// why does this cause unload??
/*for (auto obj : GEntityList->GetAllUnits())
for (auto obj : GEntityList->GetAllUnits())
{
if (obj != nullptr && obj->IsValidObject() && obj->IsValidTarget(Player, Q->Range()) && obj->HasBuff(QBuff) && (obj->ServerPosition() - target->ServerPosition()).Length() < 500 && Q->CastOnUnit(obj))
if (Utility::IsValidUnit(obj) && obj->IsValidTarget(Player, Q->Range()) && obj->HasBuff(QBuff) && (obj->ServerPosition() - target->ServerPosition()).Length() < 500 && Q->CastOnUnit(obj))
{
return;
}
}*/
}
}
}

Expand Down Expand Up @@ -251,14 +256,13 @@ void Farm()
if (LaneClearQ->Enabled() && Q->IsReady())
{
// add count to find best minion
// also causes unload
/*for (auto obj : GEntityList->GetAllUnits())
for (auto obj : GEntityList->GetAllUnits())
{
if (obj != nullptr && obj->IsValidObject() && obj->IsValidTarget(Player, Q->Range()) && obj->HasBuff(QBuff) && Q->CastOnUnit(obj))
if (Utility::IsValidUnit(obj) && obj->IsValidTarget(Player, Q->Range()) && obj->HasBuff(QBuff) && Q->CastOnUnit(obj))
{
return;
}
}*/
}
}
}

Expand Down Expand Up @@ -409,13 +413,14 @@ PLUGIN_EVENT(void) OnRender()
PLUGIN_API void OnLoad(IPluginSDK* PluginSDK)
{
PluginSDKSetup(PluginSDK);
Utility::CreateConsoleWindow();

MainMenu = GPluginSDK->AddMenu("PopBlanc");
QMenu = MainMenu->AddMenu("Q");
WMenu = MainMenu->AddMenu("W");
EMenu = MainMenu->AddMenu("E");
RMenu = MainMenu->AddMenu("R");
FleeMenu - MainMenu->AddMenu("Flee");
FleeMenu = MainMenu->AddMenu("Flee");
//Drawings = MainMenu->AddMenu("Drawings");

ComboQ = QMenu->CheckBox("Use in Combo", true);
Expand Down
Loading

0 comments on commit 7453b78

Please sign in to comment.