| 1 |
<?php |
| 2 |
/** |
| 3 |
* File functions: |
| 4 |
* Labyrynth in forrest city |
| 5 |
* |
| 6 |
* @name : maze.php |
| 7 |
* @copyright : (C) 2004,2005,2006 Vallheru Team based on Gamers-Fusion ver 2.5 |
| 8 |
* @author : thindil <thindil@users.sourceforge.net> |
| 9 |
* @version : 1.3 |
| 10 |
* @since : 31.10.2006 |
| 11 |
* |
| 12 |
*/ |
| 13 |
|
| 14 |
// |
| 15 |
// |
| 16 |
// This program is free software; you can redistribute it and/or modify |
| 17 |
// it under the terms of the GNU General Public License as published by |
| 18 |
// the Free Software Foundation; either version 2 of the License, or |
| 19 |
// (at your option) any later version. |
| 20 |
// |
| 21 |
// This program is distributed in the hope that it will be useful, |
| 22 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 |
// GNU General Public License for more details. |
| 25 |
// |
| 26 |
// You should have received a copy of the GNU General Public License |
| 27 |
// along with this program; if not, write to the Free Software |
| 28 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 29 |
// |
| 30 |
// $Id: maze.php 804 2006-10-31 14:12:31Z thindil $ |
| 31 |
|
| 32 |
$title = "Opuszczony szyb"; |
| 33 |
$title1 = $title; |
| 34 |
require_once("includes/head.php"); |
| 35 |
require_once("includes/funkcje.php"); |
| 36 |
require_once("includes/turnfight.php"); |
| 37 |
|
| 38 |
/** |
| 39 |
* Get the localization for game |
| 40 |
*/ |
| 41 |
require_once("languages/".$player -> lang."/maze.php"); |
| 42 |
|
| 43 |
if ($player -> location != 'Ardulith') |
| 44 |
{ |
| 45 |
error (ERROR); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Function to fight with monsters |
| 50 |
*/ |
| 51 |
function battle($type,$adress) |
| 52 |
{ |
| 53 |
require_once('class/monster_class.php'); |
| 54 |
require_once('class/fight_class.php'); |
| 55 |
global $player; |
| 56 |
global $smarty; |
| 57 |
global $enemy; |
| 58 |
global $arrehp; |
| 59 |
global $db; |
| 60 |
if ($player -> hp <= 0) |
| 61 |
{ |
| 62 |
error (NO_LIFE); |
| 63 |
} |
| 64 |
$enemy1 = $db -> Execute("SELECT * FROM monsters WHERE id=".$player -> fight); |
| 65 |
$span = ($enemy1 -> fields['level'] / $player -> level); |
| 66 |
if ($span > 2) |
| 67 |
{ |
| 68 |
$span = 2; |
| 69 |
} |
| 70 |
$expgain = ceil(rand($enemy1 -> fields['exp1'],$enemy1 -> fields['exp2']) * $span); |
| 71 |
$goldgain = ceil(rand($enemy1 -> fields['credits1'],$enemy1 -> fields['credits2']) * $span); |
| 72 |
$enemy = array("strength" => $enemy1 -> fields['strength'], |
| 73 |
"agility" => $enemy1 -> fields['agility'], |
| 74 |
"speed" => $enemy1 -> fields['speed'], |
| 75 |
"endurance" => $enemy1 -> fields['endurance'], |
| 76 |
"hp" => $enemy1 -> fields['hp'], |
| 77 |
"name" => $enemy1 -> fields['name'], |
| 78 |
"id" => $enemy1 -> fields['id'], |
| 79 |
"exp1" => $enemy1 -> fields['exp1'], |
| 80 |
"exp2" => $enemy1 -> fields['exp2'], |
| 81 |
"level" => $enemy1 -> fields['level']); |
| 82 |
if ($type == 'T') |
| 83 |
{ |
| 84 |
if (!isset ($_POST['action'])) |
| 85 |
{ |
| 86 |
//prepare session variables for monsters and player |
| 87 |
$monster = new Monster($player -> fight,1,0); |
| 88 |
$attacker = new Fighter($player -> id); |
| 89 |
$_SESSION['amount'] = 1; |
| 90 |
for ($k = 0; $k < $_SESSION['amount']; $k++) { |
| 91 |
//each monster identifier |
| 92 |
$strIndex = 'mon'.$k; |
| 93 |
$_SESSION[$strIndex]['id'] = $monster -> id; |
| 94 |
//each monster hit points |
| 95 |
$_SESSION[$strIndex]['hp'] = $monster -> hp; |
| 96 |
//each monster action points |
| 97 |
if ($attacker -> speed > $monster -> attackspeed) { |
| 98 |
$_SESSION[$strIndex]['ap'] = 1; |
| 99 |
} |
| 100 |
else { |
| 101 |
$_SESSION[$strIndex]['ap'] = floor($monster -> attackspeed / $attacker -> speed); |
| 102 |
if ($_SESSION[$strIndex]['ap'] > 5) { |
| 103 |
$_SESSION[$strIndex]['ap'] = 5; |
| 104 |
} |
| 105 |
} |
| 106 |
$tmpActionArr[$k][0] = $monster -> attackspeed; |
| 107 |
$tmpActionArr[$k][1] = $k; |
| 108 |
} |
| 109 |
$tmpActionArr[$k][0] = $attacker -> speed; |
| 110 |
$tmpActionArr[$k][1] = -1; |
| 111 |
|
| 112 |
/** |
| 113 |
* function to compare elements of actionArr |
| 114 |
*/ |
| 115 |
function aacmp($a,$b) { |
| 116 |
if ($a[0] == $b[0]) return 0; |
| 117 |
return ($a[0] > $b[0]) ? -1 : 1; |
| 118 |
} |
| 119 |
|
| 120 |
usort($tmpActionArr,"aacmp"); |
| 121 |
for ($k = 0; $k <= $_SESSION['amount']; $k++) { |
| 122 |
$actionArr[$k] = $tmpActionArr[$k][1]; |
| 123 |
} |
| 124 |
$_SESSION['actionArr'] = $actionArr; |
| 125 |
$_SESSION['exhaust']=0; |
| 126 |
if ($attacker -> speed > $monster -> attackspeed) { |
| 127 |
$_SESSION['points'] = floor($attacker -> speed / $monster -> attackspeed); |
| 128 |
if ($_SESSION['points'] > 5) { |
| 129 |
$_SESSION['points'] = 5; |
| 130 |
} |
| 131 |
} |
| 132 |
else { |
| 133 |
$_SESSION['points'] = 1; |
| 134 |
} |
| 135 |
$_SESSION['round']=0; |
| 136 |
} |
| 137 |
turnfight ($adress); |
| 138 |
if (isset($_SESSION['result'])) unset($_SESSION['result']); |
| 139 |
} |
| 140 |
else |
| 141 |
{ |
| 142 |
$monster = new Monster($player -> fight,1,0); |
| 143 |
$attacker = new Fighter($player -> id); |
| 144 |
pvmfastfight ($attacker,$monster,1,1); |
| 145 |
} |
| 146 |
$fight = $db -> Execute("SELECT fight FROM players WHERE id=".$player -> id); |
| 147 |
if ($fight -> fields['fight'] == 0) |
| 148 |
{ |
| 149 |
$player -> energy = $player -> energy - 1; |
| 150 |
if ($player -> energy < 0) |
| 151 |
{ |
| 152 |
$player -> energy = 0; |
| 153 |
} |
| 154 |
$db -> Execute("UPDATE players SET energy=".$player -> energy." WHERE id=".$player -> id); |
| 155 |
$smarty -> assign ("Link", "<br /><br /><a href=\"maze.php?action=explore\">".A_EXPLORE."</a><br />"); |
| 156 |
} |
| 157 |
else |
| 158 |
{ |
| 159 |
$smarty -> assign("Link", ''); |
| 160 |
} |
| 161 |
$fight -> Close(); |
| 162 |
$enemy1 -> Close(); |
| 163 |
} |
| 164 |
|
| 165 |
/** |
| 166 |
* If player not escape - start fight |
| 167 |
*/ |
| 168 |
if (isset($_GET['step']) && $_GET['step'] == 'battle') |
| 169 |
{ |
| 170 |
if (!isset ($_GET['type'])) |
| 171 |
{ |
| 172 |
$type = 'T'; |
| 173 |
} |
| 174 |
else |
| 175 |
{ |
| 176 |
$type = $_GET['type']; |
| 177 |
} |
| 178 |
battle($type,'maze.php?step=battle'); |
| 179 |
} |
| 180 |
|
| 181 |
/** |
| 182 |
* If player escape |
| 183 |
*/ |
| 184 |
if (isset($_GET['step']) && $_GET['step'] == 'run') |
| 185 |
{ |
| 186 |
$enemy = $db -> Execute("SELECT speed, name, exp1, exp2, id FROM monsters WHERE id=".$player -> fight); |
| 187 |
if (empty($enemy -> fields)) |
| 188 |
{ |
| 189 |
error(ERROR); |
| 190 |
} |
| 191 |
/** |
| 192 |
* Add bonus from rings |
| 193 |
*/ |
| 194 |
$arrEquip = $player -> equipment(); |
| 195 |
if ($arrEquip[9][2]) |
| 196 |
{ |
| 197 |
$arrRingtype = explode(" ", $arrEquip[9][1]); |
| 198 |
$intAmount = count($arrRingtype) - 1; |
| 199 |
if ($arrRingtype[$intAmount] == R_SPE5) |
| 200 |
{ |
| 201 |
$player -> speed = $player -> speed + $arrEquip[9][2]; |
| 202 |
} |
| 203 |
} |
| 204 |
if ($arrEquip[10][2]) |
| 205 |
{ |
| 206 |
$arrRingtype = explode(" ", $arrEquip[10][1]); |
| 207 |
$intAmount = count($arrRingtype) - 1; |
| 208 |
if ($arrRingtype[$intAmount] == R_SPE5) |
| 209 |
{ |
| 210 |
$player -> speed = $player -> speed + $arrEquip[10][2]; |
| 211 |
} |
| 212 |
} |
| 213 |
$chance = (rand(1, $player -> level * 100) + $player -> speed - $enemy -> fields['speed']); |
| 214 |
$intChance2 = rand(1, 10); |
| 215 |
$smarty -> assign ("Chance", $chance); |
| 216 |
if (($intChance2 < 3) || ($chance > 0)) |
| 217 |
{ |
| 218 |
$intExpGain = 2; |
| 219 |
$intExpLvl = ceil($enemy -> fields['level']/10); |
| 220 |
if ($intExpGain < $intExpLvl) |
| 221 |
$intExpGain = $intExpLvl; |
| 222 |
$smarty -> assign(array("Ename" => $enemy -> fields['name'], |
| 223 |
"Expgain" => $intExpGain, |
| 224 |
"Escapesucc" => ESCAPE_SUCC, |
| 225 |
"Escapesucc2" => ESCAPE_SUCC2, |
| 226 |
"Escapesucc3" => ESCAPE_SUCC3)); |
| 227 |
checkexp($player -> exp,$intExpGain,$player -> level,$player -> race,$player -> user,$player -> id,0,0,$player -> id,'',0); |
| 228 |
$db -> Execute("UPDATE players SET fight=0 WHERE id=".$player -> id); |
| 229 |
} |
| 230 |
else |
| 231 |
{ |
| 232 |
$strMessage = ESCAPE_FAIL." ".$enemy -> fields['name']." ".ESCAPE_FAIL2.".<br />"; |
| 233 |
$smarty -> assign ("Message", $strMessage); |
| 234 |
$smarty -> display ('error1.tpl'); |
| 235 |
battle('T','maze.php?step=battle'); |
| 236 |
} |
| 237 |
$hp = $db -> Execute("SELECT hp FROM players WHERE id=".$player -> id); |
| 238 |
$smarty -> assign ("Health", $hp -> fields['hp']); |
| 239 |
if ($hp -> fields['hp'] > 0) |
| 240 |
{ |
| 241 |
$smarty -> assign("Link", "<a href=\"maze.php?action=explore\">".A_EXPLORE."</a>"); |
| 242 |
} |
| 243 |
$hp -> Close(); |
| 244 |
} |
| 245 |
|
| 246 |
if (!isset($_GET['action'])) |
| 247 |
{ |
| 248 |
$smarty -> assign(array("Mazeinfo" => MAZE_INFO, |
| 249 |
"Ayes" => YES)); |
| 250 |
$_GET['action'] = ''; |
| 251 |
} |
| 252 |
|
| 253 |
if (isset($_GET['action']) && $_GET['action'] == 'explore') |
| 254 |
{ |
| 255 |
if ($player -> energy < 0.3) |
| 256 |
{ |
| 257 |
error(NO_ENERGY); |
| 258 |
} |
| 259 |
if ($player -> hp <= 0) |
| 260 |
{ |
| 261 |
error(YOU_DEAD); |
| 262 |
} |
| 263 |
if (!empty($player -> fight)) |
| 264 |
{ |
| 265 |
$enemy = $db -> Execute("SELECT name FROM monsters WHERE id=".$player -> fight); |
| 266 |
error (FIGHT1.$enemy -> fields['name'].FIGHT2."<br /> |
| 267 |
<a href=maze.php?step=battle&type=T>".Y_TURN_F."</a><br /> |
| 268 |
<a href=maze.php?step=battle&type=N>".Y_NORM_F."</a><br /> |
| 269 |
<a href=maze.php?step=run>".NO."</a><br />"); |
| 270 |
$enemy -> Close(); |
| 271 |
} |
| 272 |
$db -> Execute("UPDATE players SET energy=energy-.3 WHERE id=".$player -> id); |
| 273 |
$intRoll = rand(1, 100); |
| 274 |
$smarty -> assign(array("Link" => "<a href=\"maze.php?action=explore\">".A_EXPLORE."</a>", |
| 275 |
"Roll" => $intRoll)); |
| 276 |
if ($intRoll < 49) |
| 277 |
{ |
| 278 |
$smarty -> assign("Message", EMPTY_1); |
| 279 |
} |
| 280 |
if ($intRoll > 48 && $intRoll < 64) |
| 281 |
{ |
| 282 |
$intRoll2 = rand(1,5); |
| 283 |
if ($inRoll2 < 5 ) |
| 284 |
{ |
| 285 |
$arrMonsters = array(2, 4, 12, 14, 17, 69, 74, 79, 84); |
| 286 |
$intRoll3 = rand(0, 8); |
| 287 |
} |
| 288 |
if ($intRoll2 == 5) |
| 289 |
{ |
| 290 |
$arrMonsters = array(32, 41, 53, 88, 92, 102, 116); |
| 291 |
$intRoll3 = rand(0, 6); |
| 292 |
} |
| 293 |
$enemy = $db -> Execute("SELECT `name`, `id` FROM `monsters` WHERE id=".$arrMonsters[$intRoll3]); |
| 294 |
$db -> Execute("UPDATE `players` SET `fight`=".$enemy -> fields['id']." WHERE `id`=".$player -> id); |
| 295 |
$smarty -> assign (array("Name" => $enemy -> fields['name'], |
| 296 |
"Youmeet" => YOU_MEET, |
| 297 |
"Fight2" => FIGHT2, |
| 298 |
"Yturnf" => Y_TURN_F, |
| 299 |
"Ynormf" => Y_NORM_F, |
| 300 |
"Ano" => NO)); |
| 301 |
} |
| 302 |
if ($intRoll > 63 && $intRoll < 70) |
| 303 |
{ |
| 304 |
$objHerb = $db -> Execute("SELECT gracz FROM herbs WHERE gracz=".$player -> id); |
| 305 |
$arrHerbs = array('illani', 'illanias', 'nutari', 'dynallca'); |
| 306 |
$intRoll2 = rand(0, 3); |
| 307 |
$intAmount = rand(1, 10); |
| 308 |
if (!$objHerb -> fields['gracz']) |
| 309 |
{ |
| 310 |
$db -> Execute("INSERT INTO herbs (gracz, ".$arrHerbs[$intRoll2].") VALUES(".$player -> id.",".$intAmount.")"); |
| 311 |
} |
| 312 |
else |
| 313 |
{ |
| 314 |
$db -> Execute("UPDATE herbs SET ".$arrHerbs[$intRoll2]."=".$arrHerbs[$intRoll2]."+".$intAmount." WHERE gracz=".$player -> id); |
| 315 |
} |
| 316 |
$objHerb -> Close(); |
| 317 |
$smarty -> assign("Message", F_HERBS.$intAmount.I_AMOUNT.$arrHerbs[$intRoll2]); |
| 318 |
} |
| 319 |
if ($intRoll > 69 && $intRoll < 76) |
| 320 |
{ |
| 321 |
$objLumber = $db -> Execute("SELECT owner FROM minerals WHERE owner=".$player -> id); |
| 322 |
$intAmount = rand(1, 10); |
| 323 |
$arrLumber = array('pine', 'hazel', 'yew', 'elm'); |
| 324 |
$arrType = array(T_PINE, T_HAZEL, T_YEW, T_ELM); |
| 325 |
$intRoll2 = rand(0, 3); |
| 326 |
if (!$objLumber -> fields['owner']) |
| 327 |
{ |
| 328 |
$db -> Execute("INSERT INTO minerals (owner, ".$arrLumber[$intRoll2].") VALUES(".$player -> id.",".$intAmount.")"); |
| 329 |
} |
| 330 |
else |
| 331 |
{ |
| 332 |
$db -> Execute("UPDATE minerals SET ".$arrLumber[$intRoll2]."=".$arrLumber[$intRoll2]."+".$intAmount." WHERE owner=".$player -> id); |
| 333 |
} |
| 334 |
$objLumber -> Close(); |
| 335 |
$smarty -> assign("Message", F_LUMBER.$intAmount.I_AMOUNT.$arrType[$intRoll2]); |
| 336 |
} |
| 337 |
if ($intRoll > 75 && $intRoll < 81) |
| 338 |
{ |
| 339 |
$intRoll2 = rand(1,5); |
| 340 |
$db -> Execute("UPDATE players SET platinum=platinum+".$intRoll2." WHERE id=".$player -> id); |
| 341 |
$smarty -> assign("Message", F_MITHRIL.$intRoll2.M_AMOUNT); |
| 342 |
} |
| 343 |
if ($intRoll > 80 && $intRoll < 86) |
| 344 |
{ |
| 345 |
$smarty -> assign("Message", F_ENERGY); |
| 346 |
$db -> Execute("UPDATE players SET energy=energy+1 WHERE id=".$player -> id); |
| 347 |
} |
| 348 |
if ($intRoll > 85 && $intRoll < 89) |
| 349 |
{ |
| 350 |
$smarty -> assign("Message", F_ENERGY); |
| 351 |
$db -> Execute("UPDATE players SET energy=energy+1 WHERE id=".$player -> id); |
| 352 |
} |
| 353 |
if ($intRoll > 88 && $intRoll < 91) |
| 354 |
{ |
| 355 |
$intRoll2 = rand(1, 10); |
| 356 |
if ($intRoll2 < 6) |
| 357 |
{ |
| 358 |
$intRoll3 = rand(1,3); |
| 359 |
$strSymbol = '<'; |
| 360 |
if ($intRoll3 == 1) |
| 361 |
{ |
| 362 |
$strType = 'B'; |
| 363 |
} |
| 364 |
if ($intRoll3 == 2) |
| 365 |
{ |
| 366 |
$strType = 'O'; |
| 367 |
} |
| 368 |
if ($intRoll3 == 3) |
| 369 |
{ |
| 370 |
$strType = 'U'; |
| 371 |
} |
| 372 |
} |
| 373 |
if ($intRoll2 > 5 && $intRoll2 < 9) |
| 374 |
{ |
| 375 |
$intRoll3 = rand(1,3); |
| 376 |
$strSymbol = '='; |
| 377 |
if ($intRoll3 == 1) |
| 378 |
{ |
| 379 |
$strType = 'B'; |
| 380 |
} |
| 381 |
if ($intRoll3 == 2) |
| 382 |
{ |
| 383 |
$strType = 'O'; |
| 384 |
} |
| 385 |
if ($intRoll3 == 3) |
| 386 |
{ |
| 387 |
$strType = 'U'; |
| 388 |
} |
| 389 |
} |
| 390 |
if ($intRoll2 < 9) |
| 391 |
{ |
| 392 |
$smarty -> assign("Message", EMPTY_3); // previous: find spells |
| 393 |
} |
| 394 |
if ($intRoll2 > 8) |
| 395 |
{ |
| 396 |
$smarty -> assign("Message", EMPTY_4); |
| 397 |
} |
| 398 |
} |
| 399 |
if ($intRoll == 91) |
| 400 |
{ |
| 401 |
$intRoll2 = rand(1, 10); |
| 402 |
if ($intRoll2 < 6) |
| 403 |
{ |
| 404 |
$strSymbol = '<'; |
| 405 |
} |
| 406 |
if ($intRoll2 > 5 || $intRoll2 < 9) |
| 407 |
{ |
| 408 |
$strSymbol = '='; |
| 409 |
} |
| 410 |
if ($intRoll2 < 9) |
| 411 |
{ |
| 412 |
$smarty -> assign("Message", EMPTY_6); // prevoius: find bow/arrow plans |
| 413 |
} |
| 414 |
if ($intRoll2 > 8) |
| 415 |
{ |
| 416 |
$smarty -> assign("Message", EMPTY_1); |
| 417 |
} |
| 418 |
} |
| 419 |
if ($intRoll == 92) |
| 420 |
{ |
| 421 |
$intRoll2 = rand(1, 10); |
| 422 |
if ($intRoll2 < 6) |
| 423 |
{ |
| 424 |
$strSymbol = '<'; |
| 425 |
} |
| 426 |
if ($intRoll2 == 6 || $intRoll2 == 7) |
| 427 |
{ |
| 428 |
$strSymbol = '='; |
| 429 |
} |
| 430 |
if ($intRoll2 == 8) |
| 431 |
{ |
| 432 |
$strSymbol = '>'; |
| 433 |
} |
| 434 |
if ($intRoll2 < 9) |
| 435 |
{ |
| 436 |
$smarty -> assign("Message", EMPTY_3); // previous: find alchemy recipes |
| 437 |
} |
| 438 |
if ($intRoll2 > 8) |
| 439 |
{ |
| 440 |
$smarty -> assign("Message", EMPTY_4); |
| 441 |
} |
| 442 |
} |
| 443 |
if ($intRoll == 93) |
| 444 |
{ |
| 445 |
$intRoll2 = rand(1, 10); |
| 446 |
if ($intRoll2 < 6) |
| 447 |
{ |
| 448 |
$strSymbol = '<'; |
| 449 |
} |
| 450 |
if ($intRoll2 == 6 || $intRoll2 == 7) |
| 451 |
{ |
| 452 |
$strSymbol = '='; |
| 453 |
} |
| 454 |
if ($intRoll2 == 8) |
| 455 |
{ |
| 456 |
$strSymbol = '>'; |
| 457 |
} |
| 458 |
if ($intRoll2 < 9) |
| 459 |
{ |
| 460 |
$smarty -> assign("Message", EMPTY_5); // previous: find mage staffs (wands) |
| 461 |
} |
| 462 |
if ($intRoll2 > 8) |
| 463 |
{ |
| 464 |
$smarty -> assign("Message", EMPTY_1); |
| 465 |
} |
| 466 |
} |
| 467 |
if ($intRoll == 94) |
| 468 |
{ |
| 469 |
$intRoll2 = rand(1, 10); |
| 470 |
if ($intRoll2 < 6) |
| 471 |
{ |
| 472 |
$strSymbol = '<'; |
| 473 |
} |
| 474 |
if ($intRoll2 == 6 || $intRoll2 == 7) |
| 475 |
{ |
| 476 |
$strSymbol = '='; |
| 477 |
} |
| 478 |
if ($intRoll2 == 8) |
| 479 |
{ |
| 480 |
$strSymbol = '>'; |
| 481 |
} |
| 482 |
if ($intRoll2 < 9) |
| 483 |
{ |
| 484 |
$smarty -> assign("Message", EMPTY_3); // previous: find mage clothes (robes) |
| 485 |
} |
| 486 |
if ($intRoll2 > 8) |
| 487 |
{ |
| 488 |
$smarty -> assign("Message", EMPTY_4); |
| 489 |
} |
| 490 |
} |
| 491 |
if ($intRoll == 95) |
| 492 |
{ |
| 493 |
$intRoll2 = rand(1, 10); |
| 494 |
if ($intRoll2 < 6) |
| 495 |
{ |
| 496 |
$strSymbol = '<'; |
| 497 |
} |
| 498 |
if ($intRoll2 == 6 || $intRoll2 == 7) |
| 499 |
{ |
| 500 |
$strSymbol = '='; |
| 501 |
} |
| 502 |
if ($intRoll2 == 8) |
| 503 |
{ |
| 504 |
$strSymbol = '>'; |
| 505 |
} |
| 506 |
if ($intRoll2 < 9) |
| 507 |
{ |
| 508 |
$smarty -> assign("Message", EMPTY_6); // previous: find bows |
| 509 |
} |
| 510 |
if ($intRoll2 > 8) |
| 511 |
{ |
| 512 |
$smarty -> assign("Message", EMPTY_1); |
| 513 |
} |
| 514 |
} |
| 515 |
/** |
| 516 |
* Find astral components |
| 517 |
*/ |
| 518 |
if ($intRoll == 96 || $intRoll == 97) |
| 519 |
{ |
| 520 |
require_once('includes/findastral.php'); |
| 521 |
$strResult = findastral(5); |
| 522 |
if ($strResult != false) |
| 523 |
{ |
| 524 |
$smarty -> assign("Message", F_ASTRAL.$strResult); |
| 525 |
} |
| 526 |
else |
| 527 |
{ |
| 528 |
$smarty -> assign("Message", EMPTY_1); |
| 529 |
} |
| 530 |
} |
| 531 |
if (0 && $intRoll > 97) //no quest available for now |
| 532 |
{ |
| 533 |
$aviable = $db -> Execute("SELECT qid FROM quests WHERE location='maze.php' AND name='start'"); |
| 534 |
$number = $aviable -> RecordCount(); |
| 535 |
if ($number > 0) |
| 536 |
{ |
| 537 |
$arramount = array(); |
| 538 |
$i = 0; |
| 539 |
while (!$aviable -> EOF) |
| 540 |
{ |
| 541 |
$query = $db -> Execute("SELECT id FROM questaction WHERE quest=".$aviable -> fields['qid']." AND player=".$player -> id); |
| 542 |
if (empty($query -> fields['id'])) |
| 543 |
{ |
| 544 |
$arramount[$i] = $aviable -> fields['qid']; |
| 545 |
$i = $i + 1; |
| 546 |
} |
| 547 |
$query -> Close(); |
| 548 |
$aviable -> MoveNext(); |
| 549 |
} |
| 550 |
$i = $i - 1; |
| 551 |
if ($i >= 0) |
| 552 |
{ |
| 553 |
$roll = rand(0,$i); |
| 554 |
$name = "quest".$arramount[$roll].".php"; |
| 555 |
require_once("quests/".$name); |
| 556 |
} |
| 557 |
else |
| 558 |
{ |
| 559 |
$smarty -> assign("Message", EMPTY_2); |
| 560 |
} |
| 561 |
} |
| 562 |
else |
| 563 |
{ |
| 564 |
$smarty -> assign("Message", EMPTY_3); |
| 565 |
} |
| 566 |
$aviable -> Close(); |
| 567 |
} |
| 568 |
} |
| 569 |
//no quests |
| 570 |
if (0 && isset($_GET['step']) && $_GET['step'] == 'quest') |
| 571 |
{ |
| 572 |
$query = $db -> Execute("SELECT quest FROM questaction WHERE player=".$player -> id." AND action!='end'"); |
| 573 |
$name = "quest".$query -> fields['quest'].".php"; |
| 574 |
if (!empty($query -> fields['quest'])) |
| 575 |
{ |
| 576 |
require_once("quests/".$name); |
| 577 |
} |
| 578 |
$query -> Close(); |
| 579 |
} |
| 580 |
|
| 581 |
/** |
| 582 |
* Initialization of variable |
| 583 |
*/ |
| 584 |
if (!isset($_GET['step'])) |
| 585 |
{ |
| 586 |
$_GET['step'] = ''; |
| 587 |
} |
| 588 |
|
| 589 |
/** |
| 590 |
* Assign variables to template and display page |
| 591 |
*/ |
| 592 |
$smarty -> assign(array("Action" => $_GET['action'], |
| 593 |
"Step" => $_GET['step'])); |
| 594 |
$smarty -> display ('maze.tpl'); |
| 595 |
|
| 596 |
require_once("includes/foot.php"); |
| 597 |
?> |