Вход Регистрация
Файл: metal_plant.php
Строк: 158
<?php

include_once("settings.php");
include_once(
"game_header.php");
include_once(
"things.php");
include_once(
"thing.php");
include_once(
"chain.php");
include_once(
"player_thing.php");

//FIX ME
if($room_id!=1){
    
header("Location: area.php");
    break;
}

$things = new CThings($db);
$thing = new CThing($db);
$chain = new CChain($db);
$player_thing = new CPlayerThings($db,$vnum);

$skills = new CSkill($db,$vnum);
$level_gunsmith=$skills->getSkillLevel(SKILL_GUNSMITH);
if(
$level_gunsmith==false){
    
//add player gansmith skill
    
$skills->setSkill(SKILL_GUNSMITH);
    
$level_gunsmith=1;
}

/* type make resource */
$type_res=array();

if(
$room_id==1){
    
$type_res[]=53;//fishion rods
    
$type_res[]=29;
    
$type_res[]=7;//iron mining axe
    
$type_res[]=5;//axe iron
    
$type_res[]=27;//iron caster
    
$type_res[]=49;//machete
    
$type_res[]=46;//rezaki
    
$type_res[]=67;//spining
    
$type_res[]=28;//steel hammer
    
$type_res[]=4;//steel axe
    
$type_res[]=50;//battle knife
    
$type_res[]=45;//steel perchatki
    
$type_res[]=51;//ripper
    
$type_res[]=52;//super minig axe
}

if(isset(
$mode)){
    
$info_msg="";
    switch(
$mode){
        case 
'make':
        if(isset(
$obj)){
            
$chain->setVnum($obj);
            
$thing->setVnum($obj);
            if(
$chain->checkComponents($player_thing)==false){
                
$info_msg="х ЧБУ ОЕФ ОХЦОЩИ ЛПНРПОЕОФ";
                break;
            }
            
//check player level and level things
            
$things_level $thing->getLevel();

            if(
$things_level-5>$level_gunsmith){
                
$info_msg="чЩ ОЕ НПЦЕФЕ ЙЪЗПФПЧЙФШ ЬФХ ЧЕЭШ. чБЫ ХТПЧЕОШ УМЙЫЛПН НБМ.";
                break;
            }

            
//all ok, try make things
            
$chain->makeThings($player_thing);
            
$info_msg="чЩ ХУРЕЫОП ЙЪЗПФПЧЙМЙ ЧЕЭШ";

            
//update exp
            
$object_exp=$chain->calculateExp();

            
$skills->setSkill(SKILL_GUNSMITH,$object_exp);
        }
        break;
    }
    
session_register("info_msg");
    
header("location: metal_plant.php");
    exit();
}

if(isset(
$info_msg))
{
    
$smarty->assign('INFO_MSG',$info_msg);
    
session_unregister("info_msg");
}

//get ores in player bag
$ores=$player_thing->getAllThingsOneType("bar");
$ores=array_merge($ores,$player_thing->getAllThingsOneType("wood"));
$ores=array_merge($ores,$player_thing->getAllThingsOneType("leather"));
foreach(
$ores as $v)
{
    
$smarty->append("ores",array(
    
'VNUM' => $v['vnum_obj'],
    
'NAME' => $v['name'],
    
'COUNT' => $v['count']
    ));
}

foreach (
$type_res as $v)
{
    
$thing->setVnum($v);
    if(
$thing->getMake()==0) continue;
    
$thing_name=$thing->getName();
    
$thing_level=$thing->getLevel();

    
$chain->setVnum($v);
    
$component $chain->getComponents();

    if(
$component==false) continue;

    
$thing->setVnum($component['vnum_1']);
    
$comp1_name=$thing->getName();
    
$comp1_count=$component['count_1'];
    
    if(
$component['count_2']!=0){
        
$thing->setVnum($component['vnum_2']);
        
$comp2_name=$thing->getName();
        
$comp2_count=$component['count_2'];
    }else{
        
$comp2_name="";
        
$comp2_count="";
    }
    
    
    
$smarty->append("things",array(
                
'VNUM' => $v,
                
'NAME' => $thing_name,
                
'LEVEL' => $thing_level,
                
'COMP1_NAME' => $comp1_name,
                
'COMP2_NAME' => $comp2_name,
                
'COMP1_COUNT' => $comp1_count,
                
'COMP2_COUNT' => $comp2_count,
            ));
}

$smarty->assign('LEVEL_GUNSMITH',$level_gunsmith);

$plant=$smarty->fetch($templ_path.'/metal_plant.tpl');

$smarty->assign('MAIN',$plant);

echo(
$smarty->fetch($templ_path.'/game.tpl'));

?>
Онлайн: 0
Реклама