IPlugin
Namespace: SharpPluginLoader.Core
public interface IPlugin
Properties
Name
The name of the plugin.
public abstract string Name { get; }
Property Value
Author
The author of the plugin.
public string Author { get; }
Property Value
Methods
Initialize()
Gets called when the plugin is loaded. This is where you configure your plugin within the framework. The plugin must return a struct, which tells the framework which events to call.
Default event, always called once per plugin [re]load.
PluginData Initialize()
Returns
PluginData
The filled out PluginData
OnLoad()
Gets called after the game has initialized it's singletons. This is you initialize anything in your plugin that uses the game state (e.g. reading pointers, accessing singletons, etc).
Default event, always called once per plugin [re]load.
void OnLoad()
OnPreMain()
Called before any of the game's code runs (including static initializers). This is only used for special cases, and is not applicable to most plugins. This will NOT be called during hot-reloading.
void OnPreMain()
OnWinMain()
Called after game's static initializers, but before WinMain. This is only for special cases, and is not applicable to most plugins.
void OnWinMain()
OnUpdate(Single)
Gets called every frame.
void OnUpdate(float deltaTime)
Parameters
deltaTime
Single
The time elapsed since the last time this function was called, in seconds
OnSave()
Gets called when the game is saved.
void OnSave()
OnSelectSaveSlot(Int32)
Gets called when the player selects a save slot.
void OnSelectSaveSlot(int slot)
Parameters
slot
Int32
The save slot that was selected
OnResourceLoad(Resource, MtDti, String, UInt32)
Gets called when a resource is requested/loaded.
void OnResourceLoad(Resource resource, MtDti dti, string path, uint flags)
Parameters
resource
Resource
The loaded resource, or null if the request failed
dti
MtDti
The DTI of the resource
path
String
The file path of the resource, without its extension
flags
UInt32
The flags passed to the request
OnChatMessageSent(String)
Gets called when a chat message is sent (on the local side).
void OnChatMessageSent(string message)
Parameters
message
String
The contents of the message
OnQuestAccept(Int32)
Gets called when a quest is accepted on the quest board.
void OnQuestAccept(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestCancel(Int32)
Gets called when a quest is cancelled on the quest board.
void OnQuestCancel(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestDepart(Int32)
Gets called when the player departs on a quest.
void OnQuestDepart(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestEnter(Int32)
Gets called when the player arrives in the quest area.
void OnQuestEnter(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestLeave(Int32)
Gets called when the player leaves the quest area.
void OnQuestLeave(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestComplete(Int32)
Gets called when a quest is completed.
void OnQuestComplete(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestFail(Int32)
Gets called when a quest is failed.
void OnQuestFail(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestReturn(Int32)
Gets called when the player selects "Return from Quest" in the menu.
void OnQuestReturn(int questId)
Parameters
questId
Int32
The id of the quest
OnQuestAbandon(Int32)
Gets called when the player selects "Abandon Quest" in the menu.
void OnQuestAbandon(int questId)
Parameters
questId
Int32
The id of the quest
OnMonsterCreate(Monster)
Gets called when a monster is created.
void OnMonsterCreate(Monster monster)
Parameters
monster
Monster
The monster being created
Remarks:
This function is called immediately after the monsters constructor is run, most of its data is not yet initialized by this point.
OnMonsterInitialized(Monster)
Gets called after a monster is initialized.
void OnMonsterInitialized(Monster monster)
Parameters
monster
Monster
The monster that was initialized
Remarks:
Most data in the monster is ready to be used by this point.
OnMonsterAction(Monster, Int32&)
Gets called when a monster does an action.
void OnMonsterAction(Monster monster, Int32& actionId)
Parameters
monster
Monster
The monster doing the action
actionId
Int32&
The id of the action to be executed
Remarks:
The actionId parameter can be modified to change the executed action
OnMonsterFlinch(Monster, Int32&)
Gets called when a monster gets flinched.
bool OnMonsterFlinch(Monster monster, Int32& actionId)
Parameters
monster
Monster
The monster getting flinched
actionId
Int32&
The flinch action it will perform
Returns
Boolean
False to cancel the flinch
OnMonsterEnrage(Monster)
Gets called when a monster gets enraged.
void OnMonsterEnrage(Monster monster)
Parameters
monster
Monster
The monster getting enraged
OnMonsterUnenrage(Monster)
Gets called when a monster leaves its enraged state.
void OnMonsterUnenrage(Monster monster)
Parameters
monster
Monster
The monster leaving its enraged state
OnMonsterDeath(Monster)
Gets called when a monster dies.
void OnMonsterDeath(Monster monster)
Parameters
monster
Monster
The monster that died
OnMonsterDestroy(Monster)
Gets called when a monster is destroyed (its destructor is called).
void OnMonsterDestroy(Monster monster)
Parameters
monster
Monster
The monster that is about to be destroyed
OnPlayerAction(Player, ActionInfo&)
Gets called when the player does an action.
void OnPlayerAction(Player player, ActionInfo& action)
Parameters
player
Player
The player doing the action
action
ActionInfo&
The action to be executed
Remarks:
The action parameter can be modified to change the executed action
OnWeaponChange(Player, WeaponType, Int32)
Gets called when the player changes their weapon.
void OnWeaponChange(Player player, WeaponType weaponType, int weaponId)
Parameters
player
Player
The player changing weapons
weaponType
WeaponType
The new weapon type
weaponId
Int32
The new weapon id
Remarks:
This function is called asynchronously.
OnEntityAction(Entity, ActionInfo&)
Gets called when any entity does an action.
void OnEntityAction(Entity entity, ActionInfo& action)
Parameters
entity
Entity
The entity doing the action
action
ActionInfo&
The action to be executed
Remarks:
The action parameter can be modified to change the executed action
OnEntityAnimation(Entity, AnimationId&, Single&, Single&)
Gets called when any entity does an animation.
void OnEntityAnimation(Entity entity, AnimationId& animationId, Single& startFrame, Single& interFrame)
Parameters
entity
Entity
The entity doing the animation
animationId
AnimationId&
The id of the animation to be executed
startFrame
Single&
The starting frame of the animation
interFrame
Single&
The number of frames to use for interpolation between animations
Remarks:
Both the animationId and the startFrame parameters can be modified to change the executed animation.
OnEntityAnimationUpdate(Entity, AnimationId, Single)
Gets called when an entity's animation component is updated.
void OnEntityAnimationUpdate(Entity entity, AnimationId currentAnimation, float deltaTime)
Parameters
entity
Entity
The entity whos animation component is updated
currentAnimation
AnimationId
The current active animation
deltaTime
Single
The time since the last time this entity's animation component was updated
OnSendPacket(Packet, Boolean, SessionIndex)
Gets called when a packet is sent.
void OnSendPacket(Packet packet, bool isBroadcast, SessionIndex session)
Parameters
packet
Packet
The packet being sent
isBroadcast
Boolean
Whether the packet is broadcasted to all players in the session or not
session
SessionIndex
The session the packet is sent to
OnReceivePacket(UInt32, PacketType, SessionIndex, NetBuffer)
Gets called when a packet is received.
void OnReceivePacket(uint id, PacketType type, SessionIndex sourceSession, NetBuffer data)
Parameters
id
UInt32
The id of the packet
type
PacketType
The type of the packet
sourceSession
SessionIndex
The session the packet was sent from
data
NetBuffer
The data of the packet
OnRender()
The user can use this function to render arbitrary things on the screen (after the game has rendered).
void OnRender()
OnImGuiRender()
The user can use this function to render ImGui widgets on the screen. Widgets rendered here will be inside the main SPL ImGui window.
void OnImGuiRender()
OnImGuiFreeRender()
The user can use this function to render their own ImGui windows.
void OnImGuiFreeRender()
Remarks:
Note: To render any ImGui widgets inside this function, you must create your own ImGui window.