Thread Tools Display Modes
08/01/14, 04:45 PM   #1
unLeashed3k
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 33
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
  Reply With Quote
08/01/14, 06:40 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by unLeashed3k View Post
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.
  Reply With Quote
03/25/22, 04:01 AM   #3
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
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)
  Reply With Quote
03/25/22, 07:06 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.

Last edited by Baertram : 03/25/22 at 07:09 AM.
  Reply With Quote
03/26/22, 04:43 AM   #5
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Am I in a City (Safe to Logout)

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