Originally Posted by farangkao
2nd Toughts about Garkin's Code....
I'm not sure if i see this correctly, but be aware, if you replace the default GetDisplayName() function,
it might affect other Addons as well, and therefore make their Saved Data invalid.
|
I see only one problem: It ends up overriding GetDisplayName() regardless if it works properly or not.
And if you put that code into multiple Addons, each of those would would verride GetDisplayName() again.
Based on that data, this verison might be slightly better:
Code:
--First get the current function
local currentGDN = GetDisplayName
--Second, defined your corrected function
local function newGDN()
local displayName
if GetNumGuilds() > 0 then
displayName = GetGuildMemberInfo(GetGuildId(1), GetPlayerGuildMemberIndex(GetGuildId(1)))
else
displayName = "@" .. GetCVar("AccountName")
end
return displayName
end
--Thrid, check if the currently used GDN function is faulty
local displayName = currentGDN()
if displayName == nil or displayName == "" then
--Overwrite the current version
GetDisplayName = newGDN
end
Just putting it in your code would be too agressive/out of user hands. How about
:
We make a Addon just for this (call it "DisplayNameFix" or something like this)
Users can
choose to install it or not. And can prerpar thier settings files accordingly.
We put this addon as OptionalDependency for all our Addons, so it runs before them (only nessesary if we need the DisplayName before the LoadedEvent/Settings loading).
Once the issues is solved Zenimax Side, we can just make it a blank (empty the .lua file and remove the entry from the manifest, as well as).
Edit:
Noticed one mistake - we do not check if our retrival functiosn returns anything valid either. Each of those functions might bug out. I need to look into it a bit more...