Beispiel #1
0
 /**
  * Uninstall a game
  * @param $game_id
  * @param $gamename
  */
 public final function Uninstall($game_id, $gamename)
 {
     global $cache, $db;
     $this->game_id = $game_id;
     $this->gamename = $gamename;
     $db->sql_transaction('begin');
     $factions = new \bbdkp\controller\games\Faction();
     $factions->game_id = $this->game_id;
     $factions->Delete_all_factions();
     $races = new \bbdkp\controller\games\Races();
     $races->game_id = $this->game_id;
     $races->Delete_all_races();
     $classes = new \bbdkp\controller\games\Classes();
     $classes->game_id = $this->game_id;
     $classes->Delete_all_classes();
     $roles = new \bbdkp\controller\games\Roles();
     $roles->game_id = $this->game_id;
     $roles->Delete_all_roles();
     $sql = 'DELETE FROM ' . BBGAMES_TABLE . " WHERE game_id = '" . $this->game_id . "'";
     $db->sql_query($sql);
     $db->sql_transaction('commit');
     $cache->destroy('sql', BBGAMES_TABLE);
     $cache->destroy('sql', CLASS_TABLE);
     $cache->destroy('sql', BB_LANGUAGE);
     $cache->destroy('sql', RACE_TABLE);
     $cache->destroy('sql', DKPSYS_TABLE);
     $cache->destroy('sql', EVENTS_TABLE);
     $cache->destroy('sql', MEMBER_LIST_TABLE);
 }
Beispiel #2
0
 /**
  * lists game parameters
  *
  * @param \bbdkp\controller\games\game $editgame
  */
 private function showgame(\bbdkp\controller\games\game $editgame)
 {
     global $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $config, $template;
     //populate dropdown
     foreach ($this->gamelist as $key => $game) {
         $template->assign_block_vars('gamelistrow', array('VALUE' => $key, 'OPTION' => $game, 'SELECTED' => $editgame->game_id == $key ? ' selected="selected"' : ''));
     }
     // list the factions
     $listfactions = new \bbdkp\controller\games\Faction();
     $listfactions->game_id = $editgame->game_id;
     $fa = $listfactions->getfactions();
     $total_factions = 0;
     foreach ($fa as $faction_id => $faction) {
         $total_factions++;
         $template->assign_block_vars('faction_row', array('ID' => $faction['f_index'], 'FACTIONGAME' => $editgame->game_id, 'FACTIONID' => $faction['faction_id'], 'FACTIONNAME' => $faction['faction_name'], 'U_DELETE' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=editgames&action=deletefaction&id={$faction['f_index']}&" . URI_GAME . '=' . $editgame->game_id), 'U_EDIT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=editgames&action=editfaction&id={$faction['f_index']}&" . URI_GAME . '=' . $editgame->game_id)));
     }
     // list the races
     $sort_order = array(0 => array('game_id asc, race_id asc', 'game_id desc, race_id asc'), 1 => array('race_id', 'race_id desc'), 2 => array('race_name', 'race_name desc'), 3 => array('faction_name desc', 'faction_name, race_name desc'));
     $current_order = $this->switch_order($sort_order);
     $total_races = 0;
     $listraces = new \bbdkp\controller\games\Races();
     $listraces->game_id = $editgame->game_id;
     $ra = $listraces->listraces($current_order['sql']);
     foreach ($ra as $race_id => $race) {
         $total_races++;
         $template->assign_block_vars('race_row', array('GAME' => $race['game_name'], 'RACEID' => $race['race_id'], 'RACENAME' => $race['race_name'], 'FACTIONNAME' => $race['faction_name'], 'RACE_IMAGE_M' => strlen($race['image_male']) > 1 ? $phpbb_root_path . "images/bbdkp/race_images/" . $race['image_male'] . ".png" : '', 'RACE_IMAGE_F' => strlen($race['image_female']) > 1 ? $phpbb_root_path . "images/bbdkp/race_images/" . $race['image_female'] . ".png" : '', 'S_RACE_IMAGE_M_EXISTS' => strlen($race['image_male']) > 1 ? true : false, 'S_RACE_IMAGE_F_EXISTS' => strlen($race['image_female']) > 1 ? true : false, 'U_VIEW_RACE' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=addrace&r=" . $race['race_id'] . "&" . URI_GAME . "={$listraces->game_id}"), 'U_DELETE' => $this->u_action . "&racedelete=1&id={$race['race_id']}&" . URI_GAME . "={$listraces->game_id}", 'U_EDIT' => $this->u_action . "&raceedit=1&id={$race['race_id']}&" . URI_GAME . "={$listraces->game_id}"));
     }
     unset($listraces, $ra);
     // list the roles
     $sort_order = array(0 => array('game_id asc, role_id asc', 'game_id desc, role_id asc'), 1 => array('role_id', 'role_id desc'), 2 => array('rolename', 'rolename desc'));
     $current_order3 = $this->switch_order($sort_order);
     $listroles = new \bbdkp\controller\games\Roles();
     $listroles->game_id = $editgame->game_id;
     $total_roles = 0;
     $roles = $listroles->listroles($current_order3['sql']);
     foreach ($roles as $role_id => $role) {
         $total_roles++;
         $template->assign_block_vars('role_row', array('ROLE_ID' => $role['role_id'], 'ROLE_NAME' => $role['rolename'], 'ROLE_COLOR' => $role['role_color'], 'ROLE_ICON' => $role['role_icon'], 'S_ROLE_ICON_EXISTS' => strlen($role['role_icon']) > 0 ? true : false, 'U_ROLE_ICON' => strlen($role['role_icon']) > 0 ? $phpbb_root_path . "images/bbdkp/role_icons/" . $role['role_icon'] . ".png" : '', 'ROLE_CAT_ICON' => $role['role_cat_icon'], 'S_ROLE_CAT_ICON_EXISTS' => strlen($role['role_cat_icon']) > 0 ? true : false, 'U_ROLE_CAT_ICON' => strlen($role['role_cat_icon']) > 0 ? $phpbb_root_path . "images/bbdkp/role_icons/" . $role['role_cat_icon'] . ".png" : '', 'U_DELETE' => $this->u_action . '&action=deleterole&role_id=' . $role['role_id'] . '&' . URI_GAME . "=" . $editgame->game_id, 'U_EDIT' => $this->u_action . '&action=editrole&role_id=' . $role['role_id'] . '&' . URI_GAME . "=" . $editgame->game_id));
     }
     // list the classes
     $sort_order2 = array(0 => array('c.game_id asc, c.class_id asc', 'c.game_id desc, c.class_id asc'), 1 => array('class_id', 'class_id desc'), 2 => array('class_name', 'class_name desc'), 3 => array('class_armor_type', 'class_armor_type, class_id desc'), 4 => array('class_min_level', 'class_min_level, class_id desc'), 5 => array('class_max_level', 'class_max_level, class_id desc'));
     $current_order2 = $this->switch_order($sort_order2, "o1");
     $total_classes = 0;
     $listclasses = new \bbdkp\controller\games\Classes();
     $listclasses->game_id = $editgame->game_id;
     $cl = $listclasses->listclasses($current_order2['sql'], 1);
     foreach ($cl as $c_index => $class) {
         $total_classes++;
         $template->assign_block_vars('class_row', array('GAME' => $class['game_name'], 'C_INDEX' => $c_index, 'CLASSID' => $class['class_id'], 'CLASSNAME' => $class['class_name'], 'COLORCODE' => $class['colorcode'], 'CLASSARMOR' => isset($user->lang[$class['class_armor_type']]) ? $user->lang[$class['class_armor_type']] : ' ', 'CLASSMIN' => $class['class_min_level'], 'CLASSMAX' => $class['class_max_level'], 'CLASSHIDE' => $class['class_hide'], 'S_CLASS_IMAGE_EXISTS' => strlen($class['imagename']) > 1 ? true : false, 'CLASSIMAGE' => strlen($class['imagename']) > 1 ? $phpbb_root_path . "images/bbdkp/class_images/" . $class['imagename'] . ".png" : '', 'U_VIEW_CLASS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=addclass&r=" . $class['class_id'] . "&game_id={$listclasses->game_id}"), 'U_DELETE' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=editgames&classdelete=1&id={$class['class_id']}&game_id={$listclasses->game_id}"), 'U_EDIT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=editgames&classedit=1&id={$class['class_id']}&game_id={$listclasses->game_id}")));
     }
     unset($listclasses, $cl);
     $imgexists = file_exists($phpbb_root_path . 'images/bbdkp/gameworld/' . $editgame->game_id . '/' . $editgame->getImagename() . '.png');
     //set the other fields
     $template->assign_vars(array('F_ENABLEARMORY' => $editgame->getArmoryEnabled(), 'GAMEIMAGEEXPLAIN' => sprintf($user->lang['GAME_IMAGE_EXPLAIN'], $editgame->game_id), 'GAMEIMAGE' => $editgame->getImagename(), 'GAME_NAME' => $editgame->getName(), 'GAMEPATH' => $phpbb_root_path . 'images/bbdkp/gameworld/' . $editgame->game_id . '/' . $editgame->getImagename() . '.png', 'S_GAMEIMAGE_EXISTS' => strlen($editgame->getImagename()) > 0 && $imgexists ? true : false, 'EDITGAME' => sprintf($user->lang['ACP_EDITGAME'], $editgame->getName()), 'BOSSBASEURL' => $editgame->getBossbaseurl(), 'ZONEBASEURL' => $editgame->getZonebaseurl(), 'ISWOW' => $editgame->game_id == 'wow' ? 1 : 0, 'APIKEY' => $editgame->getApikey(), 'PRIVKEY' => $editgame->getPrivkey(), 'LOCALE' => $editgame->getApilocale(), 'GAME_ID' => $editgame->game_id, 'URI_GAME' => URI_GAME, 'O_RACEGAMEID' => $current_order['uri'][0], 'O_RACEID' => $current_order['uri'][1], 'O_RACENAME' => $current_order['uri'][2], 'O_FACTIONNAME' => $current_order['uri'][3], 'O_CLASSGAMEID' => $current_order2['uri'][0], 'O_CLASSID' => $current_order2['uri'][1], 'O_CLASSNAME' => $current_order2['uri'][2], 'O_CLASSARMOR' => $current_order2['uri'][3], 'O_CLASSMIN' => $current_order2['uri'][4], 'O_CLASSMAX' => $current_order2['uri'][5], 'U_ADD_GAMES' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=editgames&"), 'LISTFACTION_FOOTCOUNT' => sprintf($user->lang['LISTFACTION_FOOTCOUNT'], $total_factions), 'LISTRACE_FOOTCOUNT' => sprintf($user->lang['LISTRACE_FOOTCOUNT'], $total_races), 'LISTCLASS_FOOTCOUNT' => sprintf($user->lang['LISTCLASS_FOOTCOUNT'], $total_classes), 'LISTROLES_FOOTCOUNT' => sprintf($user->lang['LISTROLES_FOOTCOUNT'], $total_roles), 'U_ACTION' => $this->u_action));
 }