-
Posts
2,140 -
Joined
-
Last visited
-
Days Won
148
Content Type
Profiles
Forums
Events
Everything posted by Magictallguy
-
Jee, gravedig much!
-
Lite/v1 doesn't. I'm offering a conversion service with your choice of either MySQLi or PDO (preferred). I charge $5 an hour (negotiable), I use Toggl to track all time whilst coding, and a small file that shows you to-the-second tracked time. Short report (basic detail (time tracked, cost)) Detailed report contains each time tracked - will only show for whichever "workspace" I've used (to track specifically your time)
-
Jeez, procedural style is almost alien to me after writing OO for so long.. <?php ini_set('error_reporting', E_ALL); $dbhost = "localhost"; $dbuser = "usernamehere"; $dbpass = "passwordhere"; $dbbase = "dbnamehere"; $cron_are_so_cool = "trick_is_da_bomb"; $db = "mysql_tut"; $con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbbase); if(!isset($_GET['code_to_run']) || $_GET['code_to_run'] != $cron_are_so_cool) die("<center><font color=red>Fatal error!</font><br/><blink>IP logged as {$_SERVER['REMOTE_ADDR']}</blink></center>"); /*----------------------- HELPER FUNCTIONS ------------------------ */ // -- Fugly "hacky" method for implementing MySQL's mysql_result() into MySQLi function mysqli_result($result, $row = 0, $column = 0) { $count = mysqli_num_rows($result); if($count && $row <= ($count - 1) && $row >=0) { mysqli_data_seek($result, $row); $get = ctype_digit($row) ? mysqli_fetch_row($result) : mysqli_fetch_assoc($result); if(isset($get[$column])) return $get[$column]; } return false; } // -- End fugly "hacky" method function remove_staff($id) { global $con; if(!ctype_digit($id)) return false; $selectStaff = mysqli_query($con, 'SELECT `p_maids`, `p_butler`, `p_guard`, `p_doctor`, `p_pilot` FROM `members_properties` WHERE `p_id` = '.$id) or exit(mysqli_error($con)); if(!mysqli_num_rows($selectStaff)) return false; $row = mysqli_fetch_assoc($selectStaff); $happloss = 0; if($row['p_maids'] != 0) { $selectName = mysqli_query($con, 'SELECT `ps_name` FROM `property_staff` WHERE `ps_id` = '.$row['p_maids']) or exit(mysqli_error($con)); if(!mysqli_num_rows($selectName)) return false; switch(mysqli_result($selectName)) { case '5x Maid Service': $happloss += 100; break; case '3x Maid Service': $happloss += 85; break; case '2x Maid Service': $happloss += 75; break; case 'Maid Service': $happloss += 50; break; } } if($row['p_butler'] != 0) { $selectName = mysqli_query($con, 'SELECT `ps_name` FROM `property_staff` WHERE `ps_id` = '.$row['p_butler']) or exit(mysqli_error($con)); if(!mysqli_num_rows($selectName)) return false; switch(mysqli_result($selectName)) { case '3x Butler Service': $happloss += 125; break; case '2x Butler Service': $happloss += 100; break; case 'Butler Service': $happloss += 75; break; } } if($row['p_guard'] != 0) { $selectName = mysqli_query($con, 'SELECT `ps_name` FROM `property_staff` WHERE `ps_id` = '.$row['p_guard']) or exit(mysqli_error($con)); if(!mysqli_num_rows($selectName)) return false; switch(mysqli_result($selectName)) { case '10x Guard Service': $happloss += 500; break; case '5x Guard Service': $happloss += 300; break; case '3x Guard Service': $happloss += 200; break; case '2x Guard Service': $happloss += 150; break; case 'Guard Service': $happloss += 100; break; } } if($row['p_doctor'] != 0) $happloss += 25; if($row['p_pilot'] != 0) $happloss += 50; mysqli_query($con, 'UPDATE `members_properties` SET `p_happy` = GREATEST(`p_happy` - '.$happloss.', 0), `p_maids` = 0, `p_butler` = 0, `p_guard` = 0, `p_doctor` = 0, `p_pilot` = 0, `p_priceofstaff` = 0, `p_daysofstaff` = 0 WHERE `p_id` = '.$id) or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `members` SET `my_maxhappy` = my_maxhappy` - '.$happloss.' WHERE `my_property` = '.$id) or exit(mysqli_error($con)); } function in_event($player, $text, $cs_val = true) { global $con; if(!ctype_digit($player)) return false; mysqli_query($con, 'INSERT INTO `member_events` VALUES (NULL, '.$player.', "'.mysqli_real_escape_string($con, $text).'", '.time().', 0)') or exit(mysqli_error($con)); if($cs_val) mysqli_query($con, 'UPDATE `city_statistic` SET `cs_value` = `cs_value` + 1 WHERE `cs_id` = 1') or exit(mysqli_error($con)); } function stock_credit($id, $credit) { global $con; if(!ctype_digit($id) || !ctype_digit($credit)) return false; mysqli_query($con, 'UPDATE `stock_market` SET `s_profit` = GRETEST(0, `s_profit` + '.$credit.'), `s_losses` = GREATEST(0, `s_losses` - '.$credit.') WHERE `s_id` = '.$id) or exit(mysqli_error($con)); } function award_check($user, $number, $award) { global $con; if(!ctype_digit($user) || !ctype_digit($number) || !ctype_digit($award)) return false; $selectAward = mysqli_query($con, 'SELECT `ma_id`, `ma_tier` FROM `members_award` WHERE `ma_playerid` = '.$user.' AND `ma_award` = '.$award) or exit(mysqli_error($con)); if(mysqli_num_rows($selectAward)) { $row = mysqli_fetch_assoc($selectAward); if($row['ma_tier'] < $number) { mysqli_query($con, 'UPDATE `members_awards` SET `ma_viewed` = 0, `ma_time` = '.time().', `ma_tier` = '.$number.' WHERE `ma_id` = '.$row['ma_id']) or exit(mysqli_error($con)); } } else mysqli_query($con, 'INSERT INTO `members_awards` VALUES (NULL, '.$award.', '.$number.', '.$user.', 0, '.time().')') or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `members` SET `my_merits` = `my_merits` + 1 WHERE `playerid` = '.$user) or exit(mysqli_error($con)); } /* ------------------- END HELPER FUNCTIONS ----------------------- */ /*----------------------------------Start cron days--------------------------*/ mysqli_query($con, 'UPDATE `members` SET `my_mailban` = IF(`my_mailban` > 0, `my_mailban` - 1, 0), `my_forumban` = IF(`my_forumban` > 0, `my_forumban` - 1, 0), `my_dondays` = IF(`my_dondays` > 0, `my_dondays` - 1, 0), `my_maxenergy` = IF(`my_dondays` = 0, 100, `my_maxenergy`), `my_partner_days`` = IF(`my_partner` > 0, `my_partner_days` - 1, 0), `brew` = 0') or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `members_extra` SET `my_daysold` = `my_daysold` + 1, `energy_refill` = 0, `my_ctokens` = `my_ctokens_daily`.`my_cstreak` = 0') or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `none_agressive` SET `na_days` = IF(`na_days` > 0, `na_days` - 1, 0)') or exit(mysqli_error($con)); mysqli_query($con, 'DELETE FROM `none_agressive` WHERE `na_days` = 0') or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `city_shop_dogs` SET `csd_daysold` = `csd_daysold` + 1') or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `members_dogs` SET `md_daysold` = `md_daysold` + 1') or exit(mysqli_error($con)); $newones = mt_rand(1, 15); $morf = [ 1 => 'male', 2 => 'female' ]; for($i = 1; $i <= $newones; ++$i) mysqli_query($con, 'INSERT INTO `city_shop_dogs` VALUES (NULL, '.mt_rand(1, 8).', "'.$morf[mt_rand(1, 2)].'", 0)') or exit(mysqli_error($con)); $selectPlayerJobs = mysqli_query($con, 'SELECT `me`.`playerid`, `me`.`my_job`, `me`.`my_job_rank`, `sjr`.*, `m`.`mt_level` FROM `members_extra` AS `me` INNER JOIN `system_job_ranks` AS `sjr` ON `me`.`my_job_rank` = `sjr`.`r_ID` INNER JOIN `members` AS `m` ON `me`.`playerid` = `m`.`playerid` WHERE `me`.`my_job` > 0') or exit(mysqli_error($con)); if(mysqli_num_rows($selectPlayerJobs)) { $job = [ 1 => 'armypoints', 2 => 'grocpoints', 3 => 'casipoints', 4 => 'medipoints', 5 => 'educpoints', 6 => 'lawpoints' ]; while($row = mysqli_fetch_assoc($selectPlayerJobs)) { mysqli_query($con, 'UPDATE `memberstats` SET `my_labor` = `my_labor` + '.$row['r_MANUALGAIN'].', `my_intelligence` = `my_intelligence` + '.$row['r_INTELGAIN'].', `my_endurance` = `my_endurance` + '.$row['r_ENDURGAIN'].' WHERE `playerid` = '.$row['playerid']) or exit(mysqli_error($con)); $row['r_POINTS'] *= $row['my_level']; mysqli_query($con, 'UPDATE `members_extra` SET `'.$job[$row['my_job']].'` = `'.$job[$row['my_job']].'` + '.$row['r_POINTS'].' WHERE `playerid` = '.$row['playerid']) or exit(mysqli_error($con)); mysqli_query($con, 'UPDATE `members` SET `wallet` = `wallet` + '.$row['r_WAGES'].' WHERE `playerid` = '.$row['playerid']) or exit(mysqli_error($con)); } } mysqli_query($con, 'UPDATE `members_properties` SET `p_ltime` = IF(`p_leasedto` > 0, GREATEST(0, `p_ltime` - 1), 0), `p_daysofstaff` = IF(`p_priceofstaff` > 0, `p_daysofstaff` + 1, `p_daysofstaff`)') or exit(mysqli_error($con)); //Check for expired rentings $selectRents = mysqli_query($con, 'SELECT * FROM `members_properties` AS `mp` LEFT JOIN `properties` AS `h` ON `mp`.`p_property` = `h`.`house_id` WHERE `mp`.`p_leasedto` > 0 AND `mp`.`p_ltime` = 0') or exit(mysqli_error($con)); if(mysqli_num_rows($selectRents)) { while($row = mysqli_fetch_assoc($selectRents)) { // ---- THIS BIT IS FUGLY AS HELL AND NEEDS A REWRITE (Well, it all does, but this bit especially!) $getPlayer = mysqli_query($con, 'SELECT `playerid` FROM `members` WHERE `my_property` = '.$row['p_id']) or exit(mysqli_error($con)); if(mysqli_num_rows($getPlayer)) { $prop = mysqli_fetch_assoc($getPlayer); $selectProp = mysqli_query($con, 'SELECT `p_id` FROM `members_properties` WHERE `p_property` = 1 AND `p_playerid` = '.$prop['playerid']) or exit(mysqli_error($con)); $pid = mysqli_result($selectProp); mysqli_query($con, 'UPDATE `members` SET `my_property` = '.$pid.', `my_happy` = 100, `my_maxhappy` = 100 WHERE `playerid` = '.$prop['playerid']) or exit(mysqli_error($con)); } remove_staff($row['p_id']); mysqli_query($con, 'UPDATE `members_properties` SET `p_leasedto` = 0, `p_ltime` = 0 WHERE `p_id` = '.$row['p_id']) or exit(mysqli_error($con)); in_event($row['p_playerid'], 'The lease for your '.$row['house_name'].' has now ended. Your property has been returned to you.', false); in_event($row['p_leasedto'], 'The lease for the '.$row['house_name'].' has now ended. The property has been returned to its owner.', false); } } //Check for expired rentings //Charge daily upkeep $selectProps = mysqli_query($con, 'SELECT * FROM `members_properties` AS `mp` LEFT JOIN `properties` AS `h` ON `mp`.`p_property` = `h`.`house_id` WHERE `mp`.`p_property` <> 1') or exit(mysqli_error($con)); if(mysqli_num_rows($selectProps)) { while($row = mysqli_fetch_assoc($selectProps)) { $total = $row['p_priceofstaff'] + $row['house_tax']; $target = $row['p_leasedto'] ? $row['p_leasedto'] : $row['p_playerid']; $selectPlayer = mysqli_query($con, 'SELECT `wallet` FROM `members` WHERE `playerid` = '.$target) or exit(mysqli_error($con)); if(mysqli_num_rows($selectPlayer)) { //Shouldn't be necessary - failsafe check $cash = mysqli_result($selectPlayer); if($row['p_priceofstaff']) { stock_credit(5, 1); if($cash < $total) { remove_staff($row['p_id']); in_event($target, 'You didn\'t have enough to pay your staff for today. They\'ve packed up and left!'); } mysqli_query($con, 'UPDATE `members` SET `wallet` = GREATEST(0, `wallet` - '.$total.') WHERE `playerid` = '.$target) or exit(mysqli_error($con)); } } } } //Charge daily upkeep $selectAwards = mysqli_query($con, 'SELECT * FROM `award_checks` AS `ac` LEFT JOIN `awards` AS `a` ON `ac`.`ac_award_id` = `a`.`a_id`') or exit(mysqli_error($con)); if(mysqli_num_rows($selectAwards)) { while($row = mysqli_fetch_assoc($selectAwards)) { $selectAward = mysqli_query($con, 'SELECT `'.$row['ac_identify'].'`, `'.$row['ac_what'].'` FROM `'.$row['ac_table'].'` WHERE `'.$row['ac_what'].'` >= '.$row['ac_amount']) or exit(mysqli_error($con)); if(mysqli_num_rows($selectAward)) while($get = mysqli_fetch_assoc($selectAward)) award_check($get[$row['ac_identify']], $row['ac_number'], $row['ac_award_id']); } } $selectFactionPlayers = mysqli_query($con, 'SELECT `playerid` FROM `members` WHERE `my_faction` > 0') or exit(mysqli_error($con)); if(mysqli_num_rows($selectFactionPlayers)) while($row = mysqli_fetch_assoc($selectFactionPlayers)) mysqli_query($con, 'UPDATE `members_extra` SET `my_faction_days`= `my_faction_days` + 1 WHERE `playerid` = '.$row['playerid']) or exit(mysqli_error($con)); mysqli_query($con, 'DELETE FROM `votes_count` WHERE `vc_site` IN ("apex", "ultra")') or exit(mysqli_error($con)); $selectStocks = mysqli_query($con, 'SELECT * FROM `stock_holdings` WHERE `sh_saletime` > 0 AND `sh_playerid` <> 3 AND (`sh_saletime` + 1036800) <= '.time()) or exit(mysqli_error($con)); if(mysqli_num_rows($selectStocks)) { while($row = mysqli_fetch_assoc($selectStocks)) { $credit = $row['sh_nowprice'] * $row['sh_qty']; mysqli_query($con, 'UPDATE `members` SET `wallet` = `wallet` + '.$credit.' WHERE `playerid` = '.$row['sh_playerid']) or exit(mysqli_error($con)); in_event($row['sh_playerid'], 'Someome bought '.$row['sh_qty'].' of your stocks for $'.number_format($credit)); mysqli_query($con, 'UPDATE `stock_holdings` SET `sh_playerid` = 1, sh_payed` = '.$row['sh_nowprice'].', `sh_time` = '.time().', `sh_sale` = 1, `sh_saletime` = '.time().' WHERE `sh_id` = '.$row['sh_id']) or exit(mysqli_error($con)); } } $yearago = (time() - 32140800); $sixmonths = $yearago / 2; $threemonths = $sixmonths / 2; $onemonth = $sixmonths / 6; $twoweeks = $onemonth / 2; $queries = [ 'DELETE FROM `member_mail` WHERE `mm_time` <= '.$onemonth, 'DELETE FROM `members_events` WHERE `e_time` <= '.$onemonth, 'DELETE FROM`attack_logs` WHERE `time` <= '.$onemonth, 'DELETE FROM `faction_events` WHERE `fe_time` <= '.$onemonth, 'DELETE FROM `stock_history` WHERE `h_time` <= '.$sixmonth ]; foreach($queries as $query) mysqli_query($con, $query) or exit(mysqli_error($con)); From 500~ lines to 268 and does the same job. There's still a few practises in there that I'd change, but I'm not willing to do all the work for you TESTED FOR PARSE ERRORS ONLY This is now using mysqli_*() (as opposed to deprecated mysql_*()) Including another file that contains database connections or mysql_*() functions may break this. I can provide a mysql_*() version if you'd like
-
Hnng *twitch*... jQuery != Java JavaScript != Java JavaScript != jQuery .... -.-
-
Ugh.. Genuine stomach churns whilst writing this - friggin' mysql_*() bleh.. <?php session_start(); require_once __DIR__ . '/global_func.php'; $userid = array_key_exists('userid', $_SESSION) && ctype_digit($_SESSION['userid']) ? $_SESSION['userid'] : null; if(empty($userid)) exit(header('Location: login.php')); require_once __DIR__ . '/header.php'; $h = new headers; $h->startheaders(); require_once __DIR__ . '/mysql.php'; global $c; $is = mysql_query( 'SELECT `u`.*, `us`.*, `h`.* FROM `users` AS `u` LEFT JOIN `userstats` AS `us` ON `u`.`userid` = `us`.`userid` LEFT JOIN `houses` AS `h` ON `h`.`hWILL` = `u`.`maxwill` WHERE `u`.`userid` = '.$userid, $c ) or exit(mysql_error()); if(!mysql_num_rows($is)) { session_unset(); session_destroy(); exit(header('Location: login.php')); } $ir = mysql_fetch_assoc($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); $_GET['id'] = array_key_exists('id', $_GET) && ctype_digit($_GET['id']) ? $_GET['id'] : null; if (!isset($_GET['work'])) $_GET['work'] = ''; switch ($_GET['work']){ case 'apply': apply_job($ir, $c, $h); break; case 'hired': complete_job($ir, $c); break; default: job_home($ir, $c); } function job_home($ir, $c) { ?><table bgcolor="#c4c4c4" width="75%"><?php if($ir['job']) { $select = mysql_query('SELECT `Jname`, `Jpay` FROM `jobs` WHERE `Jid` = '.$ir['job'], $c) or exit(mysql_error()); if(!mysql_num_rows($select)) { mysql_query('UPDATE `users` SET `job` = 0 WHERE `job` = '.$ir['job'], $c) or exit(mysql_error()); echo 'The job you had no longer exists..'; } else { $row = mysql_fetch_assoc($select); ?><tr> <th colspan="4" style="text-align:center">You currently work at <?php echo $row['Jname'];?> making <?php echo money_formatter($row['Jpay']);?> a day!</th> </tr><?php } } $select = mysql_query('SELECT * FROM `jobs` ORDER BY `Jid` ASC', $c) or exit(mysql_error()); ?><tr> <th>Job</th> <th>Level</th> <th>Pay</th> <th>Apply</th> </tr><?php if(!mysql_num_rows($select)) echo '<tr><td colspan="4" style="text-align:center">There are no jobs</td></tr>'; else while($row = mysql_fetch_assoc($select)) { ?><tr> <td><?php echo $row['Jname'];?></td> <td><?php echo $row['Jlevel'];?></td> <td><?php echo money_formatter($row['Jpay']);?></td> <td><?php echo $row['Jlevel'] <= $ir['level'] ? '<a href="jobs.php?work=apply&id='.$row['Jid'].'">Apply</a>':'';?></td> </tr><?php } ?></table><?php } function apply_job($ir, $h, $c) { if(empty($_GET['id'])) { echo 'You didn\'t select a valid job'; exit($h->endpage()); } $select = mysql_query('SELECT `Jname`, `Jlevel`, `Jpay` FROM `jobs` WHERE `Jid` = '.$_GET['id'], $c) or exit(mysql_error()); if(!mysql_num_rows($select)) { echo 'The job you\'ve selected doesn\'t exist'; exit($h->endpage()); } $row = mysql_fetch_assoc($select); if($row['Jlevel'] > $ir['level']) { echo 'Your level isn\'t high enough for this job - go get some experience!'; exit($h->endpage()); } if(!array_key_exists('ans', $_GET)) { ?>Are you sure you want to apply to <?php echo $row['Jname'];?>?<br /> <a href="jobs.php?work=apply&id=<?php echo $_GET['id'];?>">Aye!</a><br /> <a href="jobs.php">Nah, take me back..</a><?php } else { mysql_query('UPDATE `users` SET `job` = '.$_GET['id'].', `jobpay` = '.$row['Jpay'].' WHERE `userid` = '.$ir['userid'], $c) or exit(mysql_error()); ?>You got the job! Congratulations!<br /> You now work at <?php echo $row['Jname'];?><br /> <a href="jobs.php"><span style="color:grey;">~</span> Back</a><?php } } $h->endpage(); And cron becomes: mysql_query('UPDATE `users` SET `money` = `money` + `jobpay`', $c) or exit(mysql_error());
-
For anyone else having an issue with the lack of SQL tag support... *glares at MWG admins* CREATE TABLE `mugger_oth` ( `uid` INT(11) NOT NULL, `total_mugged` INT(11) NOT NULL DEFAULT 0, `date_start` DATETIME NOT NULL, FOREIGN KEY (`uid`) REFERENCES `users`(`userid`) ON DELETE CASCADE ) ENGINE=MyISAM; CREATE TABLE `mugger_oth_global` ( `entry_type` ENUM('top_ever', 'top_hour', 'top_24') NOT NULL DEFAULT 'top_24', `uid` INT(11) NOT NULL, `total_mugs` INT(11) NOT NULL, `total_mugged` INT(11) NOT NULL, PRIMARY KEY (`entry_type`), FOREIGN KEY (`uid`) REFERENCES `users`(`userid`) ) ENGINE=MyISAM; INSERT INTO `mugger_oth_global` (`entry_type`, `uid`, `total_mugs`, `total_mugged`) VALUES ('top_24', 1, 0, 0), ('top_hour', 1, 0, 0), ('top_ever', 1, 0, 0);
-
My apologies, my internet has been cut off for a few days - got cut off from the world in the process. I can do it ;)
-
Granted, but in this case, you're expecting an int/float, not a string ;)
-
Plzn, plzno, kthx
-
Recommending use of ctype_digit() over abs(intval($var)) + 0 for this instance.. $bounty = array_key_exists('bounty', $_GET) && ctype_digit($_GET['bounty']) ? $_GET['bounty'] : null;
-
Error exists because you've added a WHERE clause. Remove it (and put the "boxes" part of the query in a new query, or change it so it doesn't needed the WHERE)
-
Aye, perhaps it be a little overkill, I just like to cover as many bases as possible. For most, though: if(!isset($_GET['action'])) $_GET['action'] = null; should be enough (though I would recommend the use of array_key_exists() over isset() in these cases
-
Perhaps, but this also filters in for SilLYCaSe actions. without strotlower() file.php?action=SomEThing = default with it file.php?action=SomEThing = whatever "something" is. Good for developers who make typos or catch the shift key too often (I have done both many times)
-
*sigh* Please actually read the answers granted. Add: $_GET['action'] = array_key_exists('action', $_GET) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; if you want it to be done properly in this case, or if(!isset($_GET['action'])) $_GET['action'] = ''; if not - above the switch($_GET['action'])
-
mccode-v2 Updated Newspaper - more than one page
Magictallguy replied to Magictallguy's topic in Free Modifications
ALTER TABLE `papercontent` ADD `page2_content` TEXT NOT NULL, ADD `page3_content` TEXT NOT NULL; -
bcoz ppl dun no cde lyk we do That, and newbies are exactly that. The amount of times I had buggy code on production servers was insane and beyond idiotic. Suppressed all errors to all but myself though, so that was easy enough
-
mccode-v2 Updated Newspaper - more than one page
Magictallguy replied to Magictallguy's topic in Free Modifications
Wow, gravedig and a half there. I'm not seeing any reference to "news" within my code (my old, fugly code at that) Where are you getting that E_NOTICE? -
What, in the absolute fuckhole, is this shit?! Moderators, please take this down - this is beyond offensive -.-
-
If you feel like giving us the error message, we may be able to help you.
-
My apologies for both the graveyard dig and the lateness of my response. I've done minor optimizations on the entire staff_chat.php file. I'll do some debugging shortly -- Edit: Debug complete (unfortunately, no test area, so I can't properly test it. Any issues, post back please :)
-
In docrime.php, the $sucrate (or success rate) is determined, by default, using basic maths - algebra, to be exact. $find = ['LEVEL', 'CRIMEXP', 'EXP', 'WILL', 'IQ']; $repl = [$ir['level'], $ir['crimexp'], $ir['exp'], $ir['will'], $ir['IQ']]; $sucrate = str_replace($find, $repl, $r['crimePERCFORM']); The default formula upon crime creation is ((WILL*0.8)/2.5)+(LEVEL/4) Remember that "BODMAS", BIDMAS", "PEMDAS", or however you remember it, all play in here - I was taught the "BIDMAS" method, though they all mean basically the same thing. Brackets Indices Division Multiplication Addition Subtraction (in that order) Now, for example, we'll use the "stats" that would be there as a brand new player (i.e. Will = 100, Level = 1, CrimeXP = 0, EXP = 0, IQ = 10) Break up the formula, brackets comes first. ((100 * 0.8) / 2.5) = 80 / 2.5 = 32 (1 / 4) = 0.25 32 + 0.25 = 32.25 So, that leaves us with 32.25. Now, because of the way that the docrime.php is setup, the closer to 100 the formula equals, the easier the crime (anything above 100 is treated as success anyway). With that logic, and with a newbie (to your game), there's at least 32.25% chance of successfully completing that crime. I say "at least" because there's also a rand() in there too, adding to the chances of success The output from the crime failure is simple. It's a 50% chance of just a fail or jail time. --------- You can easily add to that str_replace() logic at the top, adding more things like 'TOTAL_STATS', 'STRENGTH', 'MONEY', etc. (and obviously add the replacements too) to be able to use more modifiers.
-
From what I can tell by reading the code CREATE TABLE `referrals` ( `refID` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `refREFER` INT(11) NOT NULL DEFAULT 0, `refREFED` INT(11) NOT NULL DEFAULT 0, `refBONUS` INT(11) NOT NULL DEFAULT 0 ); CREATE TABLE `referrals_reward` ( `refID` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `refLEVEL` INT(11) NOT NULL DEFAULT 0, `refBONUS` INT(11) NOT NULL DEFAULT 0, `refMONEY` INT(11) NOT NULL DEFAULT 0, `refCOINS` INT(11) NOT NULL DEFAULT 0 );
-
Put the to-be-serialized data into separate columns. Make the PHP do the rest ;)
-
That list is incomplete. But I believe I can run a pretty easy conversion - CSV -> SQL :)
-
Needs completing, haven't got around to it yet - been far too busy with IRL stuff