EVENT EXPERIENCE UPDATE

From ESOUI Wiki

Jump to: navigation, search

This event fires when the player gains experience.

Parameters

EVENT_EXPERIENCE_UPDATE (string unitTag, integer currentExp, integer maxExp, integer reason)

string unitTag - The Unit that is affected. This is "player" by default.

integer currentExp - The new current XP for the unit.

integer maxExp - The Exp required to level-up.

integer reason - What triggered the XP gain.

Reason Codes / Notes

Experience Reason Handles

-

Reason IDs

-1 - PROGRESS_REASON_NONE

0 - PROGRESS_REASON_KILL (Called whenever a player gets an assist or killing blow on an enemy)

1 - PROGRESS_REASON_QUEST

2 - PROGRESS_REASON_COMPLETE_POI

3 - PROGRESS_REASON_DISCOVER_POI

4 - PROGRESS_REASON_COMMAND

5 - PROGRESS_REASON_KEEP_REWARD (Called periodically for defending a keep)

6 - PROGRESS_REASON_BATTLEGROUND

7 - PROGRESS_REASON_SCRIPTED_EVENT (Example: Daedric Ambush)

8 - PROGRESS_REASON_MEDAL

9 - PROGRESS_REASON_FINESSE

10 - PROGRESS_REASON_LOCK_PICK (Called when unlocking a chest)

11 - PROGRESS_REASON_COLLECT_BOOK

12 - PROGRESS_REASON_SKILL_BOOK

13 - PROGRESS_REASON_ACTION

14 - PROGRESS_REASON_SKILL_GUILD_REP

15 - PROGRESS_REASON_SKILL_AVA

16 - PROGRESS_REASON_SKILL_TRADESKILL

17 - PROGRESS_REASON_REWARD

18 - PROGRESS_REASON_SKILL_TRADESKILL_ACHIEVEMENT

19 - PROGRESS_REASON_SKILL_TRADESKILL_QUEST

20 - PROGRESS_REASON_SKILL_TRADESKILL_CONSUME

21 - PROGRESS_REASON_SKILL_TRADESKILL_HARVEST

22 - PROGRESS_REASON_SKILL_TRADESKILL_RECIPE

23 - PROGRESS_REASON_SKILL_TRADESKILL_TRAIT

24 - PROGRESS_REASON_OVERLAND_BOSS_KILL

(Source)

Simple Usage Example

  MyAddon = {}
  MyAddon.name = "MyAddonName"
  MyAddon.currentXP = GetUnitXP('player')
   function MyAddOn:OnXPUpdate( eventCode, unitTag, currentExp, maxExp, reason )
       if ( unitTag ~= 'player' ) then return end
       local XPgain = currentExp - MyAddon.currentXP
       d("You gained " .. XPgain .. " experience.")
       MyAddon.currentXP = currentExp
   end
  EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_EXPERIENCE_UPDATE, MyAddon.OnXPUpdate)
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox