Thread Tools Display Modes
06/30/23, 03:35 AM   #1
Toirealach
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 27
Imperial City base detection?

Is there any way to test to see if a player is currently in their home base in the Imperial City Sewers?
  Reply With Quote
06/30/23, 04:30 AM   #2
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
Originally Posted by Toirealach View Post
Is there any way to test to see if a player is currently in their home base in the Imperial City Sewers?
Getting the map id maybe?
  Reply With Quote
06/30/23, 05:52 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Code:
/script d("Current mapId: " ..tostring(GetCurrentMapId()) )
Or using merTorchbug Updated and improved
/tb GetCurrentMapId()
----- @return name string, mapType [UIMapType|#UIMapType], mapContentType [MapContentType|#MapContentType], zoneIndex luaindex, description string
/tb GetMapInfoByIndex(GetCurrentMapIndex())

MapContentType should return MAP_CONTENT_AVA then
and zoneIndex most probably will be the zoneIndex of the Imperial Sewers (there might exist multiple zoneIndices/zoneIds for the different parts of the sewers, not sure. Maybe onlky the mapIds differ there) then

Last edited by Baertram : 06/30/23 at 05:57 AM.
  Reply With Quote
06/30/23, 11:29 AM   #4
Toirealach
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 27
Originally Posted by Baertram View Post
Code:
GetMapInfoByIndex(GetCurrentMapIndex())
MapContentType should return MAP_CONTENT_AVA then
and zoneIndex most probably will be the zoneIndex of the Imperial Sewers (there might exist multiple zoneIndices/zoneIds for the different parts of the sewers, not sure. Maybe onlky the mapIds differ there) then
That's exactly what I tried in my code and it doesn't seem to return the right information. It says I'm in Imperial Sewers and in Harena Hypogeum even when I'm inside the Ebonheart Pact Base rather than on the other side of the door actually in the Harena Hypogeum area.
  Reply With Quote
06/30/23, 12:40 PM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Sometimes,if mapIds and zoneIds do not help, the map's texture name helps. Dunno which API function returned that one but perhaps it contains an string identifer then that you could use.
I think LibZone got an API function to return that.
  Reply With Quote
06/30/23, 01:55 PM   #6
Toirealach
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 27
Originally Posted by Baertram View Post
Sometimes,if mapIds and zoneIds do not help, the map's texture name helps. Dunno which API function returned that one but perhaps it contains an string identifer then that you could use.
I think LibZone got an API function to return that.
I tried:

Code:
	local mapID = GetCurrentMapId()
	local tileFilename = ""
	for tileIndex = 1, 5 do
		tileFilename = GetMapTileTextureForMapId(mapID, tileIndex) or "NONE"
		d(string.format("tileIndex: %d, tileFileName: %s", tileIndex, tileFilename))
	end
And it returns the same thing on either side of the base door:

tileIndex: 1, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_0.dds
tileIndex: 2, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_1.dds
tileIndex: 3, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_2.dds
tileIndex: 4, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_3.dds
tileIndex: 5, tileFileName: Art/maps/cyrodiil/Imperialsewers_ebon1_base_4.dds
  Reply With Quote
07/01/23, 05:59 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Okay, looks like the game is not differentiating it then Only way to find out then is maybe mapId + player position on it if mapId is a special one. If for example mapId = IC district mapId 1 and the position on x or y axis is above a value, then you are in the base. But if the pos. values are below a value, you are outside the base next to the door.

Else I don't know what could be used here if there is not other API returning some "IsInBase" stuff.

Other idea as event trackes do that: Could you maybe check for the mapPins of the base vendor's that do not show outside of the bases?
  Reply With Quote
07/01/23, 01:28 PM   #8
Toirealach
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 27
Originally Posted by Baertram View Post
Okay, looks like the game is not differentiating it then Only way to find out then is maybe mapId + player position on it if mapId is a special one. If for example mapId = IC district mapId 1 and the position on x or y axis is above a value, then you are in the base. But if the pos. values are below a value, you are outside the base next to the door.

Else I don't know what could be used here if there is not other API returning some "IsInBase" stuff.

Other idea as event trackes do that: Could you maybe check for the mapPins of the base vendor's that do not show outside of the bases?
Yes, thanks for the suggestions. I was going to walk around each base and calculate distances and vectors from things like dungeon entrances near the bases to estimate that the player is likely inside the base.
  Reply With Quote
07/02/23, 06:06 AM   #9
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
You could try using GetUnitRawWorldPosition to determine if the player is inside the bounding box of a base. Unlike regular map or world coordinates it gives you the "real" position inside 3d space of the loaded world data.
The bases are not really behind the doors you see when you enter, but somewhere a bit further away, so it should be possible to find 2 points that surround the base, but won't overlap with the area outside of it.

Then you can just run the check as needed, or if you want to have a callback, you should be able to use EVENT_PLAYER_ACTIVATED for most entrances and for the ones that do not have a loading screen it should be enough to listen to the invulnerability buff being added (I believe it is also added when you leave the base?).
  Reply With Quote
07/02/23, 03:41 PM   #10
Toirealach
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 27
Originally Posted by sirinsidiator View Post
You could try using GetUnitRawWorldPosition to determine if the player is inside the bounding box of a base. Unlike regular map or world coordinates it gives you the "real" position inside 3d space of the loaded world data.
The bases are not really behind the doors you see when you enter, but somewhere a bit further away, so it should be possible to find 2 points that surround the base, but won't overlap with the area outside of it.

Then you can just run the check as needed, or if you want to have a callback, you should be able to use EVENT_PLAYER_ACTIVATED for most entrances and for the ones that do not have a loading screen it should be enough to listen to the invulnerability buff being added (I believe it is also added when you leave the base?).
This is a fantastic suggestion! I'll give it a try this coming week! Thank you!
  Reply With Quote
07/04/23, 02:32 PM   #11
Toirealach
AddOn Author - Click to view addons
Join Date: Sep 2020
Posts: 27
Originally Posted by Toirealach View Post
This is a fantastic suggestion! I'll give it a try this coming week! Thank you!
Hey just to let you know, I worked out some coordinates for the bases using your suggestion and it works great! Thanks!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Imperial City base detection?


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