[Help] Item Adder

Wikko0

Active Member
Joined
Oct 17, 2012
Messages
647
Reaction score
245
Здравейте!
Имам проблем с тази функция. Добавят се само sword-ове, които са с item type 0, всеки друг предмет различен от sword не се добавя правилно - добавя се sword.
Смятах, че проблема е във $FF, но сравих с itemadder-a от уебшопа на Дарк за 97д версията и не намирам разлика, а там си работи :D
Някакви идеи от какво може да е?


PHP:
$i_info = mssql_fetch_array(mssql_query("select * from [WebShop] where [uid]='".(int) secure($_GET['uid'])."'"));
$credita = mssql_fetch_row(mssql_query("exec WZ_GetItemSerial"));
$online = mssql_fetch_array(mssql_query("SELECT * FROM MEMB_STAT WHERE memb___id='".secure($_SESSION['dt_username'])."' AND ConnectStat = 1"));
$credita = sprintf("%08X", $credita[0],00000000);
$AA    = sprintf("%02X", $i_info['id'],00);
$BB    = 0;
$ZZ    = 0;
$CC    = sprintf("%02X", $i_info['default_durability'],00);
$DDEE = $credita;
$itemtype = $i_info['type'];
switch ($itemtype) {
    case 14:
        $itemtype=12;
    break;
    case 12:
        $itemtype=13;
    break;
    case 13:
        $itemtype=14;
    break;
}
$itemtype = $itemtype*16;
$FF    = sprintf("%02X",$itemtype,00);
$HH    = 0;
$HI    = 0;
if(($i_info['hasLevel']==1) && ($_GET['item_level']>0) && ($_GET['item_level']<=$shopy['limit']['item_level'])) { $BB += $_GET['item_level']*8; }
else { $BB += $i_info['stickLevel']*8; }
if($_GET['item_level']>$shopy['limit']['item_level']) { echo '<br />The maximum level that item can be is <b>'.$_GET['limit']['item_level'].'</b>, do not exceed it!'; $error = true; }
if($_GET['item_option']>$shopy['limit']['item_option']) { echo '<br />The maximum option that item can have is at stage #<b>'.$shopy['limit']['item_option'].'</b>, do not exceed it!'; $error = true; }
$ops = 0;       
if(($i_info['hasOption']==1) && ($_GET['item_option']>0) && ($_GET['item_option']<=7)) {
if($_GET['item_option']>=4) { $BB += $_GET['item_option']-4; $HH+=64; }
else { $BB += $_GET['item_option']; }
}
if(($i_info['skill']==1) && ($_GET['item_skill']==1)) { $BB += 128; }
if(($i_info['luck']==1) && ($_GET['item_luck']==1)) { $BB += 4; }
if($BB<0) $BB=0;
if(($i_info['ex_type']!=-1) && ($i_info['ex_type']!=3))
{
if($_GET['ex1']) { $HH+=1; $ops++; }
if($_GET['ex2']) { $HH+=2; $ops++; }
if($_GET['ex3']) { $HH+=4; $ops++; }
if($_GET['ex4']) { $HH+=8; $ops++; }
if($_GET['ex5']) { $HH+=16; $ops++; }
if($_GET['ex6']) { $HH+=32; $ops++; }
}
if(($i_info['type']==12) && ($i_info['id']==37))
{
    switch($_GET['fenrir'])
    {
        case 1:
            $HH=1;
            $i_info['credits'] += $shopy['credits']['fenrir_destroy'];
        break;
        case 2:
            $HH=2;
            $i_info['credits'] += $shopy['credits']['fenrir_protect'];
        break;
        case 3:
            $HH=4;
            $i_info['credits'] += $shopy['credits']['fenrir_gold'];
        break;
    }
}
if($_GET['item_ref']==1) { $FF    = sprintf("%02X",$itemtype+8,00); }
if($_GET['item_harmony']>0) { $HI = $_GET['item_harmony'].sprintf("%01X",'13',00); } else { $HI = sprintf("%02X",'00',00); }

$BB = sprintf("%02X",$BB,00);
$HH = sprintf("%02X",$HH,00);
$ZZ = sprintf("%02X",$ZZ,00);

$newitem = $AA.$BB.$CC.$DDEE.$HH.$ZZ.$FF;

$item = ItemInfo($newitem);
if($ops>$shopy['limit']['item_excellent']) { echo '<br />The maximum excellent options an item can have are #<b>'.$webshop['limit']['item_excellent'].'</b>, do not exceed them!'; $error = true; }

if(@$online) { echo "<br />Your account is online.Must to be offline to buy items"; $error = true; }
elseif($mycreds['credits'] < $item['credits']) { echo '<br />You do not have enough credits to do that.'; $error = true; }
elseif(($mycreds['credits']-$item['credits'])<0) { echo '<br />You do not have enough credits to do that.'; $error = true; }
elseif($i_info['credits']==0) { echo '<br />That item is not for sale'; $error = true; }
//Searcher
$mycuritems = substr(mssql_get_last_message(mssql_query("declare @it varbinary(1920) set @it=(select [Items] from [warehouse] where [AccountID]='".$_SESSION['dt_username']."'); print @it;")),2);       
$test        = 0;
$slot = smartsearch($mycuritems,1,1);
$test = $slot * 20;
if($slot==1337) { echo "Your warehouse is fulls.Please make some space"; $error = true; }
if(!$error) {
$mynewitems = substr_replace($mycuritems,$newitem,$test,20);
mssql_query("Update [warehouse] set [Items]=0x" . $mynewitems . " WHERE [AccountId]='" . secure($_SESSION['dt_username']) . "'");
mssql_query("exec XCredits '".secure($_SESSION['dt_username'])."','".($item['credits']*-1)."'");
echo "<br />Item was added in your warehouse<br /><div style='$item[style];width: ".($item['X']*32)."px;height: ".($item['Y']*32)."px;'$item[nfo]></div><img src='img/l.gif' Onload=\"logged()\">";
}
}
 

r00tme

Member
Joined
Feb 4, 2021
Messages
42
Reaction score
33
То не е открийте разликите като дебъгваш, нацвъкай var_dump-ове на ключовите места и ще разбереш къде гърми.
 
  • Love
Reactions: Wikko0

Wikko0

Active Member
Joined
Oct 17, 2012
Messages
647
Reaction score
245
То не е открийте разликите като дебъгваш, нацвъкай var_dump-ове на ключовите места и ще разбереш къде гърми.
Оправих го със сумати мъки. Видях, че съм забравил да оправя $AA :D
Мерси все пак