• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Memory Hack API (description)

Status
Not open for further replies.
Level 19
Joined
Dec 12, 2010
Messages
2,069
I've provided a .j file with basic functions and tons of API, most of which went undocumented, so people started to ask questions. I'll try to comment every function I put there to somehow clear things out.

Common questions
Q: This function doesn't work with address, should I put handle instead?
A: Nope, forget what handle is when you're working with memory. Handle is nothing but jass-only thing.

Q: Where is X function?
A: Impossible or not required by me, therefore never been implemented. Mem hack allows pretty much everything, yet you have to know what you want and how to find it in the memory. Thats why you need CE or wait for somebody to actually dig things up. There's definitely ways to read any data, yet you maybe won't be able to set it.

Q: Will there be updates to API?
A: Sure, but can't make a date()

Q: Why there's randomly "divided by 4" and some of others arent?
A: When we started it we were using Memory[] array, which is 4-bytes based. Saying, whenever you access address 0x1000000, you need to ask Memory[0x1000000/4]. Then, after few months, we moved to full addresses, yet legacy..

memhackapi0.jpg


Check twice if function you used takes one or another. Anyway, lets go

Constant-related API
WC3 has many constants which are known for limiting game possibilities. Most known of them is movespeed limit and attack speed limit. So first of all we tried to get rid of them.

WARNING
Some constants, which weren't declared in map's constants, like attack speed (AS) limit, are stored in READ ONLY memory section. Thanks to that, they are only loaded at game start and supposed to be constant all along. Altering them will cause your clients to have different limits than other. That's not a problem if they're gonna play your map only. But in case if player decides to join another game later he'll be disconnected as soon as he overcome default AS limit. Memory won't be repaired at map start, so he will have different limits, and that will fuck him up.
You as well can't detect whenever player leaves to run some code on his PC - he is out of reach. So, there's only 3 options for non-retarded coders:
  • Force your players to play map till the end. In the lose/victory trigger you simply re-write limits with default ones so it won't affect following games.

  • Force WC3 crashing on exit unless map finished. That will effectively reset memory and limits. It can be done in many ways, starting from trashing some fields in unit's structure, for instance. Whenver game will try to clean out objects on exit it will crash. Rest players who finished the map will be "fixed" by your trigger, which as well will remove that trash, ensuring clean exit.

  • Use injected DLL to detect map's finish and fix offsets manually, via C++. I'll ask if thats possible to create restore-only chunk from our DotA DLL. Currently we do use this approach.

JASS:
function SetMaxUnitSpeed takes real r returns nothing//MS is still limited by 522
function GetMaxUnitSpeed takes nothing returns real
Issue is, address we found first time seems to be irrelevant, so this functions basically useless if you want to pass 522 limit. Although you may check if it allows to change "constant" max speed value to lower numbers, dinamycally adjusting it for your needs instead of setting it up once at map start.
JASS:
function SetMinUnitSpeed takes real r returns nothing
function GetMinUnitSpeed takes nothing returns real
function SetMaxBuildingSpeed takes real r returns nothing
function GetMaxBuildingSpeed takes nothing returns real
function SetMinBuildingSpeed takes real r returns nothing
function GetMinBuildingSpeed takes nothing returns real
Same, just to change game constant

JASS:
function GetAttackSpeedLimit takes nothing returns real
function SetAttackSpeedLimit takes real r returns nothing
Read-only constant. Attack speed is measured in float and may be inbetween 0.2 and 5.0 by default (min & max), 1. = no changes (base attack time used). It's also known as -80% AS and 400% AS limits. You can change them to w/e you want, I can't see backstabs.

JASS:
function GetAttackTimeLimit takes nothing returns real
function SetAttackTimeLimit takes real r returns nothing
Read-only constant. Same as attack speed, attack time had it's limits. I never needed to change them, so untested.

JASS:
function DisableOPLimit takes nothing returns nothing
Read-only constant. Default OP limit (operations limit) is 30k. Means after 30k of any kind of calls or increments game will kill the thread no matter if its finished or not. This function set limit to 800-900k or higher, literally unreachable no matter what you do. This will cause forgotted endless loops to stop whole WC3 yet allows you to keep functions inlined instead of re-calling it later.

Basic functions

JASS:
function ConvertHandle takes handle h returns integer
function ConvertPointer takes integer ptr returns integer
ConvertHandle turns any given handle into the read address of object related.
ConvertPointer should be used onto things which aren't real handles - texttag, lightnings, ubserplats, etc. They have different scope in the memory, so different appoach needed. Im not sure if this func ever work tho.

JASS:
function IsFlagBitSet takes integer flags, integer bit returns boolean
Just a simple checker for a flag stored inside normal integer. Imaging it as bit-wise AND.

JASS:
function GetSomeAddress takes integer pAddr1 ,integer pAddr2 returns integer
function GetSomeAddressForAbility takes integer pAddr1 ,integer pAddr2 returns integer
function GetSomeAddressForLocustFlags takes integer pAddr1 ,integer pAddr2 returns integer// derivative
Are used to craft some address of 2 integer values. WC3 stores links onto objects using 2 keys, and that's only way for you to convert them to real address - using those functions.

JASS:
function ConvertNullTerminatedStringToString takes integer pNullTerminatedString returns string
For string handling

JASS:
function GetRealPlayerById takes integer i returns integer
function GetLocalPlayerIdReal takes nothing returns integer
function GetLocalPlayerReal takes nothing returns integer
function GetPlayerSelectedUnitReal takes integer realplayer returns integer
function SetPlayerSelectedUnitReal takes integer realplayer, integer pConvertedHandle returns nothing
Speaks for themselves, yet won't be really needed for you

Unit's API
You can find more info about units in Unit's structure
JASS:
function GetUnitFlags takes unit u returns integer
function SetUnitFlags takes unit u,integer i returns nothing
This is referred to Unit+0x5C offset which contains some flags of unit, constants held some of known values.

JASS:
function GetUnitFlags_2 takes unit u returns integer
function SetUnitFlags_2 takes unit u,integer i returns nothing
And this is for Unit+0x20
JASS:
function GetUnitArmorType takes unit u returns integer
function SetUnitArmorType takes unit u, integer id returns nothing
function GetUnitArmor takes unit u returns real
function SetUnitArmor takes unit u,real r returns nothing
Simple setter-getters, documented with numbers. Setting unit's armor always affects only white armor, although it's always returns white+green.

JASS:
function SetUnitTypeId takes unit u,integer i returns nothing
function GetUnitTypeIdReal takes integer i returns integer
Obviously allows you to spoof unit with different ID, or get the ID value directly from memory instead of native

JASS:
function SetUnitPhased takes unit u returns nothing
Turn's unit to phased stated (used by pathfinding algo for items on the ground), also known as wind walk-ing

JASS:
function GetUnitVertexColorB takes unit u returns integer
function GetUnitVertexColorG takes unit u returns integer
function GetUnitVertexColorR takes unit u returns integer
function GetUnitVertexColorA takes unit u returns integer
function GetUnitVertexColorB_2 takes unit u returns integer
function GetUnitVertexColorG_2 takes unit u returns integer
function GetUnitVertexColorR_2 takes unit u returns integer
function GetUnitVertexColorA_2 takes unit u returns integer
function SetUnitColorDirectlyForAddresss takes integer pConvertedHandle, integer red, integer green, integer blue, integer alpha returns nothing
function SetUnitColorDirectly takes unit u, integer red, integer green, integer blue, integer alpha returns nothing
Allows to change unit's coloring, including illusions. Yet illusions tends to get colored back to blue over time.

JASS:
function GetHeroPrimaryAttribute takes unit u returns integer
function GetHeroPrimaryAttributeById takes integer id returns integer
function SetHeroPrimaryAttribute takes unit u,integer i returns nothing
Take those for granted:
JASS:
    constant integer HERO_PRIM_STAT_STR=1
    constant integer HERO_PRIM_STAT_INT=2
    constant integer HERO_PRIM_STAT_AGI=3

Unit movement's API:

JASS:
function RemoveAllUnitMovementDisables takes unit u returns nothing
function IsUnitMovementDisabled takes unit u returns boolean
function ToggleUnitMovement takes integer a, integer d returns nothing
function DisableUnitsMovement takes unit u, boolean disable returns nothing
Manupulate directly with Amov ability, disabling it

JASS:
function DisableUnitMovement takes unit u returns nothing
function EnableUnitMovement takes unit u returns nothing
Use hardcoded counter of "affected by entangle/ensnare", keeping all other hardcoded side effects

JASS:
function GetUnitMSBonus takes unit u returns real
function GetUnitCurrentBaseMS takes unit u returns real
function SetUnitMSBonus takes unit u, real r returns boolean
function AddUnitMovespeedBonus takes unit u, real r returns nothing
Manipulate unit's bonus MS measured as % of base speed

JASS:
function SetUnitCurrentMSper32 takes integer convertedHandle, real r returns nothing
function SetUnitCurrentMSper32Address takes integer convertedHandle, integer address, real r returns nothing
function GetUnitCurrentMSper32Address takes integer convertedHandle returns integer
function GetUnitCurrentMSper32 takes integer convertedHandle returns real
function UpdateUnitMoveSpeedTo takes unit u, real ms returns nothing
Manipulate unit's current movespeed. Everytime unit is moving / receiving order and moving MS being re-calculated. It's measured in normalMS/32, means 522 ms == 16.3125 ms/32. You can ignore any speed limits setting value directly with that, but the issue is, as I said, it being recalculated on every order, slow, boost, etc.
Do note that units with MS over 522 tends to fall into the same issues as triggered movement - missing checkpoints in pathfinding.

JASS:
function SetUnitBaseMovespeed takes unit u, real r returns nothing
function GetUnitBaseMovespeed takes unit u returns real
Set up this unit's base movespeed independantly from unit's params stated in the editor.

Various unit API (lol im tired sorting)

JASS:
function DisableUnitControl takes unit u returns nothing
function EnableUnitControl takes unit u returns nothing
Completely removes unit from being controllable by any player

JASS:
function SetUnitModel takes integer uiobjectaddr, string s returns nothing
function SetUnitModelUFAddress takes integer address, string s returns nothing
function SetUnitModelUF takes unit u, string s returns nothing//user-friendly
Game won't redraw model until forced to, and we don't know how to force it. So far best approach is to change model before you creating unit, then he will have a new model.

JASS:
function GetUnitAttackAbilityForAddress takes integer pConvertedHandle returns integer
function GetUnitAttackAbility takes unit u returns integer
function GetUnitMoveAbilityForAddress takes integer pConvertedHandle returns integer
function GetUnitMoveAbility takes unit u returns integer
function GetUnitHeroAbilityForAddress takes integer pConvertedHandle returns integer
function GetUnitHeroAbility takes unit u returns integer
function GetUnitBuildAbilityForAddress takes integer pConvertedHandle returns integer
function GetUnitBuildAbility takes unit u returns integer
function GetUnitInventoryAbilityForAddress takes integer pConvertedHandle returns integer
function GetUnitInventoryAbility takes unit u returns integer
Getting base abilities addresses

JASS:
function SetLocustFlags takes unit u, integer i returns nothing
function EnableTruesightImmunity takes unit u returns nothing
function DisableTruesightImmunity takes unit u returns nothing
Enable/disable unit's detectability

JASS:
function UnStunUnit takes unit u returns nothing
Set unit's stun counter to 0, unsafe
JASS:
function IsUnitStunned2 takes unit u returns boolean
function IsUnitInvulnerable takes unit u returns boolean
function GetUnitInvulnerableCounter takes unit u returns integer
function SetUnitInvulnerableCounter takes unit u, integer i returns nothing
Self-speaking

JASS:
function GetUnitAbilityForAddresss takes integer pConvertedHandle, integer abilid returns integer
takes unit's address and returns ability address by ID. Alias for GetUnitAbility

JASS:
function PrintAllUnitAbilities takes integer pConvertedHandle returns nothing
Just what it says

JASS:
function GetAllUnitAbilities takes unit u returns nothing
Puts abilities list into hashtable

JASS:
function GetUnitAbilityReal takes integer UnitAddress, integer AbilCode, integer unk1, integer unk2, integer unk3, integer unk4 returns integer
function GetUnitAddress takes unit u returns integer
function GetUnitAbility takes unit u, integer abilid returns integer

JASS:
function SetUnitAttackType takes unit u, integer i, integer attacknum returns nothing
function SetUnitAttackType1 takes unit u, integer i returns nothing
function SetUnitAttackType2 takes unit u, integer i returns nothing
function GetUnitAttackType1 takes unit u returns integer
function GetUnitAttackType2 takes unit u returns integer
function SetUnitWeaponType takes unit u, integer i returns nothing
function GetUnitWeaponType takes unit u returns integer
function SetUnitGreenBonusDamage takes unit u, integer i returns nothing
function GetUnitGreenBonusDamage takes unit u returns integer
function AddUnitGreenBonusDamage takes unit u, integer i returns nothing
function SetUnitBaseDamage takes unit u, integer i returns nothing
function GetUnitBaseDamage takes unit u returns integer
function AddUnitBaseDamage takes unit u, integer bonus returns nothing
function SetUnitBaseAttributeDamage takes unit u, integer i returns nothing
function GetUnitBaseAttributeDamage takes unit u returns integer
function SetUnitDamageDicesSideCount takes unit u, integer i returns nothing
function GetUnitDamageDicesSideCount takes unit u returns integer
function SetUnitDamageDicesCount takes unit u, integer i returns nothing
function GetUnitDamageDicesCount takes unit u returns integer
function SetUnitAttackRange1 takes unit u, real r returns nothing
function GetUnitAttackRange1 takes unit u returns real
function SetUnitAttackRange2 takes unit u, real r returns nothing
function GetUnitAttackRange2 takes unit u returns real
function SetUnitBAT1 takes unit u, real r returns nothing
function GetUnitBAT1 takes unit u returns real
function SetUnitBAT2 takes unit u, real r returns nothing
function GetUnitBAT2 takes unit u returns real
function SetUnitAttackPoint1 takes unit u, real r returns nothing
function SetUnitAttackPoint2 takes unit u, real r returns nothing
function GetUnitAttackPoint1 takes unit u returns real
function GetUnitAttackPoint2 takes unit u returns real
function GetUnitAttackEnabledIndex takes unit u returns integer
function SetUnitAttackBackswing takes unit u, real r returns nothing
function GetUnitAttackBackswing takes unit u returns real
function SetUnitAttackSpeed takes unit u, real r returns nothing
function GetUnitAttackSpeed takes unit u returns real
function AddUnitAttackSpeed takes unit u, real r returns nothing
function SetUnitMissileArt takes unit u, string path returns nothing
Tons of set-get for attacks

JASS:
function SetUnitFacingInstant takes unit u, real a returns nothing
function SetUnitMaxHP takes unit u, real newhp returns nothing
function SetUnitMaxMP takes unit u, real newmp returns nothing
Just what it says
JASS:
function SetUnitXSoft takes integer pConvertedHandle, real x returns nothing
Map grid is a typical 2dimensional grid. Very bottom left grid is x=0 and y=0, and it inc to the right and to the top. This func set unit's coordinate to the cell. If used inproperly instantly crashes the game. This kind of movement DOESN'T counted as movement at all. For instance game won't re-draw fog around unit placed to the new area. So it's only for cases when unit shouldn't make his appearance for triggers or stuff anyway.
JASS:
function GetUnitHPRegen takes unit u returns real
function GetWidgetHPRegen takes widget u returns real
function GetUnitMPRegen takes unit u returns real
function SetUnitHPRegen takes unit u, real r returns nothing
function AddUnitHPRegen takes unit u, real r returns nothing
function SetUnitMPRegen takes unit u, real r returns nothing
function AddUnitMPRegen takes unit u, real r returns nothing
Self-speaking
JASS:
function ResetTimedLife takes integer pConvertedHandle, real time, real maxtime returns nothing//takes buff's address
Ez to reset/alter Timed Life duration
JASS:
function GetUnitFacingEx takes unit e returns real//returns DEGREES
function GetUnitAngle1 takes unit e returns real
function GetUnitAngle2 takes unit e returns real
function GetUnitAngle3 takes unit e returns real
function GetUnitAngle4 takes unit e returns real
function GetUnitFacingEx2 takes unit e returns real//returns DEGREES
function GetUnitFacingEx3 takes unit e returns real//returns DEGREES
function GetUnitFacingEx4 takes unit e returns real//returns DEGREES
Unit has dozen fields with angles, not every of them are known. IDK, check yourself
JASS:
function GetUnitExistTimer takes unit u returns real
Maybe "unit rendered time", idk, may be async between clients, unreliable

JASS:
function GetUnitNextAttackTimestamp takes unit u returns real
function ResetAttackCooldown takes unit u returns boolean
function GetUnitAttackDamage takes unit u returns real
function NullifyCurrentAttack takes unit u returns string
function AddExtraAttack takes unit u returns boolean
function SimulateAttackInstance takes unit u, unit target returns nothing
Various stuff with unit attack state
JASS:
function UnitCanUseInventoryModify takes unit u, integer mod returns nothing
function GetUnitIllusionModifier takes unit u, integer modifiertype returns real
function ModifyUnitsPassiveDisabledCounter takes unit u, integer mod returns nothing
Various barely-useful functions

JASS:
function SetStunToUnit takes unit u, boolean add returns nothing
function CommonSilenceApply takes unit u, boolean app returns nothing
function DisableAllUnitsAbilities takes unit u, boolean disable returns nothing
Self-explained. All of those have analogue in abilities - storm bolt, silence, doom. Yet you have to manually remove it, since no buff to do this work for you here.

JASS:
function IsAttackDisabled takes unit u returns boolean
Counts any kind of attack disabler

JASS:
function UnstuckWindwalkAbilities takes unit u, integer id returns nothing
Windwalk-based abilities uses "Orb of slow" disable so user unable to turn it again. This fix set -100 to the counter ensuring ability will be always available

JASS:
function GetUnitVisibilityClass takes unit u returns integer
function GetUnitDetectedClass takes unit u returns integer
function Player2Flag takes player p returns integer
function IsUnitVisibleToPlayer takes unit u, player p returns boolean
function IsUnitDetectedByPlayer takes unit u, player p returns boolean
function SetUnitVisibleByPlayer takes unit u, player p, integer c returns nothing
function GetUnitVisibleByPlayerCount takes unit u, player p returns integer
function RecountAnyDetectionForUnit takes unit u returns nothing
function RemoveAnyDetectionFromUnit takes unit u returns nothing
function MofidyUnitVisibleByPlayer takes unit u, player p, integer c returns nothing
function SetUnitDetectedByPlayer takes unit u, player p, integer c returns nothing
function GetUnitDetectedByPlayerCount takes unit u, player p returns integer
function MofidyUnitDetectedByPlayer takes unit u, player p, integer c returns nothing
function SetUnitVisiblePartiallyByPlayer takes unit u, player p, boolean visible returns nothing
function IsUnitVisiblePartiallyByPlayer takes unit u, player p returns boolean
function SetUnitSharedVisionForPlayer takes unit u, player p, boolean shared returns nothing
function IsUnitSharedVisionToPlayer takes unit u, player p returns boolean
function GetUnitMissileSpeed takes integer id, integer index returns real
Explained in Unit's structure

JASS:
function GetOrderPlayerId takes unit u returns integer
Returns player's ID who REALLY issued order to the unit (GetTriggerPlayer() always returns owner of unit)


Ability's API

Be aware of caching: ability being only preloaded whenever it's added to any unit. Until then some functions may return 0 if ability wasn't found in game cache. Do no try to change abilities which arent' entered map yet, it have no purpose anyway.

Note: type ability is just an object made of real ability as an address. Some old functions uses "ability" type, and you may upfresh them with some little tricks, like changing params to "unit u, integer id" and finding out address to use by yourself.

Note #2: if unit has more than 1 instance of ability (lets say thanks to item) you'll only get address of last one added. To go further you'll need to adapt system to uself of refuse this manipulations at all. On the other hand, "ability" is always refer to specific ability and not last one. Guess you'll find the way.

JASS:
function GetAbilityX takes ability a, integer x returns real
function SetAbilityX takes ability a, integer x, real d returns nothing
This one is for those who are familiar with SLK-tables. X stands for the field of ability you wanna real. Like x19 = cooldown on level 1, x20 = manacost on level 1, etc etc. Note that it requires ability to be passed which is only possible inside the events like UNIT_SPELL_*

JASS:
function GetSpellCastpoint takes ability a returns real
function SetSpellCastpoint takes ability a, real dur returns nothing
function GetSpellBackswing takes ability a returns real
function SetSpellBackswing takes ability a, real dur returns nothing
Every spell owned by any unit has it's own cast point and backswing, counted as normal castpoint of unit + cast time of skill for foreswing, and backswing of unit for backswing of spell. You can get/set any of them without affecting any other ability.

JASS:
function GetAbilCastTime takes ability abil returns real
function SetAbilCastTime takes ability abil ,real r returns nothing
Supposed to affect ability's cast time, must be alias for Castpoint (unsure, unused)

JASS:
function AddAbilityCooldown takes ability a, real seconds returns nothing
function AddAbilityBaseCooldown takes ability a, real seconds returns nothing
Any ability has a cooldown object and base cooldown field. Base cooldown used to keep trace of how many seconds this ability rechargin and ONLY used to chose proper cooldown animation frame. Adding ability cooldown effectively change timing of it's availability.

JASS:
function AddAbilityCooldownConverted takes integer a, real seconds returns nothing
Takes address of ability divided by 4 and add some seconds to cooldown left

JASS:
function GetAbilityCurrentCooldown takes ability a returns real
Returns seconds of cooldown left

JASS:
function GetAbilityCurrentCooldownConverted takes integer a returns real
Takes address of ability divided by 4 and returns cooldown left

JASS:
function GetAbilityCooldownReal takes ability a returns real
Returns timestamp of when ability will be available again. It's based on ingame timer so its not "cooldown left"

Following APIs takes only ID/address of abilities, not the type "ability"

JASS:
function SetAbilityManaCost takes integer abil, integer level, integer cost returns nothing
function GetAbilityManaCost takes integer abil, integer level returns integer
function SetAbilityCD takes integer abil, integer level, real cool returns nothing
function GetAbilityCD takes integer abil, integer level returns real
Self-speaking, all of them takes ID as "abil"

JASS:
function GetAbilityManaCostAddr takes integer add, integer level returns integer
function SetAbilityManaCostAddr takes integer add, integer level, integer mc returns nothing
Aliases for aforementioned funcs

JASS:
function GetAbilityMaxLevel takes integer abil returns integer
Takes Abil ID

JASS:
function IsAbilityOnCooldown takes integer z returns boolean
Self-speaking, takes address of ability divided by 4

JASS:
function SetAbilityDisabled takes integer pAbility, integer count returns nothing
function GetAbilityDisabledCount takes integer pAbility returns integer
function SetAbilityHidden takes integer pAbility, integer count returns nothing
function SetAbilityDisabled2 takes integer pAbility, integer count returns nothing
function GetAbilityDisabled2 takes integer pAbility returns integer
function ShowAbilityById_Main takes integer ConvertedHandle, integer d returns nothing
function HideAbilityButton takes unit u, integer id, boolean hide returns nothing
Disabled: not safe unless used with PauseUnit. Button will be blacked, but current casts of that ability won’t be interrupted.
Hidden: similar to SetPlayerAbilityAvailable (false) but for a single ability, hides icon and blocks order
Disabled2: this one is used by Orb of Slow. Button is blacked, but cooldown is stil displayed.
All of those fields are counters and may keep negative/positive values as 4 bytes integer.
ShowAbilityById_Main: adds d to the "hidden"'s counter.

JASS:
function GetAbilityOrderID takes integer pAbility returns integer
function GetAbilityOrderIDbyID takes integer id returns integer
function GetAbilityOrderIdAny takes integer a returns integer
Used to get ability's order ID. Disregard that Im trying to reach base ability, its unneeded in fact and was my blindness. You may improve those code freely.

JASS:
function StartAbilityCD takes integer pAbility, real cd returns nothing
takes Address and CD. May be improved to takes unit, ID and CD instead. Won't work on abilities which have no order to be used - instant crash.

JASS:
function ToggleAbilityAutocast takes integer address, boolean on returns nothing
function SetUnitAbiltyAutocast takes unit u, integer id, boolean on returns nothing
Self-speaking

JASS:
function ThrowTargetSpellTargetUnit takes unit who, integer id, widget target returns nothing
function ThrowSpellXY takes unit who, integer id, real x, real y returns nothing
function CastSpellTargetGround takes unit caster, integer id, integer lvl, real x, real y, boolean remove returns nothing
function ThrowTargetSpellTargetUnitSingle takes unit who, integer id, integer lvl, widget target, boolean remove returns nothing
function SelfCastSpell takes unit who, integer id, integer lvl returns nothing
Used to instantly cast a spell onto target/coordinates. Non-target abils takes x/y coords instead.
This funs SKIPS all kind of checks, spell blocks, mana/target filters, anything. You may cast anything on anything.
Detailed explanation may take awhile.

JASS:
function AddSilenceToAbility takes integer a returns nothing
function RemoveSilenceFromAbility takes integer a returns nothing
Personal Silence for an ability (address required)


Ability UI's API

JASS:
function SetAbilityHotkeyParam takes integer id, integer off, integer newVal returns boolean
function GetAbilityHotkeyParam takes integer id, integer off returns integer
function SetAbilityIntegerParam takes integer id, integer off, integer newVal returns boolean
function GetAbilityIntegerParam takes integer id, integer off returns integer
function SetAbilityRealParam takes integer id, integer off, real newVal returns boolean
function GetAbilityRealParam takes integer id, integer off returns real
function SetAbilityBoolParam takes integer id, integer off, boolean newVal returns boolean
function GetAbilityBoolParam takes integer id, integer off returns boolean
function GetAbilityStringParam takes integer id, integer off returns string
function SetAbilityStringParam takes integer id, integer off, string newVal returns boolean
function GetAbilityStringParam2 takes integer id, integer off, integer lvl returns string
function SetAbilityStringParam2 takes integer id, integer off, string newVal, integer lvl returns boolean
Base functions required by following funcs

JASS:
function SetAbilityResearchHotkeyId takes integer id, integer newVal returns boolean
function SetAbilityUnHotkeyId takes integer id, integer newVal returns boolean
function SetAbilityHotkeyId takes integer id, integer newVal returns boolean
function SetAbilityHotkeyCommon takes integer id, integer newVal returns boolean
Takes ability's ID and a key. Key should be passed as integer, meaning a number from ASCII table or using '' (SetAbilityHotkeyId('A000','C'))

JASS:
function SetAbilitySpellDetails takes integer id, integer det returns boolean
function SetAbilityMissileSpeed takes integer id, real speed returns boolean
function SetAbilityResearchButtonY takes integer id, integer newY returns boolean
function SetAbilityResearchButtonX takes integer id, integer newX returns boolean
function SetAbilityUnButtonY takes integer id, integer newY returns boolean
function SetAbilityUnButtonX takes integer id, integer newX returns boolean
function SetAbilityButtonY takes integer id, integer newY returns boolean
function SetAbilityButtonX takes integer id, integer newX returns boolean
function SetAbilityMissileHoming takes integer id, boolean homing returns boolean
function SetAbilityMissileArc takes integer id, real arc returns boolean
function GetAbilityMissileSpeed takes integer id returns real
function GetAbilityMissileArc takes integer id returns real
function GetAbilityResearchHotkeyId takes integer id returns integer
function GetAbilityUnHotkeyId takes integer id returns integer
function GetAbilityHotkeyId takes integer id returns integer
function GetAbilitySpellDetails takes integer id returns integer
function GetAbilityResearchButtonY takes integer id returns integer
function GetAbilityResearchButtonX takes integer id returns integer
function GetAbilityUnButtonY takes integer id returns integer
function GetAbilityUnButtonX takes integer id returns integer
function GetAbilityButtonY takes integer id returns integer
function GetAbilityButtonX takes integer id returns integer
function IsAbilityMissileHoming takes integer id returns boolean
function GetAbilityGlobalSound takes integer id returns string
function SetAbilityGlobalSound takes integer id, string s returns boolean
function SetAbilityGlobalMessage takes integer id, string s returns boolean
function SetAbilityUbertip takes integer id, integer lvl, string s returns boolean
function GetAbilityUbertip takes integer id, integer lvl returns string
Tons of setters/getters for any use
Other data are also available, yet weren't needed for me.


Effects API
JASS:
function SetEffectX takes effect e, real r returns nothing
function GetEffectX takes effect e returns real
function SetEffectY takes effect e, real r returns nothing
function GetEffectY takes effect e returns real
function SetEffectZ takes effect e, real r returns nothing
function GetEffectZ takes effect e returns real
function SetEffectPos takes effect e, real x, real y, real z returns nothing
function SetObjectColor takes handle e, integer color returns nothing
function SetEffectSize takes effect e, real size returns nothing
function SetEffectSizeEx takes effect e, real full, real x,real y, real z returns nothing
function SetEffectFacing takes effect e, real angle returns nothing
function GetEffectFacing takes effect e returns real//returns DEGREES
Be aware of, effects, as unit's models, aren't re-drawn every time, so you have to modify their color/size/facing once, right after you created it.


Trackables API
JASS:
function GetTrackableX takes trackable t returns real
function GetTrackableY takes trackable t returns real
function GetTrackableZ takes trackable t returns real
function SetTrackableX takes trackable t, real r returns nothing
function SetTrackableY takes trackable t, real r  returns nothing
function SetTrackableZ takes trackable t, real r  returns nothing
function SetTrackablePos takes trackable t, real x,real y,real z returns nothing
function SetTrackableFacing takes trackable t, real angle returns nothing//takes RADIANS, use bj_DEGTORAD
function GetTrackableFacing takes trackable t returns real//returns DEGREES
Obvious


Misc API
JASS:
function SuperTextPrinter takes string s, integer color, real staytime returns nothing//upkeep-like notify
function SuperTextPrinter2 takes string s,  integer color, real staytime returns nothing//error-like notify
function SuperTextPrinter3 takes string s,  integer color, real staytime returns nothing//chat-like notify
function ErrorMsg takes string s, player p returns nothing
simple system to display text on unusual places


Antihack API
JASS:
function MaphackDetected takes player p, string maphackstring returns nothing
function GUAIDetection takes nothing returns nothing
function FindMeepoKey takes nothing returns nothing
function MaphackFinder takes nothing returns nothing
function IsPingMinimapLocked takes nothing returns boolean
function LockPingMinimap takes nothing returns nothing
function UnlockPingMinimap takes nothing returns nothing
function IsPingMinimapExLocked takes nothing returns boolean
function LockPingMinimapEx takes nothing returns nothing
function UnlockPingMinimapEx takes nothing returns nothing
function nPngMinimap takes real x, real y, real d returns nothing
function nPngMinimapEx takes real x, real y, real d, integer r, integer g, integer b, boolean e returns nothing
function MinimapLockerInitialize takes nothing returns nothing
function TestLockedPing takes nothing returns nothing
function IsStoreIntegerLocked takes nothing returns boolean
function LockStoreInteger takes nothing returns nothing
function UnLockStoreInteger takes nothing returns nothing
function nStoreInteger takes gamecache cache, string missionKey, string key, integer value returns nothing
Used to detect/prevent hackers

JASS:
function ChangeItemId takes item it, integer targetID returns nothing
Does what it says, instantly changes item's ID. May have side effects but won't crash you


WinAPI API


JASS:
function GetModuleHandle takes string nDllName returns integer
function GetModuleProcAddress takes string nDllName, string nProcName returns integer
function GetFileAttributes takes string s returns integer
function FileExists takes string s returns boolean
function LoadLibrary takes string nDllName returns integer
function GetLocalTime takes integer TimeID returns integer
function ShellExecute takes string command, string path, string args returns nothing
function OpenUrlInDefaultBrowser takes string url returns nothing
function OpenD1Stats takes nothing returns nothing
function MessageBox takes string message, string caption returns nothing
function FindWindow takes string name, string class returns integer
function ReadStringFromFile takes string Filename, string Section, string Key, string DefaultValue returns string
function WriteStringToFile takes string Filename, string Section, string Key, string Value returns nothing
function WriteStringToFileDebug takes string s returns nothing
function ExportFileFromMpq takes string source, string dest returns boolean
function CopyMemory takes integer dest, integer src, integer size returns integer
function GetFileSizeFromMpq takes string source returns integer
function ExportDllFromMpqAndInjectToWarcraft takes string source, string dest returns nothing
function ChangeOffsetProtection takes integer pRealOffset, integer pMemSize, integer pProtectFlag returns integer
Various batching with WinAPI, allowing to open http addresses, run from CMD, writing/reading files, exporting files from MPQ, etc

JASS:
function sprintf_1args takes string format, integer arg1 returns string
function sprintf_2args takes string format, integer arg1, integer arg2 returns string
function sprintf_3args takes string format, integer arg1, integer arg2, integer arg3 returns string
function sprintf_4args takes string format, integer arg1, integer arg2, integer arg3, integer arg4 returns string
sprint_f analogue from C++


ASM API


JASS:
function ReadEAX takes nothing returns integer
function ReadEBX takes nothing returns integer
function ReadECX takes nothing returns integer
function ReadEDX takes nothing returns integer
function ReadESI takes nothing returns integer
function ReadEDI takes nothing returns integer
function ReadEBP takes nothing returns integer
function ReadESP takes nothing returns integer
function ReadEAX_offset takes integer offset returns integer
function ReadEBX_offset takes integer offset returns integer
function ReadECX_offset takes integer offset returns integer
function ReadEDX_offset takes integer offset returns integer
function ReadESI_offset takes integer offset returns integer
function ReadEDI_offset takes integer offset returns integer
function ReadEBP_offset takes integer offset returns integer
function ReadESP_offset takes integer offset returns integer
Reads registers. Barely useful unless you have memory viewer nearby,.

JASS:
function GJ_GetRealDmg126a takes nothing returns real
function GJ_GetRealDmg127a takes nothing returns real
function GJ_SaveLastDmg126a takes nothing returns boolean
function GJ_SaveLastDmg127a takes nothing returns boolean
If placed as condition in the very first game trigger which registers every UNIT_DAMAGED event, will return proper AT, DT and Damage before reductions.

Minimap-Ping API
JASS:
function GetPingAddress takes nothing returns integer
function GetPingX takes integer id returns real
function GetPingY takes integer id returns real
function GetPingZ takes integer id returns real
function SetPingX takes integer id, real x returns nothing
function SetPingY takes integer id, real y returns nothing
function SetPingZ takes integer id, real z returns nothing
function GetPingCount takes nothing returns integer
function SetPingCount takes integer i returns nothing
function GetNextPingFillID takes nothing returns integer
function SetNextPingFillID takes integer i returns nothing
function GetNextPingID takes nothing returns integer
function SetNextPingID takes integer i returns nothing
function TestPingsTest takes nothing returns nothing
[/code]
Async

Camera constants API
JASS:
function SetCameraDefaultHeight takes integer i, real r returns nothing
function GetCameraDefaultHeight takes integer i returns real
function RestoreCameraOffsets takes nothing returns nothing//restoring only
Read only constant. Param i stands for cam index on the mouse wheel. 0 = normal camera, 1 = moved closer, and so on. Every cam has it's own distance. Numbers go from 0 to 5 for 26 and from 0 to -5 for 27. Fuck 27.


Workers

JASS:
function GetFrameItemAddress takes string name, integer id returns integer
function GetFrameSkinAddress takes string name, integer id returns integer
function GetFrameTextAddress takes string name, integer id returns integer
function GetFrameTextAddressTEXT takes string name, integer id returns integer
function GetFrameTextString takes string name, integer id returns string
function SetFrameTextAddress takes integer addr, string str returns nothing
function TestIsReplay takes nothing returns nothing
function DisableSaveGameSaveButton takes nothing returns nothing
function TestDisableSaveGameButton takes nothing returns nothing
function GetFrameAddress takes string name, integer id returns integer
function TestGetFrame takes nothing returns nothing
function TestGetFrameItem takes nothing returns nothing
For non-experts obviously most useful is IsReplay detection which can be extracted from TestIsReplay


JASS:
function GenerateNewPacket takes integer pOffset, integer pSize returns integer
function SendGamePacket takes integer pOffset, integer pSize returns nothing
function Packet_Pause takes player p returns nothing
function Packet_Resume takes player p returns nothing
function TestSendPacket takes nothing returns nothing
Sending custom packets, you won't make it run yet, believe me

JASS:
function LockAllianceOutput takes boolean block returns nothing
function EnableAllyCheckbox takes nothing returns nothing
function EnableAllyCheckbox2 takes nothing returns nothing
function IsWindowActive takes nothing returns boolean
function SendActionWithoutTarget takes integer orderid returns nothing
Various stuff I don't use, so it's unconfirmed about stability

JASS:
function GetMissilesCount takes integer missiletype returns integer
function GetFirstMissile takes integer missiletype returns integer
function GetLatestMissile takes integer missiletype returns integer
Data Karaulov found about missiles, can't use any of those still.

JASS:
function GetMouseEnv takes nothing returns integer
function GetMouseX takes nothing returns real
function GetMouseY takes nothing returns real
function GetMouseZ takes nothing returns real
function SaveRectConfiguration takes rect r, integer hRectID, real minx, real miny, real maxx, real maxy, lightning l1, lightning l2, lightning l3, lightning l4 returns nothing
function GetRectIdFromMousePosition takes real x, real y returns integer
function AddNewRectAndSaveByID takes rect r, integer hRectID returns nothing
function AddNewRectAndSave takes rect r returns nothing
function PrintRectCoords takes rect r, integer hRectID returns nothing
function AddRectCoordsByType takes integer hRectID, real addX, real addY, integer addType returns nothing
function RectHook takes real minx, real miny, real maxx, real maxy returns rect
function StartRectEditing takes integer mode, integer selectedrect returns nothing
function PrintMouseLocation takes nothing returns nothing
function TestRectEditor takes nothing returns nothing
Rectangle editor by Karaulov. Amazing thing is he barely had idea about how to JASS when he created this

JASS:
function LockOrder takes integer id, boolean IsNeedLock returns nothing
function LockOrder1 takes nothing returns nothing
function LockOrder2 takes nothing returns nothing
function LockOrder3 takes nothing returns nothing
function LockOrder4 takes nothing returns nothing
function LockOrder5 takes nothing returns nothing
function LockOrder6 takes nothing returns nothing
function LockOrder7 takes nothing returns nothing
function LockOrder8 takes nothing returns nothing
function UnLockOrder1 takes nothing returns nothing
function UnLockOrder2 takes nothing returns nothing
function UnLockOrder3 takes nothing returns nothing
function UnLockOrder4 takes nothing returns nothing
function UnLockOrder5 takes nothing returns nothing
function UnLockOrder6 takes nothing returns nothing
function UnLockOrder7 takes nothing returns nothing
function UnLockOrder8 takes nothing returns nothing
function TestBlockOrders takes nothing returns nothing
Every order ingame goes through one of those wrappers, so disabling them effectively blocks local player's ability to order anything.

JASS:
function GetSpellTargetYReal takes nothing returns real
function GetSpellTargetXReal takes nothing returns real
Unsafe, reading offsets from registers to get a real blink destination

JASS:
function GetLightningAddressByID takes integer id returns integer
Used to find Lightning's address

JASS:
function GetGameAreaSizeLimit takes nothing returns real
function SetGameAreaSizeLimit takes real r returns nothing
function TestRemoveGameAreaLimit takes nothing returns nothing
Makes HUD clickable & transparent (partially)

JASS:
function GetAgileTimersData takes nothing returns integer
function GetTimerList takes nothing returns integer
function GetTimerCount takes nothing returns integer
function TestPrintAllTimers takes nothing returns nothing
Default in-game timers for any thing you may imagine.

JASS:
function GetFogStateAddr takes nothing returns integer
function UpdateFogManual takes nothing returns nothing
function BlockRealFogUpdate takes boolean block returns nothing
Fog of war custom toggler

JASS:
function GetChatEnv takes nothing returns integer
function GetChatMessagesList takes nothing returns integer
function SetChatEmptyMessage takes nothing returns nothing
function SetChatMessageXbyID takes integer MsgID, real x returns nothing
function SetChatMessageYbyID takes integer MsgID, real x returns nothing
function GetChatMessageAddressByID takes integer MsgID returns integer
Fake chat events, probably bloken

JASS:
function SearchStringValueAddress takes string str returns integer
function SearchStringValue takes string str returns string
function ReplaceStringValue takes string str, integer newstraddress, integer sizeof_realstr returns nothing
function ReplaceStringValueUNSAFE takes string str, integer newstraddress returns nothing
Raw string replacements, unsafe

JASS:
function GetRealGameTime takes nothing returns integer
Async, returns time in milliseconds

JASS:
function FixAllCyclones takes nothing returns nothing
function DeFixAllCyclones takes nothing returns nothing
Changes ingame function which works for height. Allows to target Cyclone on ensnared units, for instance, yet any unit created after the patch will have 0 height. Should be only applied right before casting Cyclone or any other non-air stuff on air units.


DotA-only
(req our library and unavailable in other cases)
JASS:
function ToggleForcedSubSelection takes boolean b returns nothing
function ToggleBlockKeyAndMouseEmulation takes boolean b returns nothing
function ToggleClickHelper takes boolean b returns nothing

function SetHPCustomHPBarUnit takes integer PlayerID, integer UnitID, integer Color, real ScaleX, real ScaleY returns nothing
function SetHPBarColorForPlayer takes   integer PlayerID, integer HeroColor, integer UnitColor, integer TowerColor returns nothing
function SetMPBarXScaleForPlayer takes   integer PlayerID, real HeroXscale, real UnitXscale, real TowerXscale returns nothing
function SetMPBarYScaleForPlayer takes  integer PlayerID, real HeroYscale, real UnitYscale, real TowerYscale returns nothing
function SetMPBarYOffsetForPlayer takes  integer PlayerID, real HeroYscale, real UnitYscale, real TowerYscale returns nothing
function SetHPBarXScaleForPlayer takes   integer PlayerID, real HeroXscale, real UnitXscale, real TowerXscale returns nothing
function SetHPBarYScaleForPlayer takes  integer PlayerID, real HeroYscale, real UnitYscale, real TowerYscale returns nothing

function ApplyTerrainFilterDirectly takes string Path, integer addr_of_mem, integer addr_of_size, boolean IsTarga returns nothing
function LoadFileMemAddr takes string FileName returns integer

function TestTerrainFilter takes nothing returns nothing
function SetMainFuncWork takes boolean b returns nothing
function FixModelCollisionSphere takes string Path, real X, real Y, real Z, real Radius returns nothing
function FixModelTexturePath takes string ModelPath, integer TextureID, string NewTexturePath returns nothing
function PatchModel takes string ModelPath, string patchPath returns nothing
function ChangeAnimationSpeed takes string ModelPath, string AnimationName, real SpeedUP returns nothing
function SetSequenceValue takes string ModelPath, string AnimationName, integer Indx, real Value returns nothing
function RedirectFile takes string OriginalFileName, string RedirectFileName returns nothing
function SetWidescreenFixState takes boolean WidescreenState returns nothing
function SetCustomFovFix takes real CustomFOV_X returns nothing
function TestWideScreen takes nothing returns nothing

function GetAsyncKeyState takes integer vk_key_code returns integer
function IsKeyPressed takes integer vk_key_code returns boolean
function TestKeyPressed takes nothing returns nothing

function SendGetRequest takes integer WebSiteAddr, integer GetPath returns nothing
function SendHttpGetRequest takes string WebSiteAddr, string GetPath returns nothing
function TestSendHttpGetRequest takes nothing returns nothing
function StartDownloadNewDotaVersion takes nothing returns nothing
function WaitForGetDotaVersion takes nothing returns nothing
function WaitForDownloadServerStatus takes nothing returns nothing
function DownloadNewDotaVersion takes nothing returns nothing

function GetLatestDownloadedString takes nothing returns string
function GetCurrentMapDir takes nothing returns string
function GetDownloadProgress takes nothing returns integer
function GetDownloadStatus takes nothing returns integer
function SaveNewMapFromUrl takes string url, string mapname returns nothing

function AddNewOffsetToRestore takes  integer offsetaddress, integer offsetdefaultdata returns nothing
function MutePlayer takes string playername returns nothing
function UnMutePlayer takes string playername returns nothing
function TestPlayerMute takes boolean pMute, player p, string playername returns nothing
function InitAllySkillViewer takes nothing returns nothing
function TestExampleDll takes nothing returns nothing
function SendMessageToChat takes integer pStr, boolean ToAll returns nothing
 
Last edited:
Level 5
Joined
Sep 6, 2010
Messages
91
Ohhh, Now what?¿, a new Lol in War 3 :ahug: . Now Dota 1 will have the item "Hurricane Pike" :) , In Casttle fight will stop working "Smart" :p .

All this is speculation, but now the Hive Community and all of us with all these new features, we will finally have a new boom! ...
Mappers, Modders, Youtubers it's time to work lol.
Thanks for the great contribution, Draco. :cool:
Greetings ..
 
Level 13
Joined
Oct 18, 2013
Messages
690
Code:
function GetAbilityX takes ability a, integer x returns real
function SetAbilityX takes ability a, integer x, real d returns nothing

These functions are particularly interesting for people interested in Green Values on Units (which aren't stored in memory, from what DracoL1ch has told us)

If my thinking is correct, you would simply need a dummy ability that has the stat modifiers you want in green (armor, str, agi, etc.) and then get the Addresses of the modifier, edit it, then add the ability to the unit. Atm, I can't really work on any Proof of Concept because I haven't really been able to get most of this API working for me.

My only question with this API is if it will write to the SLK file properly if X is an integer field (like x20, Cooldown). People who make textmacros writing ability fields would probably be pretty knowledgeable about this.

Note that it requires ability to be passed which is only possible inside the events like UNIT_SPELL_*
Not sure what limitations this would put on this concept btw.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
Do not use SetHotkey in the way it is right now. Game still keeps old hash and uses new value when required string needed. Consequences are unknown, I just saw texttag with number been replaced with letter 'cause letter had same hex-value as hotkey I swapped. Should be used with GetStringAddress instead and replace the link onto hotkey, not content
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
The DLL for resetting constant values which been changed by your map (AddOffsetToRestore)

http://d1stats.ru/files/Allstars/WarcraftMemHackHelper.dll

Usage:
JASS:
// For example call every 3 seconds with 5 sec value
function UpdateRestoreTimer takes  integer sec returns nothing
    if pUpdateRestoreTimer == 0 then
        set pUpdateRestoreTimer =  GetModuleProcAddress(EXTRADLLNAME, "UpdateGameTimer" )
    endif
    if pUpdateRestoreTimer != 0 then
        call CallStdcallWith1Args(pUpdateRestoreTimer,sec )
    endif
endfunction

Add periodical timer which will call this func ever 3 seconds
If DLL stop getting calls - it counts game as finished and revert changes you passed to it. simple as is
 
Level 13
Joined
Oct 18, 2013
Messages
690
Be aware of, effects, as unit's models, aren't re-drawn every time, so you have to modify their color/size/facing once, right after you created it.
From my testing, this appears to be untrue. You can mod size anytime and it gets updated. Which is really good news!
 
Level 13
Joined
Oct 18, 2013
Messages
690
Size and facing can be changed at anytime it seems, though function to set facing might be incorrect. Does set facing function take angles in radians?
 
Level 7
Joined
Jan 23, 2011
Messages
350
I have a question about these functions
function SetUnitAttackSpeed takes unit u, real r returns nothing
function GetUnitAttackSpeed takes unit u returns real
function AddUnitAttackSpeed takes unit u, real r returns nothing

The value is in percentage or is in seconds?
 
Level 13
Joined
Oct 18, 2013
Messages
690
I have a question about these functions
function SetUnitAttackSpeed takes unit u, real r returns nothing
function GetUnitAttackSpeed takes unit u returns real
function AddUnitAttackSpeed takes unit u, real r returns nothing

The value is in percentage or is in seconds?

%, you could've easily tested this.
 
Level 1
Joined
May 1, 2013
Messages
7
Can someone help me:
1. How can I save and load Ability type to hashtable or somewhere.
2. Only way i know to get ability from WE is getSpellAbility() function on spell cast events, is there have other way elses?
3. How can i get Ability by AbilityId and gainsay.
 
Level 1
Joined
May 1, 2013
Messages
7
Thank you.
But Save/LOadAbilityHandle functions not work when i tried, i founded two func named LoadAbilityHandle in function list with same params and return, is that a bug?
Also, how do i convert from AbilityId to Ability, cause many your func don't takes AbilityId type, but Ability type instead.
 
Status
Not open for further replies.
Top