WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   Connected Realm function(s) (https://www.wowinterface.com/forums/showthread.php?t=57029)

bsmorgan 02-24-19 08:23 PM

Connected Realm function(s)
 
A function to get the realms connected to this one would be a start.

The motivation for this is that some accounts have more characters than a single server can hold and have resorted to creating alts on connected realms. I believe those alts can send mail to each other and therefore share materials like crafting mats.

In Skillet, I keep a shopping list of materials needed by other characters that currently only works when all the characters are on the same realm. With a function to determine which realms are connected to this one, I can extend the shopping list across those realms.

Kanegasi 02-24-19 09:59 PM

https://wow.gamepedia.com/API_UnitRealmRelationship

bsmorgan 02-25-19 07:01 AM

Quote:

Originally Posted by Kanegasi (Post 331588)

Unfortunately, this function applies to two units that are online. I'm looking for a function that can give me this relationship for two characters that are on the same account and therefore cannot be online at the same time.

RealmRelationship(realm) could return the same values as UnitRealmRelationship and I'd be a happy camper.

I can capture the realm and the name of each character (and even the GUID) when it is online along with the information about the character's crafting needs. When that character is offline, I need to know if its realm is connected to the one the currently online character is on.

I don't understand why Blizzard wants to keep the list of connected realms a secret. It is not really a secret as addons like CensusPlus figure it out. I'd be happy with an ACE3 library that provides the list. What I don't want to do is force the owner of the account to manually enter the information (and I really don't want to maintain that information manually myself).

Fizzlemizz 02-25-19 03:41 PM

You know the realms your characters are on, couldn't you run a nameplate scan for characters on the same realm(s) and compare those, storing the results?

Lua Code:
  1. SLASH_AAAAA1 = "/aa"
  2. SlashCmdList["AAAAA"] = function(msg)
  3.     for i=1, 40 do
  4.         local name, realm = UnitName("NamePlate"..i)
  5.         if realm then
  6.             local realmRelationship = UnitRealmRelationship("NamePlate"..i)
  7.             print(name, realm, realmRelationship)
  8.         end
  9.     end
  10. end

Something a bit more elegant <cough> and automated could be put together and build your db over time/characters I'm sure.

Edit: Too much time on my hands.
Lua Code:
  1. local f = CreateFrame("Frame", "FizzleNamePlateInspector", UIParent)
  2. f:RegisterEvent("UNIT_NAME_UPDATE")
  3. f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  4. f:SetScript("OnEvent", function(self, event, ...)
  5.     local arg1 = ...
  6.     local name, realm = UnitName(arg1)
  7.     if realm then
  8.         local realmRelationship = UnitRealmRelationship(arg1)
  9.         print(name, realm, realmRelationship)
  10.     end
  11. end)

Kanegasi 02-25-19 04:54 PM

I just remembered player GUIDs. The second part is a realm ID and connected realms share that ID.

https://wow.gamepedia.com/GUID

Lua Code:
  1. local guid = UnitGUID("player")
  2. local kind, server, ID = strsplit("-", guid or "")
  3. -- example: guid="Player-970-0002FD64" kind=="Player" server=="970" ID="0002FD64"

For example, if you were on (NA) Blackrock, the middle number will be 10, but if you were on (NA) Earthen Ring, (NA) Auchindoun, or (NA) Cho'gall, which are connected together, it will be 101. The server in the example, 970, is the connected realms "Beta Leveling Realm 01" and "Beta Leveling Realm 03".

CensusPlus "figures this out" with a fork of LibRealmInfo named "LibRealmID". The original lists each server as their original ID with a connection data table while the fork combines the data into one table with "ID-servername" keys.

You'll have to arrange Skillet in a way that remembers the GUID of each alt and allows sharing between characters that have the same server ID in their GUID, which means users have to login to each alt once your change is released to save each GUID.

bsmorgan 02-25-19 05:28 PM

Quote:

Originally Posted by Kanegasi (Post 331596)
I just remembered player GUIDs. The second part is a realm ID and connected realms share that ID.

This is the revelation I need! Currently, the per character data is stored in AceDB's realm tables but I can move them to the global table indexed by this shared realm ID and it should all work (famous last words)!

brykrys 03-06-19 12:59 PM

Sounds like GetAutoCompleteRealms would help here.


All times are GMT -6. The time now is 11:25 AM.

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