PHP Code:
<?php
class Exploreforestlakeview extends View{
public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle("Fishing in the Forest Lake");
$document->add(new Comment(" <a href='http://http://atrocity.mysidiahost.com/pages/view/Forestlake'><b>Go back to the Forest?</a></b>", FALSE));
$item = "Fishing pole";
$hasitem = $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item}' and owner='{$mysidia->user->username}'")->fetchColumn();
if($hasitem){
$today = date("d"); // Day of the month
// Reset explore counter if the last recorded exploration was on a different day than today:
$reset = $mysidia->user->lastday != $today;
// Allow user to explore if they are under the limit or if reset condition is true.
if ($mysidia->user->exploretimes <= 50 || $reset) {
// Update the last day that they explored to today
$mysidia->db->update("users", array("lastday" => $today), "username = '{$mysidia->user->username}'");
// If $reset condition was true, reset the count to 1, otherwise increment the existing count.
$updatedExploreTimes = $reset ? 1 : $mysidia->user->exploretimes + 1;
$mysidia->db->update("users", array("exploretimes" => ($updatedExploreTimes)), "username = '{$mysidia->user->username}'");
$item_name = "Worm bait";
$qty = 1;
$item = new PrivateItem($item, $mysidia->user->username);
$item->remove($qty, $mysidia->user->username);
$random = rand(1,100);
if($random > 1 && $random < 20){
$item = "Bass";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/2879896ec53a9ca6f0fe008ed741fcf9.png' /><b>$item</b>!", FALSE));
}
if($random > 1 && $random < 20){
$item = "Catfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c7c6b8aecbedb50364a4a1f337465205.png' /><b>$item</b>!", FALSE));
}
if($random > 1 && $random < 20){
$item = "Minnow";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97c91ea1a9b860bd200ed64613075c28.png'/> <b>$item</b>!", FALSE));
}
elseif($random >= 21 && $random <= 30){
$amount = rand(5,20);
$mysidia->user->changecash($amount);
$document->add(new Comment("Oh look! You found $amount cash!", FALSE));
}
if($random >= 31 && $random <= 40){
$item = "Goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/c9ba65aaf86106d7dcad0ee866bfe9b5.png' /><b>$item</b>!", FALSE));
}
if($random >= 61 && $random <= 70){
$item = "Green goldfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/ea0c2e09ddabdb09219dc51327eda1c6.png'/> <b>$item</b>!", FALSE));
}
if($random >= 61 && $random <= 70){
$item = "Salmon";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/1d582df0254184cfa7db4355d0f88456.png'/> <b>$item</b>!", FALSE));
}
if($random >= 61 && $random <= 70){
$item = "Perch";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3b10be95eb860ceef037e1ec48032bd8.png' /> <b>$item</b>!", FALSE));
}
if($random >= 61 && $random <= 70){
$item = "Tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/3a2bd74fe67aaf339aca053295a05fe3.png'/><b>$item</b>!", FALSE));
}
if($random >= 61 && $random <= 70){
$item = "Tilapia";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/381485713a62701c02d9542270840c5f.png'/><b>$item</b>!", FALSE));
}
if($random >= 61 && $random <= 70){
$item = "Trout";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/64e477dc4e5f6bd8d067ca0069f383c6.png'/><b>$item</b>!", FALSE));
}
elseif($random >= 61 && $random <= 70){
$species = "Feesh";
$newadopt = new StockAdopt($species);
$newadopt->append($mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4c84be28b2521512213bf7557959d35d.png'/> $species egg! Its uncommon.", FALSE));
}
if($random >= 71 && $random <= 75){
$item = "Eel";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/31cd0b3000b5c97920ca5b24c11c209b.png'/><b>$item</b>!", FALSE));
}
if($random >= 71 && $random <= 75){
$item = "Green angelfish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/055dfbad2fc20f9436fb07c4f4377037.png'/><b>$item</b>!", FALSE));
}
if($random >= 71 && $random <= 75){
$item = "Green and blue guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e54874ea8a2b03d12da45f53621b4b6d.png'/><b>$item</b>!", FALSE));
}
if($random >= 71 && $random <= 75){
$item = "Green and magenta guppy";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/e7a43df0325b27724e313928683b2ff4.png'/><b>$item</b>!", FALSE));
}
if($random >= 71 && $random <= 75){
$item = "Red lobster";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/97cbb6c7b48e66c68a415d2e3a6bbcdc.png'/><b>$item</b>!", FALSE));
}
if($random == 100){
$item = "Green betta fish";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/879a6fc1961eb7d8e504e6579c267fed.png'/><b>$item</b>!", FALSE));
}
if($random == 100){
$item = "Green koi";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/95d261007e6933e5c9e0e098af07199a.png'/><b>$item</b>!", FALSE));
}
if($random == 100){
$item = "Green tetra";
$qty = 1;
$newitem = new StockItem($item);
$newitem->append($qty, $mysidia->user->username);
$document->add(new Comment("Oh look! You caught a <img src='http://atrocity.mysidiahost.com/picuploads/png/4181c20e206d7c27063ebd322aeae903.png'/><b>$item</b>!", FALSE));
}
if($random >= 91 && $random <= 99){
$document->add(new Comment("You didn't catch anything. Better luck next time.", FALSE));
}
} else { // Past limit
$document->add(new Comment("It seems you have fished too much today, why don't you take a rest until tomorrow?", FALSE));
}
} else { // Lacking item
$document->add(new Comment("Sorry you need a fishing pole and Bait to Fish!", FALSE));
}
$document->add(new Comment("<img src='http://i67.tinypic.com/1zxb4fk.jpg'/>", FALSE));
}
}
?>