[HELP]Looking for a genious

09/07/2011 01:28 en[DEV]er#1
I am adapting Korean Client to use it on a new client and I encounter the sad situation: only 19,000 (rounded) of 65000 index of item_shape are being used, and I had an idea: it would be nice if someone could put all index's in sequence on the client and then I remember to epvpers:''There is a lot of guys in epvpers smart, I will ask for their help! " And so here I am! Someone can help me ?:D
09/07/2011 16:03 Zombe#2
So what do you want, just to get a list of items from all item files sorted by their IDs? Give me a few min...

Done, put the files at the same folder as the script, edit add or delete file names as you like. Results will be saved as output.csv :)
PHP Code:
<?php
$files 
= array(
'itemarmor.csv',
'itemcash.csv',
'itemetc.csv',
'itemweapon.csv'
);
foreach(
$files as $filename)
{
    
$file file($filename);
    
$flag false;
    foreach(
$file as $row)
    {
        if(!
$flag)
        {
            
$flag true;
            continue;
        }
        
$expl explode(',',$row);
        if(
$expl[0] == '')
            continue;
        
$ids[] = $expl[0];
        
$rows[$expl[0]] = $row;
    }
}
sort($ids);
foreach(
$ids as $id)
{
    
$newrows[$id] = $rows[$id];
}
file_put_contents('output.csv',$newrows);
?>
09/07/2011 23:20 en[DEV]er#3
Thks dude ! awesome job !

Quote:
Originally Posted by Zombe View Post
So what do you want, just to get a list of items from all item files sorted by their IDs? Give me a few min...

Done, put the files at the same folder as the script, edit add or delete file names as you like. Results will be saved as output.csv :)
PHP Code:
<?php
$files 
= array(
'itemarmor.csv',
'itemcash.csv',
'itemetc.csv',
'itemweapon.csv'
);
foreach(
$files as $filename)
{
    
$file file($filename);
    
$flag false;
    foreach(
$file as $row)
    {
        if(!
$flag)
        {
            
$flag true;
            continue;
        }
        
$expl explode(',',$row);
        if(
$expl[0] == '')
            continue;
        
$ids[] = $expl[0];
        
$rows[$expl[0]] = $row;
    }
}
sort($ids);
foreach(
$ids as $id)
{
    
$newrows[$id] = $rows[$id];
}
file_put_contents('output.csv',$newrows);
?>

this code put the ids in sequence? like that,my problems its this: i shoud can put with a script like that reindex the files in sequence with the item_shape.csv ...

ex.:
(itemarmor)
101, argan armor,...
(item_shape)
101,....

the script put automaticly
(itemarmor)
1, argan armor,...
(item_shape)
1,....
09/10/2011 06:47 en[DEV]er#4
nobody's can help me? very sad =/
09/10/2011 10:43 Zombe#5
Well I can, I just know it will take probably 2-3 hours, and I can't force myself to do it... :|

Cause you know, to change all IDs you'd need to change them not only in item_shape.csv and itemwhatever.csv, but you'd also need to change the upgrading pointers, if you can call it that, also edit all drops, and lastly generate and run one big-ass query made up of ~20k smaller queries, one for each ID...

I'm not sure if I want to spend so much time doing it all... :|
09/10/2011 22:20 en[DEV]er#6
Quote:
Originally Posted by Zombe View Post
Well I can, I just know it will take probably 2-3 hours, and I can't force myself to do it... :|

Cause you know, to change all IDs you'd need to change them not only in item_shape.csv and itemwhatever.csv, but you'd also need to change the upgrading pointers, if you can call it that, also edit all drops, and lastly generate and run one big-ass query made up of ~20k smaller queries, one for each ID...

I'm not sure if I want to spend so much time doing it all... :|
Yeah...work a lot =/