Файл: kitchen.php
Строк: 105
<?php
include_once("settings.php");
include_once("game_header.php");
include_once("thing.php");
include_once("player_thing.php");
//FIX ME
if($room_id!=1){
    header("Location: area.php");
    break;
}
$thing = new CThing($db);
$player_thing = new CPlayerThings($db,$vnum);
$cook_level=$skill->getSkillLevel(SKILL_COOK);
if(isset($mode)){
    switch($mode){
        case 'fry':
            //get skill cook
            if(!$cook_level){
                $info_msg="чЩ ОЕ ЪОБЕФЕ ЛБЛ, УРТПУЙФЕ ЛПЗП ОЙВХФШ РП ВМЙЪПУФЙ";
                break;
            }
            //check object level
            $thing->setVnum($obj);
            $things_level = $thing->getLevel();
            if($things_level-5>$cook_level){
                $info_msg="чЩ ОЕ НПЦЕФЕ ЙЪЗПФПЧЙФШ ЬФХ ЧЕЭШ. чБЫ ХТПЧЕОШ УМЙЫЛПН НБМ.";
                break;
            }
            
            //check object
            if($thing->getType()!='fish'){
                $info_msg="чЩ ОЕ НПЦЕФЕ ЙЪЗПФПЧЙФШ ЬФХ ЧЕЭШ. ьФП ОЕ ЗПФПЧЙФУС.";
                break;
            }
            
            //transfer things
            $new_id=0;
            switch($obj){
                case 55:
                    $new_id=62;
                    break;
                case 56:
                    $new_id=63;
                    break;
                case 57:
                    $new_id=64;
                    break;
                case 58:
                    $new_id=65;
                    break;
                case 61:
                    $new_id=66;
                    break;
            }
            
            //possibly error
            if($new_id==0) return 0;
            
            //get count thing
            $obj_vnum = $player_thing->getThingVnum($obj);
            if($obj_vnum==-1){
                $info_msg="х ЧБУ ОЕФ ЬФПК ЧЕЭЙ";
                break;
            }
            $count_things=$player_thing->getCountThing($obj_vnum);
            //remove this things
            $player_thing->removeThing($obj_vnum,$count_things);
            //add new obj
            $player_thing->addThing($new_id,$count_things);
            
            //update player exp
            $thing->setVnum($new_id);
            $expir=$thing->getV0()*$count_things;
            
            $skill->setSkill(SKILL_COOK,$expir);
            
            $info_msg = "чЩ РТЙЗПФПЧЙМЙ $count_things ЕДЙОЙГХ ЕДЩ Й РПМХЮЙМЙ $expir ПРЩФБ";
            
            break;
    }
    session_register("info_msg");
    header("location: kitchen.php");
    exit();
}
if(isset($info_msg))
{
    $smarty->assign('INFO_MSG',$info_msg);
    session_unregister("info_msg");
}
//get ores in player bag
$animals=$player_thing->getAllThingsOneType("fish");
foreach($animals as $v)
{
    $thing->setVnum($v['obj_id']);
    $thing_name=$thing->getName();
    $smarty->append("animals",array(
    'VNUM' => $v['obj_id'],
    'NAME' => $thing_name,
    'COUNT' => $v['count'],
    'LEVEL' => $v['level'],
    ));
}
$smarty->assign('LEVEL_COOK',$cook_level);
$kitchen_txt=$smarty->fetch($templ_path.'/kitchen.tpl');
$smarty->assign('MAIN',$kitchen_txt);
echo($smarty->fetch($templ_path.'/game.tpl'));
?>