Client Data Callback Functions

From Age of Dungeons Wiki

Age of Dungeons provides some official client mod support by sending a selection of callback functions that can help inform your client scripts about certain game state changes. These include your current stats, immediate changes to your health or mana, how much damage you deal and where, and some boss status information.

Callback functions are opt-in, to enable them one of your client scripts must define or package clientCmdAoD_HandshakeReceive(%code) function, and then send the AoD_HandshakeVerify server command in response with the given code. Doing this will enable you to start getting callbacks.

Example implementation of the handshake:

package myAoDClient
{
	function clientCmdAoD_HandshakeReceive(%code)
	{
		commandToServer('AoD_HandshakeVerify', %code, true);
		parent::clientCmdAoD_HandshakeReceive(%code);
	}
};
activatePackage(myAoDClient);

clientCmdAoD_HandshakeReceive(%code){}

The second argument in the AoD_HandshakeVerify command signature is a bool that controls whether the server will continue to send you its default bottomPrint HUD. Set it to false to disable the bottomPrint HUD. Packaging client callback functions is suggested for increased interoperability with multiple AoD client mods in the same installation

The following callback functions are then enabled for your use:

clientCmdAoD_ReceiveStats(string %stats) - Sends a space-delimited string with your various current stats.¹
clientCmdAoD_Health(float %amount) - Indicates how much health your player has gained/lost.
clientCmdAoD_Shield(float %amount) - Indicates that your player currently has blocked the given amount of damage via shields.
clientCmdAoD_Mana(float %mana) - Indicates how much mana your player has gained/lost.
clientCmdAoD_Gold(int %gold) - Indicates how much gold your player has gained/lost.
clientCmdAoD_Damage(float %damage, int %type, Point3f %position) - Indicates that you have dealt damage and where. %type can be 0 for generic damage, 1 for fire damage, and 2 for poison damage.
clientCmdAoD_RangerCooldowns(string %cooldowns) - Sends a tab-delimited string with your arrow mod item cooldowns.
clientCmdAoD_AddBoss(int %bossID, string %bossName, float %health, bool %isChallenged) - Sends information about the boss your player encounters, use this for any custom boss health bars needs. (This only works for main floor bosses, mini-bosses are not included.)
clientCmdAoD_RemoveBoss(int %bossID) - Sends which boss your player have disengaged from, use this to remove any custom boss health bars.
clientCmdAoD_UpdateBoss(int %bossID, float %health) - Sends an updated value of the boss' current health, this will only trigger if the boss is currently engaged.

¹ %stats = %level SPC %xp SPC %expGain SPC %requiredExp SPC %EXPMultiplier SPC %health SPC %extraHP SPC %shieldAmount SPC %maxHealth SPC %isInvincible SPC %mana SPC %extraMana SPC %maxMana SPC %gold SPC %goldGain SPC %goldMultiplier SPC %alignment SPC %alignmentAmt SPC %armor SPC %arrowMod SPC %spellPower SPC %manaRegen SPC %poison SPC %corruption SPC %bloodBuild SPC %bloodCurse SPC %healing