# Bridges

***

(Version 2.5)\ <mark style="color:yellow;">**OnCheckItemUse(aIndex, ItemIndex, TargetIndex)**</mark>

<mark style="color:yellow;">aIndex</mark> = User Index.\ <mark style="color:yellow;">ItemIndex</mark> = Index of the item used.\ <mark style="color:yellow;">TargetIndex</mark> = Target item index.\
\
Bridge used to get the index of the used item and the target item when adding one item over another, usage can be blocked by returning 1, default return 0.

***

(Version 2.5)\ <mark style="color:yellow;">**OnChaosMixResult(aIndex, Type, Item, Level)**</mark>

<mark style="color:yellow;">aIndex</mark> = User Index.\ <mark style="color:yellow;">Type</mark> = Chaos Mix Type Result.\ <mark style="color:yellow;">Item</mark> = Item Index Result.\ <mark style="color:yellow;">Level</mark> = Level Item Result.\
\ <mark style="color:orange;">CHAOS MIX TYPE:</mark>

<mark style="color:orange;">1 = Chaos Item Mix</mark>\ <mark style="color:orange;">2 = Devil Square Mix</mark>\ <mark style="color:orange;">3 = Plus Item Mix</mark>\ <mark style="color:orange;">4 = Dinorant Mix</mark>\ <mark style="color:orange;">5 = Fruit Mix</mark>\ <mark style="color:orange;">6 = Wing level 2 Mix</mark>\ <mark style="color:orange;">7 = Blood Castle Mix</mark>\ <mark style="color:orange;">8 = Wing level 1 Mix</mark>\ <mark style="color:orange;">9 = Pet Mix</mark>\ <mark style="color:orange;">10 = Horn of Fenrir Mix</mark>\ <mark style="color:orange;">11 = Horn of Fenrir Upgrade Mix</mark>\ <mark style="color:orange;">12 = Illusion Temple Mix</mark>\ <mark style="color:orange;">13 = Feather of Condor Mix</mark>\ <mark style="color:orange;">14 = Wing level 3 Mix</mark>\ <mark style="color:orange;">Other = Custom Mix Index</mark>

***

(Version 2.4)\ <mark style="color:yellow;">**OnReloadMonster()**</mark>\
\
This function runs as the last call after the Game Server's Reload Monster.

***

(Version 2.3)\ <mark style="color:yellow;">**OnPotionInfinite(aIndex, Potion)**</mark>

<mark style="color:yellow;">aIndex</mark> = User Index.\ <mark style="color:yellow;">Potion</mark> = Potion Index.\
\ <mark style="color:red;">14, 0 -> "Apple"</mark>\ <mark style="color:red;">14, 1 -> "Small Healing Potion"</mark>\ <mark style="color:red;">14, 2 -> "Healing Potion"</mark>\ <mark style="color:red;">14, 3 -> "Large Healing Potion"</mark>\ <mark style="color:red;">14, 4 -> "Small Mana Potion"</mark>\ <mark style="color:red;">14, 5 -> "Mana Potion"</mark>\ <mark style="color:red;">14, 6 -> "Large Mana Potion"</mark>\ <mark style="color:red;">14, 8 -> "Antidote"</mark>\ <mark style="color:red;">14, 35 -> "Small SD Potion"</mark>\ <mark style="color:red;">14, 36 -> "SD Potion"</mark>\ <mark style="color:red;">14, 37 -> "Large SD Potion"</mark>\ <mark style="color:red;">14, 38 -> "Small Complex Potion"</mark>\ <mark style="color:red;">14, 39 -> "Complex Potion"</mark>\ <mark style="color:red;">14, 40 -> "Large Complex Potion"</mark>\ <mark style="color:red;">14, 70 -> "Elite Healing Potion"</mark>\ <mark style="color:red;">14, 71 -> "Elite Mana Potion"</mark>\ <mark style="color:red;">14, 133 -> "Elite SD Potion"</mark>\
\
Return 1 for infinite and 0 for consumable.

***

<mark style="color:yellow;">**OnUserWalk(aIndex, UserX, UserY)**</mark>

<mark style="color:yellow;">aIndex</mark> = User Index.\ <mark style="color:yellow;">UserX</mark> = User Position X.\ <mark style="color:yellow;">UserY</mark> = User Position Y.\
\
Return 1 for block walk or 0 for allow walk.

***

<mark style="color:yellow;">**OnUserExperience(aIndex, Level, MasterLevel, Reset, MasterReset, Map, MapX, MapY, Experience)**</mark>

<mark style="color:yellow;">aIndex</mark> = User Index.\ <mark style="color:yellow;">Level</mark> = User Level.\ <mark style="color:yellow;">MasterLevel</mark> = User Master Level.\ <mark style="color:yellow;">Reset</mark> = User Reset.\ <mark style="color:yellow;">MasterReset</mark> = User Master Reset.\ <mark style="color:yellow;">Map</mark> = User Map .\ <mark style="color:yellow;">MapX</mark> = User Position X.\ <mark style="color:yellow;">MapY</mark> = User Position Y.\ <mark style="color:yellow;">Experience</mark> = User Experience Gains.\
\
return <mark style="color:yellow;">Experience</mark> \
\
Get and manipulate Experience, return should be Experience, if -1 becomes default.

***

<mark style="color:yellow;">**OnMonsterDieGiveItem(aIndex, bIndex, Map, MapX, MapY, ItemIndex, Money)**</mark>

<mark style="color:yellow;">aIndex</mark> = Index of the monster that died.\ <mark style="color:yellow;">bIndex</mark> = player index.\ <mark style="color:yellow;">Map</mark> = Map where the monster died.\ <mark style="color:yellow;">MapX</mark> = position X on the map.\ <mark style="color:yellow;">MapY</mark> = Y position on the map.\ <mark style="color:yellow;">ItemIndex</mark> = Returns the Item Index, or -1 if Money is different from -1.\ <mark style="color:yellow;">Money</mark> = Returns the Money Value, or -1 if ItemIndex is different from -1.\
\
\&#xNAN;*"This bridge is used to control the drop of a specific mob, being able to cancel the drop and then do a manual drop."*

Return 1 prevents the monster from dropping the item / zen, return 0 releases the item / zen from dropping

***

<mark style="color:yellow;">**OnSQLAsyncResult(resultTable, label, param, result)**</mark>\
\ <mark style="color:yellow;">resultTable</mark> = If the query is a select, it returns a table containing the select information, with the table keys being the names of the columns in the select.\ <mark style="color:yellow;">label</mark> = Returns the Identification received from the SQLAsyncQuery function.\ <mark style="color:yellow;">param</mark> = Additional parameter, such as a label, is received to serve as query identifier in the callback.\ <mark style="color:yellow;">result</mark> = 0 is query failed, 1 is query successful.\
\
\&#xNAN;*"If type(resultTable) == "number" then the query is an insert/delete, if type(resultTable) == "table" the query is a select."*\
\
Used to return results in a processing queue, it only works in conjunction with the SQLAsyncQuery function.&#x20;

***

<mark style="color:yellow;">**OnUserDamage(aIndex, bIndex, Damage, Skill, Combo, DmgFlag)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User Index (Attacker).\ <mark style="color:yellow;">bIndex</mark> = Object Index (Target).\ <mark style="color:yellow;">Damage</mark> = Returns the value of damage dealt.\ <mark style="color:yellow;">Skill</mark> = Returns the skill used.\ <mark style="color:yellow;">Combo</mark> = Return 1 for combo and 0 for common attack.\ <mark style="color:yellow;">DmgFlag</mark> = 0 - Common (Yellow) <mark style="color:yellow;">|</mark> 1 - Ignore (Light blue) <mark style="color:yellow;">|</mark> 2 - Excellent (Green) <mark style="color:yellow;">|</mark> 3 - Critical (Blue) <mark style="color:yellow;">|</mark> 64 - Double (Yellow) <mark style="color:yellow;">|</mark> 128 - Combo (Yellow) <mark style="color:yellow;">|</mark> 129 - Combo + Ignore (Light blue) <mark style="color:yellow;">|</mark> 130 - Combo + Excellent <mark style="color:yellow;">|</mark> 131 - Combo + Critical (Blue) <mark style="color:yellow;">|</mark> 256 - Triple (Yellow) <mark style="color:yellow;">|</mark> 257 - Triple + Ignore (Light blue) <mark style="color:yellow;">|</mark> 258 - ... (Green).\
\
return <mark style="color:yellow;">Damage</mark>\
\
If return -1 = Miss                                                             &#x20;

***

<mark style="color:yellow;">**OnCommandManager(aIndex, code, arg)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">code</mark> = Command index.\ <mark style="color:yellow;">arg</mark> = Command parameters.\
\
Called after a user types a valid command, must return (1) if the command is valid, (0) if not.

***

<mark style="color:yellow;">**OnCommandDone(aIndex, code)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">code</mark> = Command index.\
\
Called after a user execute valid command.

***

<mark style="color:yellow;">**OnCharacterEntry(aIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\
\
Called after a user enters the game with a character.

***

<mark style="color:yellow;">**OnCharacterClose(aIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\
\
Called after a user leaves the game with a character.

***

<mark style="color:yellow;">**OnNpcTalk(aIndex, bIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = NPC index.\ <mark style="color:yellow;">bIndex</mark> = User index.\
\
Called after a user talks with a NPC, must return (0) if the talk is successful, (1) if not.

***

<mark style="color:yellow;">**OnMonsterDie(aIndex, bIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = Monster index (victim).\ <mark style="color:yellow;">bIndex</mark> = User index (killer).\
\
Called after a monster dies.

***

<mark style="color:yellow;">**OnUserDie(aIndex, bIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index (victim).\ <mark style="color:yellow;">bIndex</mark> = Object index (killer).\
\
Called after a user dies.

***

<mark style="color:yellow;">**OnUserRespawn(aIndex, KillerType)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">KillerType</mark> = 0 - Monster <mark style="color:yellow;">|</mark> 1 - User <mark style="color:yellow;">|</mark> 2 - GuildWar <mark style="color:yellow;">|</mark> 3 - Duel.\
\
Called when a user is going to respawn.

***

<mark style="color:yellow;">**OnCheckUserTarget(aIndex, bIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index (attacker).\ <mark style="color:yellow;">bIndex</mark> = User index (target).\
\
Called on the attack target verification, must return (1) if the target can be attacked, (0) if not.

***

<mark style="color:yellow;">**OnCheckUserKiller(aIndex, bIndex)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index (killer).\ <mark style="color:yellow;">bIndex</mark> = User index (victim).\
\
Called on the player killer verification, must return (1) if the killer is going to recieve PK status, (0) if not.

***

<mark style="color:yellow;">**OnUserItemPick(aIndex, Index)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">Index</mark> = Item slot.\
\
Called on item pick, must return (1) if the item can be picked, (0) if not.

***

<mark style="color:yellow;">**OnUserItemDrop(aIndex, Slot, x, y)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">Slot</mark> = Item slot.\ <mark style="color:yellow;">x</mark> = Item drop position x. \ <mark style="color:yellow;">y</mark> = Item drop position y.\
\
Called on item drop, must return (1) if the item can be dropped, (0) if not.

***

<mark style="color:yellow;">**OnUserItemMove(aIndex, aFlag, aSlot, bFlag, bSlot)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">aFlag</mark> = Item source flag.\ <mark style="color:yellow;">aSlot</mark> = Item source slot. \ <mark style="color:yellow;">bFlag</mark> = Item target flag.\ <mark style="color:yellow;">bSlot</mark> = Item target slot.\
\
FlagList: 0 - Inventory <mark style="color:yellow;">|</mark> 1 - Trade <mark style="color:yellow;">|</mark> 2 - Warehouse <mark style="color:yellow;">|</mark> 3 - Chaos Box <mark style="color:yellow;">|</mark> 4 - Personal Shop <mark style="color:yellow;">|</mark> 5\~20 - Chaos Box <mark style="color:yellow;">|</mark> 21 - Event Inventory <mark style="color:yellow;">|</mark> 22 - Muun Inventory.\
\
Called on item move, must return (1) if the item can be moved, (0) if not.

***

<mark style="color:yellow;">**OnCommandManagerDirect(aIndex, str)**</mark>\
\
Called when player type /command, can be used for create direct commands instead declare him at Commands.txt

Return 1 to block or 0 to continue.

***

<mark style="color:yellow;">**OnUserMove(aIndex, Map)**</mark>\
\
Called when a player move to another map (M Window or /move), must return (0) if allow move, (1) if not.

***

<mark style="color:yellow;">**OnPacketRecv(aIndex, Str)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">Str</mark> = Information in text format.\
\
Used to receive text string from client side (send) function.

***

<mark style="color:yellow;">**OnUserLevelUp(aIndex, Level)**</mark>\
\ <mark style="color:yellow;">aIndex</mark> = User index.\ <mark style="color:yellow;">Level</mark> = User level.\
\
return -1 = Returns the normal amount of points defined on the GameServer. \
return 0 = Blocks earning points per level. \
return value = Determines a specific value of points per level.\
\
Used to modify point gains per level or master level

***

<mark style="color:yellow;">**OnReadScript()**</mark>\
\
Called once at GameServer initialization.

***

<mark style="color:yellow;">**OnShutScript()**</mark>\
\
Called once before script reload.

***

<mark style="color:yellow;">**OnTimerThread()**</mark>\
\
Called every 1 second, can be used as a timer.

***
