GameObject
Important Functions to remember
Every object accessed accessed from entity_list is an instance of game_object class
IsValid
Checks whether the object is still valid meaning if its still in the game Call this function before any other call. It is very important to prevent crashes.
//Checks whether the object is still valid meaning if its still in the game
//
bool is_valid( ) const;
IsValidTarget
Checks if object IsValid and also if it is targetable for auto attacks
//Returns true if object IsValid and also if it is targetable for autoattacks
// float range - maximum range from Player to entity_list
// vector from - if set to zero range will be checked from Player position otherwise from the vector you pass
// bool ignore_invulnerability - skips the check for is_invurnelable (Kayle R, Zhonyas etc)
//
bool is_valid_target( float range = FLT_MAX, vector const& from = vector( 0, 0 ), bool ignore_invulnerability = false );
Type checkers
//Returns instance of object_type_script class containing information about object type
//
object_type_script get_type( );
//Returns true if object is a champion
//
bool is_ai_hero( );
//Returns true for objects that inherit from AIBase. Ex. AIHero, AIMinion, AITurret
//
bool is_ai_base( );
//Returns true if object is a minion (any type, jungle monsters, lane minions, wards, etc)
//
bool is_ai_minion( );
//Returns true if object is a turret
//
bool is_ai_turret( );
//Returns true if object is a nexus
//
bool is_nexus( );
//Returns true if object is an inhibitor
//
bool is_inhibitor( );
//Returns true if object is a missile
//
bool is_missile( );
//Returns true if object is a particle
//
bool is_general_particle_emitter( );
Minion checkers
//Returns true if object is a monster (mobs in jungle)
//
bool is_monster( );
//Returns true if object is a minion
//
bool is_minion( );
//Returns true if object is a jungle buff (blue buff, red buff)
//
bool is_jungle_buff( );
//Returns true if object is an epic monster (baron, herald, dragon)
//
bool is_epic_monster( );
//Returns true if object is a lane minion
//
bool is_lane_minion( );
//Returns true if object is a plant
//
bool is_plant( );
//Returns true if object is a ward
//
bool is_ward( );
Utility functions
//Checks if the object is the local player.
//
bool is_me( );
//Checks if the object is visible. Meaning if it's not in FOW
//
bool is_visible( );
//Checks whether the object is moving.
//
bool is_moving( );
//Checks whether the object is dashing.
bool is_dashing( );
//Checks if the object is dead.
//
bool is_dead( );
//Checks if the object is melee.
//
bool is_melee( );
//Checks if the object is ranged.
//
bool is_ranged( );
//Checks if the object is an ally towards local player.
//
bool is_ally( );
//Checks if the object is enemy towards local player.
//
bool is_enemy( );
//Returns name of the object. For champions it will be the Player's name.
//
std::string get_name( );
//Returns base model. For champions it will be the champion's name.
//
std::string get_model( );
//Returns the base skin name of the object.
//
std::string get_base_skin_name( );
//Returns the object team.
//
game_object_team get_team( );
//Returns auto attack spell data of the object.
//
spell_data_script get_auto_attack( );
//Returns the Id of the object in the EntityList.
//
uint16_t get_id( );
//Returns the NetworkId of the object.
//
uint32_t get_network_id( );
//Checks whether the object is winding up. Meaning if the object is doing an action like. casting spell or autoattack.
//
bool is_winding_up( );
//Returns mana needed to use a spell
// - spellslot of the spell
float get_mana_for_spell( spellslot slot );
//Returns path starting from object position to it's destination.
//
std::vector<vector> get_real_path( );
//Returns auto attack damage of the object on the target.
// - target
// - include passive damage in calculations (eg. on-hit damages)
//
float get_auto_attack_damage( game_object_script to, bool respect_passives = true );
//Checks if the object is recalling to base
//
bool is_recalling( );
//Checks if the target is in auto attack range of the object.
// - target
// - additional range
//
bool is_in_auto_attack_range( game_object_script to, float additional = 0.f );
//Checks whether the object is under enemy turret (enemy towards the object)
//
bool is_under_enemy_turret( );
//Checks whether the object is under ally turret (ally towards the object)
//
bool is_under_ally_turret( );
//Checks if the object can issue an attack command.
//Example: if the object is stunned function will return false
//
bool can_attack( );
//Checks if the object can issue a move command.
//Example: if the object is stunned function will return false
//
bool can_move( );
//Checks if the object can cast a spell.
//Example: if the object is stunned function will return false
//
bool can_cast( );
//Checks if the object is stealthed.
//
bool is_stealthed( );
//Checks if the object is immovable.
//
bool is_immovable( );
//Checks if the object is ghosted (has move speed buff).
//
bool is_ghosted( );
//Checks if Local Player can issue an attack command on the object
// - Skip invulnerability buff check
//
bool is_attack_allowed_on_target( bool ignore_invulnerability = false );
//Returns spell_state flags of the spell.
// - spellslot of the spell to check
//
// Available states:
// spell_state::Ready,
// spell_state::NotLearned ,
// spell_state::NotAvaliable,
// spell_state::Surpressed,
// spell_state::Cooldown,
// spell_state::NotEnoughMana,
// spell_state::UnknownState
//
//
spell_state get_spell_state( spellslot spell ) = 0;
//
//How to check if spell is ready?
//
// if ( object->get_spell_state( spellslot::q ) & spell_state::Ready )
// {
// ...
// }
//
//Checks if object is targetable.
//
bool is_targetable( );
//Checks if object is targetable to team.
// - team to check
//
bool is_targetable_to_team( game_object_team team );
//Returns ChampionId. Object must be of type AIHeroClient.
//Check is_ai_hero() before calling this function
//
champion_id get_champion( );
//Returns 2 dimensional distance from object to object.
// - object to check distance
//
float get_distance( game_object_script to );
//Returns 2 dimensional distance from object to position.
// - position in the game
//
float get_distance( vector to );
//Returns the object position in the game.
//
vector get_position( );
//Returns the spell_instance_script instance of current casting spell otherwise nullptr.
// - old is no longer used by the core. The value of this parameter doesn't matter
//
spell_instance_script get_active_spell( bool old = false );
//Returns the numer of allies around the object (allies towards the object)
// - maximum range from object to allies
//
int32_t count_allies_in_range( float range );
//Returns the numer of enemies around the object (enemies towards the object)
// - maximum range from object to enemies
//
int32_t count_enemies_in_range( float range );
//Returns the perpendicular direction of the object.
//
vector get_direction_perpendicular( );
//Returns the direction of the object.
//
vector get_direction( );
//Returns the direction on the waypoint of the object.
//
vector get_pathing_direction( );
//Checks whether the object is facing object.
// - the object to check
//
bool is_facing( game_object_script obj );
//Checks whether the object is facing a position.
// - the position to check
//
bool is_facing( vector& position );
//Checks whether the object is immune to physical damage.
//
bool is_physical_immune( );
//Checks whether the object is immune to magical damage.
//
bool is_magic_immune( );
//Checks whether the object is immune to lifesteal.
//Meaning if dealing damage will return back % health of the damage dealt (if you have lifesteal).
//
bool is_lifesteal_immune( );
//Checks whether the object is immune to any source of damage. (Kayle R, zhonyas, etc.)
//
bool is_invulnerable( );
//Checks whether the object is using a teleport.
//
bool is_teleporting( );
//Returns the teleport state.
//Possible return values: "Recall", "SuperRecall", "SummonerTeleport", "Gate", "shenrchannelmanagerm", "shenrtargettracker", "YuumiW"
//
std::string get_teleport_state( );
//Returns the texture of the object avatar. Return value may be nullptr
//
uint32_t* get_square_icon_portrait( );
//Returns the texture of the object passive icon. Return value may be nullptr
//
uint32_t* get_passive_icon_texture( );
//Returns the value of importance of the current casting spell
//Possible return values:
// 0 - object is not casting an important spell
// 1 - object is casting important spell of medium danger value (Fiddlesticks W, MasterYi W)
// 2 - object is casting important spell of high danger value (Katarina R, Caitlyn R)
int32_t is_casting_interruptible_spell( );
//Returns the screen position of the object HPBar
//
vector get_hpbar_pos( );
//Returns the amount of stacks under the unit HPBar
//Example: Annie stacks, Zeri passive stacks...
//
float get_hp_bar_stacks( );
//Returns the amount of spell training points.
//
int get_lvlup_stacks( );
//Checks whether the object is visible on the screen.
//
bool is_visible_on_screen( );
//Checks whether the object is zombie
//Example: Sion passive, Karthus passive
//
bool is_zombie( );
//Returns the object BoundingBox min
//
vector get_bbox_min( );
//Returns the object BoundingBox max
//
vector get_bbox_max( );
//Checks whether the object has had it's HPBar recently rendered
//
bool is_hpbar_recently_rendered( );
//Returns the floating hero stat
// - id of the float_hero_stat
//
float get_hero_stat( float_hero_stat id );
//Returns the int hero stat
// - id of the int_hero_stat
//
int get_hero_stat( int_hero_stat id );
//Returns the immovibility time left of the object
//
float get_immovibility_time( );
//Returns the particle rotation right vector.
//
vector get_particle_rotation_right( );
//Returns the particle rotation up vector.
//
vector get_particle_rotation_up( );
//Returns the particle rotation forward vector.
//
vector get_particle_rotation_forward( );
//Returns health with shields
// - include physical_shield into calculations
// - include magical_shield into calculations
//
float get_real_health( bool physical_shield = false, bool magical_shield = false );
//Set's the object skin
// - id of the skin
// - desired model name
//
void set_skin( uint32_t id, const std::string& model );
//Calculates the path starting from object position to the end
// - position where waypoint ends
//
std::vector<vector> get_path( vector end );
//Returns the owner of the object otherwise nullptr. Calling this function on Tibbers will return Annie (the owner of Tibbers)
// - Please remember owner is not yet set to an object in on_create event.
// Game sets the owner in later update ticks
//
game_object_script get_owner( );
Entity stats functions
int get_level( );
float get_exp( );
float get_exp_percent( );
float get_bounding_radius( );
float get_move_speed( );
float get_attack_delay( );
float get_attack_cast_delay( );
float get_gold( );
float get_crit( );
float get_bonus_spell_block( );
float get_spell_block( );
float get_armor( );
float get_bonus_armor( );
float get_attack_range( );
float get_magic_lathality( );
float get_percent_bonus_armor_penetration( );
float get_percent_magic_penetration( );
float get_flat_magic_reduction( );
float get_percent_magic_reduction( );
float get_flat_armor_penetration( );
float get_physical_lathality( );
float get_flat_magic_penetration( );
float get_percent_armor_penetration( );
float get_base_attack_damage( );
float get_additional_attack_damage( );
float get_total_attack_damage( );
float get_percent_physical_damage_mod( );
float get_flat_physical_damage_mod( );
float get_base_ability_power( );
float get_total_ability_power( );
float get_flat_magic_damage_mod( );
float get_percent_magic_damage_mod( );
float get_flat_damage_reduction_from_barracks_minion_mod( );
float get_percent_damage_to_barracks_minion_mod( );
float get_mana( );
float get_mana_percent( );
float get_max_mana( );
float get_health( );
float get_health_percent( );
float get_max_health( );
float get_hp_regen_rate( );
float get_physical_shield( );
float get_magical_shield( );
float get_all_shield( );
float msar_max( );
float get_passive_cooldown_end_time( );
float get_passive_cooldown_total_time( );
float get_percent_cooldown_mod( );
float mDodge( );
float mPARRegenRate( );
float mAttackSpeedMod( );
float mFlatCastRangeMod( );
float mPercentLifeStealMod( );
float mPercentSpellVampMod( );
float mPercentPhysicalVamp( );
float mPercentCritBonusArmorPenetration( );
float mPercentCritTotalArmorPenetration( );
float mPercentBonusMagicPenetration( );
float mBaseHPRegenRate( );
float mPrimaryARBaseRegenRateRep( );
float mSecondaryARRegenRateRep( );
float mSecondaryARBaseRegenRateRep( );
float mPercentCooldownCapMod( );
float mPercentCCReduction( );
float mPercentEXPBonus( );
float mFlatBaseAttackDamageMod( );
float mPercentBaseAttackDamageMod( );
float mBaseAttackDamageSansPercentScale( );
float mFlatBaseHPPoolMod( );
float mPercentBonusPhysicalDamageMod( );
float mPercentBasePhysicalDamageAsFlatBonusMod( );
float mPercentAttackSpeedMod( );
float mPercentMultiplicativeAttackSpeedMod( );
float mCritDamageMultiplier( );
float mPercentOmnivampMod( );
float mFlatBubbleRadiusMod( );
float mPercentBubbleRadiusMod( );
float mMoveSpeedBaseIncrease( );
float mScaleSkinCoef( );
Local Player only functions
You should call these functions only on local player for readability and code integriy
//Buys an item.
// - item id to buy
//
void buy_item( ItemId itm );
//Levels a spell on a given spellslot
// - spellslot of the spell
//
void levelup_spell( spellslot slot );
//Casts a ping.
// - position of the ping
// - object to be pinged (can be nullptr)
// - type of the ping to send
//
void cast_ping( vector position, game_object_script object, _player_ping_type ping_type );
//Send's a message in the chat.
//
void send_chat( const char* format, ... );
//Issues an attack command on target
// - target of the order
// - should event be triggered?
// - enable or disable core humanizer
//
void issue_order( game_object_script target, bool trigger_event = true, bool use_humanizer = true );
//Issues a move command
// - position of the order
// - should event be triggered?
// - set the order to attack_move
//
void issue_order( vector game_pos, bool trigger_event = true, bool use_humanizer = true, bool attack_move = false );
//Issues an order on the player
// - _issue_order_type type of the order
// - should event be triggered?
// - enable or disable core humanizer
//
void issue_order( _issue_order_type type, bool trigger_event = true, bool use_humanizer = true );
//Casts a spell
// - slot of the spell to be casted
// - should event be triggered?
// - is charded spell
//
void cast_spell( spellslot slot, bool trigger_event = true, bool is_charging = false );
//Casts a spell
// - slot of the spell to be casted
// - position to where spell needs to be casted
// - should event be triggered?
// - is charded spell
//
void cast_spell( spellslot slot, vector pos, bool trigger_event = true, bool is_charging = false );
//Casts a spell
// - slot of the spell to be casted
// - target of the spell
// - should event be triggered?
// - is charded spell
//
void cast_spell( spellslot slot, game_object_script obj, bool trigger_event = true, bool is_charging = false );
//Casts a spell
// - slot of the spell to be casted
// - start position of the spell
// - end position of the spell
// - should event be triggered?
// - is charded spell
//
void cast_spell( spellslot slot, vector startPos, vector endPos, bool trigger_event = true, bool is_charging = false );
//Updates a charged spell
// - slot of the spell to be updated
// - position of the spell to be updated
// - release cast
// - should event be triggered?
//
void update_charged_spell( spellslot slot, vector position, bool releaseCast, bool trigger_event = true );
Dealing with missiles
You need to make sure first that, the object is a missile.
All functions related to missiles
unsigned short missile_get_sender_id( );
unsigned short missile_get_target_id( );
bool missile_is_targeted( );
vector missile_get_start_position( );
vector missile_get_end_position( );
spell_data_script get_missile_sdata( );
How to get sender/target of the missile
auto sender = entitylist->get_object( missile->missile_get_sender_id( ) );
if ( sender != nullptr )
{
...
}
auto target = entitylist->get_object( missile->missile_get_target_id( ) );
if ( target != nullptr )
{
...
}
How to get the positions of missile
auto start_position = missile->missile_get_start_position( );
auto current_position = missile->get_position( );
auto end_position = missile->missile_get_end_position( );
How to get the missile SpellData
Dealing with object buffs
You need to make sure that the object is at least of type AIBaseClient. Otherwise calling these functions are useless.
All functions related to missiles
//Returns a vector of object buffs
//
std::vector<std::shared_ptr<buff_instance>> get_bufflist( );
//Check whether the object has buff of the hashed name
// - hashed buff name
//
bool has_buff( uint32_t hash );
//Check whether the object has any buff of the hashed names
// - vector of hashed buff names
//
bool has_buff( std::vector<uint32_t> hashes );
//Check whether the object has buff of type
// - type of the buff
//
bool has_buff_type( buff_type type );
//Check whether the object has any of the buffs of type you pass
// - vector of buff types
//
bool has_buff_type( std::vector<buff_type> type );
//Returns a buff with a given hash name otherwise nullptr.
// - hashed buff name
//
buff_instance_script get_buff( uint32_t hash );
//Returns a buff with a given type otherwise nullptr.
// - type of the buff
//
buff_instance_script get_buff_by_type( buff_type type );
//Returns buff count of a buff with a given hash name otherwise 0.
// - hashed buff name
//
int get_buff_count( uint32_t hash );
//Returns time left of a buff with a given hash name otherwise 0.
// - hashed buff name
//
float get_buff_time_left( uint32_t hash );
//Returns a buff with any of given types otherwise nullptr.
// - vector of buff types
//
buff_instance_script get_buff_by_type( std::vector<buff_type> type );
How to get hash of buff name
To get the hashed name of the buff you need to use buff_hash function.
/**
* Creates buff name hash for given buff name
*
* Use that macro when checking for buff or getting a buff
* We don't support getting buffs by their name, you have to pass hash
*
* buff_hash is ignorecase hashing function
*/
buff_hash( )
Example usage:
How to check whether object has a given buff
You need to use any of the provided buff related functions.
Example:
How to iterate through buff list
Warning
Remember to always check if buff returned from bufflist is valid and alive, as in the example provided below.
if ( object->is_ai_base( ) )
{
for ( auto&& buff : object->get_bufflist( ) )
{
if ( buff->is_valid( ) && buff->is_alive( ) )
{
...
}
}
}
Dealing with object items
You need to make sure that the object is at least of type AIBaseClient. Otherwise calling these functions are useless.
All functions related to items
//Returns instance of item_script for a given spellslot otherwise nullptr.
// - spellslot of an item
//
item_script get_item( spellslot itemslot );
//Returns spellslot of an item for a given ItemId otherwise spellslot::invalid.
// - ItemId of an item
//
spellslot has_item( int32_t itemid );
//Returns spellslot of given ItemIds otherwise spellslot::invalid.
// - vector of ItemIds
//
spellslot has_item( ItemId itemid );
//Returns spellslot of given ItemIds otherwise spellslot::invalid.
// - vector of ItemIds
//
spellslot has_item( std::vector<ItemId> itemid );
//Checks whether the item of given id is owned by the object and ready to use.
// - ItemId of an item
//
bool is_item_ready( int32_t itemid );
//Checks whether the item of given id is owned by the object and ready to use.
// - ItemId of an item
//
bool is_item_ready( ItemId itemid );
How to iterate through items of an object
if ( object->is_ai_base( ) )
{
for ( spellslot slot = spellslot::item_1; slot <= spellslot::item_6; slot = ( spellslot )( ( int ) slot + 1 ) )
{
auto item = object->get_item( slot );
if ( item != nullptr )
{
...
}
}
}
Dealing with object perks
You need to make sure that the object is at least of type AIBaseClient. Otherwise calling these functions are useless.
All functions related to perks
//Returns a vector of object perks
//
std::vector<std::shared_ptr<perk>> get_perks( );
//Checks whether an object has a perk of given id
// - id of the perk
//
bool has_perk( uint32_t id );