Jump to content

Question

1 answer to this question

Recommended Posts

Posted (edited)

With your server OFF, you can do this in 3 steps:
 

1: Run the query below and you will get the insert syntax for all the cards equipped.

select concat(concat(concat('INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (', cid),',',card),',1,1);')
from (
	select `char_id` cid,`card0` card from `inventory` where `card0` between 4000 and 4999
	union all
	select `char_id` cid,`card1` card from `inventory` where `card1` between 4000 and 4999
	union all
	select `char_id` cid,`card2` card from `inventory` where `card2` between 4000 and 4999
	union all
	select `char_id` cid,`card3` card from `inventory` where `card3` between 4000 and 4999
) cards; 

 
 
2: The query above will produce a big result like:

....
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (150021,4035,1,1);
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (161994,4331,1,1);
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (150050,4086,1,1);
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (153757,4345,1,1);
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (150162,4362,1,1);
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (150162,4305,1,1);
INSERT INTO `inventory` (`char_id`,`nameid`,`identify`,`amount`) VALUES (151345,4122,1,1);
....

 
RUN ALL results returned by the query above as a new query to insert the cards to the respective owners.
 

3: Update all items and set card to 0 with the query below.

update `inventory` set `card0` = 0 where `card0` between 4000 and 4999;
update `inventory` set `card1` = 0 where `card1` between 4000 and 4999;
update `inventory` set `card2` = 0 where `card2` between 4000 and 4999;
update `inventory` set `card3` = 0 where `card3` between 4000 and 4999;

 

 

WARNING:

Maybe some character will get more than 100 item in their inventory. This is a problem because the items that exceed this limit will not be displayed.

To show that characters, use the query below:

select `char_id` from `inventory` group by `char_id` having count(`char_id`) > 100;

 

 

 

NOTE: Always make backup before doing that kind of operation.

Edited by Digos

Join the conversation

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

Guest
Answer this question...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...