EQ2Emulator Development forum.
Moderator: Team Members
-
Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Post
by Ememjr » Sun Oct 08, 2017 5:33 am
how do i get a player( character)s uniqueid if all i know is their name
and they do not have to be logged in
this is for my
PlayerHouseAccessUpdateMsg function that is sent to client when adding a player to your house access list
Code: Select all
<Struct Name="WS_PlayerHouseAccessUpdateMsg" ClientVersion="1" OpcodeName="OP_PlayerHouseAccessUpdateMsg">
<Data ElementName="unique_id" Type="int64" /> <!-- players unique_id -->
<Data ElementName="access_delete" Type="int8" />
<Data ElementName="access_name" Type="EQ2_16Bit_String" />
<Data ElementName="access_level" Type="int8" />
</Struct>
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Post
by Jabantiz » Sun Oct 08, 2017 3:00 pm
If they are not logged in I do not believe it is possible to get the id so you will need to make a new function to hit the DB to get it.
-
xinux
- Team Member
- Posts: 680
- Joined: Wed Mar 10, 2010 11:10 am
- Location: Destroyer of Servers
Post
by xinux » Sun Oct 08, 2017 4:18 pm
Yea we started running in to the same issue over at vgoemu and we ended up making the the player unique ID the same as the character_id so we could grab it if they were on or offline.
EQ II - Build=1360 (Orig) - Build=1360 (DoF) - Build=2654 (KoS) - Build=3375 (Classic) - Build=3554 (EoF)
EQ II - Build=4412 (RoK) - Build=5122 (TSO) - Build=6118 (SF) - Build=7628 (DoV) - Build=8295 (Aod)
-
Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Post
by Ememjr » Sun Oct 08, 2017 10:52 pm
so would you say the unique character id would be the ID from characters table?
-
tyrbo
- Team Member
- Posts: 271
- Joined: Thu Feb 18, 2016 12:33 pm
Post
by tyrbo » Mon Oct 09, 2017 4:48 am
Yes.
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Post
by Jabantiz » Mon Oct 09, 2017 3:19 pm
Yes, and the player already loads it but you can't get it if the player is offline.
-
Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Post
by Ememjr » Thu Oct 12, 2017 2:46 pm
well it appears that we already have a function that get the unique id by name
but as usual how do i call it from housingpackets.cpp
Code: Select all
int32 WorldDatabase::GetCharacterID(const char* name) {
int32 id = 0;
Query query;
if (name) {
MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT `id` FROM `characters` WHERE `name`='%s'", name);
if (result && mysql_num_rows(result) > 0) {
MYSQL_ROW row;
row = mysql_fetch_row(result);
id = atoul(row[0]);
}
}
return id;
}
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Post
by Jabantiz » Thu Oct 12, 2017 3:27 pm
First make sure world database is included then an "extern WorldDatabase database" under the includes then just do database.GetCharacterID()
-
Ememjr
- Team Member
- Posts: 975
- Joined: Wed Mar 15, 2017 9:41 am
- EQ2Emu Server: Perseverance
Post
by Ememjr » Fri Oct 13, 2017 3:58 am
lol thanks that worked,
i had tired
and
but i did not try them both at the same time
Who is online
Users browsing this forum: No registered users and 0 guests