Last active
December 29, 2015 11:09
-
-
Save peterdemartini/7662266 to your computer and use it in GitHub Desktop.
Video game script, I think it's hilarious. Funny, Coding Humor. Great for testing SugarCRM or calling save() on all Contact
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Define Entry Point | |
if(!defined('sugarEntry'))define('sugarEntry', true); | |
chdir(realpath(dirname(__FILE__))); | |
require_once('include/entryPoint.php'); | |
class PowerMove { | |
private $db; | |
private $hitpoints; //AKA contacts | |
private $wave = 0; // AKA Page | |
private $max_xp = 9001; // It is Over 9000!!! | |
public function __construct(){ | |
global $db; | |
$this->db = $db; | |
} | |
public function charge_up(){ | |
echo "Charging Up, WAVE {$this->wave} \n"; | |
$offset = $this->wave * $this->max_xp; | |
$res = $this->db->query(" | |
SELECT | |
contacts.id | |
FROM contacts | |
LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c | |
WHERE | |
contacts.deleted = 0 | |
LIMIT {$offset}, {$this->max_xp} | |
"); | |
$c = $this->db->getRowCount($res); | |
echo "Powering up for a move worth {$c} XP. \n"; | |
if($c == 0) return false; | |
$this->wave++; // Up 1 | |
while($row = $this->db->fetchByAssoc($res)) | |
$this->mega_thunderstrike($row['id']); | |
echo ">>>>CAPOOWWWW!!!!! \n"; | |
return true; | |
} | |
private function mega_thunderstrike($id){ | |
echo ":"; | |
$HitPoint = BeanFactory::getBean('Contacts', $id); | |
$HitPoint->save(); | |
return true; | |
} | |
} | |
echo "Round 1 Begins! \n"; | |
$PowerMove = new PowerMove(); | |
while($PowerMove->charge_up()){ | |
echo "Critical Hit!!! \n"; | |
} | |
die("K/O!!! Dominated! \n"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment