03-17-2015, 06:29 PM
the file should look like
function DeductNas($cid, $amount)
{
global $LC_Db; global $con_cms_pdo;
$query = sprintf
("
Update
%s.t_characters
SET
a_nas = a_nas - :amount
WHERE
a_index = :cidindex
AND
a_enable = 1
", $LC_Db );
$dbh = $con_cms_pdo->prepare( $query );
$dbh->execute( array( ':amount' => $amount ,':cidindex' => $cid ));
}
function GetitemBalance( $cid, &$invRow, &$invCol, &$invAmount )
{
global $LC_Db; global $con_cms_pdo;
$l = substr($cid, -1);
$query = sprintf
("
SELECT
a_item_idx0,
a_item_idx1,
a_item_idx2,
a_item_idx3,
a_item_idx4,
a_count0,
a_count1,
a_count2,
a_count3,
a_count4,
a_row_idx
FROM
%s.t_inven0".$l."
WHERE
a_char_idx = :cidindex
", $LC_Db );
$dbh = $con_cms_pdo->prepare( $query );
$dbh->execute( array( ':cidindex' => $cid ));
$invRow = -1;
$invCol = -1;
$invAmount = 0;
while( $row = $dbh->fetch() )
{
$r = $row['a_row_idx'];
for( $c=0; $c<5; $c++ )
{
if( $row['a_item_idx'.$c] == 9999 )
{
$invRow = $r;
$invCol = $c;
$invAmount = $row['a_count'.$c];
}
}
}
}
function DeductItem($cid, $row, $col, $amount)
{
$l = substr($cid, -1);
global $LC_Db; global $con_cms_pdo;
$query = sprintf
("
UPDATE
%s.t_inven0%d
SET
a_count%d = %s
WHERE
a_char_idx = '%s'
AND
a_row_idx = '%s'
", $LC_Db,
$l,
$col,
$amount,
$cid,
$row );
$dbh = $con_cms_pdo->prepare( $query );
$dbh->execute();
}
function GetGoldBalance( $cid, &$invRow, &$invCol, &$invAmount )
{
global $LC_Db; global $con_cms_pdo;
$l = substr($cid, -1);
$query = sprintf
("
SELECT
hope you serve

