View Source: /source/newday.php
Click here for the source, OR
Other files that you may wish to view the source of:
<?
require_once "common.php";
/***************
** SETTINGS **
***************/
$turnsperday = getsetting("turns",10);
$maxinterest = ((float)getsetting("maxinterest",10)/100) + 1; //1.1;
$mininterest = ((float)getsetting("mininterest",1)/100) + 1; //1.1;
//$mininterest = 1.01;
$dailypvpfights = getsetting("pvpday",3);
/******************
** End Settings **
******************/
if (count($session[user][dragonpoints])<$session[user][dragonkills]&&$_GET[dk]!=""){
array_push($session[user][dragonpoints],$_GET[dk]);
switch($_GET[dk]){
case "hp":
$session[user][maxhitpoints]+=5;
break;
case "at":
$session[user][attack]++;
break;
case "de":
$session[user][defence]++;
break;
}
}
if (count($session[user][dragonpoints])<$session[user][dragonkills] && $_GET[dk]!="ignore"){
page_header("Dragon Points");
addnav("Max Hitpoints + 5","newday.php?dk=hp");
addnav("Forest Fights + 1","newday.php?dk=ff");
addnav("Attack + 1","newday.php?dk=at");
addnav("Defense + 1","newday.php?dk=de");
//addnav("Ignore (Dragon Points are bugged atm)","newday.php?dk=ignore");
output("`@You have `^".($session[user][dragonkills]-count($session[user][dragonpoints]))."`@ unspent dragon points. How do you wish to spend them?`n`n");
output("You earn one dragon point each time you slay the dragon. Advancements made by spending dragon points are permanent!");
}else if ((int)$session[user][specialty]==0){
if ($HTTP_GET_VARS[setspecialty]===NULL){
addnav("","newday.php?setspecialty=1");
addnav("","newday.php?setspecialty=2");
addnav("","newday.php?setspecialty=3");
page_header("A little history about yourself");
output("Growing up as a child, you remember:`n`n");
output("<a href='newday.php?setspecialty=1'>Killing a lot of woodland creatures (`\$Dark Arts`0)</a>`n",true);
output("<a href='newday.php?setspecialty=2'>Dabbling in mystical forces (`%Mystical Powers`0)</a>`n",true);
output("<a href='newday.php?setspecialty=3'>Stealing from the rich and giving to yourself (`^Thievery`0)</a>`n",true);
addnav("`\$Dark Arts","newday.php?setspecialty=1");
addnav("`%Mystical Powers","newday.php?setspecialty=2");
addnav("`^Thievery","newday.php?setspecialty=3");
}else{
addnav("Continue","newday.php");
switch($HTTP_GET_VARS[setspecialty]){
case 1:
page_header("Dark Arts");
output("`5Growing up, you recall killing many small woodland creatures, insisting that they were ");
output("plotting against you. Your parents, concerned that you had taken to killing the creatures ");
output("barehanded, bought you your very first pointy twig. It wasn't until your teenage years that ");
output("you began performing dark rituals with the creatures, dissapearing into the forest for days ");
output("on end, no one quite knowing where those sounds came from.");
break;
case 2:
page_header("Mystical Forces");
output("`3Growing up, you remember knowing there was more to the world than the physical, and what you ");
output("could place your hands on. You realized that your mind itself, with training, could be turned ");
output("in to a weapon. Over time, you began to control the thoughts of small creatuers, commanding ");
output("them to do your bidding, and also to begin to tap in to the mystical force known as mana, ");
output("which could be shaped in to numerous elemental forms, fire, water, ice, earth, wind, and also ");
output("used as a weapon against your foes.");
break;
case 3:
page_header("Thievery");
output("`6Growing up, you recall discovering that a casual bump in a crowded room could earn you ");
output("the coin purse of someone otherwise more fortunate than you. You also discovered that ");
output("the back side of your enemies were considerably more prone to a narrow blade than the ");
output("front side was to even a powerful weapon.");
break;
}
$session[user][specialty]=$HTTP_GET_VARS[setspecialty];
}
}else{
if ($session[user][slainby]!=""){
page_header("You have been slain!");
output("`\$You were slain in the ".$session[user][killedin]." by `%".$session[user][slainby]."`\$. They cost you 5% of your experience, and took any gold you had. Don't you think it's time for some revenge?");
addnav("Continue","newday.php");
$session[user][slainby]="";
}else{
page_header("It is a new day!");
$interestrate = e_rand($mininterest*100,$maxinterest*100)/(float)100;
output("`c<font size='+1'>`b`#It is a New Day!`0`b</font>`c",true);
if ($session[user][alive]!=true){
$session[user][resurrections]++;
output("`@You are resurrected! This is your ".ordinal($session[user][resurrections])." resurrection.`0`n");
$session[user][alive]=true;
}
$session[user][age]++;
$session[user][seenmaster]=0;
output("You open your eyes to discover that a new day has been bestowed upon you, it is your `^".ordinal($session[user][age])."`0 day. ");
output("You feel refreshed enough to take on the world!`n");
output("`2Turns for today set to `^$turnsperday`n");
if ($session[user][turns]>getsetting("fightsforinterest",4) && $session[user][goldinbank]>=0) {
$interestrate=1;
output("`2Today's interest rate: `^0% (Bankers in this village only give interest to those who work for it)`n");
}else{
output("`2Today's interest rate: `^".(($interestrate-1)*100)."% `n");
if ($session[user][goldinbank]>=0){
output("`2Gold earned from interest: `^".(int)($session[user][goldinbank]*($interestrate-1))."`n");
}else{
output("`2Interest Accrued: `^".-(int)($session[user][goldinbank]*($interestrate-1))."`2 gold.`n");
}
}
output("`2Hitpoints have been restored to `^".$session[user][maxhitpoints]."`n");
$skills = array(1=>"Dark Arts","Mystical Powers","Thievery");
$sb = getsetting("specialtybonus",1);
output("`2For being interested in `&".$skills[$session[user][specialty]]."`2, you receive $sb extra `&".$skills[$session[user][specialty]]."`2 use for today.`n");
$session[user][darkartuses] = (int)($session[user][darkarts]/3) + ($session[user][specialty]==1?$sb:0);
$session[user][magicuses] = (int)($session[user][magic]/3) + ($session[user][specialty]==2?$sb:0);
$session[user][thieveryuses] = (int)($session[user][thievery]/3) + ($session[user][specialty]==3?$sb:0);
$session['user']['bufflist']=array();
reset($session[user][dragonpoints]);
$dkff=0;
while(list($key,$val)=each($session[user][dragonpoints])){
if ($val=="ff"){
$dkff++;
}
}
if ($dkff>0) output("`n`2You gain `^$dkff`2 forest fights from spent dragon points!");
$r1 = e_rand(-1,1);
$r2 = e_rand(-1,1);
$spirits = $r1+$r2;
if ($_GET['resurrection']=="true"){
$spirits=-6;
$session['user']['deathpower']=0;
$session['user']['restorepage']="village.php?c=1";
}
$sp = array((-6)=>"Resurrected",(-2)=>"Very Low",(-1)=>"Low","0"=>"Normal",1=>"High",2=>"Very High");
output("`n`2You are in `^".$sp[$spirits]."`2 spirits today!`n");
if (abs($spirits)>0){
output("`2As a result, you `^");
if($spirits>0){
output("gain ");
}else{
output("lose ");
}
output(abs($spirits)." forest fights`2 for today!`n");
}
$rp = $session[user][restorepage];
$x = max(strrpos("&",$rp),strrpos("?",$rp));
if ($x>0) $rp = substr($rp,0,$x);
if (substr($rp,0,10)=="badnav.php"){
addnav("Continue","news.php");
}else{
addnav("Continue",preg_replace("'[?&][c][=].+'","",$rp));
}
$session[user][laston] = date("Y-m-d H:i:s");
$session[user][goldinbank]*=$interestrate;
$session[user][turns]=$turnsperday+$spirits+$dkff;
$session[user][hitpoints] = $session[user][maxhitpoints];
$session[user][spirits] = $spirits;
$session[user][playerfights] = $dailypvpfights;
$session[user][transferredtoday] = 0;
$session[user][seendragon] = 0;
$session[user][seenmaster] = 0;
$session[user][seenlover] = 0;
$session['user']['soulpoints']=100;
$session['user']['gravefights']=getsetting("gravefightsperday",10);
$session[user][seenbard] = 0;
$session[user][boughtroomtoday] = 0;
$session['user']['recentcomments']=$session['user']['lasthit'];
$session[user][lasthit] = date("Y-m-d H:i:s");
if ($session[user][drunkenness]>66){
output("`&Coming off of a hangover, you lose 1 forest fight today");
$session[user][turns]--;
}
if ($session[user][hashorse]){
$horses=array(1=>"pony","gelding","stallion");
output("`n`&You strap your `%".$session[user][weapon]."`& to your ".$horses[$session[user][hashorse]]."'s saddlebags and head out for some adventure.`0");
output("`n`&Because you have a ".$horses[$session[user][hashorse]].", you gain ".((int)$session[user][hashorse])." forest fights for today!`n`0");
$session[user][turns]+=((int)$session[user][hashorse]);
}else{
output("`n`&You strap your `%".$session[user][weapon]."`& to your back and head out for some adventure.`0");
}
$config = unserialize($session['user']['donationconfig']);
if (!is_array($config['forestfights'])) $config['forestfights']=array();
reset($config['forestfights']);
while (list($key,$val)=each($config['forestfights'])){
$config['forestfights'][$key]['left']--;
output("`@You gain an extra turn from points spent on `^{$val['bought']}`@.");
$session['user']['turns']++;
if ($val['left']>1){
output(" You have `^".($val['left']-1)."`@ days left on this buy.`n");
}else{
unset($config['forestfights'][$key]);
output(" This buy has expired.`n");
}
}
$session['user']['donationconfig']=serialize($config);
if ($session['user']['hauntedby']>""){
output("`n`n`)You have been haunted by {$session['user']['hauntedby']}`), as a result, you lose a forest fight!");
$session['user']['turns']--;
$session['user']['hauntedby']="";
}
$session[user][drunkenness]=0;
}
}
page_footer();
?>