public function respond() { $c = $this->get_controller(); if (!$c->_prep()) { $c->forward('index', 'index', NULL, array('error' => 'problem loading game')); } elseif (!$c->view->player_group) { $params = array('error' => 'Cannot load group'); $c->forward('run', NULL, NULL, $params); } $ord = new Ultimatum_Model_Ultplayergrouporders(); $ord->player_group = $c->view->player_group->identity(); $ord->type = 'attack'; if ($c->_getParam('repeat')) { $ord->repeat = 'iterate'; $ord->iterations = min(1, (int) $c->_getParam('repeat_count')); } $ord->target = $c->_getParam('target'); $ord->save(); $attack = new Ultimatum_Model_Ultplayergrouporderattacks(); $attack->order_id = $ord->identity(); $attack->reduceprop = $c->_getParam('reduceprop'); $attack->reduceprop_property = (int) $c->_getParam('reduceprop_property'); $attack->reduceprop_strength = (int) $c->_getParam('reduceprop_strength'); $attack->loss = $c->_getParam('loss'); // $attack->loss_count = $c->_getParam('loss_strength_count'); $attack->loss_strength = $c->_getParam('loss_strength'); $attack->loss_strength_count = $c->_getParam('loss_strength_count'); $attack->payoff = $c->_getParam('payoff'); $attack->payoff_count = $c->_getParam('payoff_count'); $attack->save(); $params = array('message' => 'Scheduled attack'); $c->forward('run', NULL, NULL, $params); }
public static function getInstance() { if ($pReload || is_null(self::$_Instance)) { // process self::$_Instance = new self(); } return self::$_Instance; }