ZO LinkHandler CreateLink

From ESOUI Wiki

Jump to: navigation, search

Contents

Link Handling in ESO

ZO_LinkHandler_CreateLink() is used to create clickable links

They can be links to : Item, Achievement, CharacterName, Channel, Book, DisplayName, An addon can also register its own type and then execute some code when you clic on it

The function ZO_LinkHandler_CreateLink() itself contain arguments :

ZO_LinkHandler_CreateLink(string textDisplayed, linkStyle color, string linkType, ...)

textDisplayed

textDisplayed is the text which will be displayed


LinkStyle color

A linkStyle color (can be nil, because this argument is ignored


LinkHandler

A Variable from zo_linkhandler list

Data

Here, you can pass many argument as you want, please note that the data format will be string, you'll need to use tonumber() function if you want to get back your number format


DISPLAY_NAME_LINK_TYPE

A displayName link can be done easily with :

-- displayName = "@exemple"
local link = ZO_LinkHandler_CreateDisplayNameLink(displayName)
-- link will display [@exemple] : Clicking on it will handle Displayame functions for display name @exemple (whisp, right clic, etc)

Advanced users can hack the Handler with ZO_LinkHandler_CreateLink

-- displayName = "@exemple" , -- stringToDisplay = "John"
local link = ZO_LinkHandler_CreateLink(stringToDisplay, nil, DISPLAY_NAME_LINK_TYPE, displayName)
-- link will display [John] : Clicking on it will handle Displayame functions for display name @exemple (whisp, right clic, etc)

Expert users can use string.format() too

Please note DisplayNameLink pattern :

|H1:display:%s|h%s|h
-- displayName = "@exemple" , -- stringToDisplay = "Sandy"
local link
link = string.format("|H1:display:%s|h%s|h", displayName, stringToDisplay)
-- link will display Sandy (without Brackets) : Clicking on it will handle Displayame functions for display name @exemple (whisp, right clic, etc)


CHARACTER_LINK_TYPE

A CharacterName link can be done easily with :

-- CharacterName = "Emily"
local link = ZO_LinkHandler_CreatePlayerLink(CharacterName)
-- link will display [Emily] : Clicking on it will handle CharacterName functions for CharacterName Emily (whisp, right clic, etc)
-- Please also note that a DisplayName can be passed to ZO_LinkHandler_CreatePlayerLink(), it will call ZO_LinkHandler_CreateDisplayNameLink()

or

-- CharacterName = "Emily"
local link = ZO_LinkHandler_CreateCharacterLink(CharacterName)
-- link will display [Emily] : Clicking on it will handle CharacterName functions for CharacterName Emily (whisp, right clic, etc)


Advanced users can hack the Handler with ZO_LinkHandler_CreateLink

-- CharacterName = "Emily" , -- stringToDisplay = "Emma"
local link = ZO_LinkHandler_CreateLink(stringToDisplay, nil, CHARACTER_LINK_TYPE, CharacterName)
-- link will display [Emma] : Clicking on it will handle CharacterName functions for CharacterName  Emily (whisp, right clic, etc)

Expert users can use string.format() too

Please note CharacterName pattern :

For Males Characters

|H1:character:%s%^Mx|h%s|h

or For Female Characters

|H1:character:%s%^Fx|h%s|h
-- CharacterName = "Emily" , -- stringToDisplay = "Max"
local link
link = string.format("|H1:character:%s%^Fx|h%s|h", CharacterName, stringToDisplay)
-- link will display Max (without Brackets) : Clicking on it will handle CharacterName functions for CharacterName Emily (whisp, right clic, etc)


CHANNEL_LINK_TYPE

A ChannelName link could be done easily with ZO_LinkHandler_CreateChannelLink(MsgChannelType chanCode) but it will result to display the chanCode between brackets So, developpers should use :

-- newName = "MyGuild"
local link = ZO_LinkHandler_CreateLink(newName, nil, CHANNEL_LINK_TYPE,  CHAT_CHANNEL_GUILD_1)
-- link will display [MyGuild] : Clicking on it will handle ChannelName functions for Channel CHAT_CHANNEL_GUILD_1

Expert users can use string.format() too

Please note CharacterName pattern :

|H1:channel:%s|h%s|h
-- chanCode = CHAT_CHANNEL_GUILD_1, -- stringToDisplay = "Ultimate Guild"
local link
link = string.format("|H1:channel:%s|h%s|h", chanCode, stringToDisplay)
-- link will display Ultimate Guild (without Brackets) : Clicking on it will handle ChannelName functions for Channel CHAT_CHANNEL_GUILD_1


ITEM_LINK_TYPE

A ItemName link can be done with ZO_LinkHandler_CreateLink() :

I will require few comprehension to the 21 optionnal parameters but needed to write an Item Link

Expert users can use string.format() too

Please note ItemNameLink pattern :

|H%d:item:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s|h|h


stringToDisplay

string stringToDisplay Here we can put whatever we want to display, it will be the item name, please note that this information is facultative if itemID is correct


Optional parameters

All optional parameters are integers, please note, all those information cannot be verified easily

#1 itemID

itemID should be the correct itemID of the item

#2 Quality

Quality is the Quality level of the item for armors and weapons Please note that many more Quality ID have been found in game

0 : grey

1 : white

2 : green (also AvA consumables)

3 : blue

4 : purple (but also Treasure Scrolls and guild crests)

5 : yellow

7 : non-veteran Named Blue Boss loots

8 : non-veteran Named Purple Boss loots

9 : Trophies


30 : White materials

31 : Green materials

32 : Blue materials

33 : Purple materials

34 : yellow materials


49 : Unique items

50 : Named items

65 : veteran Named Blue Boss loots

75 : veteran Named Purple Boss loots

100 : some veteran purple item

124 : Mara Ring

164 : Purple Glyphs

175 : Pets

229 : Set item (multiple set use this id)

247 : Set item (multiple set use this id)

250 : Set item (multiple set use this id)

257 : Set item (multiple set use this id)

258 : Set item (multiple set use this id)


#3 Level Requirement

0-50 is the level requirement of your item, highter values can be accepted


#4 Enchantment Type

Here are a few ID's for enchantment types (04)

45871 - Reduce Feat Cost

26847 - Disease Resist

26578 - Reduce Targets Armor by xx for xx seconds

26579 - Adds XX Max Stamina

26580 - Adds Health

26581 - Adds Health Recovery

26582 - Adds Magicka

26583 - Adds Magicka Recovery

26586 - Adds Poison Resistance

26587 - Deals Poison Damage

26588 - Adds Stamina

26589 - Adds Stamina Recovery

26590 - Vampire Slaying (Deals x fire damage to vampires)

26591 - Reduce targets Power by xx for xx seconds

5365 - Adds Frost Damage

26844 - Adds Shock Damage

26848 - Adds Flame Damage


#5 Enchantment Strength

#6 Enchantment Strength

?


#16 Style

The style may be:

00 - ITEMSTYLE_NONE - None

01 - ITEMSTYLE_RACIAL_BRETON - Breton

02 - ITEMSTYLE_RACIAL_REDGUARD - Redguard

03 - ITEMSTYLE_RACIAL_ORC - Orc

04 - ITEMSTYLE_RACIAL_DARK_ELF - Dunmer

05 - ITEMSTYLE_RACIAL_NORD - Nord

06 - ITEMSTYLE_RACIAL_ARGONIAN - Argonian

07 - ITEMSTYLE_RACIAL_HIGH_ELF - Altmer

08 - ITEMSTYLE_RACIAL_WOOD_ELF - Bosmer

09 - ITEMSTYLE_RACIAL_KHAJIIT - Khajit

10 - ITEMSTYLE_UNIQUE - Unique

11 - ITEMSTYLE_ORG_THIEVES_GUILD - Thieves Guild

12 - ITEMSTYLE_ORG_DARK_BROTHERHOOD - Dark Brotherhood

13 - ITEMSTYLE_DEPRECATED1 - Deprecated

14 - ITEMSTYLE_AREA_DWEMER - Dwemer

15 - ITEMSTYLE_AREA_ANCIENT_ELF - Ancient Elf

16 - ITEMSTYLE_AREA_IMPERIAL - Imperial

17 - ITEMSTYLE_AREA_REACH - Reach (Barbaric)

18 - ITEMSTYLE_ENEMY_BANDIT - Bandit

19 - ITEMSTYLE_ENEMY_PRIMITIVE - Primitive

20 - ITEMSTYLE_ENEMY_DAEDRIC - Daedric

21 - ITEMSTYLE_DEPRECATED2 - Deprecated

22 - ITEMSTYLE_DEPRECATED3 - Deprecated

23 - ITEMSTYLE_DEPRECATED4 - Deprecated

24 - ITEMSTYLE_DEPRECATED5 - Deprecated

25 - ITEMSTYLE_DEPRECATED6 - Deprecated

26 - ITEMSTYLE_DEPRECATED7 - Deprecated

27 - ITEMSTYLE_RAIDS_CRAGLORN - Craglorn

28 - ITEMSTYLE_DEPRECATED8 - Deprecated

29 - ITEMSTYLE_DEPRECATED9 - Deprecated

30 - ITEMSTYLE_DEPRECATED10 - Deprecated

31 - ITEMSTYLE_ENEMY_DRAUGR - Draugr

32 - ITEMSTYLE_ENEMY_MAORMER - Maomer

33 - ITEMSTYLE_AREA_AKAVIRI - Akaviri

34 - ITEMSTYLE_RACIAL_IMPERIAL - Imperial

35 - ITEMSTYLE_AREA_YOKUDAN - Yokudan


#17 Crafted State

0 Not crafted

1 Crafted


#18 Bound State

0 Not bound

1 Bound


#19 Stolen State

0 Not stolen

1 Stolen


#20 Enchant charges / Condition

Arg #20 is Enchant charges status for weapons and condition for armor


#21 Instance data

Crafted potions' effects are encoded here, as up to three 8-bit effect IDs. The least significant byte is the third effect.

arg21 = tonumber(arg21)
effect1 = math.floor(arg21 / 65536) % 256
effect2 = math.floor(arg21 / 256) % 256
effect3 = arg21 % 256

Example: Solution of Invisibility

 "|H1:item:44715:30:40:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1441792|h|h"
 1441792 == 0x160000
 effect1 == 0x16 ... Invisibility

Example: Solution of Health + Restore Stamina

 "|H1:item:54339:30:40:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:66816|h|h"
 66816 == 0x010500
 effect1 == 0x01 ... Restore Health (Major Fortitude)
 effect2 == 0x05 ... Restore Stamina (Major Endurance)

Example: Solution of Spell Critical + Restore Health + Restore Magicka

 "|H1:item:30141:30:40:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:983299|h|h"
 983299 == 0x0f0103
 effect1 == 0x0f ... Spell Critical (Major Prophecy)
 effect2 == 0x01 ... Restore Health (Major Fortitude)
 effect3 == 0x03 ... Restore Magicka (Major Intelect)

Example: Solution of Detection + Spell Damage + Restore Magicka

 "|H1:item:30142:30:40:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1379075|h|h"
 1379075 == 0x150b03
 effect1 == 0x15 ... Stealth Detection
 effect2 == 0x0b ... Spell Damage (Major Sorcery)
 effect3 == 0x03 ... Restore Magicka (Major Intelect)

Example of Data

45147:4:12:26580:4:12:0:0:0:0:0:0:0:0:0:4:0:0:10000:0

1: 45147 - Rawhide Boots

2: 4 - Blue/Superior

3: 12 - Level 12 required

4: 26580 - Adds XX Health

5-6: (4:12) - Strength of Health Buff (13 max health)

16: 4 = Dunmer

17: 0 = Not crafted

18: 0 = Not bound

19: 0 = Not stolen

20: 10000 = Fully repaired


Some example code to use in game

The following lines when pasted in game will create clickable links where you can easily see how the item quality affects the tooltip link.

/script d(ZO_LinkHandler_CreateLink("Test Trash", nil, ITEM_LINK_TYPE, 45336, 1, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 10000, 0)) -- Trash 100% more
/script d(ZO_LinkHandler_CreateLink("Test Normal", nil, ITEM_LINK_TYPE, 45336, 2, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 10000, 0)) -- Normal Sell 125% more
/script d(ZO_LinkHandler_CreateLink("Test Green", nil, ITEM_LINK_TYPE, 45336, 3, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 10000, 0)) -- Green, 150% more
/script d(ZO_LinkHandler_CreateLink("Test Blue", nil, ITEM_LINK_TYPE, 45336, 4, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 10000, 0)) -- Blue, 175% more
/script d(ZO_LinkHandler_CreateLink("Test Purple", nil, ITEM_LINK_TYPE, 45336, 5, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 10000, 0)) -- Purple, 200% more
/script d(ZO_LinkHandler_CreateLink("Test Gold", nil, ITEM_LINK_TYPE, 45336, 6, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 10000, 0)) -- Legendary 225% more
-- And just for fun:
/script d(ZO_LinkHandler_CreateLink("Godlike", nil, ITEM_LINK_TYPE, 45336, 7, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 1, 10000, 0)) -- Stolen Legendary 225% more
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox