The API's main use would be for scripts or anything not directly involved in the CORE of the server.
I've only taken the time to plan out some events, but we should figure out useful methods to be exposed to
scripts as well.
All have base class of "Event," not sure what it should be.
All methods should return booleans for if the action can continue.
Scripts will have priorities so you can run them in a specific order.
Not sure how Items in different Interfaces would work. Can items from one Interface be used with another's
Items?
"_" denotes that it's an abstract class
Code:GroundItem:
_GroundItemEvent (what Tile and what Item)
GroundItemAddEvent (new ground item)
GroundItemUpdateEvent (item amount)
GroundItemPickupEvent (who, more specific version of GroundItemRemoveEvent)
GroundItemRemoveEvent (reason, Player)
Movement: (Entities)
_MovementEvent (what Entity)
PathUpdateEvent (new path)
MoveEvent (where to, running or not, less specific version of walk and run events)
WalkEvent (where to)
RunEvent (where to)
Teleport: (Entities)
_TeleportEvent (what Entity, where to)
TeleportStartEvent (doing animation)
TeleportEndEvent (actually teleporting)
Harvest: (Players, the "harvest success rate" formula will be applied in the core - events fired accordingly)
_HarvestEvent (what Object)
HarvestTreeStartEvent (these are for when the action is beginning, you can check requirements here)
HarvestFarmStartEvent
HarvestRockStartEvent
HarvestTreeEvent (these are actually when a resource is supposed to be collected)
HarvestFarmEvent
HarvestRockEvent
HarvestTreeEndEvent (what reason - manual stop, depleted, etc.)
HarvestFarmEndEvent (what reason)
HarvestRockEndEvent (what reason)
Entity:
_EntityEvent (what id, what EntityType)
EntityInitializeEvent (very start of entity)
EntitySpawnEvent (what location, reason - death or first spawn)
EntityDamageEvent (reason: poison type, pvp, pvm, does actual damaging itself)
EntityAnimationEvent (what Animation)
EntityHealEvent (via prayer, food, or a special)
Combat: (Entities)
_CombatEvent (what Entity, what Entity we are attacking)
CombatStartEvent (can we attack)
CombatSpecialEvent (what special)
CombatDamageEvent (does actual damaging)
CombatEndEvent (reason)
Death: (Entities)
_DeathEvent (what Entity, where, and what cause)
DeathStartEvent (ex: doing animation)
DeathEndEvent (actually dying)
Player: Entity
_PlayerEvent (what Player)
PlayerClickEvent (x, y, left or right mouse button)
PlayerPrayerEvent (on or off and what prayer)
PlayerLogoutEvent (reason)
PlayerReconnectEvent
PlayerDisconnectEvent (reason)
NPC: Entity
_NPCEvent (what NPC)
Interface: (Players)
_InterfaceEvent (what Player, what Interface)
InterfaceButtonClickEvent (what button)
InterfaceAnimationEvent (what animation)
InterfaceCloseEvent (reason - disconnect, x button, etc.)
Poison: (Entities)
_PoisonEvent (what Entity)
PoisonStartEvent (cause, time it lasts)
PoisonDamageEvent (type, does actual damaging itself)
PoisonEndEvent (reason - food, prayer, or it ending on its own)
Armor: (Player, NPC if implemented client-side)
_ArmorEvent (what Entity, what Item)
ArmorEquipEvent (can equip)
ArmorUpdateEvent (updating amount of arrows, charges, etc.)
ArmorRemoveEvent (removing armor)
Inventory: (player, trade, bank, duel etc.)
_InventoryEvent (what Item, what slot, what Interface)
InventoryAddEvent (can add item to slot in interface)
InventoryUpdateEvent (reason - amount or id, new amount or new id)
InventoryRemoveEvent (reason - death, player removal, etc.)
InventoryUseEvent (reason - Item or Entity, on what instance)
InventorySwitchEvent (to which slot)
Tile:
_TileEvent (what Tile)
TileEnterEvent (reason - walk into or log in, what Entity)
TileLeaveEvent (reason - walk away or log out, what Entity)
Object: Entity
_ObjectEvent (what Object)
ObjectAddEvent (alias for EntitySpawnEvent)
ObjectRemoveEvent (alias for DeathEndEvent)
ObjectFaceUpdateEvent (to what Face)
ObjectStateUpdateEvent (to what State)