Page 1 of 1

CharId and clan_id in IdFactory

Posted: Mon Jun 21, 2010 4:56 pm
by reblock
Hello. I'm trying to transfer all data from PTS server to L2J. I have a question. There is a different id system in L2J (BitSet idFactory). I transfered all IDs with offset (FIRST_OID from IdFactory), but all ids in different tables started with same number (1 + 0x10000000). Is that ok, that row in [characters] has the same id with row in [clan_data]? Function getNextId generates unique id for all tables...

http://www.l2jserver.com/svn/trunk/L2_G ... ctory.java

Code: Select all

final TIntArrayList temp = new TIntArrayList(); rset = statement.executeQuery("SELECT COUNT(*) FROM characters");rset.next();temp.ensureCapacity(rset.getInt(1));rset = statement.executeQuery("SELECT charId FROM characters");while (rset.next()){	temp.add(rset.getInt(1));} rset = statement.executeQuery("SELECT COUNT(*) FROM items");rset.next();temp.ensureCapacity(temp.size() + rset.getInt(1));rset = statement.executeQuery("SELECT object_id FROM items");while (rset.next()){	temp.add(rset.getInt(1));} rset = statement.executeQuery("SELECT COUNT(*) FROM clan_data");rset.next();temp.ensureCapacity(temp.size() + rset.getInt(1));rset = statement.executeQuery("SELECT clan_id FROM clan_data");while (rset.next()){	temp.add(rset.getInt(1));}

Re: CharId and clan_id in IdFactory

Posted: Sun Jun 27, 2010 8:42 am
by reblock
Up. Does anybody know the answer? Maybe there will be problem in 'items' table, when char and clan has the same id?

Re: CharId and clan_id in IdFactory

Posted: Sun Jun 27, 2010 8:52 am
by JIV
in theory clanid and charid do not conflict (charid and itemid do) but when clan is destroyed Id is released so that can makes serious problems, you will have to generate new ids for clanId.

Re: CharId and clan_id in IdFactory

Posted: Sun Jun 27, 2010 8:59 am
by reblock
JIV wrote:in theory clanid and charid do not conflict (charid and itemid do) but when clan is destroyed Id is released so that can makes serious problems, you will have to generate new ids for clanId.
Thank you for answer. So item, char and clan can't have same id (char and item too)? It's only one right way - generate unique id for all objects? What about itemsonground and messages?

P. S. Very strange solution. I think, using auto_increment id in each table (characters, clan_data, items) - simple, fast, nice and much better way.