Table of Contents
Extend this Class instead of MelonMod to gain access to dozens of easy to use built-in hooks
public abstract class BloonsTD6Mod : BTD_Mod_Helper.BloonsMod
Inheritance MelonLoader.MelonMod BloonsMod BloonsTD6Mod
Acts on a Network message that's been sent to the client
Use ReadMessage<T>(Message) to read back the message you sent.
If this is one of your messages and you're consuming and acting on it, return true.
Otherwise, return false. Seriously.
Note: Only invoked if CheatMod == true.
public virtual bool ActOnMessage(Message message);
message
Il2CppNinjaKiwi.NKMulti.Message
Called before the game shows a hint for a specific round
Return 'false' to prevent the original method from running
Equivalent to a HarmonyPrefix on InGame.GetRoundHint
public virtual bool GetRoundHint(InGame inGame, int round, ref string text);
inGame
Il2CppAssets.Scripts.Unity.UI_New.InGame.InGame
round
System.Int32
the current round
text
System.String
the text the hint will have, passed as a ref to allow changes
Called when a ability is cast
Equivalent to a HarmonyPostFix on Ability.Activate
public virtual void OnAbilityCast(Ability ability);
ability
Il2CppAssets.Scripts.Simulation.Towers.Behaviors.Abilities.Ability
Called right after an Attack is created
Equivalent to a HarmonyPostFix on Attack.Initialise
public virtual void OnAttackCreated(Attack attack, Entity entity, Model modelToUse);
attack
Il2CppAssets.Scripts.Simulation.Towers.Behaviors.Attack.Attack
entity
Il2CppAssets.Scripts.Simulation.Objects.Entity
modelToUse
Il2CppAssets.Scripts.Models.Model
Called right after a Tower's Attack is changed for any reason (creation, upgrading, etc.)
Equivalent to a HarmonyPostFix on Attack.UpdatedModel
public virtual void OnAttackModelChanged(Attack attack, Model newModel);
attack
Il2CppAssets.Scripts.Simulation.Towers.Behaviors.Attack.Attack
newModel
Il2CppAssets.Scripts.Models.Model
Called when the games audioFactory is loaded
Equivalent to a HarmonyPostFix on AudioFactory.Start
public virtual void OnAudioFactoryStart(AudioFactory audioFactory);
audioFactory
Il2CppAssets.Scripts.Unity.Audio.AudioFactory
Called after a banana is picked up
Equivalent to a HarmonyPostfix on Cash.Pickup
public virtual void OnBananaPickup(Cash banana, float amount);
banana
Il2CppAssets.Scripts.Simulation.Towers.Projectiles.Behaviors.Cash
amount
System.Single
Called right after a Bloon is first created
Equivalent to a HarmonyPostFix on Bloon.Initialise
public virtual void OnBloonCreated(Bloon bloon);
bloon
Il2CppAssets.Scripts.Simulation.Bloons.Bloon
Called after a new bloon emission is added to the spawner
Equivalent to a HarmonyPostfix on Spawner.AddEmissions
public virtual void OnBloonEmissionsAdded(Spawner spawner, Il2CppReferenceArray<BloonEmissionModel> newEmissions, int round, int index=0);
spawner
Il2CppAssets.Scripts.Simulation.Track.Spawner
newEmissions
Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppReferenceArray
round
System.Int32
index
System.Int32
Called after a bloon is emitted from a spawner
Equivalent to a HarmonyPostfix on Spawner.Emit
public virtual void OnBloonEmitted(Spawner spawner, BloonModel bloonModel, int round, int index, float startingDist, ref Bloon bloon);
spawner
Il2CppAssets.Scripts.Simulation.Track.Spawner
bloonModel
Il2CppAssets.Scripts.Models.Bloons.BloonModel
round
System.Int32
index
System.Int32
startingDist
System.Single
bloon
Il2CppAssets.Scripts.Simulation.Bloons.Bloon
Called right after a Bloon's BloonModel is updated
Equivalent to a HarmonyPostFix on Bloon.UpdatedModel
public virtual void OnBloonModelUpdated(Bloon bloon, Model model);
bloon
Il2CppAssets.Scripts.Simulation.Bloons.Bloon
model
Il2CppAssets.Scripts.Models.Model
Called after any button is clicked
Equivalent to a HarmonyPostfix on Button.OnPointerClick
public virtual void OnButtonClicked(Button button, PointerEventData clickData);
button
UnityEngine.UI.Button
clickData
UnityEngine.EventSystems.PointerEventData
Executed once the user has connected to a game session.
Note: Only invoked if CheatMod == true.
public virtual void OnConnected(NKMultiGameInterface nkGi);
nkGi
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
The interface used to interact with the game.
Executed once the user has tried to connect to a server, but failed to do so.
Note: Only invoked if CheatMod == true.
public virtual void OnConnectFail(NKMultiGameInterface nkGi);
nkGi
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
The interface used to interact with the game.
Called right after a match ends in defeat
Equivalent to a HarmonyPostFix on Simulation.OnDefeat
public virtual void OnDefeat();
Executed once the player has disconnected from a server.
Note: Only invoked if CheatMod == true.
public virtual void OnDisconnected(NKMultiGameInterface nkGi);
nkGi
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
The interface used to interact with the game.
Called right after a game ends in victory
Equivalent to a HarmonyPostFix on TimeManager.SetFastForward
public virtual void OnFastForwardChanged(bool newValue);
newValue
System.Boolean
Called when the GameData.Instance object is first loaded
public virtual void OnGameDataLoaded(GameData gameData);
gameData
Il2CppAssets.Scripts.Data.GameData
GameData.Instance
Called when Game.instance.model is not null
public virtual void OnGameModelLoaded(GameModel model);
model
Il2CppAssets.Scripts.Models.GameModel
Called when all of the existing GameObjects within a match are destroyed
public virtual void OnGameObjectsReset();
Called when InGame.instance.UnityToSimulation.Simulation is not null
public virtual void OnInGameLoaded(InGame inGame);
inGame
Il2CppAssets.Scripts.Unity.UI_New.InGame.InGame
Called when you go to the main menu screen
Equivalent to a HarmonyPostFix on MainMenu.OnEnable
public virtual void OnMainMenu();
Called when a map model is loaded by the game. Equivelant to MapLoader.Load.
public virtual void OnMapModelLoaded(ref MapModel mapModel);
mapModel
Il2CppAssets.Scripts.Models.Map.MapModel
The map that was just loaded. It is passed by reference to allow for modifications.
Called when the player returns to the MainMenu from a match
Equivalent to a HarmonyPostFix on InGame.Quit
public virtual void OnMatchEnd();
Called right after a match is started up (restart included it seems like)
Equivalent to a HarmonyPostFix on InGame.StartMatch
public virtual void OnMatchStart();
Called when a display is being loaded such as a towers 3d model
Equivalent to a HarmonyPostFix on GameModel.CreatedModded
public virtual void OnModelLoaded(Factory factory, string ModelToLoad, System.Action<UnityDisplayNode> action);
factory
Il2CppAssets.Scripts.Unity.Display.Factory
ModelToLoad
System.String
action
System.Action<Il2CppAssets.Scripts.Unity.Display.UnityDisplayNode>
Called when a new GameModel is created, aka when things like Monkey Knowledge are applied to towers
Equivalent to a HarmonyPostFix on GameModel.CreatedModded
public virtual void OnNewGameModel(GameModel result, List<ModModel> mods);
result
Il2CppAssets.Scripts.Models.GameModel
mods
Il2CppSystem.Collections.Generic.List
Called when a new GameModel is created, including the map
Equivalent to a HarmonyPostFix on GameModel.CreatedModded
public virtual void OnNewGameModel(GameModel result, MapModel map);
result
Il2CppAssets.Scripts.Models.GameModel
map
Il2CppAssets.Scripts.Models.Map.MapModel
Called when a new GameModel is created, aka when things like Monkey Knowledge are applied to towers
Equivalent to a HarmonyPostFix on GameModel.CreatedModded
public virtual void OnNewGameModel(GameModel result, System.Collections.Generic.IReadOnlyList<ModModel> mods);
result
Il2CppAssets.Scripts.Models.GameModel
mods
System.Collections.Generic.IReadOnlyList<Il2CppAssets.Scripts.Models.ModModel>
Called when a new GameModel is created, aka when things like Monkey Knowledge are applied to towers
Equivalent to a HarmonyPostFix on GameModel.CreatedModded
public virtual void OnNewGameModel(GameModel result);
result
Il2CppAssets.Scripts.Models.GameModel
Called when the pause screen is closed
Equivalent to a HarmonyPostfix on PauseScreen.Close
public virtual void OnPauseScreenClosed(PauseScreen pauseScreen);
pauseScreen
Il2CppAssets.Scripts.Unity.UI_New.Pause.PauseScreen
Called when the pause screen is opened
Equivalent to a HarmonyPostfix on PauseScreen.Open
public virtual void OnPauseScreenOpened(PauseScreen pauseScreen);
pauseScreen
Il2CppAssets.Scripts.Unity.UI_New.Pause.PauseScreen
Executed when a new client has joined the game session.
Note: Only invoked if CheatMod == true.
public virtual void OnPeerConnected(NKMultiGameInterface nkGi, int peerId);
nkGi
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
The interface used to interact with the game.
peerId
System.Int32
Index of the peer in question.
Executed when a new client has left the game session.
Note: Only invoked if CheatMod == true.
public virtual void OnPeerDisconnected(NKMultiGameInterface nkGi, int peerId);
nkGi
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
The interface used to interact with the game.
peerId
System.Int32
Index of the peer in question.
Called after the mouse goes over a selectable ui element
Equivalent to a HarmonyPostfix on Button.OnPointerEnter
public virtual void OnPointerEnterSelectable(Selectable button, PointerEventData eventData);
button
UnityEngine.UI.Selectable
eventData
UnityEngine.EventSystems.PointerEventData
Called after the mouse leaves a button
Equivalent to a HarmonyPostfix on Button.OnPointerExit
public virtual void OnPointerExitSelectable(Selectable button, PointerEventData eventData);
button
UnityEngine.UI.Selectable
eventData
UnityEngine.EventSystems.PointerEventData
Called when the player's ProfileModel is loaded.
Equivalent to a HarmonyPostFix on ProfileModel.Validate
public virtual void OnProfileLoaded(ProfileModel result);
result
Il2CppAssets.Scripts.Models.Profile.ProfileModel
Called right after a Projectile is created
Equivalent to a HarmonyPostFix on Projectile.Initialise
public virtual void OnProjectileCreated(Projectile projectile, Entity entity, Model modelToUse);
projectile
Il2CppAssets.Scripts.Simulation.Towers.Projectiles.Projectile
entity
Il2CppAssets.Scripts.Simulation.Objects.Entity
modelToUse
Il2CppAssets.Scripts.Models.Model
Called right after a Tower's TowerModel is changed for any reason (creation, upgrading, etc.)
Equivalent to a HarmonyPostFix on Projectile.UpdatedModel
public virtual void OnProjectileModelChanged(Projectile projectile, Model newModel);
projectile
Il2CppAssets.Scripts.Simulation.Towers.Projectiles.Projectile
newModel
Il2CppAssets.Scripts.Models.Model
Called after a Removeable is destroyed
Equivalent to a HarmonyPostfix on Map.DestroyRemoveable
public virtual void OnRemoveableDestroyed(Removeable removeable);
removeable
Il2CppAssets.Scripts.Simulation.Track.Removeable
Called when a match is restarted
Equivalent to a HarmonyPostFix on InGame.Restart
public virtual void OnRestart();
Called right after a round starts
Equivalent to a HarmonyPostFix on Simulation.OnRoundEnd
public virtual void OnRoundEnd();
Called right after a round starts
Equivalent to a HarmonyPostFix on Simulation.OnRoundStart
public virtual void OnRoundStart();
Called when a sprite is being loaded
Equivalent to a HarmonyPostFix on ResourceLoader.LoadSpriteFromSpriteReferenceAsync
public virtual void OnSpriteLoad(SpriteReference spriteref, Image image);
spriteref
Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
image
UnityEngine.UI.Image
Called right after the game finishes loading everything
Equivalent to a HarmonyPostFix on TitleScreen.Start
public virtual void OnTitleScreen();
Called after a TowerPurchaseButton is created
Equivalent to a HarmonyPostfix on ShopMenu.CreateTowerButton
public virtual void OnTowerButtonCreated(TowerModel tower, int index, bool showAmount, ref ITowerPurchaseButton button);
tower
Il2CppAssets.Scripts.Models.Towers.TowerModel
index
System.Int32
showAmount
System.Boolean
button
Il2CppAssets.Scripts.Unity.UI_New.InGame.StoreMenu.ITowerPurchaseButton
Called right after a Tower is initialized
Equivalent to a HarmonyPostFix on Tower.Initialise
public virtual void OnTowerCreated(Tower tower, Entity target, Model modelToUse);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
target
Il2CppAssets.Scripts.Simulation.Objects.Entity
modelToUse
Il2CppAssets.Scripts.Models.Model
Called right after a Tower is deselected by the player
Equivalent to a HarmonyPostFix on Tower.UnHighlight
public virtual void OnTowerDeselected(Tower tower);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
Called right after a Tower is destroyed
Equivalent to a HarmonyPostFix on Tower.Destroyed
public virtual void OnTowerDestroyed(Tower tower);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
Called right before a Tower's 3D graphics are initialized
Equivalent to a HarmonyPreFix on InputManager.CreateTowerGraphicsAsync
public virtual void OnTowerGraphicsCreated(TowerModel towerModel, System.Collections.Generic.List<UnityDisplayNode> placementGraphics);
towerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
placementGraphics
System.Collections.Generic.List<Il2CppAssets.Scripts.Unity.Display.UnityDisplayNode>
Called after a TowerInventory is initialized
Equivalent to a HarmonyPostfix on TowerInventory.Init
public virtual void OnTowerInventoryInit(TowerInventory towerInventory, System.Collections.Generic.List<TowerDetailsModel> baseTowers);
towerInventory
Il2CppAssets.Scripts.Simulation.Input.TowerInventory
baseTowers
System.Collections.Generic.List<Il2CppAssets.Scripts.Models.TowerSets.TowerDetailsModel>
Called when the TowerInventory is initialized for a game
public virtual void OnTowerInventoryInitialized(TowerInventory towerInventory, System.Collections.Generic.List<TowerDetailsModel> allTowersInTheGame);
towerInventory
Il2CppAssets.Scripts.Simulation.Input.TowerInventory
allTowersInTheGame
System.Collections.Generic.List<Il2CppAssets.Scripts.Models.TowerSets.TowerDetailsModel>
Called when you load a save file and a Tower's save data get loaded for the tower
Use saveData.metaData to load custom information
Equivalent to a HarmonyPostFix on Tower.SetSavedData
public virtual void OnTowerLoaded(Tower tower, TowerSaveDataModel saveData);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
saveData
Il2CppAssets.Scripts.Models.Profile.TowerSaveDataModel
Called right after a Tower's TowerModel is changed for any reason (creation, upgrading, etc.)
Equivalent to a HarmonyPostFix on Tower.UpdatedModel
public virtual void OnTowerModelChanged(Tower tower, Model newModel);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
newModel
Il2CppAssets.Scripts.Models.Model
Called at the end of each round when a Tower's data is saved
Use saveData.metaData to save custom information
Equivalent to a HarmonyPostFix on Tower.GetSavedData
public virtual void OnTowerSaved(Tower tower, TowerSaveDataModel saveData);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
saveData
Il2CppAssets.Scripts.Models.Profile.TowerSaveDataModel
Called right after a Tower is selected by the player
Equivalent to a HarmonyPostFix on TowerSelectionMenu.Show
public virtual void OnTowerSelected(Tower tower);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
Called right after a Tower is sold
Equivalent to a HarmonyPostFix on Tower.OnSold
public virtual void OnTowerSold(Tower tower, float amount);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
amount
System.Single
Called right after a Tower is upgraded
public virtual void OnTowerUpgraded(Tower tower, string upgradeName, TowerModel newBaseTowerModel);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower
upgradeName
System.String
newBaseTowerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
Called right after a match ends in victory
Equivalent to a HarmonyPostFix on InGame.OnVictory
public virtual void OnVictory();
Called right after a Weapon is created
Equivalent to a HarmonyPostFix on Weapon.Initialise
public virtual void OnWeaponCreated(Weapon weapon, Entity entity, Model modelToUse);
weapon
Il2CppAssets.Scripts.Simulation.Towers.Weapons.Weapon
entity
Il2CppAssets.Scripts.Simulation.Objects.Entity
modelToUse
Il2CppAssets.Scripts.Models.Model
Called when a weapon fires
Equivalent to a HarmonyPostFix on Weapon.SpawnDart
public virtual void OnWeaponFire(Weapon weapon);
weapon
Il2CppAssets.Scripts.Simulation.Towers.Weapons.Weapon
Called right after a Tower's WeaponModel is changed for any reason (creation, upgrading, etc.)
Equivalent to a HarmonyPostFix on Weapon.UpdatedModel
public virtual void OnWeaponModelChanged(Weapon weapon, Model newModel);
weapon
Il2CppAssets.Scripts.Simulation.Towers.Weapons.Weapon
newModel
Il2CppAssets.Scripts.Models.Model
Called right after a Bloon leaks.
Equivalent to a HarmonyPostFix on Bloon.Leaked
public virtual void PostBloonLeaked(Bloon bloon);
bloon
Il2CppAssets.Scripts.Simulation.Bloons.Bloon
If you removed any data in PreCleanProfile, you may want to add it back here, or just call
OnProfileLoaded(ProfileModel)
again on the profile.
public virtual void PostCleanProfile(ProfileModel profile);
profile
Il2CppAssets.Scripts.Models.Profile.ProfileModel
Called after a sprite is loaded from a SpriteAtlas
Equivalent to a HarmonyPostfix on SpriteAtlas.GetSprite
public virtual void PostSpriteLoaded(SpriteAtlas spriteAtlas, string name, ref Sprite result);
spriteAtlas
UnityEngine.U2D.SpriteAtlas
name
System.String
result
UnityEngine.Sprite
Called right before a Bloon would leak.
Return 'false' to prevent the leak from happening
Equivalent to a HarmonyPreFix on Bloon.Leaked
public virtual bool PreBloonLeaked(Bloon bloon);
bloon
Il2CppAssets.Scripts.Simulation.Bloons.Bloon
Perform actions on a profile right before the Mod Helper cleans it. If you see that the Mod Helper cleans
past profile data from your mod on startup, it should be removed here.
public virtual void PreCleanProfile(ProfileModel profile);
profile
Il2CppAssets.Scripts.Models.Profile.ProfileModel
Called before a sprite is loaded from a SpriteAtlas
Return 'false' to prevent the original method from running
Equivalent to a HarmonyPrefix on SpriteAtlas.GetSprite
public virtual bool PreSpriteLoaded(SpriteAtlas spriteAtlas, ref string name, ref Sprite result);
spriteAtlas
UnityEngine.U2D.SpriteAtlas
name
System.String
result
UnityEngine.Sprite
Called before the TowerInventory is initialized
Equivalent to a HarmonyPrefix on TowerInventory.Init
public virtual void PreTowerInventoryInit(TowerInventory towerInventory, ref System.Collections.Generic.IEnumerable<TowerDetailsModel> baseTowers);
towerInventory
Il2CppAssets.Scripts.Simulation.Input.TowerInventory
baseTowers
System.Collections.Generic.IEnumerable<Il2CppAssets.Scripts.Models.TowerSets.TowerDetailsModel>