User:The Nerevarine

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search
ON-banner-Aldmeri Dominion.png ON-banner-Aldmeri Dominion.png

TES related

User-userbox-Morrowind.gif This user played Morrowind.
User-userbox-Tribunal Logo.png This user played the Tribunal expansion to Morrowind.
User-userbox-Bloodmoon.jpg This user played the Bloodmoon expansion to Morrowind.
MW-birthsign-Mage.jpg This user was born under the sign of The Mage.
User-Userbox-Vivecdead.jpg This user killed Vivec before confronting Dagoth Ur.
User-userbox-Oblivion.png This user played Oblivion.
OBbsign Mage.jpg This user was born under the sign of The Mage.
SR-icon-logo.jpg This user played Skyrim until the change of the EULA in December 2012.
ON-icon-logo.jpg This user plays Elder Scrolls Online on the European PC server.
Character(s): Azhai
ON-icon-logo.jpg This user is member of the UESP ESO guild on the European PC server.

UESP related

Wiki.png This user has been on UESPWiki for 17 years, 10 months, and 23 days.

Misc

47px-Flag_of_Germany.svg.pngde Dieser Benutzer spricht Deutsch als Muttersprache.
47px-Flag_of_the_United_Kingdom.svg.pngen-2 This user is able to communicate with an intermediate level of English.
User-userbox-PC Icon.png This user plays on a Windows PC.
MaleIcon.png This user is male.
ENTJ
This user has an ENTJ
Myers-Briggs Type Indicator
SR-icon-misc-Lute.png This user is a fan of heavy metal music.

Contact[edit]

If someone wants to discuss for some reason contributions, modifications or just wants to communicate for some trivial reasons, just leave a message on my talk page.

Tasks[edit]

A List to remind me what i want to do

  • Propose a concept for NPC categorization by location/city according to this discussion. Be ready to be the one to have to implement it.

Fast Access[edit]

Fast Access Tools and Links for my convenience

General[edit]

The Elder Scrolls Online (ESO)[edit]

Vendors[edit]

Other NPC of Interest[edit]

Named Usable Items[edit]

Sets[edit]

ESO - XML logging[edit]

Schema Definitions[edit]

Schema definitions follow the data structures gained from the pubic part of the ESO API as close as possible.

Transformations[edit]

NPC Data[edit]

Originally I planned to provide the xslt files i used earlier to transform the xml files into a wikisyntax template. I realised that there would be much confusing explanation how to fill the gaps, when to remove what part, when a certain part would be inappropriate... and so on. So i wrote a small GUI tool to support that transformation and easy filling of the data gaps.

It is still highly beta (missing some "you have forgotten to.." and "you can't do that without..." checks), but used correctly it fulfills its task smoothly. Don't forget to read the README.txt. The software comes of course without any warranty and if you decide to use it, you do it on your own risk. Ah yes, and Java 7 will be required to run it. So if you still want to give it a try: The Nerevarines Tool Set (zip file, ~430 KB).

lua data acquisition (logger)[edit]

I decided for a modular approach, so the core framework handles the general events and has methods usable for all modules, while the modules take care of the data acquisition of their respective type. I have not figured out yet how to separate and dynamically load the modules from different files with that clumsy script "language". so the first module and the core comes together in one lua script:

the xml file[edit]

<GuiXml>
    <Controls>
        <TopLevelControl name="The Nerevarine's Tool Set" hidden="true" movable="true">
            <OnUpdate>
                TNTS.onUpdate()
            </OnUpdate>
        </TopLevelControl>
    </Controls>
</GuiXml>

I admit, i have no clue if that above is really necessary or optimal for an AddOn without GUI elements, but it's what i got from the examples i looked at and it works, so... *shrug*

the txt file[edit]

## Title: The Nerevarine's Tool Set
## Author: The Nerevarine
## Version: 0.1
## APIVersion: 100004
## SavedVariables: tntsLog

TNTS.lua
TNTS.xml

the lua file[edit]

TNTS = { NPCM = {} }

TNTS.NPCM.skippedNpcNames = {
  Familiar = true,
  Cat = true,
  Rat = true,
  Lizard = true,
  Mudcrab = true,
  Horse = true,
  Snake = true,
  Scorpion = true,
  Beetle = true,
  Fox = true,
  Goat = true,
  Chicken = true,
  Dog = true,
  Rabbit = true,
  Clannfear = true,
  Frog = true,
  Deer = true,
  Spider = true,
  Torchbug = true,
  Pig = true, 
  Sheep = true,
  Cow = true,
  Butterfly = true,
  Squirrel = true,
  Centipede = true,
  Fleshflies = true,
  Monkey = true,
  Wasp = true,
  Honor = true,
  Scuttler = true,
  Scrib = true,
  ["Bantam Guar"] = true,
  ["Razak's Opus"] = true,
  ["Draft Horse"] = true,
  ["Light Horse"] = true,
  ["Restoring Twilight"] = true,
  ["Winged Twilight"] = true,
  ["Twilight Matriarch"] = true,
  ["Volatile Familiar"] = true,
  [""] = true
}

TNTS.NPCM.reactionTypeNames = {
    [UNIT_REACTION_DEFAULT]     = "default",
    [UNIT_REACTION_INTERACT]    = "interact",
    [UNIT_REACTION_DEAD]        = "dead",
    [UNIT_REACTION_HOSTILE]     = "hostile",
    [UNIT_REACTION_NEUTRAL]     = "neutral",
    [UNIT_REACTION_FRIENDLY]    = "friendly",
    [UNIT_REACTION_PLAYER_ALLY] = "pc ally",
    [UNIT_REACTION_NPC_ALLY]    = "ally"
}

TNTS.NPCM.difficultyNames = {
    [MONSTER_DIFFICULTY_NONE]   = "none",
    [MONSTER_DIFFICULTY_EASY]   = "easy",
    [MONSTER_DIFFICULTY_NORMAL] = "normal",
    [MONSTER_DIFFICULTY_HARD]   = "hard",
    [MONSTER_DIFFICULTY_DEADLY] = "deadly"
}

function TNTS.NPCM.onReticleTargetChanged(eventCode)
    if (not TNTS.loaded) then return end
    if (not IsUnitPlayer("reticleover")) then
        local name = GetUnitName("reticleover")
        if (not TNTS.NPCM.skippedNpcNames[name]) then
            local msg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            msg = msg .. "<npc xmlns=\"http://org.example.esologging/npc\"\n"
            msg = msg .. "     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
            msg = msg .. "     xsi:schemaLocation=\"http://org.example.esologging/npc NPC.xsd\"\n"
            msg = msg .. "     name=\"" .. name .. "\"\n"
    
            msg = msg .. "     level=\"" .. GetUnitLevel("reticleover") .. "\"\n"

            local gender = GetUnitGender("reticleover")
            local genderName
            if (gender == 0) then
              genderName = "Neutrum"
            elseif (gender == 1) then
              genderName = "Female"
            elseif (gender == 2) then
              genderName = "Male"
            else
              genderName = gender
            end
            msg = msg .. "     gender=\"" .. genderName .. "\"\n"

            msg = msg .. "     difficulty=\"" .. TNTS.NPCM.difficultyNames[GetUnitDifficulty("reticleover")] .. "\"\n"

            msg = msg .. "     reaction=\"" .. TNTS.NPCM.reactionTypeNames[GetUnitReaction("reticleover")] .. "\"\n"
            
            msg = msg .. "     trader=\"" .. TNTS.toString(CanUnitTrade("reticleover")) .. "\"\n"

            msg = msg .. "     attackable=\"" .. TNTS.toString(IsUnitAttackable("reticleover")) .. "\"\n"

            msg = msg .. "     dead=\"" .. TNTS.toString(IsUnitDead("reticleover")) .. "\"\n"

            msg = msg .. "     type=\"" .. GetUnitType("reticleover") .. "\"\n"

            local curH, maxH, effH = GetUnitPower("reticleover", POWERTYPE_HEALTH)
            msg = msg .. "     health=\"" .. maxH .. "\"\n"

            local curM, maxM, effM = GetUnitPower("reticleover", POWERTYPE_MAGICKA)
            msg = msg .. "     magicka=\"" .. maxM .. "\"\n"

            local curS, maxS, effS = GetUnitPower("reticleover", POWERTYPE_STAMINA)
            msg = msg .. "     stamina=\"" .. maxS .. "\"\n"

            local follower = IsUnitFriendlyFollower("reticleover");
            msg = msg .. "     follower=\"" .. TNTS.toString(follower) .. "\">\n"

            local caption = GetUnitCaption("reticleover")
            if (caption and caption ~= "") then
                msg = msg .. "    <caption>" .. TNTS.xmlEscape(caption) .. "</caption>\n"
            end

            local rawName = GetRawUnitName("reticleover")
            if (rawName and rawName ~= "") then
                msg = msg .. "    <raw>" .. TNTS.xmlEscape(rawName) .. "</raw>\n"
            end

            local class = GetUnitClass("reticleover")
            msg = msg .. "    <class id=\"" .. GetUnitClassId("reticleover") .. "\""
            if (class and class ~= "") then
                msg = msg .. ">" .. TNTS.xmlEscape(class) .. "</class>\n"
            else
                msg = msg .. " />\n"
            end

            local zone = GetUnitZone("reticleover")
            if (zone and zone ~= "") then
                msg = msg .. "    <zone>" .. TNTS.xmlEscape(zone) .. "</zone>\n"
            end

            local location = GetPlayerLocationName()
            if (location and location ~= "") then
                msg = msg .. "    <location>" .. TNTS.xmlEscape(location) .. "</location>\n"
            end

            local drowntime = GetUnitDrownTime("reticleover")
            if (drowntime) then
                msg = msg .. "    <drowntime>" .. TNTS.xmlEscape(drowntime) .. "</drowntime>\n"
            end

            local race = GetUnitRace("reticleover")
            if (race and race ~= "") then
                msg = msg .. "    <race>" .. TNTS.xmlEscape(race) .. "</race>\n"
            end

            local title = GetUnitTitle("reticleover")
            if (title and title ~= "") then
                msg = msg .. "    <title>" .. TNTS.xmlEscape(title) .. "</title>\n"
            end
            
            msg = msg .. "</npc>\n"
            
            local save = savedVars["TNTS"]
            if (not save.NPCM) then
                save.NPCM = {}
            end
            if (not save.NPCM[name]) then
                save.NPCM[name] = msg
                savedVars["TNTS"] = save
            end
        end
    end
end

function TNTS.NPCM.onPlayerActivated ( ... )
    EVENT_MANAGER:RegisterForEvent ( "NPCModule" , EVENT_RETICLE_TARGET_CHANGED      , TNTS.NPCM.onReticleTargetChanged )
end

-- The Nerevarine's Tool Set core --

TNTS.loaded = false

function TNTS.toString(boolVal)
  local stringVal = "false"
  if (boolVal) then stringVal = "true" end
  return stringVal
end

function TNTS.xmlEscape (text)
    local result = string.gsub(text,"&","&")
    result = string.gsub(result,"<","<")
    return string.gsub(result,">",">")
end

function TNTS.onPlayerActivated ( ... )
    if (TNTS.loaded) then return end

    TNTS.NPCM.onPlayerActivated()
    TNTS.loaded = true
end

function TNTS.NPCM.onUpdate ()
    if ( not AFAisLoaded ) then return end
end

function TNTS.onAddonLoaded ( eventCode , addonName )
    if ( addonName ~= "TNTS" ) then return end
    local default = { TNTS = {}}
    savedVars = ZO_SavedVars:New("tntsLog", 1, nil, default, nil)
end

EVENT_MANAGER:RegisterForEvent     ( "TNTS" , EVENT_ADD_ON_LOADED               , TNTS.onAddonLoaded          )
EVENT_MANAGER:RegisterForEvent     ( "TNTS" , EVENT_PLAYER_ACTIVATED            , TNTS.onPlayerActivated      )