Quantcast [about to release] Display Name Fix - ESOUI
Thread Tools Display Modes
07/04/14, 04:10 PM   #1
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 281
[about to release] Display Name Fix

The current issues with SavedVars are related to Zenimax breaking the GetDisplayName function. We managed to cobble together a nice fix/addon for that. It will replaces the buggy version with one that is almost 100% reliable (see details).
http://www.esoui.com/downloads/info6...ayNameFix.html

The thing is: This about the single most dangerous piece of code I wrote in some time.
So I would rather have some more people look at it before adding it to a category minion considers and advertising it on the main forum.
Here is the code.

Manifest/DisplayNameFix.txt:
Code:
## Title: Display Name Fix
## APIVersion: 100007
## OptionalDependsOn: BugEater

DisplayNameFix_Constants.lua
DisplayNameFix.lua
Constants file. To be modified by the user:
Lua Code:
  1. if (DisplayNameFixConstants == nil) then
  2.     DisplayNameFixConstants =
  3.     {
  4.         UserOverride = ""
  5.     }
  6. end

And the main course, DisplayNameFix.lua:
Lua Code:
  1. d("Before DNF: " .. GetDisplayName())
  2.  
  3. --step one: get a reference on the current GDN function
  4. local oldGDN = GetDisplayName
  5.  
  6.  
  7. --step two, prepare the sub functions to gather names from specific sources
  8. local function gdnLogin()
  9.     --Try to get the login name from the login screen, if user selected "remmeber account name"
  10.     local result = GetCVar("AccountName")
  11.  
  12.     if(result ~= nil and string.len(result) >= 1) then
  13.         result = DecorateDisplayName(result)
  14.     else
  15.         result = nil
  16.     end
  17.  
  18.     return result
  19. end
  20.  
  21. local function gdnGuild()
  22.     local result = nil
  23.  
  24.     --try to get the name from the Guild member list
  25.     if GetNumGuilds() > 0 then
  26.         result = GetGuildMemberInfo(GetGuildId(1), GetPlayerGuildMemberIndex(GetGuildId(1)))
  27.     end
  28.  
  29.     --check if what you got is at least remotely valid just in case; if not, ignore it
  30.     if not (result ~= nil and string.len(result) >= 2 and string.sub(result, 1, 1) == "@") then
  31.         result = nil
  32.     end
  33.  
  34.     return result
  35. end
  36.  
  37. local function gdnOverride()
  38.     local result = nil
  39.  
  40.     --Extract the value of the override
  41.     if(DisplayNameFixConstants ~= nil) then
  42.         result = DisplayNameFixConstants.UserOverride
  43.  
  44.         if not (result ~= nil and string.len(result) >= 2 and string.sub(result, 1, 1) == "@") then
  45.             result = nil
  46.         end
  47.     end
  48.  
  49.     return result
  50. end
  51.  
  52.  
  53. --Step three, build your actuall function
  54. local function newGDN()
  55.     local result = nil
  56.  
  57.     --1. Try out the Login function. If you get a hit, out with it
  58.     result = gdnLogin()
  59.     if(result ~= nil) then return result end
  60.  
  61.     --2. Try out the Guild function. If you get a hit, out with it
  62.     result = gdnGuild()
  63.     if(result ~= nil) then return result end
  64.  
  65.     --3. Try the user override. It comes late as the value is shared between all people logging in on this Account.
  66.     result = gdnOverride()
  67.     if (result~= nil) then return result end
  68.  
  69.     --4. If all failed, at least return the normal function result
  70.     return oldGDN ()
  71. end
  72.  
  73. --Step four, check if the currently used function is buggy. If so, replace it:
  74. local DName = GetDisplayName()
  75. if (DName == nil or string.len(DName) <= 1 or string.sub(result, 1, 1) ~= "@") then
  76.     d("DNF is replacing GetDisplayName")
  77.     GetDisplayName = newGDN
  78.     d("Login Result: ", gdnLogin())
  79.     d("Guild Result: ", gdnGuild())
  80.     d("UserOverride Result: ", gdnOverride())
  81. end
  82.  
  83. d("After DNF: " .. GetDisplayName())

Some tests with an extra use of "d" showed that the replaced functions seems to be only called twice after being out in place (one of them is for the saved var system).
If your addons needs the proper DisplayName before the onloaded event, you have to add this one as (optional) dependency. If you only need the name in the loaded event or later (like for accessing saved vars), you have to do nothing.

If nobody finds any mistake I propably put it live and advertise it on Sunday or Monday.
  Reply With Quote
07/05/14, 02:18 AM   #2
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
The way you setup your Addon, you don't have to worry too much.

If a user uses your addon ,he has been warned that his SavedVars should be backup'ed.

For People with Multiple Accounts it might actually be counter productive to use it,since at the moment
all Characters of multiple accounts will be stored in the same space.

Once it's patched, that won't work anymore, so they will not see all their characters on multiple accounts in the same Addon anymore
__________________
@farangkao on EU Servers. My Addon: Mobile Bank Extended, For Developers: ZeroBrane Studio - ESOAddonDev Plugin
  Reply With Quote
07/07/14, 06:55 AM   #3
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 281
And I just threw it out to the public:
http://forums.elderscrollsonline.com...tal-fix#latest

Let's see what happens.
Let's see how long untill the first troll tries the "you can hack accounts with addons" claim (but I think they find some way even I could not expect).
  Reply With Quote

ESOUI » AddOns » Released AddOns » [about to release] Display Name Fix

Thread Tools
Display Modes

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