Файл: useitem.php
Строк: 24
<?
// использование предметов  
        if (!file_exists("./items/".$use)){ unset ($player["items"][$use]);  unset($player["bank"][$use]);
        msg ("Возможно этот предмет удален администратором игры");
        } else
 if ((time()-$player['deystvo'])<=3) {
msg("Вы не можете так часто выполнять действия!");
         } else {
        if (!isset($player["items"][$use])) msg("<p>У вас нет этого предмета");
        //шмот по уровням
        //броня
                if (substr($use,0,11)=='item.armor.') {
                $item=explode("|",implode("",file("./items/".$use)));
                $war1=explode("|",$player["war"]);
                $lev=($item[4]-$war1[13]);
                if ($item[4]>$war1[13]) msg ("Слишком маленький уровень!Нехватает ".$lev." уровней");
                } 
        //оружия
                if (substr($use,0,12)=='item.weapon.') {
                $item=explode("|",implode("",file("./items/".$use)));
                $war1=explode("|",$player["war"]);
                $lev=($item[10]-$war1[13]);
                if ($item[10]>$war1[13]) msg ("Слишком маленький уровень!Нехватает ".$lev." уровней");
                } 
        //мин силы
                if (substr($use,0,12)=='item.weapon.') {
                $item=explode("|",implode("",file("./items/".$use)));
                $skill=explode("|",$player["skills"]);
                $lev=($item[5]-$skill[0]);
                if ($item[5]>$skill[0]) msg ("Нехватает силы владеть этим оружием !Нехватает ".$lev." силы");
                } 
        //мин интеллекта
                if (substr($use,0,12)=='item.weapon.') {
                $item=explode("|",implode("",file("./items/".$use)));
                $skill=explode("|",$player["skills"]);
                $lev=($item[6]-$skill[2]);
                if ($item[6]>$skill[2]) msg ("Нехватает интеллекта владеть этим оружием !Нехватает ".$lev." интеллекта");
                } 
        if (substr($use,0,12)=='item.weapon.' || substr($use,0,11)=='item.armor.' || substr($use,0,10)=='item.amul.') {        // одеваем/снимаем оружие броню
            if ($player['animag']) { msg("Нельзя одевать предметы под действием навыка ''анимагия''!"); }
      else {
      // если в руках нож и есть $to, то освежевание
if ($to && substr($use,0,17)=='item.weapon.knife'){
require "./use/knife.dat";
                }else {
                if (!$player["equip"] || !array_search($use,$player["equip"])) {                // одеваем
          if (substr($use,0,12)=='item.weapon.') $player["equip"]["arm"]=$use;
          if (substr($use,0,15)=='item.armor.body') $player["equip"]["body"]=$use;
                    if (substr($use,0,15)=='item.armor.hand') $player["equip"]["hand"]=$use;
                    if (substr($use,0,14)=='item.armor.leg') $player["equip"]["leg"]=$use;
                    if (substr($use,0,15)=='item.armor.head') $player["equip"]["head"]=$use;
                    if (substr($use,0,17)=='item.armor.shield') $player["equip"]["shield"]=$use;
                    if (substr($use,0,14)=='item.armor.sap') $player["equip"]["sap"]=$use;
                    if (substr($use,0,14)=='item.armor.per') $player["equip"]["per"]=$use;
                     if (substr($use,0,9)=='item.amul') $player["equip"]["amul"]=$use;
                    // if (substr($use,0,9)=='item.rune') $player["equip"]["rune"]=$use;
          // если берем в руки нож, то просим цель для освежевания
                    if (substr($use,0,17)=='item.weapon.knife') $list='all';
                    } else if ($player["equip"]) unset($player["equip"][array_search($use,$player["equip"])]);
                calcparam($login);
                if (!$list) $list='inv';    // только если не взяли нож
                }
            } 
      }else 
            if (substr($use,0,9)=='item.note') {
                $item=explode("|",implode("",file("./items/".$use)));
                msg("<p>".$item[3],$item[0],1);
            } else 
            if (substr($use,0,12)=='item.scroll.' || substr($use,0,10)=='item.rune.' ) {    // свитки и руны кастуются ниже как магия, но не требует регов
                $scroll=$use;
                if (substr($use,0,12)=='item.scroll.') $use="magic.".substr($use,12); else $use="magic.".substr($use,10);
                require "magic.php";    // загружаем всю магию
                $magic=split("|",$arr_magic[$use]);
                if ($magic[6] && !$to) {$use=$scroll; $list='all'; $scroll=0;}    // чтобы вывести список целей
            }else 
            if (substr($use,0,10)=='item.food.' || substr($use,0,12)=='item.bottle.') {
require "./use/bottle.dat";
            }   else 
            if (substr($use,0,8)=='item.rod') { //рыбалка
require "./use/fish.dat";
            } else 
            if (substr($use,0,10)=='item.topor')
            {
require "./use/topor.dat";
        }
        
        
               if (substr($use,0,10)=='item.axe') {
require "./use/axe.dat";
}else 
            if (substr($use,0,10)=='item.kirka')
            {
require "./use/kirka.dat";
};
}
                          ?>