Aleos

Increase item ID array size!

Recommended Posts

Increased item ID array size!

As of 7cd82d0, rAthena is now able to support item IDs up to 65,535!

 

The added benefit is that there is no extra memory consumption for the increased size. By changing the variables to unsigned this removes all the negative values that could never be used. This patch also included a change to CARD0_PET and removed the negative value of it since it's not dependent on the client.

 

@Cydh was able to help and tested clients 2010-07-30 and up and was able to create items successfully over 32k. If you still run a client before 2010-07-30 post your results so I can update this topic!

 

Don't forget to run sql-files/upgrades/upgrade_20140612.sql and sql-files/upgrades/upgrade_20140612_log.sql!

 

Follow ups:

  • Upvote 5
  • Love 1

Share this post


Link to post
Share on other sites

/no1

 

the (fake) fact that u @Aleos an excuse that u can't diff 2013 client, then u forced me to did a test for him. /heh

  • Upvote 1

Share this post


Link to post
Share on other sites

Nice addition :P 

Share this post


Link to post
Share on other sites

Made a small change in 42b29ee. Cydh pointed out that adjusting the tables before changing CARD0_PET caused the value to be set to 0 since we are applying an unsign change before the absolute change. Just make sure to use the updated SQL files. :)

  • Upvote 1

Share this post


Link to post
Share on other sites

Thanks! Correct me if im wrong. So what i did was

1. Truncate all of my SQL Files. From item_cash_db.sql to mob_skill_db2_re.sql (Located at \rAthena\sql-files)

2. After truncating all of my SQL files. I go to folder called upgrades and look for SQL files named upgrade_20140612.sql and upgrade_20140612_log.sql as stated above. ( Located at \rathena\sql-files\upgrades)

3. Im using MySQL Query so File > Open Script > select those updates then Execute.

 

Am i making sense? I see no error after doing these steps above.

 

 

 

 

 

Uhm hi. How to do this?

 

just execute it on your database. sameway on how you import the main.sql and log.sql

 

 

Btw i tried this. As i am only using MAIN.SQL and LOG.SQL. The update upgrade_20140612.sql and upgrade_20140612_log.sql wont complete when i click the Execute. So what i did was the step above.

Share this post


Link to post
Share on other sites

You don't have to truncate anything when applying anything from the upgrade folder. As long as what steps you did above seem to work for you, then ok. Seems like all you did was remove stuff from non-character based files.

Share this post


Link to post
Share on other sites

Well if there are new revision for git. I always start from zero.

 

Out of topic.

What are the files should i need to truncate? As i am using only 1 schema now named rathena. (The reason for this was the VPS i purchased only have 1 schema) so another schema is not necessary.

 

Besides from MAIN and LOG what else?

post-25150-0-46861500-1402592586_thumb.jpg

Share this post


Link to post
Share on other sites

By default all you need is main.sql. Log would be if you want to use the logging system. The rest of the stuff is not needed unless you want everything to be ran via the SQL side rather than the db/ files.

  • Upvote 1

Share this post


Link to post
Share on other sites

By default all you need is main.sql. Log would be if you want to use the logging system. The rest of the stuff is not needed unless you want everything to be ran via the SQL side rather than the db/ files.

So to apply those updates from above. What i need to truncate is only the MAIN.SQL, LOG.SQL, MOB_DB.SQL, MOB_DB_RE.SQL, MOB_DB2.SQL and MOB_DB2_RE.SQL.

 

Those 6. Because i tried it again only importing MAIN and LOGS. Im seeing error.

And yeah you're right. I still want to run the db/files. So only those 6 sql's right?

post-25150-0-33780300-1402593676_thumb.jpg

Share this post


Link to post
Share on other sites

If you're using the db/ folder then all you need to import are the main and log SQL files. The rest of the files are not needed then.

  • Upvote 1

Share this post


Link to post
Share on other sites

Thank you so much Aleos. yeah. Thats why im having a hard time understanding the upgrade sql files.

 

 

So in my case. I dont need to update those upgrade_20140612.sql and upgrade_20140612_log.sql as i am using db files.

Share this post


Link to post
Share on other sites

If you still run a client before 2012-04-10 post your results so I can update this topic!

Here, I give these gifts from 2010-07-30a

post-5421-0-16171300-1402595921_thumb.jpg

post-5421-0-32373800-1402595939_thumb.jpg

post-5421-0-42108900-1402595955_thumb.jpg

  • Upvote 1

Share this post


Link to post
Share on other sites

Made another small change in 82467e1.

 

@gidzdlcrz

The point of the upgrades folder is so for later on, all you need to do is go to the upgrades folder and import the SQL file that was added from the commits you haven't applied yet. It avoids you having to dump your schema every time (using live or offline data). You'd still have to apply those upgrades since some tables affected are core tables used by the server. The tables that you aren't using, such as mob_db, item_db, mob_skill_db, etc can be ignored if you get errors in your case since you are using the db/ files.

 

@Cydh

Thanks for testing an even older client! I'm surprised it went back that far. :o

  • Upvote 1

Share this post


Link to post
Share on other sites

Made another small change in 82467e1.

 

@gidzdlcrz

The point of the upgrades folder is so for later on, all you need to do is go to the upgrades folder and import the SQL file that was added from the commits you haven't applied yet. It avoids you having to dump your schema every time (using live or offline data). You'd still have to apply those upgrades since some tables affected are core tables used by the server. The tables that you aren't using, such as mob_db, item_db, mob_skill_db, etc can be ignored if you get errors in your case since you are using the db/ files.

 

@Cydh

Thanks for testing an even older client! I'm surprised it went back that far. :o

I dont really get it. So sorry but how can i apply the update when i only use main and log sql's? So sorry again. Im being to noob.

Share this post


Link to post
Share on other sites

Okay i think that since i dont use any other SQL files beside MAIN and LOGS. And @aleos told me that i still need to apply the update even so. I think that it is okay to ignore the the error like mob_db since like i said i dont use it.

 

So only these part is necessary right?

UPDATE `auction` SET `card0` = 256 WHERE `card0` = -256;
UPDATE `cart_inventory` SET `card0` = 256 WHERE `card0` = -256;
UPDATE `guild_storage` SET `card0` = 256 WHERE `card0` = -256;
UPDATE `inventory` SET `card0` = 256 WHERE `card0` = -256;
UPDATE `mail` SET `card0` = 256 WHERE `card0` = -256;
UPDATE `storage` SET `card0` = 256 WHERE `card0` = -256;

ALTER TABLE `auction` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `auction` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `auction` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `auction` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `auction` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `cart_inventory` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `cart_inventory` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `cart_inventory` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `cart_inventory` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `cart_inventory` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `guild_storage` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `guild_storage` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `guild_storage` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `guild_storage` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `guild_storage` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `inventory` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `inventory` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `inventory` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `inventory` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `inventory` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mail` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mail` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mail` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mail` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mail` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `pet` MODIFY `egg_id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `storage` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `storage` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `storage` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `storage` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `storage` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';

While i ignore these (From line 40 to 94)

ALTER TABLE `mob_db` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';

ALTER TABLE `mob_db2` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';

ALTER TABLE `mob_db2_re` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db2_re` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';

ALTER TABLE `mob_db_re` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
ALTER TABLE `mob_db_re` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';

Please correct me if im wrong.

Share this post


Link to post
Share on other sites

Great work guys! ^_^

Share this post


Link to post
Share on other sites

@Cydh

 

please check , i'am not sure this function support for USHRT_MAX

/// npc_selllist for script-controlled shops
static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* item_list, struct npc_data* nd)
{
	char npc_ev[EVENT_NAME_LENGTH];
	char card_slot[NAME_LENGTH];
	int i, j, idx;
	int key_nameid = 0;
	int key_amount = 0;
	int key_refine = 0;
	int key_attribute = 0;
	int key_identify = 0;
	int key_card[MAX_SLOTS];

int key_nameid = 0; <-- support 65k array (not sure)
 

and 

/// Returns the id of the reference
#define reference_getid(data) ( (int32)(reference_getuid(data) & 0x00ffffff) )
/// Returns the array index of the reference
#define reference_getindex(data) ( (int32)(((uint32)(reference_getuid(data) & 0xff000000)) >> 24) )

/// Composes the uid of a reference from the id and the index
#define reference_uid(id,idx) ( (int32)((((uint32)(id)) & 0x00ffffff) | (((uint32)(idx)) << 24)) )

not support USHRT_MAX

 

thankyou

Edited by Napster

Share this post


Link to post
Share on other sites

sure they are,

int is 32-bits, short is 16-bits

Share this post


Link to post
Share on other sites

i applied this on my server sql

 

Don't forget to run sql-files/upgrades/upgrade_20140612.sql and sql-files/upgrades/upgrade_20140612_log.sql!

 

and then pet cant incubate.. please help me with this. how to revert this? i want to return back the way my sql was.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...