I wonder how do I identify the account "A" has the characters "A1", "A2", "A3".
What is the query parameters that have to pull the java to identify it in mysql?
I wonder how do I identify the account "A" has the characters "A1", "A2", "A3".
What is the query parameters that have to pull the java to identify it in mysql?
if it's not required to be realtime you can use the mysql table 'roles' generated by pwAdmin, it contains account id, role infos, faction infos and pvp infos...
for realtime
Code:<%@page import="java.sql.*"%> <%@page import="protocol.*"%> <%@page import="java.io.*"%> <%@page import="java.text.*"%> <%@page import="java.util.*"%> <%@page import="java.util.Iterator"%> <%@page import="com.goldhuman.Common.Octets"%> <%@page import="com.goldhuman.IO.Protocol.Rpc.Data.DataVector"%> <%@page import="org.apache.commons.lang.StringEscapeUtils"%> <% // fetch uid's from mysql table 'users' int uid = 32; // Get all character of current userid DataVector dv = GameDB.getRolelist(uid); if(dv != null) { Iterator itr = dv.iterator(); while(itr.hasNext()) { IntOctets ios = (IntOctets)itr.next(); int roleid = ios.m_int; String rolename = ios.m_octets.getString(); out.println(rolename); } } %>
Last edited by ronny1982; 07-11-10 at 04:32 PM.
So if I get the uid roleid + for a table, all you have roleid same UID are from this account, is it?
if you have the account id and want the corresponding role id's:
use the solution above
if you have the role id and want the corresponding account id:
account_id = role_id/16*16 // <- Integer Division !!!!
i.e.
role_id = 36
account_id = 36/16*16 = 32
wouldn't the 16*16 part be utterly useless? as it just gives you the same number as you started with unless I messed up my math
36/16*16 = 36, if I am not mistaken... unless you do an int cast to prevent it from being a float (or set it as int, don't remember how that works in java...) you'll always get the same number back..
Edit: right as I finished posting that I realized you specified integer division, oh well see above if you don't know what that means