#
function towncenter() { //This area will have NPCs for quests.
//Setting up Variables
global $userrow;
$latitude = $userrow["latitude"];
$longitude = $userrow["longitude"];
$Q1 = $userrow["Q1"];
$kills = $userrow["kills"];
$Q2 = $userrow["Q2"];
$deaths = $userrow["deaths"];
$Q3 = $userrow["Q3"];
$Q4 = $userrow["Q4"];
$Q5 = $userrow["Q5"];
$Q6 = $userrow["Q6"];
$Q7 = $userrow["Q7"];
$gold = $userrow["gold"];
//Different NPCs dependent on location
if ($latitude == 0 AND $longitude == 0) {
if ($Q1 == 0) {$page = "An elderly man walks up to you with hopeful eyes. He mentions monsters have recently been attacking the farms around Midworld.<br> <br>";
$page .= "Hello there. You seem to be new around here! I'm sorry to ask this of you so suddenly, but could you kill ten of those monsters outside town? If you return to me, I will give you something in return for your hard efforts!<br> <br> ";
$page .= "You accept the request without hesitation, and rush out of the town hall, to prepare for your battle.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q1 = $userrow["Q1"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q1='$Q1' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q1 == 1 AND $kills >= 10) {$page = "You have returned? Have you slayed the monsters as I have asked? You did! Great! Here take my life savings, it may not be much but it is all I can do to repay you for your services!";
$page .= "<br><br> You have gained 50 gold and 10 EXP!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 50;
$newexp = $userrow["experience"] + 10;
$Q1 = $userrow["Q1"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q1='$Q1',gold='$newgold',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q4 == 1) {$page = "You see a stone of the purest white. You also see a few faded footsteps in the nearby soil. They must have been made by Billy and this must be the Life Stone.<br> <br>";
$Q4 = $userrow["Q4"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q4='$Q4' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q5 == 1) { $page = "You walk into the Town Center, and notice everyone laughing. You yourself cannot help but laugh as you enter the room. As you inquire a nearby woman about it, she states she found a Laughing Stone, and used it to brighten up the atmosphere here. You tell her of your current quest, and she agrees to let you have to stone.";
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 30 AND $longitude == 30) {
if ($Q2 == 0) { $page = "A philosopher, probably around the young age of 20, approaches you with a curious gleam in his eye.<br> <br>";
$page .= "Greetings adventurer. You seem to be a knowledgeable chap! I am a firm believer that reincarnation exists. Would you be able to die and return to me alive once again?<br> <br> ";
$page .= "You give him an odd glance, sigh, and nod, agreeing to the request. This could be a dangerous one";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q2 = $userrow["Q2"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q2='$Q2' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q2 == 1 AND $deaths >= 1) {$page = "I heard the news of your death but here you are in front of me now! Great, now if you please follow me...";
$page .= "<br><br> You follow the philosopher into a meeting, where he explains your death and rebirth. By the end, no one believes his story.";
$page .= "<br><br> Oh bother. None of them believe me! No matter, now I know myself for certain reincarnation exists. Here is a reward for your troubles.";
$page .= "<br><br> You receive 100 gold and 50 EXP!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 100;
$newexp = $userrow["experience"] + 50;
$Q2 = $userrow["Q2"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q2='$Q2',gold='$newgold',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 70 AND $longitude == -70) {
if ($Q3 == 0) {$page = "A seasoned warrior approaches you with a hardened resolve and a deep voice. He begins to boast.<br> <br>";
$page .= "Ha! You puny explorer. I am the great Jern, only warrior who ever lived to slay 1000 monsters! Anyone who can beat that record I will allow acquisition of my prized possession!<br> <br> ";
$page .= "You glare at him with an annoyed look. Who does he think he is!? You decide to show him who's boss, you are going to break his record...";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q3 = $userrow["Q3"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q3='$Q3' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q3 == 1 AND $kills >= 1001) {$page = "You walk up to the egotistic warrior, as he is boasting of his past battles with not-so-fearsome creatures of the wilderness. You interrupt him to show your papers, proving you have over 1,000 kills, in his face. He blushes, let's out a mighty sorrowful roar. After he calms he states. I see, well then I guess I owe you this. His expression changes to a smile as he hands you a book called \"Adventures of the Battler Legend\" written by Jern. You stomp away, only slightly annoyed that this is your prize. You soon decide to take a break near a tree, and out of lack of any other books in your possession, begin reading it.";
$page .= "<br><br> What a surprise! Jern may have been exaggerating his kills, but he sure knows his stuff! You feel you have better fighting skills just reading the book! You gain 1000 exp!";
$page .= "<br><br>You may return to <a href=\"index.php\">town</a>";
$newexp = $userrow["experience"] + 1000;
$Q3 = $userrow["Q3"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q3='$Q3',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == -100 AND $longitude == 100) {
if ($Q4 == 0) {$page = "An ancient woman sneaks up on you from behind.<br> <br>";
$page .= "Excuse
me, I seem to have lost my stone of life. I think that little Billy
stole it again, he usually hangs out around Midworld, could
you retrieve it for me?<br> <br> ";
$page .= "You
look at the old lady with a sense that she may very well be insane, but
you inevitably agree to the quest she has given you. Midworld she
said...";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q4 = $userrow["Q4"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q4='$Q4' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q4 == 2) {$page = "You have returned? Do you have my stone? You do! Can I have it please? Oh thank you young man, your kindness will never be forgotten!";
$page .= "<br>The old lady disappears in a ghostly fashion. Did she just look transparent for a moment there? And how come she vanished in thin air....?";
$page .= "<br><br> You find 250 gold on the ground where the old woman had stood, moments before.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 250;
$Q4 = $userrow["Q4"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q4='$Q4',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == -130 AND $longitude == -130) {
if ($Q5 == 0) {$page = "A fool wanders up to you and glumly requests of your service.<br> <br>";
$page .= "Hello there, I am supposed to be entertaining the Lord of Smarksere this evening, but I am discouraged, could you possibly find me something to once again encourage me to entertain well?<br> <br> ";
$page .= "You accept the request and begin to ponder. How could you encourage him? You are tired, perhaps you should go to the Dragonspear Inn.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q5 == 2) {$page = "He sees you return and runs over. You show him the laughing stone and he bursts out in chuckles. He looks at you, thanks you whole heartedly and states that your pay was on the bench he was sitting on.";
$page .= "<br><br> You walk over to the bench and find 100g! Under the bench you find something else. A stone that contains swirling darkness within. You wonder what you could possibly find that it would be useful for.";
#
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 100;
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else{ $page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 170 AND $longitude == 170) {
if ($Q5 == 2) {$page = "A woman who claims to be a mystic is advertising the fact that she is buying a darkness stone. She seems to be paying well, too bad you don't have one.<br> <br>";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
elseif ($Q5 == 3) {$page = "An woman who claims to be a mystic strides over to you and states that she senses you have a Dark Stone on you. She says she will pay 2,500 gold for it. You agree, figuring it would have no other use, and walk off with a pocket freshly full of coins.";
$page .= "<br><br> You have gained 2500 gold";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 2500;
$Q5 = $userrow["Q5"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q5='$Q5',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q5 == 4) {$page = "You walk into the town center. You spot the mystic you sold your stone to. She thanks you again and you walk off, wondering exactly what use she did make of that stone.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
else{$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == 200 AND $longitude == -200) {
if ($Q6 == 0 AND $Q3 == 2) {$page = "You see Jerf, the seasoned warrior once again, just as he spots you. He walks over and declares another challenge, but this time not with egotism, but with genuine intrigue with you.<br> <br>";
$page .= "I wish to see you kill 5,000 monsters. Can you do this for me? I wish to see the strongest man fight his hardest and write a book of him. As you know, I weave tales very well.<br> <br> ";
$page .= "You accept this unexpected request without a second thought. You walk back to town to prepare for this long battle";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q6 = $userrow["Q6"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q6='$Q6' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q6 == 1 AND $kills >= 5000) {$page = "You have returned? Have you slayed the monsters as I have asked? You did! Great! Now tell me of your adventure and I shall begin writing your story!";
$page .= "<br><br> A few months later you receive a letter in the mail from Jern stating the book was an absolute hit! He said he also included a share inside the letter. You are astounded to see 10,000 gold!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] + 10000;
$Q6 = $userrow["Q6"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q6='$Q6',gold='$newgold' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
elseif ($latitude == -250 AND $longitude == -250) {
if ($Q7 == 0) {$page = "A young girl approaches and states that she is collecting money for the homeless children shelter.<br> <br>";
$page .= "Your heart is struck dead by her story, and before realizing it, you agree to find her 1,000,000 gold!<br> <br> ";
$page .= "What a fool you were! However, you will not break your word, so you go off to find her 1,000,000 gold...";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$Q7 = $userrow["Q7"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q7='$Q7' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
elseif ($Q7 == 1 AND $gold >= 1000000) {$page = "With a deep sigh, you hand the little girl 1,000,000 gold. You have to say, this was one large life experience.";
$page .= "<br><br> You have gained 50,000 EXP!";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";
$newgold = $userrow["gold"] - 1000000;
$newexp = $userrow["experience"] + 50000;
$Q7 = $userrow["Q7"] + 1;
$updatequery = doquery("UPDATE {{table}} SET Q7='$Q7',gold='$newgold',experience='$newexp' WHERE id='".$userrow["id"]."' LIMIT 1", "users");}
else {$page = "You walk into the town center. It seems everything is running smoothly, as no one here seems troubled.";
$page .= "<br>You may return to <a href=\"index.php\">town</a>";}
}
else {display("Cheat attempt detected.<br /><br />Get a life, loser.", "Error");}
$updatequery;
display($page, "Quests");
}
//quest snippet above developed by Chris R.D. (aka. Vandril Lorde)