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 function resizeexecuteAction() { if (!$this->_prep()) { $params = array('error' => 'Cannot load game.'); return $this->_forward('index', 'index', NULL, $params); } elseif (!$this->view->player_group) { $params = array('error' => 'Cannot load group'); return $this->_forward('run', NULL, NULL, $params); } $form = new Ultimatum_Form_GroupResize($this->_getParam('player_group')); $new_values = $form->scale($this->_getAllParams()); $order = new Ultimatum_Model_Ultplayergrouporders(); $order->type = 'resize'; $order->player_group = $this->view->player_group->identity(); $order->save(); $resize = Ultimatum_Model_Ultplayergrouporderresizes::getInstance()->get(NULL, $new_values); $resize->order_id = $order->identity(); $resize->save(); $params = array('message' => 'Group resize order given'); $this->_forward('run', NULL, NULL, $params); }