Page 1 of 1

[SOLVED] AIO Buffer PHP reserved Object ID pool

Posted: Thu Oct 31, 2013 11:44 pm
by Ane
L2J Revision 5937
L2JDP Revision 9641

Hi L2j, I have some trouble on solving "how this works".

This is what I wan't to do:
A PHP script which opens me a way to add a AIO Buffer, I don't have any problem on how to add actual AIO, but on how to create a new weapon for that player who want's AIO. The reason that I have titled Factory ID, is that I'm worrying that some day something will get messed up, and the AIO creator will insert Object ID of the same number as something else. I need help on how to check the Objects with PHP before I render new Object ID,

Thanks, Ane.

Re: Factory ID description

Posted: Fri Nov 01, 2013 12:43 am
by xban1x
That's a bit hard, i guess you could make a scheduledTask that checks every 10 seconds if there is still enough free Ids in special database table. And make sure that table is filled with 10-20 objectIds. PHP script takes them and removes them and voila. If you set that objectId pool to 50 i believe it will never be empty and set the scheduled task to let's say 30 minutes.

Re: Factory ID description

Posted: Fri Nov 01, 2013 12:47 am
by Ane
Thanks for the reply!

Code: Select all

     protected static final String[] ID_CHECKS =    {        "SELECT owner_id    FROM items                 WHERE object_id >= ?   AND object_id < ?",        "SELECT object_id   FROM items                 WHERE object_id >= ?   AND object_id < ?",        "SELECT charId     FROM character_quests      WHERE charId >= ?     AND charId < ?",        "SELECT charId     FROM character_contacts    WHERE charId >= ?     AND charId < ?",        "SELECT contactId  FROM character_contacts    WHERE contactId >= ?  AND contactId < ?",        "SELECT charId     FROM character_friends     WHERE charId >= ?     AND charId < ?",        "SELECT charId     FROM character_friends     WHERE friendId >= ?   AND friendId < ?",        "SELECT charId     FROM character_hennas      WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_recipebook  WHERE charId >= ?     AND charId < ?",        "SELECT charId     FROM character_recipeshoplist  WHERE charId >= ?     AND charId < ?",        "SELECT charId     FROM character_shortcuts   WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_macroses    WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_skills      WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_skills_save WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_subclasses  WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_ui_actions  WHERE charId >= ? AND charId < ?",        "SELECT charId     FROM character_ui_categories  WHERE charId >= ? AND charId < ?",        "SELECT charId      FROM characters            WHERE charId >= ?      AND charId < ?",        "SELECT clanid      FROM characters            WHERE clanid >= ?      AND clanid < ?",        "SELECT clan_id     FROM clan_data             WHERE clan_id >= ?     AND clan_id < ?",        "SELECT clan_id     FROM siege_clans           WHERE clan_id >= ?     AND clan_id < ?",        "SELECT ally_id     FROM clan_data             WHERE ally_id >= ?     AND ally_id < ?",        "SELECT leader_id   FROM clan_data             WHERE leader_id >= ?   AND leader_id < ?",        "SELECT item_obj_id FROM pets                  WHERE item_obj_id >= ? AND item_obj_id < ?",        "SELECT object_id   FROM itemsonground        WHERE object_id >= ?   AND object_id < ?"    }; 
What if I generate an ID, and then do while if the ID is not placed anywhere in this tables. Then an item would prehaps be created?

Re: Factory ID description

Posted: Fri Nov 01, 2013 12:49 am
by xban1x
Why this complex checks? You can make sure that IdFactory prepares you free and reserved objectIds and you just take them from sql table and use them in PHP to reinsert...

Re: Factory ID description

Posted: Fri Nov 01, 2013 12:52 am
by Ane
That sounds good. Thanks :)

Re: Factory ID description

Posted: Fri Nov 01, 2013 4:14 am
by Ane
Okay! I managed to get it work.

Server on fixed Schedule looks in database for row, if finds it the index increases. Index - pool gives a missing number of a pool, if is more than 0, server loops the missing number and adds the objects ID to the pool. If server is booting, the pool is cleaned, and filled an again.

So finally, i can make PHP script to handle adding skills to the character, level, access level of a AIO Buffer and desired duals for the character, with one simple click :). Just awesome. Even better, now creating a item mall in Lineage2 will be piece of cake with this pool! Because, it allows the buyer when hes offline purchase items, without giving it individually to each player in a game. From a web!

Thanks l2j, i couldn't think of this method any better than xban1x did :)

Re: [SOLVED] AIO Buffer PHP reserved Object ID pool

Posted: Fri Nov 01, 2013 2:06 pm
by xban1x
Better way would be a TelnetHandler which would return you a free objectId when you request it. Making a connection thru PHP is fairly easy over telnet ;)