Inserting an item from database.

05/06/2012 20:27 sarkoplata#1
Hello community,

For example, I want to make a web-item-shop. How will add them to database programatically?

I know I should first add item to Item database, then get the item id and add to the inventory database. But I'm having problems with the 'Serial64' Column.
What should I do with it?

Thanks in advance.
05/07/2012 04:01 ✗EpicSoul✗#2
well first you need to know a lot of php,sql

you could use some easy queries to add the items to players.
-for example

USE SRO_VT_SHARD
--Usage:
--exec _ADD_ITEM_EXTERN 'CharName','ItemsCodeName',Count,OptLvl
declare @CharName varchar(64)

set @CharName = 'YourCharName'

exec _ADD_ITEM_EXTERN @CharName,'ITEM_EU_TSTAFF_11_SET_B_RARE',1,10

this query would give the character 1 egyptian staff + 10
05/07/2012 11:25 sarkoplata#3
Thank you, that was what i was looking for
05/07/2012 13:27 LemoniscooL#4
yeah i knew that, but how to add magic options to the items created? like full blue and 100% on all stats?
05/07/2012 14:39 sarkoplata#5
Quote:
Originally Posted by LemoniscooL View Post
yeah i knew that, but how to add magic options to the items created? like full blue and 100% on all stats?
Take a look at _SMC_ITEM_ADD function. (or something like that)
Or, after adding item to database you can get it's id and edit params yourself. It will be pain in the ass :D

Here is a quick php script to add an item to every character on the database:

PHP Code:
<?php

$a 
'';
$b 'ITEM_EU_TSTAFF_01'// your item code. this is an example
$c 1;                  // amount
$d 8;                  // plusvalue +8

$connection odbc_connect("Driver={SQL Server};Server=YOURPC\SQL;Database=YOURSHARDDATABASENAME;""YOURSQLUSERNAME""YOURSQLPASS");
$query odbc_exec($connection"SELECT * FROM _Char");

while(
$extracted odbc_fetch_array($query))
{
    
$a $extracted['CharName16'];
    
$stmt    odbc_prepare($connection"{CALL _ADD_ITEM_EXTERN('$a', '$b', '$c', '$d')}");
    
$success odbc_execute($stmt, array());
    
}

?>
05/07/2012 14:41 ✗EpicSoul✗#6
Quote:
Originally Posted by sarkoplata View Post
Take a look at _SMC_ITEM_ADD function. (or something like that)
Or, after adding item to database you can get it's id and edit params yourself. It will be pain in the ass :D

Here is a quick php script to add an item to every character on the database:

PHP Code:
<?php

$a 
'';
$b 'ITEM_EU_TSTAFF_01'// your item code. this is an example
$c 1;                  // amount
$d 8;                  // plusvalue +8

$connection odbc_connect("Driver={SQL Server};Server=YOURPC\SQL;Database=YOURSHARDDATABASENAME;""YOURSQLUSERNAME""YOURSQLPASS");
$query odbc_exec($connection"SELECT * FROM _Char");

while(
$extracted odbc_fetch_array($query))
{
    
$a $extracted['CharName16'];
    
$stmt    odbc_prepare($connection"{CALL _ADD_ITEM_EXTERN('$a', '$b', '$c', '$d')}");
    
$success odbc_execute($stmt, array());
    
}

?>
nice !! :)
05/07/2012 15:12 LemoniscooL#7
yeah well thats an easy one .. also what use does it have to add an tem to all chars on server? Oo if you want to build an item shop online you need something that will add an item into an accounts storage (chest in smc) maybe ill write a small script for that later
05/07/2012 15:26 sarkoplata#8
Quote:
Originally Posted by LemoniscooL View Post
yeah well thats an easy one .. also what use does it have to add an tem to all chars on server? Oo if you want to build an item shop online you need something that will add an item into an accounts storage (chest in smc) maybe ill write a small script for that later
web-shop was an example to explain. The script does my job^^