"; if(!$log){ print " $tblstart$tccell1>You must be logged in to access the Item Shop.
". redirect('index.php','return to the main page',0). $tblend; }else{ $user=mysql_fetch_array(mysql_query("SELECT posts,regdate,users_rpg.* FROM users,users_rpg WHERE id=$loguserid AND uid=id")); $p=$user[posts]; $d=(ctime()-$user[regdate])/86400; $st=getstats($user); $GP=$st[GP]; switch($action){ case '': $shops=mysql_query('SELECT * FROM itemcateg ORDER BY corder'); $eq=mysql_fetch_array(mysql_query("SELECT * FROM users_rpg WHERE uid=$loguserid")); $eqitems=mysql_query("SELECT * FROM items WHERE id=$eq[eq1] OR id=$eq[eq2] OR id=$eq[eq3] OR id=$eq[eq4] OR id=$eq[eq5] OR id=$eq[eq6] OR id=$eq[eq7]"); while($item=mysql_fetch_array($eqitems)) $items[$item[id]]=$item; while($shop=mysql_fetch_array($shops)) $shoplist.=" $tccell1>$shop[name] $tccell2s>$shop[description] $tccell1s>".$items[$eq['eq'.$shop[id]]][name]." "; print " $tccell1>This place hasn't been touched in ages... $tblend
$tblstart $tccellh colspan=3>Hidden Shop $tccellc>Shop$tccellc>Description$tccellc>Item equipped $shoplist $tblend
$tblstart $tccellh>???
"; break; case 'items': $eq=mysql_fetch_array(mysql_query("SELECT eq$cat AS e FROM users_rpg WHERE uid=$loguserid")); $eqitem=mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id=$eq[e]")); print " $tblstart $tccell1>Return to shop list $tblend

"; $atrlist=''; for($i=0;$i<9;$i++) $atrlist.="$tccellh width=50>$stat[$i]"; $items=mysql_query("SELECT * FROM items WHERE (cat=$cat OR cat=0) AND `hidden` = 1 ORDER BY type,coins"); print " $tblstart $tccellh width=110 colspan=2>Commands$tccellct width=1 rowspan=10000>  $tccellh colspan=1>Item $atrlist $tccellh width=6%> $tccellh width=5%> "; while($item=mysql_fetch_array($items)){ $preview="
Preview"; if($item[id]==$eq[e] && $item[id]){ $comm="width=80 colspan=2>Sell"; }elseif($item[id] && $item[coins]<=$GP && !$item[gcoins]){ $comm="width=30>Buy$tccell1 width=50>$preview"; }elseif(!$eq[e] && !$item[id]){ $comm="width=80 colspan=2>-"; }else{ $comm="width=80 colspan=2>$preview"; } if($item[id]==$eqitem[id]) $color=' class=equal'; elseif($item[coins]>$GP) $color=' class=disabled'; else $color=''; $atrlist=''; for($i=0;$i<9;$i++){ $st=$item["s$stat[$i]"]; if(substr($item[stype],$i,1)=='m'){ $st=vsprintf('x%1.2f',$st/100); if($st==100) $st=' '; }else{ if($st>0) $st="+$st"; if(!$st) $st=' '; } $itst=$item["s$stat[$i]"]; $eqst=$eqitem["s$stat[$i]"]; if(!$color && substr($item[stype],$i,1)==substr($eqitem[stype],$i,1)){ if($itst> $eqst) $st="$st"; if($itst==$eqst) $st="$st"; if($itst< $eqst) $st="$st"; } $atrlist.=" $tccell1>$st"; } if ($item['desc']) { $item['name'] .= " - ". $item['desc'] .""; } print " $tccell1 $comm $tccell2l>$item[name] $atrlist $tccell2r>". ($item[coins] < 8388607 ? $item[coins] : "tons") ." $tccell2r>". ($item[gcoins] < 8388607 ? $item[gcoins] : "tons") ." "; } print $tblend; break; case 'buy': $item=mysql_fetch_array(mysql_query("SELECT * FROM items WHERE id=$id")); if($item[coins]<=$GP){ $pitem=mysql_fetch_array(mysql_query("SELECT coins FROM items WHERE id=".$user['eq'.$item[cat]])); $whatever = $pitem[coins]*0.6-$item[coins]; mysql_query("UPDATE users_rpg SET `eq". $item[cat] ."`='". $id ."',`spent`=spent-". $whatever ." WHERE uid=$loguserid") or print mysql_error(); print " $tblstart $tccell1>The $item[name] has been bought and equipped.
".redirect('shoph.php','return to the shop',0)." $tblend "; } break; case 'sell': $pitem=mysql_fetch_array(mysql_query("SELECT coins FROM items WHERE id=".$user['eq'.$cat])); mysql_query("UPDATE users_rpg SET eq$cat=0,spent=spent-$pitem[coins]*0.6 WHERE uid=$loguserid") or print mysql_error(); print " $tblstart $tccell1>The $item[name] has been unequipped and sold.
".redirect('shoph.php','return to the shop',0)." $tblend "; break; default: } } print $footer; printtimedif($startingtime); ?>