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

//check login
include_once("settings.php");
include_once(
"game_header.php");

include_once(
"shop.php");
include_once(
"player.php");
include_once(
"thing.php");
include_once(
"messages.php");
include_once(
"log.php");
include_once(
"player_chat.php");

$uuid=$player->getUuid();
$logs_players=new CLogPlayers($db,$vnum,$uuid);
$player_chat = new CPlayerChat($db,$vnum);

//check mode
if(!isset($mode)) $mode="";

$action=$player->getAction();

switch(
$mode)
{
    case 
'stop':
        
//stop work
        
$player->setState(STATE_STAND);
        
//refresh
        
switch($action){
            case 
ACTION_MINIG:
                 
header("Location: resources.php");
                 exit();
                 break;
        }
        break;
}


$state=$player->getState();
switch(
$state)
{
    case 
STATE_WORK:
        
$obj_vnum=$player->getObject();
        
$thing = new CThing($db,$obj_vnum);
        
$obj_name=$thing->getName();
        
$msg="";
        
$action_txt=getAction();
        if(
$action==ACTION_MINIG){
            
$msg=getMsgMining($obj_name);
        }
        if(
$action==ACTION_WOODCUT){
            
$msg=getMsgWoodcut($obj_name);
        }
        if(
$action==ACTION_SMELT){
            
$msg=getMsgSmelt($obj_name);
        }
        
$logs=$logs_players->getLogMsgs();
        break;
    case 
STATE_STAND:
        
header("Location: area.php");
         exit();
        break;
}

$smarty->assign('MSG',$msg);
$smarty->assign('ACTION',$action_txt);

foreach(
$logs as $v)
{
    
$smarty->append("logs",array(
        
'TIME' => getTimes($v['pdate']),
        
'TEXT' => $v['text'],
        ));
}

//get chat messages
$chat_msg=$player_chat->getLastMessage($room_id,15);

foreach(
$chat_msg as $k => $v){
    
$chat_msg[$k]['pdata']=getChatTime($v['pdata']);
}

$smarty->assign_by_ref("chat_msg",$chat_msg);

$txt=$smarty->fetch($templ_path.'/state.tpl');
$smarty->assign('MAIN',$txt);

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

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