[Rev 81] Storage and Itemmall structure

This is guide mostly for website tools and code, for example CMS or registration scripts.
There can also be tools.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

[Rev 81] Storage and Itemmall structure

Postby lmame on Thu Dec 06, 2007 5:37 pm

Here is the new storage structure:
  1.  
  2. -- ----------------------------
  3. -- Table structure for storage
  4. -- ----------------------------
  5. CREATE TABLE `storage` (
  6.   `owner` int(11) NOT NULL,
  7.   `itemnum` int(11) NOT NULL,
  8.   `itemtype` int(11) NOT NULL,
  9.   `refine` int(11) NOT NULL,
  10.   `durability` int(11) NOT NULL DEFAULT '40',
  11.   `lifespan` int(11) NOT NULL DEFAULT '100',
  12.   `slotnum` int(11) NOT NULL,
  13.   `count` int(11) NOT NULL DEFAULT '1',
  14.   `stats` int(11) NOT NULL DEFAULT '0',
  15.   `socketed` int(11) NOT NULL DEFAULT '0',
  16.   `appraised` int(11) NOT NULL DEFAULT '0',
  17.   `gem` int(11) NOT NULL DEFAULT '0',
  18.   UNIQUE KEY `ow_slot` (`owner`,`slotnum`)
  19. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  20.  



And mileage (for mileage storage):
  1.  
  2. -- ----------------------------
  3. -- Table structure for mileage
  4. -- ----------------------------
  5. CREATE TABLE `mileage` (
  6.   `owner` int(11) NOT NULL DEFAULT '0',
  7.   `itemnum` int(11) NOT NULL DEFAULT '0',
  8.   `itemtype` int(11) NOT NULL DEFAULT '0',
  9.   `refine` int(11) NOT NULL DEFAULT '0',
  10.   `durability` int(11) NOT NULL DEFAULT '40',
  11.   `lifespan` int(11) NOT NULL DEFAULT '100',
  12.   `slotnum` int(11) NOT NULL DEFAULT '0',
  13.   `count` int(11) NOT NULL DEFAULT '1',
  14.   `stats` int(11) NOT NULL DEFAULT '0',
  15.   `socketed` int(11) NOT NULL DEFAULT '0',
  16.   `appraised` int(11) NOT NULL DEFAULT '0',
  17.   `gem` int(11) NOT NULL DEFAULT '0',
  18.   UNIQUE KEY `ow_slot` (`owner`,`slotnum`)
  19. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  20.  


As you can see, it's quite like the same BUT with a unique key on owner and slotnum. SO, all PHP (os whatever) scripts must be VERY careful when adding items to a player's storage (regular or itemmall). All items MUST have a different slotnum number or else MySQL will kick you in the nuts :)

Just a little note, of course "owner" is the Account ID, not the character ID ;)

Another one, if you can, add the items one after another in itemmall as in this one there can be no gaps between each item (RoseNA requirement). It's done automatically in game (reorganized) but if you can do it... :lol:

Edit:
There are 160 slots in storage, and 48 in mileage storage:
  1.  
  2. #define MAX_STORAGE 160
  3. #define MAX_ITEMMALL 48
  4.  


Name of database changed.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: [Rev 81] Storage and Itemmall structure

Postby Jckf on Thu Dec 06, 2007 6:33 pm

Whats stored in the itemmall table? Contents of the mall?
User avatar
Jckf
Antares
Antares
 
Posts: 338
Joined: Wed Nov 28, 2007 1:09 am
Location: Norway

Re: [Rev 81] Storage and Itemmall structure

Postby lmame on Thu Dec 06, 2007 6:45 pm

Yes.

When you go in game to junon Storage for example, you can access or the storage or the item mall storage, though you can put whatever you want in it (in database, because you can't put back items from your inventory to the item mall storage).
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: [Rev 81] Storage and Itemmall structure

Postby Jckf on Thu Dec 06, 2007 6:49 pm

lmame wrote:Yes.

When you go in game to junon Storage for example, you can access or the storage or the item mall storage, though you can put whatever you want in it (in database, because you can't put back items from your inventory to the item mall storage).

Hm. So then it is:
storage = User's regular storage. Not related to item mall at all.
itemmall = Items bought from the item mal.
Correct me if I'm mistaken.
User avatar
Jckf
Antares
Antares
 
Posts: 338
Joined: Wed Nov 28, 2007 1:09 am
Location: Norway

Re: [Rev 81] Storage and Itemmall structure

Postby lmame on Thu Dec 06, 2007 6:57 pm

Well yes it's like that.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: [Rev 81] Storage and Itemmall structure

Postby rl2171 on Thu Dec 06, 2007 7:20 pm

I would like to see it that if someone gets something from the itemmall on the web for MY CMS be placed into the itemmall storage instead of the user storage.

One reason, what happens if the user fills up their storage, then what? This way it would be in the itemmall (mileage) storage till they move it out.

Oh, and yes, owner id, not char ID, I made that mistake already today! ;)
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: [Rev 81] Storage and Itemmall structure

Postby Jckf on Thu Dec 06, 2007 7:22 pm

rl2171 wrote:I would like to see it that if someone gets something from the itemmall on the web for MY CMS be placed into the itemmall storage instead of the user storage.
...

Thats how I planned it all along =) Since this is how it's supposed to be.
User avatar
Jckf
Antares
Antares
 
Posts: 338
Joined: Wed Nov 28, 2007 1:09 am
Location: Norway

Re: [Rev 81] Storage and Itemmall structure

Postby Rifke on Thu Dec 06, 2007 8:33 pm

Have you tested it? If I look at the MySQL code you can't add more than 1 item in the storage. Because the unique key will cause an error.


Jckf wrote:
rl2171 wrote:I would like to see it that if someone gets something from the itemmall on the web for MY CMS be placed into the itemmall storage instead of the user storage.
...

Thats how I planned it all along =) Since this is how it's supposed to be.

Not that there is a huge difference betweet storage an militeage (or w/e), because it's still using the same 'based' table. Only thing you've got to do is change the name of the table and you're done.
Rifke
Pero pero
Pero pero
 
Posts: 719
Joined: Thu Aug 09, 2007 3:01 pm
Location: Belgium

Re: [Rev 81] Storage and Itemmall structure

Postby Souleater on Thu Dec 06, 2007 8:41 pm

Why not use the platinum warehouse slots ? :o
Image
Souleater
Antares
Antares
 
Posts: 355
Joined: Thu Aug 09, 2007 10:59 pm

Re: [Rev 81] Storage and Itemmall structure

Postby lmame on Thu Dec 06, 2007 10:25 pm

Rifke wrote:Have you tested it? If I look at the MySQL code you can't add more than 1 item in the storage. Because the unique key will cause an error.


Hey :D
Did you look the warning I put in the first post?

As you can see, it's quite like the same BUT with a unique key on owner and slotnum. SO, all PHP (os whatever) scripts must be VERY careful when adding items to a player's storage (regular or itemmall). All items MUST have a different slotnum number or else MySQL will kick you in the nuts



The unique Key is NOT on onwer OR slotnum, it's a composed key:
  1. UNIQUE KEY `ow_slot` (`owner`,`slotnum`)


So it will only fail if a combination of owner + slotnum already exists (if owner 1 and slot 1 already exists, if you try to add again owner 1 and slot 1 it'll fail, but if you put owner 1 and slot 2 it works).
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Next

Return to PHP / Web Guides, Scripts and tools.

Who is online

Users browsing this forum: No registered users and 3 guests