# Bridges

***

*(Version 2.7)*\ <mark style="color:yellow;">**LuaHudSkillNumber(PosX, PosY, Number, Size)**</mark>\
\
**Description:**\
Used to deactivate and create new skill numbers from 0 to 9, repositioning and sizing; return 1 to disable the originals.\
\
Example:

```lua
require "System\\ScriptCore"

function HudSkillNumber(X, Y, Number, Size)
        -- Your Skill Number visual function here 

        return 1
end

BridgeFunctionAttach("LuaHudSkillNumber", "HudSkillNumber")
```

***

*(Version 2.7)*\ <mark style="color:yellow;">**LuaHudMouseEvent()**</mark>\
\
**Description:**\
Create within this bridge the entire click and mouse/keyboard event scheme for your custom HUD Interface; return 1 to disable the original events.\
\
Example:

```lua
require "System\\ScriptCore"

function HudMouseEvent()
        -- Your mouse event function here 

        return 1
end

BridgeFunctionAttach("LuaHudMouseEvent", "HudMouseEvent")
```

***

*(Version 2.7)*\ <mark style="color:yellow;">**LuaHudSkillRender()**</mark>\
\
**Description:**\
Use this bridge to render the skills; return 1 to disable the original skills.\
\
Example:

```lua
require "System\\ScriptCore"

function HudSkillRender()
        -- Your visual skill function here 

        return 1
end

BridgeFunctionAttach("LuaHudSkillRender", "HudSkillRender")
```

***

*(Version 2.7)*\ <mark style="color:yellow;">**LuaHudInterface()**</mark>\
\
**Description:**\
Used to replace the original HUD interface; use return 1 to disable the original HUD interface.\
\
Example:

```lua
require "System\\ScriptCore"

function HudRenderInterface() 
        -- Your visual hud function here 

        return 1
end

BridgeFunctionAttach("LuaHudInterface", "HudRenderInterface")
```

***

*(Version 2.6)*\ <mark style="color:yellow;">**LuaWorkInventory()**</mark>\
\
**Description:**\
Used to launch visual functions, windows, images etc...\
\
Example:

```lua
require "System\\ScriptCore"

function NewWorkInv() 
        -- Your visual function here 
end

BridgeFunctionAttach("LuaWorkInventory", "NewWorkInv")
```

***

*(Version 2.5)*\ <mark style="color:yellow;">**LuaLoadWavFile()**</mark>\
\
**Example of bridge usage:**

```lua
require "System\\ScriptCore"

function WavFilePath()
	LoadWavFile(1, "Data\\Custom\\Sound\\Toasty.wav")
end

BridgeFunctionAttach("LuaLoadWavFile", "WavFilePath")
```

Ponte utilizada para chamar as funções LoadWavFile() para carregamento de arquivos de som no formato .wav.

***

*(Version 2.5)*\ <mark style="color:yellow;">**LuaToolTipBridge(ToolTipTable)**</mark>\
\ <mark style="color:yellow;">ToolTipTable</mark> = Table.\
\
**ToolTip Table:**\ <mark style="color:green;">ToolTip.Type</mark> - <mark style="color:orange;">"Return Item index"</mark>\ <mark style="color:green;">ToolTip.Durability</mark> - <mark style="color:orange;">"Return Item Durability"</mark>\ <mark style="color:green;">ToolTip.Level</mark> - <mark style="color:orange;">"Return Item level"</mark>\ <mark style="color:green;">ToolTip.Skill</mark> - <mark style="color:orange;">"Return Item Skill \[0 or 1]"</mark>\ <mark style="color:green;">ToolTip.Luck</mark> - <mark style="color:orange;">"Return Item Luck \[0 or 1]"</mark>\ <mark style="color:green;">ToolTip.Option</mark> - <mark style="color:orange;">"Return Optiton Life"</mark>\ <mark style="color:green;">ToolTip.Excellent</mark> - <mark style="color:orange;">"Return Excellent Value"</mark>\ <mark style="color:green;">ToolTip.Ancient</mark> - <mark style="color:orange;">"Return Ancient Type"</mark>\ <mark style="color:green;">ToolTip.Socket1</mark> - <mark style="color:orange;">"Return Socket Slot 1 Value"</mark>\ <mark style="color:green;">ToolTip.Socket2</mark> - <mark style="color:orange;">"Return Socket Slot 2 Value"</mark>\ <mark style="color:green;">ToolTip.Socket3</mark>- <mark style="color:orange;">"Return Socket Slot 3 Value"</mark>\ <mark style="color:green;">ToolTip.Socket4</mark> - <mark style="color:orange;">"Return Socket Slot 4 Value"</mark>\ <mark style="color:green;">ToolTip.Socket5</mark> - <mark style="color:orange;">"Return Socket Slot 5 Value"</mark>\ <mark style="color:green;">ToolTip.Periodic</mark> - <mark style="color:orange;">"Return Item Periodic \[0 or 1]"</mark>\
\
**Example of bridge usage:**

```lua
require "System\\ScriptCore"

function ToolTipBridge(ToolTipTable)

	LogText(3, string.format("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d",
	ToolTipTable.Type, ToolTipTable.Durability, ToolTipTable.Level, ToolTipTable.Skill,
	ToolTipTable.Luck, ToolTipTable.Option, ToolTipTable.Excellent, ToolTipTable.Ancient,
	ToolTipTable.Socket1, ToolTipTable.Socket2, ToolTipTable.Socket3, ToolTipTable.Socket4,
	ToolTipTable.Socket5, ToolTipTable.Periodic))

end

BridgeFunctionAttach("LuaToolTipBridge", "ToolTipBridge")
```

***

*(Version 2.3)*\ <mark style="color:yellow;">**LuaObjectAction(Index, Action, Class, Weapon1, Weapon2, Wing, PosX, PosY, SafeZone)**</mark>\
\ <mark style="color:yellow;">Index</mark> = User Index.\ <mark style="color:yellow;">Action</mark> = Movement ID.\ <mark style="color:yellow;">Class</mark> = Character class.\ <mark style="color:yellow;">SafeZone</mark> = <mark style="color:orange;">"Returns 0 for hunting area and 1 for safe area"</mark>\
\ <mark style="color:green;">Bridge used to replace the characters' default movements.</mark>\ <mark style="color:red;">The function depends on the return of the Action argument.</mark>\
\ <mark style="color:blue;">The maximum number of actions for Season 6 Player.bmd is 285, if Season 8 Player.bmd is used the system will automatically increase the limit to 305 actions.</mark>\
\
**Example of Using:**

```lua
require "System\\ScriptCore"

function ActionPlayer(Index,Action,Class,Weapon1,Weapon2,Wing,PosX,PosY,SafeZone)

	if Class == 24 then -- Grand Master Class
		if Action == 11 then
			if MapNumber() ~= 7 and MapNumber() ~= 10 thenus
				Action = 4
			end
		elseif Action == 34 then
			if  MapNumber() ~= 10 then
				if MapNumber() ~= 7 then
					Action = 32
				else
					Action = 33
				end
			end
		elseif Action == 26 then
			if MapNumber() ~= 7 and MapNumber() ~= 10 then
				Action = 32
			end
		end
	end

        return Action;
end

BridgeFunctionAttach("LuaObjectAction", "ActionPlayer")
```

***

*(Version 2.7)*\ <mark style="color:yellow;">**LuaRenderTitle(Player, Monster, PosX, PosY,**</mark>**&#x20;**<mark style="color:yellow;">**hpRate, sdRate**</mark><mark style="color:yellow;">**)**</mark>\
\ <mark style="color:yellow;">Player</mark> = User Index.\ <mark style="color:yellow;">Monster</mark> = Monster Class.\ <mark style="color:yellow;">hpRate</mark> = Returns the HP value from 0 to 100.\ <mark style="color:yellow;">sdRate</mark> = Returns the SD value from 0 to 100.\
\ <mark style="color:red;">Bridge used to render Images over the character as well as the RankUser 2D.</mark>\
\
**Example of Using:**

```lua
require "System\\ScriptCore"

function RenderTitle(Player, Monster, PosX, PosY, hpRate, sdRate)

	if Monster == 602 then
		RenderImage(10000, PosX + 9, PosY - 54, 40, 40, 0, 0, 77.75, 77.75)
	end

	if Player >= 9000 then
		RenderImage(10001, PosX + 9, PosY - 54, 40, 40, 0, 0, 77.75, 77.75)
	end
end

BridgeFunctionAttach("LuaRenderTitle", "RenderTitle")
```

***

*(Version 2.3)*\ <mark style="color:yellow;">**LuaRuneEffect(Character)**</mark>\
\ <mark style="color:yellow;">Character</mark> = Character Table.\
\
**Character Table:**\ <mark style="color:green;">Character.Object</mark> - <mark style="color:orange;">"Used in the first argument of the UserRuneEffect function"</mark>\ <mark style="color:green;">Character.Class</mark> - <mark style="color:orange;">"Character class"</mark>\ <mark style="color:green;">Character.CtrlCode</mark> - <mark style="color:orange;">"Administrative level = 0 none, 8 GM, 32 ADM"</mark>\ <mark style="color:green;">Character.Helm</mark>\ <mark style="color:green;">Character.Armor</mark>\ <mark style="color:green;">Character.Pants</mark>\ <mark style="color:green;">Character.Gloves</mark>\ <mark style="color:green;">Character.Boots</mark>\ <mark style="color:green;">Character.HelmLevel</mark>\ <mark style="color:green;">Character.ArmorLevel</mark>\ <mark style="color:green;">Character.PantsLevel</mark>\ <mark style="color:green;">Character.GlovesLevel</mark>\ <mark style="color:green;">Character.BootsLevel</mark>\ <mark style="color:green;">Character.HandR</mark>\ <mark style="color:green;">Character.HandL</mark>\ <mark style="color:green;">Character.HandRLevel</mark>\ <mark style="color:green;">Character.HandLLevel</mark>\ <mark style="color:green;">Character.Wing</mark>\ <mark style="color:green;">Character.WingLevel</mark>\ <mark style="color:green;">Character.Pet</mark>\ <mark style="color:green;">Character.MonsterIndex</mark> - <mark style="color:orange;">"Monster Class"</mark>\ <mark style="color:green;">Character.UserIndex</mark> - <mark style="color:orange;">"User Index"</mark>\
\&#xNAN;*(Version 2.7)* <mark style="color:green;">Character.PKLevel</mark>\
\&#xNAN;*(Version 2.7)* <mark style="color:green;">Character.Gens</mark> - <mark style="color:orange;">"0 - None | 1 - Duprian | 2 - Vanert"</mark>\
\&#xNAN;*(Version 2.7)* <mark style="color:green;">Character.Kind</mark> - <mark style="color:orange;">"1 - Player | 2 - Monster | 4 - NPC"</mark>\
\&#xNAN;*(Version 2.7)* <mark style="color:green;">Character.GuildName</mark>\
\
**Example of using the bridge in conjunction with the UserRuneEffect function:**

<pre class="language-lua"><code class="lang-lua">require "System\\ScriptCore"

function RuneEffect(Character)
        if Character.Armor == 4196 then
                UserRuneEffect(Character.Object, 700118, 2.0, 0.1, 0.5, 0.0, 0.5)
        end

<strong>        if Character.MonsterIndex == 275 then
</strong>		UserRuneEffect(Character.Object, 700118, 5.0, 0.2, 0.2, 1.0, -0.5)
	end
end

BridgeFunctionAttach("LuaRuneEffect", "RuneEffect")
</code></pre>

***

<mark style="color:yellow;">**LuaWorkSS()**</mark>\
\
**Description:**\
Activates only on Select Server.\
Used to launch visual functions, windows, images etc...\
\
Example:

```lua
require "System\\ScriptCore"

function NewWorkSS() 
        -- Your visual function here 
end

BridgeFunctionAttach("LuaWorkSS", "NewWorkSS")
```

***

<mark style="color:yellow;">**LuaWorkSC()**</mark>\
\
**Description:**\
Activates only on Select Character.\
Used to launch visual functions, windows, images etc...\
\
**Example:**

```lua
require "System\\ScriptCore"

function NewWorkSC() 
        -- Your visual function here 
end

BridgeFunctionAttach("LuaWorkSC", "NewWorkSC")
```

***

<mark style="color:yellow;">**LuaWorkMH()**</mark>\
\
**Description:**\
Used to launch visual functions, windows, images etc...\
\
**Example:**

```lua
require "System\\ScriptCore"

function NewWorkMH() 
        -- Your visual function here 
end

BridgeFunctionAttach("LuaWorkMH", "NewWorkMH")
```

***

<mark style="color:yellow;">**LuaWork()**</mark>\
\
**Description:**\
Used to launch visual functions, windows, images etc...\
\
**Example:**

```lua
require "System\\ScriptCore"

function NewWork() 
        -- Your visual function here 
end

BridgeFunctionAttach("LuaWork", "NewWork")
```

***

<mark style="color:yellow;">**LuaLoadImages()**</mark>\
\
**Description:**\
Hook function for loading images, use with LoadImage()\
\
**Example:**

```lua
require "System\\ScriptCore"

function NewLoad() 
        LoadImage("Interface\\NewRender\\Exemple.tga", 200000) 
        -- Use image ID from 200000 onwards 
end

BridgeFunctionAttach("LuaLoadImages", "NewLoad")
```

***

<mark style="color:yellow;">**LuaMouseEvent()**</mark>\
\
**Description:**\
Used to initiate keyboard and mouse functions\
\
**Example:**

```lua
require "System\\ScriptCore"

function NewEvent() 
        if CheckMouseIn(X,Y,W,H) then 
                if IsRelease(0x4E) then
                        PlaySound(25)
                end
                return true -- Not Walk   
        end 
        return false -- Walk
end

BridgeFunctionAttach("LuaMouseEvent", "NewEvent")
```

***

<mark style="color:yellow;">**LuaEntryProc()**</mark>\
\
**Description:**\
Starts functions that will be loaded once when opening Main.exe\
\
**Example:**

```lua
require "System\\ScriptCore"

function NewProc()         
        -- Open Main.exe with Debug Window 
end

BridgeFunctionAttach("LuaEntryProc", "NewProc")
```

***

<mark style="color:yellow;">**LuaPacketRecv(aIndex, String)**</mark>\
\
**Description:**\
Starts a function that receives packets from the GameServer\
\
**Example:**

```lua
require "System\\ScriptCore" 
require "System\\ScriptDefines" 

local JoiaCunt = {"", "", "", "", "", "", "", "", "", ""}

function JBRecv(aIndex, str) 
        if (obterElemento(str, 0) == "JewelBank") then 
                if (obterElemento(str, 1) == "Open") then 
                        JoiaCunt[1] = obterElemento(str, 2) 
                        JoiaCunt[2] = obterElemento(str, 3) 
                        JoiaCunt[3] = obterElemento(str, 4) 
                        JoiaCunt[4] = obterElemento(str, 5) 
                        JoiaCunt[5] = obterElemento(str, 6) 
                        JoiaCunt[6] = obterElemento(str, 7) 
                        JoiaCunt[7] = obterElemento(str, 8) 
                        JoiaCunt[8] = obterElemento(str, 9) 
                        JoiaCunt[9] = obterElemento(str, 10) 
                        JoiaCunt[10] = obterElemento(str, 11)
                end 
        end 
end

BridgeFunctionAttach("LuaPacketRecv", "NewRecv")
```

***
