Quantcast
Download
(59 Kb)
Download
Updated: 08/23/19 11:08 AM
Pictures
File Info
Compatibility:
Scalebreaker (5.1.5)
Elsweyr (5.0.5)
Wrathstone (4.3)
Murkmire (4.2)
Wolfhunter (4.1)
Updated:08/23/19 11:08 AM
Created:10/15/18 11:41 AM
Monthly downloads:9,183
Total downloads:25,594
Favorites:41
MD5:
5.1.5
LibZone  Popular! (More than 5000 hits)
Version: 6.1
by: Baertram [More]
LibZone
A library to help with zone information.
It contains:
-Localized zone names for the languages DE, EN, FR
-ZoneId, ZoneIndex, ZoneParentId (beginning with API100025 "Murkmire")

And to help with translations of zone names between different languages:
This library needs the library LibSlashCommander installed seperately if you want to use the zone name translations with chat commands!

Use one of the following slash commands in your chat (only if 'LibSlashCommander' is active!):
Code:
-Added: Slash commans /lzt or /transz:
Enter a zone name afterwards (in your client language) or choose it from the autocompletion list.
Press tab or space to chose the zonename, and you'll see another auto completion which will provide you the translations of this zone to other languages.
Chosing an entry will put the translated zone name into the chat.

-Added slash commands to search in your desired language:
/lztde or /transzde: German
/lzten or /transzen: English
/lztfr or /transzfr: French
/lztjp or /transzjp: Japanese
/lztru or /transzru: Russian
/lztpl or /transzpl: Polish
Where is the data?
Your instance of LibZone contains 2 tables.
1 for the localized data:
LibZone.preloadedZoneNames[language][zoneId] = "Localized name of the zone"
-> Do NOT access this table directly but use the API function LibZone:GetAllZoneData() instead!

-> Language = String, length 2. Example: "en", "de", "fr"
-> ZoneId = The zone's unique id which you are able to get via some API function like these ones:
Code:
* GetMapInfo(*luaindex* _index_)
** _Returns:_ *string* _name_, *[UIMapType|#UIMapType]* _mapType_, *[MapContentType|#MapContentType]* _mapContentType_, *integer* _zoneId_, *string* _description_

* GetGuildMemberCharacterInfo(*integer* _guildId_, *luaindex* _memberIndex_)
** _Returns:_ *bool* _hasCharacter_, *string* _characterName_, *string* _zoneName_, *integer* _classType_, *integer* _alliance_, *integer* _level_, *integer* _championRank_, *integer* _zoneId_

* GetFriendCharacterInfo(*luaindex* _friendIndex_)
** _Returns:_ *bool* _hasCharacter_, *string* _characterName_, *string* _zoneName_, *integer* _classType_, *integer* _alliance_, *integer* _level_, *integer* _championRank_, *integer* _zoneId_
1 for the non localized data:
LibZone.zoneData[zoneId] = {
["zoneIndex"] = zoneIndex,
["parentZone"] = zoneId of the parent Zone
}

->zoneIndex = The zoneIndex which can be determined via some API functions like these ones:
Code:
* GetCurrentMapZoneIndex()
** _Returns:_ *luaindex* _zoneIndex_

* GetZoneIndex(*integer* _zoneId_)
** _Returns:_ *luaindex* _zoneIndex_
->zoneId = see above


Usage
-Download, use as standalone library or keep (otherwise the SavedVariables are lost!) the manifest txt file and just use the library file within your addon.
-Load the library within your addon code using the global variable LibZone
Lua Code:
  1. local libZone = LibZone

The file LibZone_Data.lua contains the localized zone names for DEn EN and FR language.
The file LibZone.lua contains functions to read this, and the other information, for your addons.

This function will build new zone data and save them to the savedvariables. It will use the current client's language and will be run once as the library loads. So if you are playing on a non-official client language the data will be read and added to your savedvariables.
Code:
--Check and get all zone's data and save them to the SavedVariables
--Parameters:
-->reBuildNew: Boolean [true=Rebuild the zoneData for all zones, even if they already exist / false=Skip already existing zoneIds]
-->doReloadUI: Boolean [true=If at least one zoneId was added/updated, do a ReloadUI() at the end to update the SavedVariables now / false=No automatic ReloadUI()]
function lib:GetAllZoneDataById(reBuildNew, doReloadUI)

Code:
--Returns: Returns the preloaded zoneData with all available languages as table.
function lib:GetAllZoneData()
Code:
--Return the zoneData of a zone, determined by help of the subZone ID.
--Parameters:
--subZoneId: Number SubZoneId
--language: String Language for the ParentZoneName
-->Returns table:
--->returnTable[number SubZoneId] = {
--->    ["parentZoneId"] = number ParentZoneId,
--->    ["name]"         = String "ParentZoneName"
--->}
--If no parent zone can be found the return value will be nil.
function lib:GetZoneDataBySubZone(subZoneId, language)

Code:
--Return existing zone/their subZone data to variables.
-- Returns the zoneData, subZoneData tables
-->Contents of zoneData:
-->zoneData = { ["name"] = String "Zone Name^n"
-->             ["zoneIndex"] = number zoneIndex
-- }
-->Contents of subZoneData:
-->subZoneData = { ["name"] = String "Sub zone Name^n"
-->                ["parentZone"] = number zoneId}
-- }
function lib:GetZoneData(zoneId, subZoneId, language)

Code:
--Show existing zone data to the chat now
--Output zone informtaion to the chat, using the zoneId, subZoneId (connected to zoneId via parentZoneId) and the language (e.g. "en" or "fr")
function lib:ShowZoneData(zoneId, subZoneId, language)

Code:
--Get the localized zone name by help of a zoneId
--zoneId: Number containing zoneId
--language: The language to use for the zoneName
--->Returns localized String of the zoneName
function lib:GetZoneName(zoneId, language)

Code:
--Get the localized zone names by help of a table containing the zoneIds
-->zoneIdsTable: Table containing a number index as key and the zoneId as value
-->e.g. zoneIdsTable = {2, 3, 36, 1200} or zoneIdsTable[1] = 1, zoneIdsTable[2] = 3, zoneIdsTable[3] = 36, zoneIdsTable[4] = 1200
--->Returns table containing the zone names
--->Key = zoneId
--->Value = table with the zoneData from the SavedVariables.
--->Example:
---->returnTable[2] = "Clean Test"
---->returnTable[3] = "Gelnumbra"
function lib:GetZoneNamesByIds(zoneIdsTable, language)


Code:
--Get the localized zone data by help of a table containing the zoneIds
-->zoneIdsTable: Table containing a number index as key and the zoneId as value
-->e.g. zoneIdsTable = {2, 3, 36, 1200} or zoneIdsTable[1] = 1, zoneIdsTable[2] = 3, zoneIdsTable[3] = 36, zoneIdsTable[4] = 1200
--->Returns table containing the zoneData
--->Key = zoneId
--->Value = table with the zoneData from the SavedVariables.
--->Example:
---->returnTable[2] = {
---->   ["name"] = "Clean Test",
---->   ["zoneIndex"] = 1,
---->},
---->returnTable[3] = {
---->   ["name"] = "Glenumbra",
---->   ["zoneIndex"] = 2,
---->}
function lib:GetZoneDataByIds(zoneIdsTable, language)
Code:
--Get the localized zone names matching to a localized search string
-->searchStr: The String with the search value of a zone name (using searchLanguage)
-->searchLanguage: The langauge to search the searchStr variable in Format example: "en". Can be nil (<nilable>)! If the searchLangauge is nil the client language will be taken as searchLanguage.
-->returnLanguage: The language for the translated results. e.g. you search for "Ostmar" with search language "de" and the return language "en". The result will be the "Eastmarch" zone.
--->Returns table containing the zoneId as table key and the localized (in language: returnLanguage) full zone name, matching to the search string, as table value
function lib:GetZoneNameByLocalizedSearchString(searchStr, searchLanguage, returnLanguage)
6.1
Made LibSlashCommander optional. If the library is not installed/activated you cannot use the slash commands to translate zone names in chat!
But you still got access to the zone data via LibZone's API functions.

6
-Raised API
-Removed table LibZone.givenZoneData -> Please use the API function LibZone:GetAllZoneData() instead!
-Fixed translations for some zones
-Added new zones
-Preloaded the data for each zone in different languages.
-SavedVariables will NOT contain the whole zoneNames anymore! This will speed up the loading.
Only the unknown/non translated zoneNames will be written to the SavedVariables autoamtically now.
If you want to provide me your client's language zoneNames you can provide me your SavedVariables file "LibZone.lua".
The following languages are up 2 date: DE, EN, FR
The following languages need updates: JP, RU, PL
All other languages are missing so far.

5
-Raised API
-Added ##IsLibrary: true manifest TXT tag
-Made the library work without LibStub and with.
You can use the global variable
Code:
LibZone
to access it without LibStub.
-Added Elsweyr zone names for de, en and fr. If you are using the pl, jp or ru clients send me the new zoneIds with their translations from your LibZone.lua SavedVariables please.

0.4
-Removed LibStub from the libs subfolder
-Removed the libs subfolder. This library needs the following libraries installed as standalone versions:
LibStub LibSlashCommander

-Updated Japanese translations
-Added Polish translations and chat commands: /lztpl or /transzpl
Thankls for provided the translations!

0.3
-Fixed localized zone data overwritten (corrected manifest txt)
-Added Japanese translations
-Added Russian translations
-Added ## AddOnVersion tag to manifest txt
-Added function to get localized zoneNames and their zoneIds by help of a search String (zone name) and search language:
--Get the localized zone names matching to a localized search string
-->searchStr: The String with the search value of a zone name (using searchLanguage)
-->searchLanguage: The langauge to search the searchStr variable in Format example: "en". Can be nil (<nilable>)! If the searchLangauge is nil the client language will be taken as searchLanguage.
-->returnLanguage: The language for the translated results. e.g. you search for "Ostmar" with search language "de" and the return language "en". The result will be the "Eastmarch" zone.
--->Returns table containing the zoneId as table key and the localized (in language: returnLanguage) full zone name, matching to the search string, as table value
function lib:GetZoneNameByLocalizedSearchString(searchStr, searchLanguage, returnLanguage)

-Added: Slash commans /lzt or /transz:
Enter a zone name afterwards (in your client language) or choose it from the autocompletion list.
Press tab or space to chose the zonename, and you'll see another auto completion which will provide you the translations of this zone to other languages.
Chosing an entry will put the translated zone name into the chat.

-Added slash commands to search in your desired language:
/lztde or /transzde: German
/lzten or /transzen: English
/lztfr or /transzfr: French
/lztjp or /transzjp: Japanese
/lztru or /transzru: Russian
Optional Files (0)


Archived Files (4)
File Name
Version
Size
Uploader
Date
6
58kB
Baertram
08/23/19 10:16 AM
5
56kB
Baertram
05/05/19 12:41 PM
0.4
48kB
Baertram
01/25/19 09:25 AM
0.2
29kB
Baertram
10/15/18 11:41 AM


Post A Reply Comment Options
Unread 08/23/19, 10:18 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
Version 6:
-Removed table LibZone.givenZoneData -> Please use the API function LibZone:GetAllZoneData() instead!

So if you have reference the table directly in your addon change the code to the appropriate API function LibZone:GetAllZoneData() please.
Last edited by Baertram : 08/23/19 at 10:26 AM.
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 12:05 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
Re: Re: Re: Re: Re: Re: even with out of date addon checked, this library would not load

I can only say: Maybe
Not sure, sometimes it works, sometimes it doesn't.
You can only try to rebuild it with manualy freshly installed addons + libraies (the affected ones) I guess.

Originally Posted by Anceane
Unfortunatly i was not in the game at all when i installed the libs.

The only other thing i did is that i updated also at the same time a lot of addons ( 15 or 16)

May be that was a bit too much at the same time ?


Originally Posted by Baertram
Unfortunately this is no real solution, just a workaround.
This shouldn't happen!

At least not if you are logged out before updating the libraries. If you are logged in and do reloadui it might be the problem. So always logout ebfore updating libraries or addons, is the best approach to fix ingame stuff with non-loading addons + dependencies.

Originally Posted by Gamer1986PAN
Right, i hadn't read it carefully enough. I just wanted to throw in a possible "unprecise" solution till i come back. Luckyly you already solved it and if someone is asking in our comment section about that issue we know a fast solution how to help, because of you. Thanks for that.

Originally Posted by Anceane
i think you misread what i explained All those libraries are actually as standalone in my addons folder.

Included the two i mentionned.

Though to have those two aknowlegded by the game, i had to update the api to 100026 100027, Thought we did not had to do that as users. (and yes the out of date was checked)

The problem was not with beammeup but the outdated library (those are also used by Writworthy, pet health)

And, Libzone would not actually load considering missing the Libslashcommander lib though present in the folder but considered by the game as not a good version
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 10:19 AM  
Anceane
 
Anceane's Avatar

Forum posts: 212
File comments: 726
Uploads: 0
Re: Re: Re: Re: Re: even with out of date addon checked, this library would not load

Unfortunatly i was not in the game at all when i installed the libs.

The only other thing i did is that i updated also at the same time a lot of addons ( 15 or 16)

May be that was a bit too much at the same time ?


Originally Posted by Baertram
Unfortunately this is no real solution, just a workaround.
This shouldn't happen!

At least not if you are logged out before updating the libraries. If you are logged in and do reloadui it might be the problem. So always logout ebfore updating libraries or addons, is the best approach to fix ingame stuff with non-loading addons + dependencies.

Originally Posted by Gamer1986PAN
Right, i hadn't read it carefully enough. I just wanted to throw in a possible "unprecise" solution till i come back. Luckyly you already solved it and if someone is asking in our comment section about that issue we know a fast solution how to help, because of you. Thanks for that.

Originally Posted by Anceane
i think you misread what i explained All those libraries are actually as standalone in my addons folder.

Included the two i mentionned.

Though to have those two aknowlegded by the game, i had to update the api to 100026 100027, Thought we did not had to do that as users. (and yes the out of date was checked)

The problem was not with beammeup but the outdated library (those are also used by Writworthy, pet health)

And, Libzone would not actually load considering missing the Libslashcommander lib though present in the folder but considered by the game as not a good version
__________________
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 10:06 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
Re: Re: Re: Re: even with out of date addon checked, this library would not load

Unfortunately this is no real solution, just a workaround.
This shouldn't happen!

At least not if you are logged out before updating the libraries. If you are logged in and do reloadui it might be the problem. So always logout ebfore updating libraries or addons, is the best approach to fix ingame stuff with non-loading addons + dependencies.

Originally Posted by Gamer1986PAN
Right, i hadn't read it carefully enough. I just wanted to throw in a possible "unprecise" solution till i come back. Luckyly you already solved it and if someone is asking in our comment section about that issue we know a fast solution how to help, because of you. Thanks for that.

Originally Posted by Anceane
i think you misread what i explained All those libraries are actually as standalone in my addons folder.

Included the two i mentionned.

Though to have those two aknowlegded by the game, i had to update the api to 100026 100027, Thought we did not had to do that as users. (and yes the out of date was checked)

The problem was not with beammeup but the outdated library (those are also used by Writworthy, pet health)

And, Libzone would not actually load considering missing the Libslashcommander lib though present in the folder but considered by the game as not a good version
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 10:01 AM  
Gamer1986PAN
AddOn Author - Click to view AddOns

Forum posts: 84
File comments: 415
Uploads: 2
Re: Re: Re: even with out of date addon checked, this library would not load

Right, i hadn't read it carefully enough. I just wanted to throw in a possible "unprecise" solution till i come back. Luckyly you already solved it and if someone is asking in our comment section about that issue we know a fast solution how to help, because of you. Thanks for that.

Originally Posted by Anceane
i think you misread what i explained All those libraries are actually as standalone in my addons folder.

Included the two i mentionned.

Though to have those two aknowlegded by the game, i had to update the api to 100026 100027, Thought we did not had to do that as users. (and yes the out of date was checked)

The problem was not with beammeup but the outdated library (those are also used by Writworthy, pet health)

And, Libzone would not actually load considering missing the Libslashcommander lib though present in the folder but considered by the game as not a good version
__________________
Co-Author of the Addon BeamMeUp - feel free to check it out.


BankManagerRevived Slim Edition
-dropped some functions most ESO+ users does not need to have better performance with BMR -
all working mechancis are created from the original BMR authors - all credits to orignal authors
Last edited by Gamer1986PAN : 05/19/19 at 10:01 AM.
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 09:56 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
Re: Re: Re: even with out of date addon checked, this library would not load

So you had to manually change the ##APIVersion: Tag in the LibSlashCommander.txt file to 100026 100027 in order to let the live servers load this library properly, even if the "Load out of date" checkbox was enabled?
This shouldn't happen, no.
If BeamMeUp got the following entry within it's BeamMeUp.txt,
##DependsOn: LibZone
and LibZone got the following entry in it's LibZone.txt
##DependsOn: LibSlashCommander
-> Checked this: Yes it is in the txt file of current LibZone v5.
everything should be handled via the eso ingame addon manager properly, and load properly in the order
LibSlashCommand -> LibZone -> BeamMeUp (dependencies looked up and followed).

If this does not happen there is somehwere a bug in the ingame addon manager or you might got different versions of the libraries installed (as standalone, and as subfolder version e.g. inside another addon where there is NOT a standalone LibLashCommander.txt or LibZone.txt, and where the other addons's txt file, e.g. OtherAddon.txt, got the entry like "/libs/LibSlashCommander/LibSlashCommander.lua".
So it is not loaded via it's own txt file and though loaded with whatever version this bundled subfolder version got.

If the library is installed as a standalone lib there is the ##AddOnVersion: tag as well (or hopefully it is in theer) which assures only the newest version is loaded ingame. If the library does not use LibStub!
Or else if it uses LibStub, LibStub will load the highest version, also if it's only bundled in a subfolder without own txt file.

So not sure what happened here for you but I guess you got either LibZone or LibSlashCommander instaleld multiple times and maybe not the newest version will be loaded or two versions are?

Originally Posted by Anceane
i think you misread what i explained All those libraries are actually as standalone in my addons folder.

Included the two i mentionned.

Though to have those two aknowlegded by the game, i had to update the api to 100026 100027, Thought we did not had to do that as users. (and yes the out of date was checked)

The problem was not with beammeup but the outdated library (those are also used by Writworthy, pet health)

And, Libzone would not actually load considering missing the Libslashcommander lib though present in the folder but considered by the game as not a good version

Originally Posted by Gamer1986PAN
Originally Posted by Anceane
Even with the out of date checked, to be able to use the addon Beammeup, i had to force update api on this library and the one called


https://www.esoui.com/downloads/info...Commander.html

Do i need to do more ?
As you can see in BeamMeUp Addon Info this are all the librarys you need to install:

Dependencies:
FROM v1.5 ALL LIBRARIES ARE OUTSOURCED! YOU NEED TO INSTALL THE FOLLOWING LIBRARIES SEPARATELY:

LibAddonMenu-2.0
LibDialog
LibMapPing
LibCustomMenu
LibSlashCommander
LibZone


Feel free to write comments in the BeamMeUp comment section if you have trouble with it.
Last edited by Baertram : 05/19/19 at 09:57 AM.
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 07:11 AM  
Anceane
 
Anceane's Avatar

Forum posts: 212
File comments: 726
Uploads: 0
Re: Re: even with out of date addon checked, this library would not load

i think you misread what i explained All those libraries are actually as standalone in my addons folder.

Included the two i mentionned.

Though to have those two aknowlegded by the game, i had to update the api to 100026 100027, Thought we did not had to do that as users. (and yes the out of date was checked)

The problem was not with beammeup but the outdated library (those are also used by Writworthy, pet health)

And, Libzone would not actually load considering missing the Libslashcommander lib though present in the folder but considered by the game as not a good version

Originally Posted by Gamer1986PAN
Originally Posted by Anceane
Even with the out of date checked, to be able to use the addon Beammeup, i had to force update api on this library and the one called


https://www.esoui.com/downloads/info...Commander.html

Do i need to do more ?
As you can see in BeamMeUp Addon Info this are all the librarys you need to install:

Dependencies:
FROM v1.5 ALL LIBRARIES ARE OUTSOURCED! YOU NEED TO INSTALL THE FOLLOWING LIBRARIES SEPARATELY:

LibAddonMenu-2.0
LibDialog
LibMapPing
LibCustomMenu
LibSlashCommander
LibZone


Feel free to write comments in the BeamMeUp comment section if you have trouble with it.
__________________
Report comment to moderator  
Reply With Quote
Unread 05/19/19, 06:38 AM  
Gamer1986PAN
AddOn Author - Click to view AddOns

Forum posts: 84
File comments: 415
Uploads: 2
Re: even with out of date addon checked, this library would not load

Originally Posted by Anceane
Even with the out of date checked, to be able to use the addon Beammeup, i had to force update api on this library and the one called


https://www.esoui.com/downloads/info...Commander.html

Do i need to do more ?
As you can see in BeamMeUp Addon Info this are all the librarys you need to install:

Dependencies:
FROM v1.5 ALL LIBRARIES ARE OUTSOURCED! YOU NEED TO INSTALL THE FOLLOWING LIBRARIES SEPARATELY:

LibAddonMenu-2.0
LibDialog
LibMapPing
LibCustomMenu
LibSlashCommander
LibZone


Feel free to write comments in the BeamMeUp comment section if you have trouble with it.
__________________
Co-Author of the Addon BeamMeUp - feel free to check it out.


BankManagerRevived Slim Edition
-dropped some functions most ESO+ users does not need to have better performance with BMR -
all working mechancis are created from the original BMR authors - all credits to orignal authors
Report comment to moderator  
Reply With Quote
Unread 05/18/19, 06:09 PM  
Anceane
 
Anceane's Avatar

Forum posts: 212
File comments: 726
Uploads: 0
even with out of date addon checked, this library would not load

Even with the out of date checked, to be able to use the addon Beammeup, i had to force update api on this library and the one called


https://www.esoui.com/downloads/info...Commander.html

Do i need to do more ?
__________________
Report comment to moderator  
Reply With Quote
Unread 02/01/19, 10:04 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
Originally Posted by zelenin
feature request:
add functions GetCurrentZone(), IsPublicDungeon(), IsDelvel(), IsTrial(), IsGroupDungeon() etc if this seems possible.
What should GetCurrentZone() return what is not already there?
You are already able to use ingame API functions to get teh current's zone zoneId and then use libZone to get this zones's data.

ZoneId = The zone's unique id which you are able to get via some API function like these ones:
Lua Code:
  1. * GetMapInfo(*luaindex* _index_)
  2. ** _Returns:_ *string* _name_, *[UIMapType|#UIMapType]* _mapType_, *[MapContentType|#MapContentType]* _mapContentType_, *integer* _zoneId_, *string* _description_
  3.  
  4. * GetGuildMemberCharacterInfo(*integer* _guildId_, *luaindex* _memberIndex_)
  5. ** _Returns:_ *bool* _hasCharacter_, *string* _characterName_, *string* _zoneName_, *integer* _classType_, *integer* _alliance_, *integer* _level_, *integer* _championRank_, *integer* _zoneId_
  6.  
  7. * GetFriendCharacterInfo(*luaindex* _friendIndex_)
  8. ** _Returns:_ *bool* _hasCharacter_, *string* _characterName_, *string* _zoneName_, *integer* _classType_, *integer* _
I'm not going to anually mark rentries in the zone list as delve, dungeon etc.! But this would be needed to reliably get the information, and this would me to remark them after each update as there are no API functions to check if a zone is delve, dungeon trial or whatever!

Though game provides some API functions to do some checks if you are in a dungeon, or trial. Please use them if you need to know where you are.

Please check the following addons code if you need an example:
WishList, file src/functions.lua, function WL.getCurrentZoneAndGroupStatus()

Lua Code:
  1. function WL.getCurrentZoneAndGroupStatus()
  2.     local isInPublicDungeon = false
  3.     local isInGroupDungeon = false
  4.     local isInAnyDungeon = false
  5.     local isInRaid = false
  6.     local isInDelve = false
  7.     local isInGroup = false
  8.     local groupSize = 0
  9.     local isInPVP = false
  10.     local zoneId = 0
  11.     local subZoneId = 0
  12.     local currentMapZoneIndex = GetCurrentMapZoneIndex()
  13.     if currentMapZoneIndex ~= nil then
  14.         zoneId = GetZoneId(currentMapZoneIndex)
  15.         if GetParentZoneId ~= nil then
  16.             local parentZoneId = GetParentZoneId(zoneId)
  17.             if parentZoneId ~= nil and parentZoneId ~= 0 then
  18.                 subZoneId = zoneId
  19.                 zoneId = parentZoneId
  20.             end
  21.         end
  22.     end
  23.  
  24.     isInPVP = IsPlayerInAvAWorld()
  25.     isInAnyDungeon = IsAnyGroupMemberInDungeon() -- returns true if not in group and in solo dungeon/delve
  26.     isInRaid = IsPlayerInRaid()
  27.     isInGroup = IsUnitGrouped("player")
  28.  
  29.     --Check if user is in any dungeon
  30.     if not isInGroup then
  31.         isInDelve = isInAnyDungeon
  32.     else
  33.         groupSize = GetGroupSize() --SMALL_GROUP_SIZE_THRESHOLD (4) / RAID_GROUP_SIZE_THRESHOLD (12) / GROUP_SIZE_MAX (24)
  34.         isInDelve = isInAnyDungeon and not isInRaid and groupSize <= SMALL_GROUP_SIZE_THRESHOLD
  35.     end
  36.     --Get POI info for group and public dungeons
  37.     local zoneIndex, poiIndex = GetCurrentSubZonePOIIndices()
  38.     local abort = false
  39.     if zoneIndex == nil then
  40.         abort = true
  41.     end
  42.     if poiIndex == nil then
  43.         abort = true
  44.     end
  45.     if not abort then
  46.         local _, _, _, iconPath = GetPOIMapInfo(zoneIndex, poiIndex)
  47.         if iconPath:find("poi_delve") then
  48.             -- in a delve
  49.             isInDelve = true
  50.         end
  51.         isInPublicDungeon = IsPOIPublicDungeon(zoneIndex, poiIndex)
  52.         isInGroupDungeon = IsPOIGroupDungeon(zoneIndex, poiIndex)
  53.         if isInPublicDungeon then
  54.             isInDelve = false
  55.             isInGroupDungeon = false
  56.         elseif isInGroupDungeon then
  57.             isInDelve = false
  58.             isInPublicDungeon = false
  59.         end
  60.         --[[
  61.             else
  62.                 --Workaround as long as some public dungeons are not determined correctly (e.g. in Reapers March)
  63.                 --Workaround disabled: Delves are not determined correctly this way (you are normally grouped in public dungeons?!)!
  64.                 isInPublicDungeon = (isInAnyDungeon and not isInGroup)
  65.         ]]
  66.     end
  67.     return isInPVP, isInDelve, isInPublicDungeon, isInGroupDungeon, isInRaid, isInGroup, groupSize, zoneId, subZoneId
  68. end

This function is not 100% reliable as Delves are not always recognized. But it helps at least.
Last edited by Baertram : 02/01/19 at 10:24 AM.
Report comment to moderator  
Reply With Quote
Unread 02/01/19, 06:36 AM  
zelenin
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 51
Uploads: 2
feature request:
add functions GetCurrentZone(), IsPublicDungeon(), IsDelvel(), IsTrial(), IsGroupDungeon() etc if this seems possible.
Report comment to moderator  
Reply With Quote
Unread 01/13/19, 08:11 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
New beta version 0.3:

Code:
-Fixed localized zone data overwritten (corrected manifest txt)
-Added Japanese translations
-Added Russian translations
-Added ## AddOnVersion tag to manifest txt
-Added function to get localized zoneNames and their zoneIds by help of a search String (zone name) and search language:
--Get the localized zone names matching to a localized search string
-->searchStr: The String with the search value of a zone name (using searchLanguage)
-->searchLanguage: The langauge to search the searchStr variable in Format example: "en". Can be nil (<nilable>)! If the searchLangauge is nil the client language will be taken as searchLanguage.
-->returnLanguage: The language for the translated results. e.g. you search for "Ostmar" with search language "de" and the return language "en". The result will be the "Eastmarch" zone.
--->Returns table containing the zoneId as table key and the localized (in language: returnLanguage) full zone name, matching to the search string, as table value
function lib:GetZoneNameByLocalizedSearchString(searchStr, searchLanguage, returnLanguage)

-Added: Slash commans /lzt or /transz:
Enter a zone name afterwards (in your client language) or choose it from the autocompletion list.
Press tab or space to chose the zonename, and you'll see another auto completion which will provide you the translations of this zone to other languages.
Chosing an entry will put the translated zone name into the chat.

-Added slash commands to search in your desired language:
/lztde or /transzde: German
/lzten or /transzen: English
/lztfr or /transzfr: French
/lztjp or /transzjp: Japanese
/lztru or /transzru: Russian





You are able to download and test it here:
LibZone v0.3 beta
Last edited by Baertram : 01/21/19 at 04:13 PM.
Report comment to moderator  
Reply With Quote
Unread 10/15/18, 11:51 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2356
File comments: 2617
Uploads: 57
Be sure to include the LibZone.txt file in your addon if you embed this library into your addon or your savedvariables won't work properly!
-> Be sure to remove the LibStub folder and files + the call to it from LibZone.txt as well if you already have LibStub added to your addon then!

And do not forget to add LibZone to your addon's .txt manifest file:
##OptionalDependsOn: LibZone

Non-official Game client languages or client language "jp"
If you are using a game client which uses another language then "de", "en", "fr" feel freee to send me your SavedVariables so I can add your client language to the LibZone_Data.lua file for next versions!
Last edited by Baertram : 10/15/18 at 11:52 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: