Game events are ambient or global, they can either be broadcasted to the entire server or you can observe nearby happenings through these events.

// Register to a single event: game.on("level_up",function(data){ game_log(data.name+" is now level "+data.level+"!"); }); // Register to all events: game.all(function(name,data){ data.event_name=name; show_json(data); });

Data Reference:

"event"
{ name: "snowman", // Some others: "pinkgoo", "wabbit", "franky", "grinch" // Optional coordinates: map: "winterland", x: 12, y: 88, }
"trade"
{ seller: "SellerName", buyer: "BuyerName", item: {name:"staff",level:9}, slot: "trade8", }
"action"
{ source: "attack", // Can be positive or negative actor: "CharacterName", // Monster ID or Character ID target: "42", // Monster ID or Character ID damage: 1390, projectile: "momentum", eta: 50, // Arrival in milliseconds pid: "abcd1234", // Projectile ID } { source: "heal", actor: "CharacterName", target: "PartyMember", heal: 1390, projectile: "heal", eta: 400, pid: "abcd1234", // Projectile ID } { source: "curse", actor: "CharacterName", target: "MortalEnemy", projectile: "curse", eta: 800, pid: "abcd1234", // Projectile ID } { source: "burst", actor: "CharacterName", target: "MortalEnemy", ray: "burst", instant: true, } // Warning: The formats might refine in the future [26/01/20]
"hit"
{ source: "attack", // Can be positive or negative actor: "CharacterName", // Monster ID or Character ID target: "42", // Monster ID or Character ID damage: 1390, pid: "abcd1234", // Projectile ID heal: 0, // Set if the projectile was healing crit: false, kill: false, evade: false, miss: false, avoid: false, // Outrunning the projectile poison: false, // Whether the attack poisoned the target freeze: false, // Whether the attack freezed the target stun: false, // Whether the attack stunned the target reflect: 0, // Reflected damage dreturn: 0, // Returned damage trigger: "sugarrush", // Set when the attack triggered a condition/buff condition: "curse", // Could be both a positive or negative condition for the target sneak: false, // Set if this was a Rogue sneak attack stacked: [], // Array of ID's - If multiple opponents staying in the same spot got hit mobbing: 88, // If 4+ monsters target you, their attacks increase the mobbing intensity/damage unintentional: false, // true for the non-main targets of a stacked attack aoe: false, // true for uncontrollable attacks like cleave and shadowstrike // Not all properties are always set, if the value is false, [] or 0 - they are usually not set }
"level_up"
{ name: "CharacterName", // Character name level: 72, // Characters' new level }
"death"
{ id: "428", // Character Name or Monster ID }
"shutdown"
{ seconds: 20, // Server shutdown in 20 seconds }
"sell"
{ // Item sold to an NPC name: "CharacterName", item: {"name":"pants",level:8}, }
"buy"
{ // Item bought from an NPC name: "CharacterName", item: {"name":"pants",level:0}, }
"sbuy"
{ // Item bought from Ponty name: "CharacterName", item: {"name":"pants",level:0}, }
"fbuy"
{ // Item bought from Lost and Found name: "CharacterName", item: {"name":"pants",level:0}, }
"item_sent"
{ // Player to player item transfer sender: "SenderName", receiver: "ReceiverName", item: {"name":"pants",level:0}, }
"gold_sent"
{ // Player to player gold transfer sender: "SenderName", receiver: "ReceiverName", gold: 100, }
"cx_sent"
{ // Player to player cosmetics transfer sender: "SenderName", receiver: "ReceiverName", cx: "hat999", }
"mluck"
{ name: "MerchantName", item: {name:"staff",level:0}, num: 12, }
"api_response"
{ type: "servers_and_characters", servers: [], characters: [], }

Work in progress ...