-
Posts
182 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Events
Everything posted by TheMasterGeneral
-
Don't laptops have that little area, right of the touchpad, meant as a scrollwheel, essentially? O_o What do I know, I don't happen to use one. :( [/sarcasm] Nonetheless, hope the issues gets resolved for you, Raven. :P
-
Zoom out in your browser (typically by pressing Control while scrolling with your mouse wheel) or increase your screen's resolution. The market occasionally does that to me when I've snapped the window to the side of my screen. Lol. If that fails, clear cache/cookies/other'ies
-
He's a pretty stand up guy, in my opinion. He and I have communicated through Skype for roughly a month now and he's quite the nice guy. He's usually pretty quick with replies too. I trust him as well. I'd recommend him to anyone. I also really like how his game looks too. :)
-
Mod Title: Player Purchasable Ads Info: Allows a player to post an ad in a newspaper, which lasts for three days. The ad costs, at minimum, 100K Cash (your main currency.) The more you pay, however, the higher you are ranked on the page. This Mod Comes With: 1 SQL Query 1 PHP 1 Cron (Too lazy to copy and paste? Click me for a download!) Call this whatever: [Default = playerads.php, will need to change a config value on line 15 if its different, however, the code has been set to allow use of custom file names] <?php /* Mod Title: Player Purchasable Ads (Replaces Newspaper) Info: Allows players to purchase ads to be shown to other players. Author: TheMasterGeneral Cost: Free, of course. (I don't think I have made a mod for the cash. Lol) License: Install, use, alter, etc. So long as I'm still credited. Make sure to add to your daily cron and execute the SQL!!!! */ require_once('globals.php'); echo "<h3>Player Ads</h3><hr />"; //Configuration $adtime=(3); //Time (in days) for player ads to run. [Default = 3] $filename=('playerads'); //If you change the filename, change this to the value you chose. [Default = playerads] //DO NOT ADD (.PHP) $cost=(100000); //Minimum cost (in your primary currency) to post an add. [Default = 100000] //End Configuration $q=$db->query("SELECT * FROM `newspaperads` ORDER BY `ad_price` DESC"); $cost_format = money_formatter($cost); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'buyad': // /{$filename}.php?action=buyad playads_buy(); break; default: // /{$filename}.php playerads_home(); break; } function playerads_home() { global $db, $q, $filename, $cost_format; //I think I got this nailed down? :D echo "<a href='{$filename}.php?action=buyad'><b>Buy An Ad - Costs {$cost_format}</b></a> <hr /> Showing player ads. <table width='75%' cellspacing='1' cellpadding='1' class='table'> <tr> <th>Poster</th> <th>Content</th> <th>Cost</th> <th>Days Left</th> </tr>"; while ($ads = $db->fetch_row($q)) { echo"<tr> <td><a href='viewuser.php?u={$ads['ad_userid']}'>{$ads['ad_username']}</a></td> <td>" . $ads['ad_text'] . "</td> <td>" . money_formatter($ads['ad_price']) . "</td> <td>" . $ads['ad_daysremain'] . "</td></tr> "; } $db->free_result($q); echo '</table>'; $h->endpage(); } function playads_buy() { global $db, $q, $filename, $ir, $adtime, $cost_format, $userid; $_POST['ad_content'] = $db->escape( str_replace("\n", "<br />", strip_tags(stripslashes($_POST['ad_content'])))); $_POST['ad_cost'] = $db->escape( str_replace("\n", "<br />", strip_tags(stripslashes($_POST['ad_cost'])))); if (!empty($_POST['ad_cost'])) { if (!empty($_POST['ad_content'])) { if (strlen($_POST['ad_content']) > 500) { echo "You may only enter 500 or less characters here."; exit; } if ($_POST['ad_cost'] < 100000) { echo "Ads cost, at minimum {$cost_format}."; exit; } if ($_POST['ad_cost'] > $ir['money']) { echo "Not enough cash on hand to purchase an advertisement."; exit; }else { $db->query( "INSERT INTO `newspaperads` (`ad_id`, `ad_username`, `ad_userid`, `ad_price`, `ad_daysremain`, `ad_text`) VALUES (NULL, '{$ir['username']}', '{$userid}', '{$_POST['ad_cost']}', '{$adtime}', '{$_POST['ad_content']}');"); echo"Player ad has been purchased."; $db->query("UPDATE `users` SET `money` = `money` - {$_POST['ad_cost']} WHERE `userid` = {$userid}"); exit; } } } else { echo "<b>You are posting an ad in the newspaper.</b> An ad costs, at minimum, {$cost_format}. The more you pay, the higher your ad shows on the paper. Please be sure to obey all rules. Ads run for {$adtime} days.<br /><br /> <form action='{$filename}.php?action=buyad' method='post'> <b>Ad Cost</b><br /> (Minimum of {$cost_format} Copper Coins)<br /><textarea name='ad_cost'></textarea><br /> <b>Ad Content</b><br /><textarea rows='5' cols='30' name='ad_content'></textarea><br /> <input type='submit' value='Purchase Ad' /></form>"; } } Execute this SQL CREATE TABLE IF NOT EXISTS `newspaperads` ( `ad_id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'AD ID.', `ad_username` tinytext NOT NULL, `ad_userid` bigint(11) NOT NULL COMMENT 'User ID of ad creator', `ad_price` bigint(11) NOT NULL COMMENT 'Price for the ad. (Higher = displayed higher)', `ad_daysremain` int(11) NOT NULL DEFAULT '3' COMMENT 'How many days remain. [Default = 3]', `ad_text` text NOT NULL COMMENT 'Text of the ad. Max = 1000 characters', PRIMARY KEY (`ad_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Add to day cron: $db->query("UPDATE `newspaperads` SET `ad_daysremain` = `ad_daysremain` - 1"); $db->query("DELETE FROM `newspaperads` WHERE `ad_daysremain` <= 0"); That should be it. Questions or comments? Leave a reply here and I will get to it ASAP!!
-
[MENTION=70654]Jax[/MENTION] thank you for the input. I've switched the random variables around. I just set it, in my personal game, to mt_rand(1,20); Which gives 5% chance to win, rather than 1% I might adjust it if I see fit, however, I think its fine right now. [MENTION=70283]Samurai Legend[/MENTION], thanks dude. :D [MENTION=69823]jcvenom[/MENTION] , It really wouldn't inflate the game, imo. It really only adds 100K cash to the economy, the rest is just transferred from many players, into one, if they win. However, there is a configuration area at the top of the code, you could probably use that to adjust it to your economy.
-
Pfffffft, you scrubs. Buy an Android tablet and install DroidEdit free and you can do all your needs in the coding biz. [/sarcasm]
-
Info: This mod puts a nice little player-set user description on their profile. Needed: -Edit two files. -Execute one SQL. -Create new file. SQL: ALTER TABLE `users` ADD `userDESC` TEXT NOT NULL ; Create userdesc.php Paste: Save, upload. Open preferences.php Find: [php]Display Pic Change Add underneath: Change User Description Save, upload. Open viewuser.php Find the user query at the top. Add in `userDESC`, Scroll down to the end of the file. Above the endpage, paste: echo " Player Description"; if ($r['userDESC']) { echo" {$r['userDESC']}"; } else { echo"This player does not have a user description set."; } echo "[Report Description to staff for advertising/inappropriate behavior/etc.]"; Save, upload! Questions or errors? Please let me know!
-
Where at? I'm either ignorant or I just don't see where else I could put a random value.
-
mccode-v2 Refinery [Use with my mining mod]
TheMasterGeneral replied to TheMasterGeneral's topic in Free Modifications
Samurai, Alrighty. I'll send you my username. :P Kyle, I've added your tweaks to the OP, and I even credited your tweaks as well. :) -
mccode-v2 Refinery [Use with my mining mod]
TheMasterGeneral replied to TheMasterGeneral's topic in Free Modifications
Samurai, that I do. Is that you who popped up my Skype? :P You should really let me know who you are in that contact request box. ;P I'm looking at the globals file, Kyle, and my mouth has dropped. Mainly because I'm thinking "Why didn't I think of that...?" Thank you Kyle. :) Is it alright if I put your tweaks into the OP? -
My work connection is solid 1.5Mbit both ways. :(
-
An add-on for that mining mod I put together. They both can be used together, and I would highly recommend that they are. CREATE A FILE CALLED refine.php: <?php /** Mod Title: Refinery Info: Refine Gold/Silver/Copper flakes into their respected currency. By: TheMasterGeneral Code Tweaks: KyleMassacre (Thanks Kyle!) Cost: Free File: /refine.php */ require('refine_globals.php'); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'refinegold': refine_gold(); break; case 'refinesilver': refine_silver(); break; case 'refinecopper': refine_copper(); break; default: refine_home(); break; } function refine_home() { global $h; echo "<h3>Refinery</h3> Welcome to the refinery. Here you may refine your flakes into coins! How awesome is that?! You've got to have the flakes, and the skill. If you have neither, you will more than likely fail at refining flakes. Now, what would you like to refine? [<a href='refine.php?action=refinecopper'>Copper Coins</a>] [<a href='refine.php?action=refinesilver'>Silver Coins</a>] [<a href='refine.php?action=refinegold'>Gold Coins</a>]"; //Gold coins is my third currency. If you //Do not have, then you can remove the link. $h->endpage(); } function refine_copper() { global $db,$userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidcopperflake']} AND `inv_userid` = $userid"); $totalcflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Copper</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinecopper' method='post'> How many flakes do you wish to refine into copper coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. (If you have 11 flakes, and enter 11 flakes, you will receive 1 coin, and lose all flakes) <input type='text' name='amount' /> <input type='submit' value='Refine Copper Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requirecflakes']) { echo "You need to refine at least {$refine['requirecflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalcflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedcflakes = ($_POST['amount']/$refine['requirecflakes']); $flakesgonec = ($receivedcflakes*$refine['requirecflakes']); echo "You have refined {$_POST['amount']} Copper Flakes and gained {$receivedcflakes} Copper Coins!"; item_remove($userid, $refine['itemidcopperflake'], $flakesgonec); $db->query( "UPDATE `users` SET `money` = `money` + {$receivedcflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } function refine_silver() { global $db, $userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidsilverflake']} AND `inv_userid` = $userid"); $totalsflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Silver</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinesilver' method='post'> How many flakes do you wish to refine into Silver Coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. (If you have 26 flakes, and enter 26 flakes, you will receive 1 coin, and lose all flakes) <input type='text' name='amount' /> <input type='submit' value='Refine Silver Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requiresflakes']) { echo "You need to refine at least {$refine['requiresflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalsflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedsflakes = ($_POST['amount']/$refine['requiresflakes']); $flakesgones = ($receivedsflakes*$refine['requiresflakes']); echo "You have refined {$_POST['amount']} Silver Flakes and gained {$receivedsflakes} Silver Coins!"; item_remove($userid, $refine['itemidsilverflake'], $flakesgones); $db->query( "UPDATE `users` SET `crystals` = `crystals` + {$receivedsflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } function refine_gold() { global $db, $userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidgoldflake']} AND `inv_userid` = $userid"); $totalgflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Gold</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinegold' method='post'> How many flakes do you wish to refine into gold coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. (If you have 51 flakes, and enter 51 flakes, you will receive 1 coin, and lose all flakes) <input type='text' name='amount' /> <input type='submit' value='Refine Gold Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requiregflakes']) { echo "You need to refine at least {$refine['requiregflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalgflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedgflakes = ($_POST['amount']/$refine['requiregflakes']); $flakesgoneg = ($receivedgflakes*$refine['requiregflakes']); echo "You have refined {$_POST['amount']} Gold Flakes and gained {$receivedgflakes} Gold Coins!"; item_remove($userid, $refine['itemidgoldflake'], $flakesgoneg); $db->query( "UPDATE `users` SET `goldcoin` = `goldcoin` + {$receivedgflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } Save, upload. CREATE ANOTHER FILE CALLED refine_globals.php: [There's an underscore (_) between refine and globals] <?php //Thanks Kyle require_once('globals.php'); //Config start. (Edit as you see fit) $refine = array( "requiregflakes" => 50, "requiresflakes" => 25, "requirecflakes" => 10, "itemidgoldflake" => 94, "itemidsilverflake" => 68, "itemidcopperflake" => 95 ); //Config end Replace the information I have set to yours. You may have to consult your mine_globals.php file for your items (if you are currently using the mining mod I made) Save, upload. ADD TO explore.php (or anywhere): <a href='refine.php'>Refinery</a> Screenies: Home Refine? Refined! Current Version: 1.0 Changelog Version 1.0 [1-15-2015]: Public release "Friendly to lazies" download link coming in a few!! Comments, questions or concerns. please let me know by replying here or by PM.
-
-
What's up dude. I've made a small lottery mod. Haven't really tested it, but should work as is. If it doesn't, reply here. Yes, there's probably many lottery mods, but I threw this together in 5 minutes for my game. If it works for you, great. If not, I'm sorry. No need to flame me for making another lottery mod. :( </3 Things to note, however: There is a few values you can adjust completely. (I've left comments where you can) This is FREE. Trivia: This originally was going to be a scratch-ticket mod. Swag that comes along with this: One File One SQL A hug1. :) SQL: INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES (NULL, 'lotterycash', '100000'); Call this lottery.php <?php /** Lottery by TheMasterGeneral Filename: /lottery.php Cost: free! Copyright: 2015 SQL: INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES (NULL, 'lotterycash', '100000'); */ require("globals.php"); //Config $minimumpot = 100000; //Minimum pot. $costtoplay = 10000; //Cost to get a ticket. $addedtopot = 9000; //How much, out of per ticket, is added to the pot. $currency = ('Copper Coins'); //Change this to your currency's name, if you got it. (If not, remove the characters) $lotteryid = 18; //The Id of conf_id for lotterycash. Change to yours. // if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'play': lottery_play(); break; default: lottery_home(); break; } function lottery_home() { global $db, $ir, $c, $userid, $h, $minimumpot, $costtoplay, $addedtopot, $currency, $set; echo "<h3>Lottery</h3> The lottery. The pot starts at {$minimumpot} {$currency}. It costs {$costtoplay} {$currency} to play. {$addedtopot} is deducted from your ticket and added into the pot. Whoever gets the lucky ticket will get all the cash in the pot.<br /> <br /> <b>Current Pot: {$set['lotterycash']} {$currency}<br /></b> <br /> [<a href='/lottery.php?action=play'>Buy Ticket</a>]"; } function lottery_play() { global $db, $ir, $c, $userid, $h, $minimumpot, $costtoplay, $addedtopot, $currency, $set, $lotteryid; $chance = rand(1,100); echo "<h3>Lottery</h3>"; if ($ir['money'] < $costtoplay) { echo "You do not have enough money to play. I am sorry."; exit; } //Pay up, subtracts money from player's cash //then adds {$addedtopot} to the pot. $db->query( "UPDATE `settings` SET `conf_value` = `conf_value` + {$addedtopot} WHERE `conf_id` = {$lotteryid}"); $db->query( "UPDATE `users` SET `money` = `money` - {$costtoplay} WHERE `userid` = {$userid}"); if ($chance == 1) //Winner, winner, chicken dinner!! { echo "You paid {$costtoplay} {$currency} and won the lottery ({$set['lotterycash']} {$currency})! Congratulations!"; //Adds money! $db->query( "UPDATE `users` SET `money` = `money` + {$set['lotterycash']} WHERE `userid` = {$userid}"); //Sets the pot back to the minimum. $db->query( "UPDATE `settings` SET `conf_value` = {$minimumpot} WHERE `conf_id` = {$lotteryid}"); } if ($chance >= 2) //Loser, loser, someone's got a bruiser! { echo "You paid the fee and did not win the lottery. Sorry dude!"; } } If you have any questions, comments, concerns or otherwise feedback, please feel free to leave a reply! 1=Redeemable for only five minutes after this post.
-
mccode-v2 Federal Support System
TheMasterGeneral replied to Samurai Legend's topic in Free Modifications
Interesting idea, Samurai! I've already got one (Its setup a bit differently, but yields the same results) -
Game looks amazing, Ben!
-
I'd hate to bump my own thread, but, I've altered the function (mine_power_buy) it was exploitable and I fixed that. It was my lazy coding the first time around. Lol. If you don't care to find the function in the OP, have it here as well. Overwrite your mine_power_buy function. function mine_power_buy() { global $db, $ir, $c, $userid, $h; require('mine_globals.php'); echo" <h3>Dangerous Mines</h3> <hr />"; // if ($level <= 10) //If mining level is 1-10, 100 is the cost to add more power. { $cost = 100; } if ($level <= 20 && $level >= 10) //If mining level is 10-20, 1000 is the cost to add more power. { $cost = 1000; } if ($level <= 30 && $level >= 20) //If mining level is 20-30, 5000 is the cost to add more power. { $cost = 5000; } if(!isset($_POST['amount'])) { print "<form action='mine.php?action=buyp' method='post'> You can currently buy $mopower sets of 10 mining power. How many do you wish to buy? Each set will cost you $cost labour. <br><input type='text' name='amount' /><br> <input type='submit' value='Buy Power (No Prompt, so be sure!)' /> </form>"; } else { //Secure the ID input. $_GET['amount'] = (isset($_GET['amount']) && is_numeric($_GET['amount'])) ? abs(intval($_GET['amount'])) : ''; if ($_POST['amount'] > $mopower) { echo 'You do not have that many sets available to you. Try again.'; exit; } //Fix: Checks the input for negative values //To prevent users from inputting negative //values and give themselves labor //at the cost of losing mining power. if ($_POST['amount'] < 0) { echo 'Invalid input.'; exit; } if ($_POST['amount'] == 0) { echo 'Invalid input.'; exit; } if ($laber < $cost) { echo "You do not have enough labour to add {$_POST['amount']} sets of mining power."; exit; } $poweradd = (10*$_POST['amount']); $subtractlaber = ($cost*$_POST['amount']); $db->query("UPDATE `userstats` SET `labour` = `labour` - {$subtractlaber} WHERE `userid` = $userid"); $db->query("UPDATE `Mining` SET `m_Mpower` = `m_Mpower` + {$poweradd}, `m_mopower` = `m_mopower` - {$_POST['amount']} WHERE `userid` = $userid"); echo "You have purchased {$_POST['amount']} sets of mining power for $subtractlaber labour."; } } I HIGHLY suggest patching the old version to this one. The old version allowed users to input negative values and GAIN labour, at the cost of losing mining power (Which, went heavily into the negative anyway)
-
Good question Kyle! Thanks! I had chose to require the mine_globals file multiple times because of this: [ATTACH=CONFIG]1747[/ATTACH] (Before removing the repeated require code. [ATTACH=CONFIG]1748[/ATTACH] And after. At the time I was first coding it, I was really looking for functionality over "optimization" (I throw that term around loosely, btw) To fix the issue above, I could just do $mglobal=require_once('mine_globals.php'); and then add into the globals query, $mglobal; I think that'd work, right?
-
Buying power is limited to one set (10 power) per mining level. So no one can go crazy and buy all the power at once. Regardless, if you didn't want the option to buy power, I believe you should just be able to remove the link on the default function and everything should work fine.
-
Thanks Sim, but hopefully you won't burn me at the stake for trying it a different way. I dropped the file size from 37kb to about 20kb. Which still seems like a lot, but its a bit better than 37kb. I plan on changing the overall make-up of the mod before Thanksgiving. My plans are to make it so the action?mine calling are calling upon the mine_globals file, which will cut down even more on space. I didn't do it this time around because I wanted to push out an "optimized" mod before anyone really adopts it. :P
-
There's a lot of repeating cases, just because I wanted certain outcomes to be more probable than others. I'm not 100% sure how to make something probable without adding more possibilities. I remember seeing something elsewhere looking like case 50 < 60 or something. Someone wanna link me to a mod that uses cases like that? I'd be willing to rewrite the mod to be a lot smaller. Edit: I'm also thinking I could probably add the cases into the global file and have the random selection to call upon cases 1 through X in the global file. Its so I only have to name the cases once. I actually think that might be a bit more efficient, until I get the cases like I said earlier.
-
You're welcome. I spent about 2 hours making it and testing. Easily my biggest coding for MCCodes.
-
Alrighty, so I put together a little mining mod. It should be rather secured. Features: -Minimum levels for mining in different mines. -Mining level/experience. -Status bars. -Ability to buy more power. First, create mine.php mine.php <?php /* TheMasterGeneral's Mining Mod Mine up items, flakes, etc. Copyright: 2016 License: DBAD Filename: mine.php */ //Gotta make sure the user is legitimate and not a bot. $macropage=('mine'); require('globals.php'); /* Testing to see if the user already exists in the databse, and if not, adding them to the database. */ $UIDB=$db->query("SELECT * FROM `tmg_mining` WHERE `userid` = {$userid}"); if (!($db->num_rows($UIDB))) { $db->query("INSERT INTO `tmg_mining` (`userid`, `max_miningpower`, `miningpower`, `miningxp`, `buyable_power`, `mining_level`) VALUES ('{$userid}', '100', '100', '0', '1', '1');"); } //Assign their information to a variable we can access later. $MUS=($db->fetch_row($db->query("SELECT * FROM `tmg_mining` WHERE `userid` = {$userid} LIMIT 1"))); //Causes a person to level up, when needed. Called on each page load while mining. mining_levelup(); echo "<h2>Dangerous Mines</h2><hr />"; //Blocks access to players who are in jail/hospital. if ($ir['hospital']) { echo "Only the healthy folk can go mining."; die($h->endpage()); } if ($ir['jail']) { echo "Only the innocent folk can go mining."; die($h->endpage()); } if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'mine': mine(); break; case 'buypower': buypower(); break; default: home(); break; } function home() { global $MUS,$db,$h; $mineen = min((int) ($MUS['miningpower'] / $MUS['max_miningpower'] * 100), 100); $minexp = min((int) ($MUS['miningxp'] / $MUS['xp_needed'] * 100), 100); $mineenp = 100 - $mineen; $minexpp = 100 - $minexp; echo "Welcome to the dangerous mines, brainless fool. Riches are avaliable for you, if you have the skill. Each mine has its own requirements, and could even have a special pickaxe that you need to use.<br /> <br /> You currently have a mining level of {$MUS['mining_level']}.<br /> Mining Power - {$MUS['miningpower']} / {$MUS['max_miningpower']}<br /> <img src='yellowbar.png' width='$mineen' height='15' /><img src='redbar.png' width='$mineenp' height='15' /><br /> Mining XP - {$MUS['miningxp']} / {$MUS['xp_needed']}<br /> <img src='yellowbar.png' width='$minexp' height='15' /><img src='redbar.png' width='$minexpp' height='15' /><br /> <u>Avaliable Mines:</u><br />"; $minesql=$db->query("SELECT * FROM `tmg_mines_data` ORDER BY `mine_level` ASC"); while ($mines = $db->fetch_row($minesql)) { $CityName=$db->fetch_single($db->query("SELECT `cityname` FROM `cities` WHERE `cityid` = {$mines['mine_location']}")); echo"[<a href='?action=mine&spot={$mines['mine_id']}'>{$CityName} - Level {$mines['mine_level']}</a>]<br />"; } echo "<br /><br /> [<a href='?action=buypower'>Buy Power</a>]"; } function buypower() { global $userid,$db,$ir,$MUS,$h; $CostForPower = $MUS['mining_level']*75+10+$MUS['mining_level']; //Cost formula, in IQ. if (isset($_POST['sets']) && ($_POST['sets'] > 0)) { $sets=abs((int) $_POST['sets']); $totalcost=$sets*$CostForPower; if ($sets > $MUS['buyable_power']) { echo "You are trying to buy more sets than you currently have available."; die($h->endpage()); } elseif (($ir['IQ'] < $totalcost)) { echo "You need " . number_format($totalcost) . " IQ for the amount of sets you wish to buy. You only have " . number_format($ir['IQ']) . "."; } else { $db->query("UPDATE `userstats` SET `IQ` = `IQ` - '{$totalcost}' WHERE `userid` = {$userid}"); $db->query("UPDATE `tmg_mining` SET `buyable_power` = `buyable_power` - '$sets', `max_miningpower` = `max_miningpower` + ($sets*10) WHERE `userid` = {$userid}"); echo "You have successfully traded " . number_format($totalcost) . " IQ for {$sets} sets of 10 mining power! Your new maximum mining power is " . number_format($MUS['max_miningpower'] + ($sets*10)) . ""; } } else { echo "You can currently buy {$MUS['buyable_power']} sets of 10 Mining Power. Each set will cost you " . number_format($CostForPower) . " IQ each. So, how many sets would you like to purchase?"; echo "<br /> <form method='post'> <input type='number' min='1' max='{$MUS['buyable_power']}' name='sets' required='1'> <br /> <input type='submit' value='Buy Power'> </form>"; } } function mine() { global $db,$MUS,$ir,$userid; if (!isset($_GET['spot']) || empty($_GET['spot'])) { echo "Invalid mining spot."; } else { $spot=abs((int) $_GET['spot']); $mineinfo=$db->query("SELECT * FROM `tmg_mines_data` WHERE `mine_id` = {$spot}"); //Testing for if the mine itself is in the database. If not, //Give them a friendly error, rather than quitting out to SQL. if (!($db->num_rows($mineinfo))) { echo "This mine does not exist."; } else { //If the mine is found, assign its data to a variable //for easy access later. $MSI=$db->fetch_row($mineinfo); if ($MUS['mining_level'] < $MSI['mine_level']) { echo "You don't have a high enough mining level to mine here. You need a mining level of {$MSI['mine_level']}, whereas you only have a mining level of {$MUS['mining_level']}."; } elseif ($ir['location'] != $MSI['mine_location']) { echo "You can only go mining in this mine if you're in the same location."; } elseif ($ir['IQ'] < $MSI['mine_iq']) { echo "Your IQ is too low to use this mine. You need " . number_format($MSI['mine_iq']) . " IQ, whereas you only have " . number_format($ir['IQ']) . "."; } elseif ($MUS['miningpower'] < $MSI['mine_power_use']) { echo "You do not have enough mining power to mine here. You need {$MSI['mine_power_use']} and you only have {$MUS['miningpower']}."; } else { //Fallback in case XP gain isn't updated later on. if (!isset($xpgain)) { $xpgain = 0; } //If the user's IQ level is between the minimum and //33% higher than minimum, they get the least amount of //Positive outputs. if ($ir['IQ'] <= $MSI['mine_iq']+($MSI['mine_iq']*.3)) { $Rolls=mt_rand(1,5); } //If the user's IQ level is between 30% higher than minimum //yet less than 60%, give them an increased chance for positive //outputs. elseif ($ir['IQ'] >= $MSI['mine_iq']+($MSI['mine_iq']*.3) && ($ir['IQ'] <= $MSI['mine_iq']+($MSI['mine_iq']*.6))) { $Rolls=mt_rand(1,10); } //If the user's IQ level is above 60% of the mine's minimum IQ, //Give them more rolls, and a chance to get the gem item. else { $Rolls=mt_rand(1,15); } //Rolls 1-3 are negative. if ($Rolls <= 3) { $NegRolls=mt_rand(1,3); //Three different outputs for the negative. $NegTime=mt_rand(50,100)*($MUS['mining_level']*.5); //Hospital if ($NegRolls == 1) { echo "While mining, you hit a gas pocket and ignite an explosion. You are found later inside the rubble, barely breathing."; //$db->query("UPDATE `users` SET `hospital`=`hospital`+{$NegTime}, //`hospreason` = 'Gas Pocket' WHERE `userid` = {$userid}"); } //Jail elseif ($NegRolls == 2) { echo "While mining, you and another miner spot the same vein with a gem in it. After a few minutes of bickering of who saw it first, he punches you, and a brawl begins. The cops see this and arrest you both."; //$db->query("UPDATE `users` SET `jail`=`jail`+{$NegTime}, //`jail_reason` = 'Fighting Over a Gem' WHERE `userid` = {$userid}"); } //Nothing found else { echo "Unlucky for you. While mining you found nothing."; } } //All the positive rolls. 4-14 elseif ($Rolls >= 3 && $Rolls <= 14) { $PosRolls=mt_rand(1,3); //Positive has 3 rolls. //Output #1 if ($PosRolls == 1) { $FlakeName=$db->fetch_single($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$MSI['mine_copper_item']}")); $flakes=mt_rand($MSI['mine_copper_min'],$MSI['mine_copper_max']); echo "You struck ore! Swing your pick away! After a few minutes, you managed to grab yourself " . number_format($flakes) . " {$FlakeName}(s) from this vein."; item_add($userid,$MSI['mine_copper_item'],$flakes); $xpgain=$flakes*0.1; } //Output #2 elseif ($PosRolls == 2) { $FlakeName=$db->fetch_single($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$MSI['mine_silver_item']}")); $flakes=mt_rand($MSI['mine_copper_min'],$MSI['mine_copper_max']); echo "You struck ore! Swing your pick away! After a few minutes, you managed to grab yourself " . number_format($flakes) . " {$FlakeName}(s) from this vein."; item_add($userid,$MSI['mine_silver_item'],$flakes); $xpgain=$flakes*0.25; } //Output #3 else { $FlakeName=$db->fetch_single($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$MSI['mine_gold_item']}")); $flakes=mt_rand($MSI['mine_copper_min'],$MSI['mine_copper_max']); echo "You struck ore! Swing your pick away! After a few minutes, you managed to grab yourself " . number_format($flakes) . " {$FlakeName}(s) from this vein."; item_add($userid,$MSI['mine_gold_item'],$flakes); $xpgain=$flakes*0.5; } } //Rolled a 15 to get a gem. else { $GemItemName=$db->fetch_single($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$MSI['mine_gem_item']}")); echo "While mining, you expertly find a {$GemItemName} and mine it out slowly. Congratulations, man!"; item_add($userid,$MSI['mine_gem_item'],1); $xpgain=1; } //Displayed at the end so players don't have to refresh. //Also adds mining xp, and removes mining power when needed. echo"<hr /> [<a href='?action=mine&spot={$spot}'>Mine Again</a>]<br /> [<a href='mine.php'>Pack it Up</a>]"; $db->query("UPDATE `tmg_mining` SET `miningxp`=`miningxp`+ {$xpgain}, `miningpower`=`miningpower`-'{$MSI['mine_power_use']}' WHERE `userid` = {$userid}"); } } } } //Function for leveling up while mining. function mining_levelup() { global $db,$userid,$MUS; //Mining XP needed for a level up. $MUS['xp_needed'] = (int) (($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * 4.4); //If the user's mining XP is higher than what's needed if ($MUS['miningxp'] >= $MUS['xp_needed']) { $expu = $MUS['miningxp'] - $MUS['xp_needed']; $MUS['mining_level'] += 1; $MUS['miningxp'] = $expu; $MUS['buyable_power'] += 1; $MUS['xp_needed'] = (int) (($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * 4.4); $db->query("UPDATE `tmg_mining` SET `mining_level` = `mining_level` + 1, `miningxp` = {$expu}, `buyable_power` = `buyable_power` + 1 WHERE `userid` = {$userid}"); } } $h->endpage(); Save, exit, upload! Now, create a file called staff_mine.php staff_mine.php <?php require('sglobals.php'); echo "<h2>Mining</h2><hr />"; if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'addmine': addmine(); break; case 'editmine': editmine(); break; case 'delmine': delmine(); break; default: echo '404'; die($h->endpage()); break; } function addmine() { global $db,$ir,$userid; if (isset($_POST['level']) && (!empty($_POST['level']))) { var_dump($_POST); $level=(isset($_POST['level']) && is_numeric($_POST['level'])) ? abs(intval($_POST['level'])) : ''; $power=(isset($_POST['power']) && is_numeric($_POST['power'])) ? abs(intval($_POST['power'])) : ''; $iq=(isset($_POST['iq']) && is_numeric($_POST['iq'])) ? abs(intval($_POST['iq'])) : ''; $pick=(isset($_POST['pick']) && is_numeric($_POST['pick'])) ? abs(intval($_POST['pick'])) : ''; $city=(isset($_POST['city']) && is_numeric($_POST['city'])) ? abs(intval($_POST['city'])) : ''; $cflakes=(isset($_POST['cflakes']) && is_numeric($_POST['cflakes'])) ? abs(intval($_POST['cflakes'])) : ''; $cflakesmin=(isset($_POST['cflakemin']) && is_numeric($_POST['cflakemin'])) ? abs(intval($_POST['cflakemin'])) : ''; $cflakesmax=(isset($_POST['cflakemax']) && is_numeric($_POST['cflakemax'])) ? abs(intval($_POST['cflakemax'])) : ''; $sflakes=(isset($_POST['sflakes']) && is_numeric($_POST['sflakes'])) ? abs(intval($_POST['sflakes'])) : ''; $sflakesmin=(isset($_POST['sflakemin']) && is_numeric($_POST['sflakemin'])) ? abs(intval($_POST['sflakemin'])) : ''; $sflakesmax=(isset($_POST['sflakemax']) && is_numeric($_POST['sflakemax'])) ? abs(intval($_POST['sflakemax'])) : ''; $gflakes=(isset($_POST['gflakes']) && is_numeric($_POST['gflakes'])) ? abs(intval($_POST['gflakes'])) : ''; $gflakesmin=(isset($_POST['gflakemin']) && is_numeric($_POST['gflakemin'])) ? abs(intval($_POST['gflakemin'])) : ''; $gflakesmax=(isset($_POST['gflakemax']) && is_numeric($_POST['gflakemax'])) ? abs(intval($_POST['gflakemax'])) : ''; $gem=(isset($_POST['gem']) && is_numeric($_POST['gem'])) ? abs(intval($_POST['gem'])) : ''; if (empty($level) || empty($iq) || empty($pick) || empty($city) || empty($cflakes) || empty($cflakesmin) || empty($cflakesmax) || empty($gflakes) || empty($gflakesmin) || empty($gflakesmax) || empty($sflakesmin) || empty($sflakesmax) || empty($sflakes) || empty($gem) || empty($power)) { echo "None of the inputs in the form can be empty."; } elseif ($level < 1) { echo "You need the level to be greater than 0."; } elseif ($cflakesmin == 0 || $cflakesmax == 0 || $gflakesmin == 0 || $gflakesmax == 0 || $sflakesmin == 0 || $sflakesmax == 0) { echo "You cannot specify a minimum or maximum output of zero."; } elseif ($cflakesmin >= $cflakesmax || $sflakesmin >= $sflakesmax || $gflakesmin >= $gflakesmax) { echo "The minimum output cannot be equal to or larger than the output."; } else { $CitySQL=($db->query("SELECT `cityname` FROM `cities` WHERE `cityid` = {$city}")); $PickSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$pick}")); $CFSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$cflakes}")); $SFSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$sflakes}")); $GFSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$gflakes}")); $GemSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$gem}")); if ($db->num_rows($CitySQL) == 0) { echo "The city you specified appears to not exist."; } elseif ($db->num_rows($PickSQL) == 0) { echo "The pickaxe you chose appears to not exist as an in-game item."; } elseif ($db->num_rows($CFSQL) == 0) { echo "The item you chose for Output #1 appears to not exist as an in-game item."; } elseif ($db->num_rows($SFSQL) == 0) { echo "The item you chose for Output #2 appears to not exist as an in-game item."; } elseif ($db->num_rows($GFSQL) == 0) { echo "The item you chose for Output #3 appears to not exist as an in-game item."; } elseif ($db->num_rows($GemSQL) == 0) { echo "The item you chose as the mine's gem does not exist in-game."; } else { $db->query("INSERT INTO `tmg_mines_data` (`mine_id`, `mine_location`, `mine_level`, `mine_copper_min`, `mine_copper_max`, `mine_silver_min`, `mine_silver_max`, `mine_gold_min`, `mine_gold_max`, `mine_pickaxe`, `mine_iq`, `mine_power_use`, `mine_copper_item`, `mine_silver_item`, `mine_gold_item`, `mine_gem_item`) VALUES (NULL, '{$city}', '{$level}', '{$cflakesmin}', '{$cflakesmax}', '{$sflakesmin}', '{$sflakesmax}', '{$gflakesmin}', '{$gflakesmax}', '{$pick}', '{$iq}', '{$power}', '{$cflakes}', '{$sflakes}', '{$gflakes}', '{$gem}');"); echo "The mine has been created successfully."; $citynamelog=$db->fetch_single($CitySQL); stafflog_add("Added a a mine in {$citynamelog}."); } } } else { echo "Use this form to add a mine into the game. The mine's name will be named after the city its placed in. If you have a specific naming scheme, you'll likely want to edit the code to allow it.<br /> <table border='1' padding='1' width='100%'> <form method='post'> <tr> <th> Mine's Location </th> <td> " . location_dropdown(NULL, "city") . " </td> </tr> <tr> <th> Minimum Mining Level </th> <td> <input type='number' name='level' min='1' required='1'> </td> </tr> <tr> <th> Minimum IQ Required </th> <td> <input type='number' name='iq' min='1' required='1'> </td> </tr> <tr> <th> Power Exhaustion Per Attempt </th> <td> <input type='number' name='power' min='1' required='1'> </td> </tr> <tr> <th> Required Pickaxe </th> <td> " . item_dropdown(NULL, "pick") . " </td> </tr> <tr> <th> Output #1 </th> <td> " . item_dropdown(NULL, "cflakes") . " </td> </tr> <tr> <th> Output #2 </th> <td> " . item_dropdown(NULL, "sflakes") . " </td> </tr> <tr> <th> Output #3 </th> <td> " . item_dropdown(NULL, "gflakes") . " </td> </tr> <tr> <th> Gem Item </th> <td> " . item_dropdown(NULL, "gem") . " </td> </tr> <tr> <th> Output #1's Minimum Output </th> <td> <input type='number' name='cflakemin' min='1' required='1'> </td> </tr> <tr> <th> Output #1's Maximum Output </th> <td> <input type='number' name='cflakemax' min='2' required='1'> </td> </tr> <tr> <th> Output #2's Minimum Output </th> <td> <input type='number' name='sflakemin' min='1' required='1'> </td> </tr> <tr> <th> Output #2's Maximum Output </th> <td> <input type='number' name='sflakemax' min='2' required='1'> </td> </tr> <tr> <th> Output #3's Minimum Output </th> <td> <input type='number' name='gflakemin' min='1' required='1'> </td> </tr> <tr> <th> Output #3's Maximum Output </th> <td> <input type='number' name='gflakemax' min='2' required='1'> </td> </tr> <tr> <td colspan='2'> <center><input type='submit' value='Add Mine'></center> </td> </tr> </form> </table>"; } } function editmine() { if (!isset($_POST['step'])) { $_POST['step'] = 0; } global $db,$ir,$userid; if (isset($_POST['level']) && (!empty($_POST['level'])) && $_POST['step'] == 2) { $mine=(isset($_POST['mineid']) && is_numeric($_POST['mineid'])) ? abs(intval($_POST['mineid'])) : ''; $level=(isset($_POST['level']) && is_numeric($_POST['level'])) ? abs(intval($_POST['level'])) : ''; $power=(isset($_POST['power']) && is_numeric($_POST['power'])) ? abs(intval($_POST['power'])) : ''; $iq=(isset($_POST['iq']) && is_numeric($_POST['iq'])) ? abs(intval($_POST['iq'])) : ''; $pick=(isset($_POST['pick']) && is_numeric($_POST['pick'])) ? abs(intval($_POST['pick'])) : ''; $city=(isset($_POST['city']) && is_numeric($_POST['city'])) ? abs(intval($_POST['city'])) : ''; $cflakes=(isset($_POST['cflakes']) && is_numeric($_POST['cflakes'])) ? abs(intval($_POST['cflakes'])) : ''; $cflakesmin=(isset($_POST['cflakemin']) && is_numeric($_POST['cflakemin'])) ? abs(intval($_POST['cflakemin'])) : ''; $cflakesmax=(isset($_POST['cflakemax']) && is_numeric($_POST['cflakemax'])) ? abs(intval($_POST['cflakemax'])) : ''; $sflakes=(isset($_POST['sflakes']) && is_numeric($_POST['sflakes'])) ? abs(intval($_POST['sflakes'])) : ''; $sflakesmin=(isset($_POST['sflakemin']) && is_numeric($_POST['sflakemin'])) ? abs(intval($_POST['sflakemin'])) : ''; $sflakesmax=(isset($_POST['sflakemax']) && is_numeric($_POST['sflakemax'])) ? abs(intval($_POST['sflakemax'])) : ''; $gflakes=(isset($_POST['gflakes']) && is_numeric($_POST['gflakes'])) ? abs(intval($_POST['gflakes'])) : ''; $gflakesmin=(isset($_POST['gflakemin']) && is_numeric($_POST['gflakemin'])) ? abs(intval($_POST['gflakemin'])) : ''; $gflakesmax=(isset($_POST['gflakemax']) && is_numeric($_POST['gflakemax'])) ? abs(intval($_POST['gflakemax'])) : ''; $gem=(isset($_POST['gem']) && is_numeric($_POST['gem'])) ? abs(intval($_POST['gem'])) : ''; if (empty($level) || empty($iq) || empty($pick) || empty($city) || empty($cflakes) || empty($cflakesmin) || empty($cflakesmax) || empty($gflakes) || empty($gflakesmin) || empty($gflakesmax) || empty($sflakesmin) || empty($sflakesmax) || empty($sflakes) || empty($gem) || empty($power) || empty($mine)) { echo "None of the inputs in the form can be empty."; } elseif ($level < 1) { echo "You need the level to be greater than 0."; } elseif ($cflakesmin == 0 || $cflakesmax == 0 || $gflakesmin == 0 || $gflakesmax == 0 || $sflakesmin == 0 || $sflakesmax == 0) { echo "You cannot specify a minimum or maximum output of zero."; } elseif ($cflakesmin >= $cflakesmax || $sflakesmin >= $sflakesmax || $gflakesmin >= $gflakesmax) { echo "The minimum output cannot be equal to or larger than the output."; } else { $CitySQL=($db->query("SELECT `cityname` FROM `cities` WHERE `cityid` = {$city}")); $PickSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$pick}")); $CFSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$cflakes}")); $SFSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$sflakes}")); $GFSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$gflakes}")); $GemSQL=($db->query("SELECT `itmname` FROM `items` WHERE `itmid` = {$gem}")); if ($db->num_rows($CitySQL) == 0) { echo "The city you specified appears to not exist."; } elseif ($db->num_rows($PickSQL) == 0) { echo "The pickaxe you chose appears to not exist as an in-game item."; } elseif ($db->num_rows($CFSQL) == 0) { echo "The item you chose for Output #1 appears to not exist as an in-game item."; } elseif ($db->num_rows($SFSQL) == 0) { echo "The item you chose for Output #2 appears to not exist as an in-game item."; } elseif ($db->num_rows($GFSQL) == 0) { echo "The item you chose for Output #3 appears to not exist as an in-game item."; } elseif ($db->num_rows($GemSQL) == 0) { echo "The item you chose as the mine's gem does not exist in-game."; } else { $db->query("UPDATE `tmg_mines_data` SET `mine_location` = '{$city}', `mine_level` = '{$level}', `mine_copper_item` = '{$cflakes}', `mine_copper_max` = '{$cflakesmax}', `mine_copper_min` = '{$cflakesmin}', `mine_silver_item` = '{$sflakes}', `mine_silver_max` = '{$sflakesmax}', `mine_silver_min` = '{$sflakesmin}', `mine_gold_item` = '{$gflakes}', `mine_gold_max` = '{$gflakesmax}', `mine_gold_min` = '{$gflakesmin}', `mine_pickaxe` = '{$pick}', `mine_iq` = '{$iq}', `mine_gem_item` = '{$gem}', `mine_power_use` = '{$power}' WHERE `mine_id` = {$mine}"); echo "The mine has been updated."; stafflog_add("Edited a mine."); } } } elseif ($_POST['step'] == 1) { $mine=(isset($_POST['mine']) && is_numeric($_POST['mine'])) ? abs(intval($_POST['mine'])) : ''; if ($db->num_rows($db->query("SELECT * FROM `tmg_mines_data` WHERE `mine_id` = {$mine}")) == 0) { echo "The mine you selected does not exist."; } else { $mi=$db->fetch_row($db->query("SELECT * FROM `tmg_mines_data` WHERE `mine_id` = {$mine}")); echo "Editing an existing mine...<br /> <table border='1' padding='1' width='100%'> <form method='post'> <input type='hidden' value='2' name='step'> <input type='hidden' value='{$mine}' name='mineid'> <tr> <th> Mine's Location </th> <td> " . location_dropdown(NULL, "city", $mi['mine_location']) . " </td> </tr> <tr> <th> Minimum Mining Level </th> <td> <input type='number' name='level' min='1' value='{$mi['mine_level']}' required='1'> </td> </tr> <tr> <th> Minimum IQ Required </th> <td> <input type='number' name='iq' min='1' value='{$mi['mine_iq']}' required='1'> </td> </tr> <tr> <th> Power Exhaustion Per Attempt </th> <td> <input type='number' name='power' min='1' value='{$mi['mine_power_use']}' required='1'> </td> </tr> <tr> <th> Required Pickaxe </th> <td> " . item_dropdown(NULL, "pick", $mi['mine_pickaxe']) . " </td> </tr> <tr> <th> Output #1 </th> <td> " . item_dropdown(NULL, "cflakes", $mi['mine_copper_item']) . " </td> </tr> <tr> <th> Output #2 </th> <td> " . item_dropdown(NULL, "sflakes", $mi['mine_silver_item']) . " </td> </tr> <tr> <th> Output #3 </th> <td> " . item_dropdown(NULL, "gflakes", $mi['mine_gold_item']) . " </td> </tr> <tr> <th> Gem Item </th> <td> " . item_dropdown(NULL, "gem", $mi['mine_gem_item']) . " </td> </tr> <tr> <th> Output #1's Minimum Output </th> <td> <input type='number' name='cflakemin' value='{$mi['mine_copper_min']}' min='1' required='1'> </td> </tr> <tr> <th> Output #1's Maximum Output </th> <td> <input type='number' name='cflakemax' value='{$mi['mine_copper_max']}' min='2' required='1'> </td> </tr> <tr> <th> Output #2's Minimum Output </th> <td> <input type='number' name='sflakemin' value='{$mi['mine_silver_min']}' min='1' required='1'> </td> </tr> <tr> <th> Output #2's Maximum Output </th> <td> <input type='number' name='sflakemax' value='{$mi['mine_silver_max']}' min='2' required='1'> </td> </tr> <tr> <th> Output #3's Minimum Output </th> <td> <input type='number' name='gflakemin' value='{$mi['mine_gold_min']}' min='1' required='1'> </td> </tr> <tr> <th> Output #3's Maximum Output </th> <td> <input type='number' name='gflakemax' value='{$mi['mine_gold_max']}' min='2' required='1'> </td> </tr> <tr> <td colspan='2'> <center><input type='submit' value='Edit Mine'></center> </td> </tr> </form> </table>"; } } else { echo "Select a mine to edit<br /> <form method='post'> <input type='hidden' name='step' value='1'> " . mines_dropdown(NULL, "mine") . "<br /> <input type='submit' value='Edit Mine'> "; } } function delmine() { global $db; if (isset($_POST['mine'])) { $mine=(isset($_POST['mine']) && is_numeric($_POST['mine'])) ? abs(intval($_POST['mine'])) : ''; if ($db->num_rows($db->query("SELECT * FROM `tmg_mines_data` WHERE `mine_id` = {$mine}")) == 0) { echo "The mine does not exist, or has been already deleted."; } else { $db->query("DELETE FROM `tmg_mines_data` WHERE `mine_id` = {$mine}"); echo "The mine has been deleted successfully."; stafflog_add("Deleted a mine"); } } else { echo "Select a mine to delete.<br /> <form method='post'> <input type='hidden' name='step' value='1'> " . mines_dropdown(NULL, "mine") . "<br /> <input type='submit' value='Delete Mine (No verification, be 100% sure)'> "; } } function mines_dropdown($connection, $ddname = "mine", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown'>"; $q = $db->query( "SELECT `mine_id`, `mine_location`, `mine_level` FROM `tmg_mines_data` ORDER BY `mine_level` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = $db->fetch_row($q)) { $CityName=$db->fetch_single($db->query("SELECT `cityname` FROM `cities` WHERE `cityid` = {$r['mine_location']}")); $ret .= "\n<option value='{$r['mine_id']}'"; if ($selected == $r['mine_id'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$CityName} - Level {$r['mine_level']}</option>"; } $db->free_result($q); $ret .= "\n</select>"; return $ret; } $h->endpage(); Save, exit, upload! Finally... Execute this SQL SQL CREATE TABLE IF NOT EXISTS `tmg_mines_data` ( `mine_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `mine_location` int(11) unsigned NOT NULL, `mine_level` int(11) unsigned NOT NULL, `mine_copper_min` int(11) unsigned NOT NULL, `mine_copper_max` int(11) unsigned NOT NULL, `mine_silver_min` int(11) unsigned NOT NULL, `mine_silver_max` int(11) unsigned NOT NULL, `mine_gold_min` int(11) unsigned NOT NULL, `mine_gold_max` int(11) unsigned NOT NULL, `mine_pickaxe` int(11) unsigned NOT NULL, `mine_iq` int(11) unsigned NOT NULL, `mine_power_use` int(11) unsigned NOT NULL, `mine_copper_item` int(11) unsigned NOT NULL, `mine_silver_item` int(11) unsigned NOT NULL, `mine_gold_item` int(11) unsigned NOT NULL, `mine_gem_item` int(11) unsigned NOT NULL, PRIMARY KEY (`mine_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `tmg_mining` ( `userid` int(11) unsigned NOT NULL, `max_miningpower` int(11) NOT NULL, `miningpower` int(11) NOT NULL, `miningxp` varchar(11) NOT NULL, `buyable_power` smallint(11) NOT NULL, `mining_level` int(11) NOT NULL, PRIMARY KEY (`userid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Mining Mod Update from TMG'; I've tested it just before uploading and it all works.
-
Oh wow, derp on me. I thought they would have been in a globals file. Thanks Magictallguy!
-
I'm 99.9% sure its not. However, I'm not sure what file I'd check to make sure if it is(n't). I've just looked in globals (all three of them), headers, the files in the class folder, and didn't really find a reference to it. I apologize if I'm overlooking it.