itemadition.ini easy creation

05/21/2014 02:26 PowerChaos#1
Dear users
This php script contains a easy way to populate your itemadition.ini file

What does it do ?

There are so many clients and so many databases that they are all differend

some databases contains a other value then other databases

The intemadition.ini provide the + bonus ( like +255) for the client side
it shows you the avaible + bonus
but as long it is not in database it will not provide any kind of bonus

so this script is just to take the value from database so you can easy create new bonusses or make sure that all items in the database also exist on the client

How does it work
Realy easy
just create a php file , edit some settings in the script and run the script
it will make a txt file that contains all item bonus from the database

on this way you just need to add the + bonus you want to the database and you can generate a simple txt file
PHP Code:
<?php
// Define mySQL variables
$hostname="localhost";  //The ip adress ( localhost )
$username="root"// Database User ( root )
$password="test"// Database user Password ( test )
$database="my"// Game Database ( my )
$bonus 24 // The bonus you like to add ( (takes double value of +12 bonus)

//DO NOT EDIT BELOW XD
// Connect to mySQL
MYSQL_CONNECT($hostname$username$password);
MYSQL_SELECT_DB('$database');

$file "eudemons.txt";
$f fopen($file'w'); // Open in write mode
$count=0;
$sql mysql_query("SELECT * FROM cq_itemaddition WHERE level = 12 ORDER BY typeid,level ASC");
while(
$row mysql_fetch_array($sql))
{
      
$string "\n";
      
$row[2] = $bonus;
      
$row[3] = $row[3] + $row[3];
      
$row[4] = $row[4] + $row[4];
      
$row[5] = $row[5] + $row[5];
      
$row[6] = $row[6] + $row[6];
      
$row[7] = $row[7] + $row[7];
      
$row[8] = $row[8] + $row[8];
      
$row[9] = $row[9] + $row[9];
      
$row[10] = $row[10] + $row[10];
      
$row[11] = $row[11] + $row[11];
     
$string .= "$row[1] $row[2] $row[3] $row[4] $row[5] $row[6] $row[7] $row[8] $row[9] $row[10] $row[11]";
     
fwrite($f$string);
    
mysql_query("insert into cq_itemaddition (id, typeid,level, life, attack_max, attack_min, defense, mgcatk_max, mgcatk_min, magic_def, dexterity, dodge) values (' ','".$row[1]."','".$row[2]."','".$row[3]."','".$row[4]."','".$row[5]."','".$row[6]."','".$row[7]."','".$row[8]."','".$row[9]."','".$row[10]."','".$row[11]."')") or die(mysql_error());

$count++;
}
fclose($f);


echo 
"<a href=eudemons.txt>TEST! and $count</a>";
?>
here is a example output of the file (eudemons.txt)
Code:
490100 24 0 664 600 0 362 328 0 0 0
490110 24 0 730 660 0 398 360 0 0 0
490120 24 0 780 704 0 428 386 0 0 0
490130 24 0 858 776 0 472 424 0 0 0
490140 24 0 924 836 0 506 456 0 0 0
490150 24 0 974 880 0 534 482 0 0 0
490160 24 0 1078 974 0 590 532 0 0 0
enjoy
Greets From Powerchaos
05/26/2014 22:00 PowerChaos#2
fixed a small error
just remove $row[12] and it will be fine

Greets From PowerChaos

updated script

now you can add easy a bonus

in my example i took the +24 , it auto take the double value of +12 and change it to +24
it also automatic make the stats double ( based on +12 stats) and add it to the db

so you got all items with a extra + (if exist in db )

Greets From PowerChaos
05/27/2014 04:19 Khalidmadkour#3
Wow thanks PowerChaos
I don't know what is it or even how is it work , but I though you should get a comment and thank for make it :)
05/28/2014 05:04 PowerChaos#4
ok let me explain it easy xD

it is for the bonus that you get on your equipment

like sword(+1)
The bonus with yellow stones

basic does the game contain all items to make it +12
but some users like to offer +255 equipment or any other value

beside the extra potention does it not provide any bonus ( it let you lose the bonus )

so unless it is added to the db , is +12 even better then +255 ( exept for the potention part)


The script just take out all weapons present in database , change the value to the value you choose ( +255 for example)
Put it in database ( 2X value of +12 bonus )
Print out a txt file that contains the needed information that need to be added to the client ( or they wont see it )


so in short

The db part add extra damage to your +bonus
the client part is just visual based , it is like shopping mall

if you do not add the id's that are in the mall to the db , then you can not buy it
same apply to everything basicly
Client side is just to show the value to the players but does not apply the value in game xD

hope this could help you

Greets From PowerChaos
06/05/2014 08:31 Khalidmadkour#5
yea i got it Nice ;D
06/28/2014 12:23 [GM]Fallen[PM]#6
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\item.php on line 18
TEST! and 0
06/28/2014 16:45 DarkNightEO#7
by using this script , we can do many thing . tq bro
06/28/2014 17:56 [GM]Fallen[PM]#8
Quote:
Originally Posted by DarkNightEO View Post
by using this script , we can do many thing . tq bro
can you give me that script.. i don't know why this script error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\item.php on line 18
TEST! and 0
06/30/2014 00:53 PowerChaos#9
Quote:
Originally Posted by [GM]Fallen[PM] View Post
can you give me that script.. i don't know why this script error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\item.php on line 18
TEST! and 0
that error just means that you do not have any items in that certain database/table

Code:
SELECT * FROM cq_itemaddition WHERE level = 12
so in short
select all rows
from
cq_itemaddition
Where
level is equal to 12

select all rows is the wildcard ( * )
from cq_itemaddition that is the bonus table ( matching the ini file name )
level means the bonus ( +12 in this case)

so if it does return a warning ( mysql_fetch) so it does not find a single value of items that are +12 in this case (is it not empty ? )

change level to 11 for example to see if it does work then ( in case you changed +12 to +255 or so :P )

Greets From PowerChaos