https://next-level-arcade.com


Results 1 to 2 of 2
  1. #1
    Administrator stangger5's Avatar

    Join Date
    Nov 2005
    Posts
    1,634
    Thanks
    666
    Thanked 621 Times in 321 Posts

    Gamebit Username HTML Markup

    html username color for Gamebit on Main arcade page.
    v3Arcade Mod Version: 2.0.3A..

    Need to edit arcade.php

    Fine: // ##### Let the games begin!
    Replace just the // ##### Let the games begin code with this:

    Code:
    	// ##### Let the games begin!
    	$gamebits = '';
    	$categorygamecnt = '0';
    
    	// No category id, so show a random selection of games.
    	if (!$vbulletin->GPC['categoryid'])
    	{
    		$games = $db->query_read("
    			SELECT arcade_games.*, user.username, user.usergroupid , arcade_categories.catname
    			FROM " . TABLE_PREFIX . "v3arcade_games AS arcade_games
    			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid = user.userid)
    			LEFT JOIN " . TABLE_PREFIX . "v3arcade_categories AS arcade_categories ON (arcade_games.categoryid = arcade_categories.categoryid)
    			" . iif($bitfieldcheck, "WHERE $bitfieldcheck") . "
    			ORDER BY RAND()
    			LIMIT " . $vbulletin->options['gamesperpage']
    		);
              $categorygamecnt = $db->num_rows($games);
    	}
    	// Favorites
    	else if ($vbulletin->GPC['categoryid'] == 2)
    	{
    		$gamecount = sizeof($favcache);
    
    		if ($gamecount)
    		{
    			// set defaults
    			sanitize_pageresults($gamecount, $pagenumber, $perpage, 100, $vbulletin->options['gamesperpage']);
    
    			$start = (int)($perpage * $pagenumber) - $perpage;
    
    			$games = $db->query_read("
    				SELECT arcade_games.*, user.username, user.usergroupid , arcade_categories.catname
    				FROM " . TABLE_PREFIX . "v3arcade_games AS arcade_games
    				LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid = user.userid)
    				LEFT JOIN " . TABLE_PREFIX . "v3arcade_categories AS arcade_categories ON (arcade_games.categoryid = arcade_categories.categoryid)
    				WHERE arcade_games.gameid IN (" . implode(',', $favcache) . ")
    					" . iif($bitfieldcheck, 'AND ' . $bitfieldcheck) . "
    				LIMIT $start, " . $vbulletin->options['gamesperpage']
    			);
    			$categorygamecnt = $db->num_rows($games);
    		}
    	}
    	// Get games only from the specified category id.
    	else
    	{
    		$querywhere = '';
              $queryorder = 'title ASC';
    
    		// Newest Games
              if ($vbulletin->GPC['categoryid'] == -2)
              {
                   $queryorder = 'arcade_games.gameid DESC';
                   $categoryname = $vbphrase['new'];
              }
    
    		//if ($vbulletin->GPC['categoryid'] != -1)
    		if ($vbulletin->GPC['categoryid'] >= 0)
    		{
    			$querywhere = 'arcade_games.categoryid = ' . $vbulletin->GPC['categoryid'];
    		}
    
    		if ($bitfieldcheck)
    		{
    			$querywhere = ($querywhere ? $querywhere . ' AND ' : '') . $bitfieldcheck;
    		}
    
    		if ($querywhere)
    		{
    			$querywhere = 'WHERE ' . $querywhere;
    		}
    
    		if ($queryorder)
    		{
    			$queryorder = 'ORDER BY ' . $queryorder;
    		}
    
    		// First of all, get a total game count.
    		$countquery = $db->query_first("
    			SELECT COUNT(*) AS gamecount
    			FROM " . TABLE_PREFIX . "v3arcade_games AS arcade_games
    			$querywhere
    		");
    		$gamecount = $countquery['gamecount'];
              $categorygamecnt = $countquery['gamecount'];
    
    		// set defaults
    		sanitize_pageresults($gamecount, $pagenumber, $perpage, 100, $vbulletin->options['gamesperpage']);
    
    		$start = (int)($perpage*$pagenumber)-$perpage;
    
    		$games = $db->query_read("
    			SELECT arcade_games.*, user.username, user.usergroupid , arcade_categories.catname
    			FROM " . TABLE_PREFIX . "v3arcade_games AS arcade_games
    			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (arcade_games.highscorerid = user.userid)
    			LEFT JOIN " . TABLE_PREFIX . "v3arcade_categories AS arcade_categories ON (arcade_games.categoryid = arcade_categories.categoryid)
    			$querywhere
                   $queryorder
    			LIMIT $start, " . $vbulletin->options['gamesperpage']
    		);
    	}
    
    	if ($db->num_rows($games))
    	{
    		// Page navigation
    		if ($vbulletin->GPC['categoryid'])
    		{
    			$pagenav = construct_page_nav(
    				$pagenumber,
    				$perpage,
    				$gamecount,
    				'arcade.php?' . $vbulletin->session->vars['sessionurl'],
    				($vbulletin->GPC['categoryid'] ? '&categoryid=' . $vbulletin->GPC['categoryid'] : '')
    				. ($vbulletin->GPC['perpage'] ? '&pp=' . $perpage : '')
    			);
    		}
    
    		// Game cache contains all the data we need to populate the game row - image links, titles, descriptions, etc.
    		$gamecache = array();
    
    		while ($game = $db->fetch_array($games))
    		{
    			/* Now, because we need to use this data to let us know which games to get score data for,
    			we're caching it here rather than spitting out the game rows. */
    			$gamecache[$game['gameid']] = $game;
    		}
    
    		// Only bother with high scores if the user is actually logged in.
    		if ($vbulletin->userinfo['userid'])
    		{
    			$scoredata = $db->query_read("
    				SELECT MAX(score) AS personalbest, MIN(score) AS personalbestr, gameid
    				FROM " . TABLE_PREFIX . "v3arcade_sessions
    				WHERE gameid IN (" . implode(',', array_keys($gamecache)) . ")
    					AND userid = " . $vbulletin->userinfo['userid'] . "
    				GROUP BY gameid
    			");
    			while ($score = $db->fetch_array($scoredata))
    			{
    				// Add this data to the $gamecache array
    				$gamecache[$score['gameid']]['personalbest'] = ($gamecache[$score['gameid']]['isreverse'] ? $score['personalbestr'] : $score['personalbest']);
    			}
    		}
    
    		$gamebit_tempname = ($barsize) ? 'v3arcade_game_bit_slim' : 'v3arcade_game_bit';
    
    		// Now we can use $gamecache to populate our game section.
    		foreach ($gamecache as $key => $game)
    		{
    			exec_switch_bg();
    
    			$show['rating'] = false;
    			if ($game['votecount'])
    			{
    				$game['rating_acc'] = round(($game['votepoints'] / $game['votecount']), 2);
    				$game['rating'] = ceil($game['rating_acc']);
    				$show['rating'] = true;
    			}
    
    			$show['fav'] = $favcache[$game['gameid']];
    
    			$game['awardimg'] = arcade_award_img($game);
    
    			($hook = vBulletinHook::fetch_hook('arcade_game_bit')) ? eval($hook) : false;
    
    			// set these below the hook incase anyone needs to do raw score comparing
    			$game['highscore'] = v3_score_format($game['highscore']);
    			$game['personalbest'] = vb_number_format($game['personalbest']);
    
                            $game['username'] = fetch_musername($game);
    
    			$templater = vB_Template::create($gamebit_tempname);
    			$templater->register('game', $game);
    			$gamebits .= $templater->render();
    		}
    	}
    Attached Images Attached Images

  2. The Following 3 Users Say Thank You to stangger5 For This Useful Post:

    junkyman (01-24-2021), lagrace (01-24-2021), Sectional (01-29-2021)

  3. #2
    Game Downloader lagrace's Avatar

    Join Date
    Jan 2018
    Posts
    12
    Thanks
    17
    Thanked 3 Times in 3 Posts
    hello and thank you for sharing

  4. The Following User Says Thank You to lagrace For This Useful Post:

    stangger5  (01-24-2021)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Link Exchange - Affiliates/Friends