Ties of the characters.

Results 1 to 5 of 5
  1. #1
    Account Upgraded | Title Enabled! lotus55 is offline
    MemberRank
    Apr 2010 Join Date
    251Posts

    Ties of the characters.

    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?


  2. #2
    Account Upgraded | Title Enabled! ronny1982 is offline
    MemberRank
    Jan 2010 Join Date
    744Posts

    Re: Ties of the characters.

    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.

  3. #3
    Account Upgraded | Title Enabled! lotus55 is offline
    MemberRank
    Apr 2010 Join Date
    251Posts

    Re: Ties of the characters.

    So if I get the uid roleid + for a table, all you have roleid same UID are from this account, is it?

  4. #4
    Account Upgraded | Title Enabled! ronny1982 is offline
    MemberRank
    Jan 2010 Join Date
    744Posts

    Re: Ties of the characters.

    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

  5. #5
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Ties of the characters.

    Quote Originally Posted by ronny1982 View Post
    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



Advertisement