<?php
// $to в банк
if (strpos($to,"_")!==false) $ti=substr($to,0,strpos($to,"_")); else
if (strpos($to,"-")!==false) $ti=substr($to,0,strpos($to,"-")); else $ti=$to;
if (substr($to,0,5)=="i.rr.") $item=explode("|","руна|50"); else if (file_exists("items/".$ti)) $item=explode("|",implode("",file("items/".$ti))); else die("err: no items/".$to);
$count=intval(preg_replace('/.*'.$to.':(\d+).*/',"\\1",$l_i[$loc][$login]["items"]));
if ($count==0) msg("У вас нет ".$item[0],$tchar[0]);
if ($count>1 && !$num) { // кол-во
$stmp="<p><small><b>Укажите количество:\n<br/><input name=\"num\" format=\"*N\" maxlength=\"7\" value=\"".$count."\"/>\n<br/><a href=\"$PHP_SELF?sid=$sid&speak=$speak&id=$id&start=$start&to=$to&num=$(num)\">ок</a><br/><a href=\"$PHP_SELF?sid=$sid&speak=$speak&id=$id&start=$start&to=$to&num=999999999\">положить все</a></b></small>";
msg($stmp,$tchar[0],1,"","num",$count);
}
if (!$num || $num<1) $num=1;
if ($num>$count) $num=$count;
if ($to=="i.money" && intval(preg_replace('/.*i.money:(\d+).*/',"\\1",$l_i[$loc][$login]["bank"]))+$num>999999999) msg("<small><b>Извините, в банке можно хранить не более 999999999 золото</b></small>");
if ($speak=="n.t.bankir") additem($loc,$login,"","i.money","20","items","items",1,0,1);
if ($speak=="n.p.bankir") additem($loc,$login,"","i.money","200","items","items",1,0,1);
additem($loc,$login,$login,$to,$num,"items","bank",0,-1,1);
msg("<small><b>Вы положили в банк ".$num." ".$item[0]."<br/><a href=\"$PHP_SELF?sid=$sid&speak=$speak&id=$id&start=$start\">Продолжить</a></b></small>");