ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Am I in a City (Safe to Logout) (https://www.esoui.com/forums/showthread.php?t=2042)

unLeashed3k 08/01/14 04:45 PM

Am I in a City (Safe to Logout)
 
Anyone know of a function that checks if the unit ("player") is safe to log out or an event that fires that toggles the state. Specifically I'm looking for something that returns true if I'm in a City or Town and the best way, perhaps, is to check if the character can logout *without* a timer.

Searched for hundreds of keywords in the hope of finding something, like, IsMapSafeZone(mapIndex), IsUnitSafe('player'), IsHostileNearby(mapIndex), IsTargetHostile('ret'), EVENT_SAFE_AREA|ZONE, EVENT_(anything dealing with logout functions).


The /logout and /quit commands know it needs to either run a timer (not in a safe area) or not run a timer, to logout.



Thanks,
Matt

merlight 08/01/14 06:40 PM

Quote:

Originally Posted by unLeashed3k (Post 10997)
The /logout and /quit commands know it needs to either run a timer (not in a safe area) or not run a timer, to logout.

I suspect they don't "know", they don't check, just Logout/Quit. Then there's a globally registered handler for EVENT_LOGOUT_DEFERRED which pops the dialog up, if the game decides you can't logout immediately.

Masteroshi430 03/25/22 04:01 AM

Hi guys,
A bit of a necro thread I'm doing here but the thread title fits and we also need to avoid posting the same questions again and again:
Is there an easy way to know if you are in town / city ?
(I would like to add an option to only allow interactions with cooking fire when in town/city for my LongPressCtrlToInteract addon)

Baertram 03/25/22 07:06 AM

No there is not afaik.

Some cities maybe provide an own mapId, but most use use the same as the parent map/zone.


You can check via the map's currently shown POIs, loop over, check their texture names and if any crafting related stuff is in there or other city only POI texture names (as these are language independent) you could "assume" it.
For sure this only works if the texture names contain some easy identier like "smithing" or "alchemy_station" or similar.

Try to contact Votan, I remember someone asked similar and he had an answer in gtter.im chat.

votan 03/26/22 04:43 AM

You have maps with multiple zones and zones with multiple maps.

GetMapIdByZoneId, GetZoneId(GetUnitZoneIndex("player"))

A combination of zoneId and mapId could identify save locations.
You could write a data miner addon to learn save locations by trying to logout everythere (all cities and all houses preview) and check if the defer logout event occurs.


All times are GMT -6. The time now is 03:28 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI