Файл: caught_fish.php
Строк: 101
<?php
include_once("settings.php");
include_once("game_header.php");
include_once("player_thing.php");
//check fish room
if($room_id!=3010){
header("Location: area.php");
}
$player_thing = new CPlayerThings($db,$vnum);
$thing = new CThing($db);
//check fish time
if(isset($get_fish)){
$diff_time=FISH_TIME;
session_unregister("get_fish");
}else{
//player already cought fish
$current_fish=time();
$fish_time=$player->getV0();
$diff_time=$current_fish-$fish_time;
$diff_time=$diff_time>FISH_TIME?0:$diff_time;
}
$smarty->assign('FISHING_TIME',$diff_time);
/*
if($diff_time<FISH_TIME){
if(!isset($info_msg)){
$info_msg="оЕ ХУРЕМЙ ХДПЮЛХ ЪБЛЙОХФШ, ХЦЕ ФБЭЙФЕ. тЩВБМЛБ РТПГЕУУ недмеоощк.";
}
}else{
*/
if(isset($mode)){
$info_msg="";
$get_fish=0;
switch ($mode){
case 'try':
$fish_time=time();
$fish_level=$skill->getSkillLevel(SKILL_FISH);
if($fish_level==false){
$info_msg="чЩ ОЕ ЪОБЕФЕ ЛБЛ ФХФ МПЧЙФШ ТЩВХ.";
break;
}
//check fish rod
$fish_tool=$player_thing->getWearThing(WEAR_TWO_HAND);
$fish_rod=$player_thing->getThingID($fish_tool);
if($fish_rod!=53 && $fish_rod!=67){
$info_msg="х ЧБУ ОЕФ ХДПЮЛЙ ЙМЙ ЮФП-ФП РПИПЦЕЗП ОЕ ОЕЕ. хДПЮЛХ ОБДП ЧЪСФШ Ч ТХЛЙ.";
break;
}
//check player bag
$things_count=$player_thing->getCountThings();
if($things_count>=MAX_PLAYER_ITEM){
$info_msg="лХДБ ТЩВЛХ ЛМБФШ ВХДЕН. нПЦЕФ Ч ЛБТНБО, Ч ТАЛЪБЛЕ ПОЙ ХЦЕ ЛБЛ ЛЙМШЛЙ Ч ВПЮЛЕ";
break;
}
//set fish time
$player->setV0($fish_time);
//check fish which player may cought
$fish_array = array(55);//carp always exist in list
$thing->setVnum(56);//perch
if(($thing->getLevel()-$fish_level)<5){
$fish_array[] = 56;
}
$thing->setVnum(57);//bream
if(($thing->getLevel()-$fish_level)<5){
$fish_array[] = 57;
}
$thing->setVnum(58);//pike
if(($thing->getLevel()-$fish_level)<5){
$fish_array[] = 58;
}
//add old things
if(mt_rand(0,10)==5){
$fish_array[] = 59;
}
if(mt_rand(0,10)==5){
$fish_array[] = 60;
}
//select rand fish from array
$fish_id=mt_rand(0,count($fish_array)-1);
$fish_id=$fish_array[$fish_id];
//check chance for this fish
$thing->setVnum($fish_id);
$fish_id_level=$thing->getLevel();
$chance=getProbability($fish_id_level,$fish_level);
$fish_true=calculateChance($chance);
if($fish_true==true){
//check tortile chance
if(mt_rand(0,200)==50){
$fish_id=61;
$thing->setVnum($fish_id);
}
$fish_name=$thing->getName();
$info_msg="чЩ РПКНБМЙ ТЩВХ - ЬФП ВЩМБ ТЩВЛБ $fish_name.";
//add player in inventory
$player_thing->addThing($fish_id);
//update exp
$fish_exp=$thing->getV0();
$skill->setSkill(SKILL_FISH,$fish_exp);
//damage rods
$player_thing->decreaseDurability($fish_tool);
$get_fish=0;
break;
}
$info_msg="чЩ ОЕ РПКНБМЙ ТЩВЛХ.";
break;
case 'fish':
$tm=time()-FISH_TIME*2;//unrool minute back
$player->setV0($tm);
break;
}
session_register("info_msg");
session_register("get_fish");
header("Location: caught_fish.php");
exit();
}
if(isset($info_msg))
{
$smarty->assign('INFO_MSG',$info_msg);
session_unregister("info_msg");
}
//check fish rod
//$fish_tool = $player_thing->getThingVnum(53);
$fish_tool=$player_thing->getWearThing(WEAR_TWO_HAND);
$fish_rod=$player_thing->getThingID($fish_tool);
if($fish_rod!=53 && $fish_rod!=67){
$smarty->assign("FISH_TOOL",0);
}else{
$smarty->assign("FISH_TOOL",1);
}
//check skill
$fish_level=$skill->getSkillLevel(SKILL_FISH);
if($fish_level!=0){
$smarty->assign("FISH_SKILL",1);
}
$caught_fish_txt=$smarty->fetch($templ_path.'/caught_fish.tpl');
$smarty->assign('MAIN',$caught_fish_txt);
echo($smarty->fetch($templ_path.'/game.tpl'));
?>