CharId and clan_id in IdFactory

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
reblock
Posts: 21
Joined: Fri Mar 05, 2010 2:08 pm

CharId and clan_id in IdFactory

Post 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));}
reblock
Posts: 21
Joined: Fri Mar 05, 2010 2:08 pm

Re: CharId and clan_id in IdFactory

Post by reblock »

Up. Does anybody know the answer? Maybe there will be problem in 'items' table, when char and clan has the same id?
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: CharId and clan_id in IdFactory

Post 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.
reblock
Posts: 21
Joined: Fri Mar 05, 2010 2:08 pm

Re: CharId and clan_id in IdFactory

Post 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.
Post Reply