Thread Tools Display Modes
07/05/14, 04:58 AM   #1
Flagrick
 
Flagrick's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 24
How to determine Guilds XP/reputation with EVENT_SKILL_XP_UPDATE ?

Hello there,

I try to differentiate Xp received on the event
Code:
EVENT_SKILL_XP_UPDATE (SKILLTYPE, skillIndex, reason, rank, previousXP, currentXP).
the goal would be to know when XP is:
  • the Warriors' Guild
  • the Mages Guild
  • or the last I can not remember the name

To filter the guild Xp I use that :
Code:
SKILLTYPE == SKILL_TYPE_GUILD
I guess I should specify the guild with skillindex but how? what are the constants ?

I have the name of the guild with
Code:
local skill = GetSkillLineInfo (SKILLTYPE, skillIndex)
but I would like that this is not depandant language client.
  Reply With Quote
07/05/14, 05:41 AM   #2
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
Hey,
I think the skillIndex is dynamic so with one character it can be 2 but with other - 1. It's that way because:

Lua Code:
  1. for skillIndex=1,GetNumSkillLines(SKILL_TYPE_GUILD) do
  2.     d("Name: "..GetSkillLineInfo(SKILL_TYPE_GUILD, skillIndex)
  3. end

So if you're only member of the Mages guild, then the guild skillIndex is 1, but if you're only member of the Figters guild, then the guild skillIndex is also 1. Looks like the only way is to check the skill name.

When your addon is loaded you can do:

Lua Code:
  1. local magesGuild = 0
  2. local fightersGuild = 0
  3. local undaunted = 0
  4.  
  5. local function SetGuildIndex(skillIndex)
  6.     local guildName = GetSkillLineInfo(SKILL_TYPE_GUILD, skillIndex)
  7.     if guildName == "Fighters Guild" then
  8.         fightersGuild = skillIndex
  9.     elseif guildName == "Mages Guild" then
  10.         magesGuild = skillIndex
  11.     elseif guildName == "Undaunted" then
  12.         undaunted = skillIndex
  13.     end
  14. end
  15.  
  16. for skillIndex=1,GetNumSkillLines(SKILL_TYPE_GUILD) do
  17.     SetGuildIndex(skillIndex)
  18. end
Of course you should use localized names instead.

You must also remember that you start without any guild skill. So you should respond to the EVENT_SKILL_LINE_ADDED event, like this:

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("someuniquename", EVENT_SKILL_LINE_ADDED, function(_, skillType, skillIndex)
  2.     if skillType == SKILL_TYPE_GUILD then
  3.         SetGuildIndex(skillIndex)
  4.     end
  5. end)
  Reply With Quote
07/05/14, 10:59 AM   #3
Flagrick
 
Flagrick's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 24
I have done something like that:

Lua Code:
  1. -------------------------------------------------------------------------------
  2. --TESO GUILDS TYPES
  3. -- 0 : unknow
  4. -- 1 : fighter, guerrier, kämpfer
  5. -- 2 : mage, mage, magier
  6. -- 3 : Undaunted, indomptable, ???
  7. function MyGetGuildType(skillType,  skillIndex)
  8.     local GuildTypeRet=0
  9.    
  10.     if (skillType ~= SKILL_TYPE_GUILD) then return GuildTypeRet end
  11.    
  12.     local skillName = GetSkillLineInfo(skillType, skillIndex)
  13.     skillName:lower()
  14.    
  15.     if ( (string.find(skillName, "fighter") ~= nil) or (string.find(skillName, "guerrier") ~= nil) or (string.find(skillName, "kämpfer") ~= nil)) then
  16.         GuildTypeRet=1
  17.     elseif ( (string.find(skillName, "mage") ~= nil ) or (string.find(skillName, "magier") ~= nil )) then
  18.         GuildTypeRet=2
  19.     --elseif ( (string.find(skillName, "undaunted") ~= nil) or (string.find(skillName, "indomptable") ~= nil) )
  20.     else
  21.         GuildTypeRet=3
  22.     end
  23.    
  24.     return GuildTypeRet
  25. end

Works in english, french and perhaps in German (i was not sure for the guils name and with german word for undaunted.

Last edited by Flagrick : 07/05/14 at 02:43 PM.
  Reply With Quote
07/05/14, 02:20 PM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Flagrick View Post
Works in english, french and perhaps in German (i was not sure for the guils name and with german word for undaunted.

English (/script SetCVar("language.2", "en")):
1 - Fighters Guild
2 - Mages Guild
3 - Undaunted

German (/script SetCVar("language.2", "de")):
1 - Kriegergilde^fd
2 - Magiergilde^fd
3 - Unershrockene^pd

French (/script SetCVar("language.2", "fr")):
1 - Guilde des guerriers
2 - Guilde des mages^f
3 - Indomptable^M
  Reply With Quote
07/05/14, 02:43 PM   #5
Flagrick
 
Flagrick's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 24
Thx Garkin ;-)

so the final code is:
Lua Code:
  1. -------------------------------------------------------------------------------
  2. --TESO GUILDS TYPES
  3. -- 0 : unknow
  4. -- 1 : fighter, guerrier, krieger
  5. -- 2 : mage, mage, magier
  6. -- 3 : Undaunted, indomptable, unershrockene
  7. function MyGetGuildType(skillType,  skillIndex)
  8.     local GuildTypeRet=0
  9.    
  10.     if (skillType ~= SKILL_TYPE_GUILD) then return GuildTypeRet end
  11.    
  12.     local skillName = GetSkillLineInfo(skillType, skillIndex)
  13.     skillName:lower()
  14.    
  15.     if ( (string.find(skillName, "fighter") ~= nil) or (string.find(skillName, "guerrier") ~= nil) or (string.find(skillName, "krieger") ~= nil)) then
  16.         GuildTypeRet=1
  17.     elseif ( (string.find(skillName, "mage") ~= nil ) or (string.find(skillName, "magier") ~= nil )) then
  18.         GuildTypeRet=2
  19.     elseif ( (string.find(skillName, "undaunted") ~= nil) or (string.find(skillName, "indomptable") ~= nil) or (string.find(skillName, "unershrockene") ~= nil) ) then
  20.         GuildTypeRet=3
  21.     end
  22.  
  23.     return GuildTypeRet
  24. end
  25. -------------------------------------------------------------------------------

Last edited by Flagrick : 07/06/14 at 12:39 PM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How to determine Guilds XP/reputation with EVENT_SKILL_XP_UPDATE ?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off