Файл: forest.php
Строк: 92
<?php
include_once("settings.php");
include_once("game_header.php");
include_once("player_thing.php");
include_once("players.php");
include_once("messages.php");
include_once("thing.php");
//check player state
checkPlayerState($player);
//FIX ME
if($room_id!=1){
header("Location: area.php");
break;
}
if($room_id==1){
$smarty->assign('LINDEN',1);
$smarty->assign('BIRCH',1);
$smarty->assign('WILLOW',1);
$smarty->assign('PINE',1);
}
$players = new CPlayers($db);
$work = $players->getPlayersInRoomAndAction($room_id,ACTION_WOODCUT);
$smarty->assign('WORK',$work);
if(!isset($mode)) $mode="";
$player_thing = new CPlayerThings($db,$vnum);
$level_woodcut=$skill->getSkillLevel(SKILL_WOODCUT);
$things = new CThing($db);
switch($mode)
{
case 'manager'://visit to controlman
//check tool on player
//check mountain skill
if($skill->getSkillProgress(SKILL_WOODCUT)==true){
$smarty->assign('WOODCUT',1);
}else{
$skill->setSkill(SKILL_WOODCUT);
}
$resources_txt=$smarty->fetch($templ_path.'/forest_manager.tpl');
break;
case 'woodcut':
if(!isset($_GET["obj"])){
header("Location: forest.php");
exit();
}
$obj = $_GET["obj"];
$things->setVnum($obj);
//check type objects, must be wood
$type_obj = $things->getType();
if($type_obj != "wood"){
header("Location: forest.php");
exit();
}
$info_msg="";
//check tool in players hand
$tool=$player_thing->getWearThing(WEAR_TWO_HAND);
$tool=$player_thing->getThingID($tool);
if($tool!=5 && $tool!=4) {
$info_msg="х ЧБУ ОЕФ ФПРПТБ Й ЧЩ ОЕ НПЦЕФЕ ТХВЙФШ ДЕТЕЧШС";
session_register("info_msg");
header("Location: forest.php");
exit();
}
//check player level and level things
$things_level = $things->getLevel();
if($things_level-5>$level_woodcut){
$info_msg="чБЫ ХТПЧЕОШ УМЙЫЛПН НБМ ДМС ТХВЛЙ ДБООПЗП ФЙРБ МЕУБ";
session_register("info_msg");
header("Location: forest.php");
exit();
}
//check player things in bag
$things_count=$player_thing->getCountThings();
if($things_count>=MAX_PLAYER_ITEM){
$info_msg="ч ЧБЫ ЙОЧЕОФБТШ ВПМШЫЕ ОЙЮЕЗП ОЕ ЧМЕЪЕФ";
session_register("info_msg");
header("Location: forest.php");
exit();
}
//start woodcut
$player->setWork(STATE_WORK,ACTION_WOODCUT,$obj);
$uuid=getUniqValue();
$player->setUuid($uuid);
//add log messages
$log_player = new CLogPlayers($db,$vnum,$uuid);
$msg=getStartWoodcuting();
$log_player->addLogMsg($msg);
//refresh
header("Location: forest.php");
exit();
break;
default:
if(isset($info_msg))
{
$smarty->assign('INFO_MSG',$info_msg);
session_unregister("info_msg");
}
$smarty->assign('LEVEL_WOODCUT',$level_woodcut);
$resources_txt=$smarty->fetch($templ_path.'/forest.tpl');
break;
}
$smarty->assign('MAIN',$resources_txt);
echo($smarty->fetch($templ_path.'/game.tpl'));
?>