Ejemplo n.º 1
0
 function char_html($character_data)
 {
     // Fetch character data
     $lookup = roster_db::lookup($character_data['character'], $character_data['server']);
     // echo var_dump($data);
     if ($lookup->count === 1) {
         $data = $lookup->lookupData;
         $data['Data'] = json_decode($data['Data'], true);
         $data['RankingData'] = json_decode($data['RankingData'], true);
         $data['IMG'] = '//us.battle.net/static-render/us/' . $data['IMG'];
         // Admin check
         if ($this->user['SiteRank'] >= 4) {
             $data['Admin'] = true;
         } else {
             $data['Admin'] = false;
         }
         // Login check
         if ($this->user['SiteRank'] >= 0) {
             $data['LoggedIn'] = true;
         } else {
             $data['LoggedIn'] = false;
         }
         $charClasses = array("Warrior" => 1, "Paladin" => 2, "Hunter" => 3, "Rogue" => 4, "Priest" => 5, "Death Knight" => 6, "Shaman" => 7, "Mage" => 8, "Warlock" => 9, "Monk" => 10, "Druid" => 11);
         // Stats
         $data['Class'] = array_search($data['Class'], $charClasses, true);
         //Find the proper class for the id
         $data['Data']['stats']['crit'] = round(@$data['Data']['stats']['crit'], 2);
         $data['Data']['stats']['mastery'] = round(@$data['Data']['stats']['mastery'], 2);
         $data['Data']['stats']['multistrike'] = round(@$data['Data']['stats']['multistrike'], 2);
         // Talents
         if (@$data['Data']['talents'][0]['selected'] == true) {
             $data['Data']['talents']['main'] = @$data['Data']['talents'][0]['spec']['name'];
             $data['Data']['talents']['off'] = @$data['Data']['talents'][1]['spec']['name'];
         } elseif (@$data['Data']['talents'][1]['selected'] == true) {
             $data['Data']['talents']['main'] = @$data['Data']['talents'][1]['spec']['name'];
             $data['Data']['talents']['off'] = @$data['Data']['talents'][0]['spec']['name'];
         }
         // Ilv>Gear
         if ($data['Lvl'] >= max_lvl - 10) {
             //Calculate gear quality percent for display
             $ilvForCalc = max_ilv;
             $data['Data']['items']['head']['BarWidth'] = round(@$data['Data']['items']['head']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['neck']['BarWidth'] = round(@$data['Data']['items']['neck']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['shoulder']['BarWidth'] = round(@$data['Data']['items']['shoulder']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['back']['BarWidth'] = round(@$data['Data']['items']['back']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['chest']['BarWidth'] = round(@$data['Data']['items']['chest']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['wrist']['BarWidth'] = round(@$data['Data']['items']['wrist']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['hands']['BarWidth'] = round(@$data['Data']['items']['hands']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['waist']['BarWidth'] = round(@$data['Data']['items']['waist']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['legs']['BarWidth'] = round(@$data['Data']['items']['legs']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['feet']['BarWidth'] = round(@$data['Data']['items']['feet']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['finger1']['BarWidth'] = round(@$data['Data']['items']['finger1']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['finger2']['BarWidth'] = round(@$data['Data']['items']['finger2']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['trinket1']['BarWidth'] = round(@$data['Data']['items']['trinket1']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['trinket2']['BarWidth'] = round(@$data['Data']['items']['trinket2']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['mainHand']['BarWidth'] = round(@$data['Data']['items']['mainHand']['itemLevel'] / $ilvForCalc * 100, 0);
             $data['Data']['items']['offHand']['BarWidth'] = round(@$data['Data']['items']['offHand']['itemLevel'] / $ilvForCalc * 100, 0);
         } else {
             $data['Data']['items']['head']['BarWidth'] = 100;
             $data['Data']['items']['neck']['BarWidth'] = 100;
             $data['Data']['items']['shoulder']['BarWidth'] = 100;
             $data['Data']['items']['back']['BarWidth'] = 100;
             $data['Data']['items']['chest']['BarWidth'] = 100;
             $data['Data']['items']['wrist']['BarWidth'] = 100;
             $data['Data']['items']['hands']['BarWidth'] = 100;
             $data['Data']['items']['waist']['BarWidth'] = 100;
             $data['Data']['items']['legs']['BarWidth'] = 100;
             $data['Data']['items']['feet']['BarWidth'] = 100;
             $data['Data']['items']['finger1']['BarWidth'] = 100;
             $data['Data']['items']['finger2']['BarWidth'] = 100;
             $data['Data']['items']['trinket1']['BarWidth'] = 100;
             $data['Data']['items']['trinket2']['BarWidth'] = 100;
             $data['Data']['items']['mainHand']['BarWidth'] = 100;
             $data['Data']['items']['offHand']['BarWidth'] = 100;
         }
         // Off Hand
         if (@$data['Data']['items']['offHand']['id'] != null) {
             $data['Data']['items']['offHandStatus'] = true;
         } else {
             $data['Data']['items']['offHandStatus'] = false;
         }
         // Rankings
         $data['CharacterRankings'] = array();
         // Fetch Req Warcraft Logs Encounter data stored in DB
         $fetchWCLencounters = roster_db::fetch_WCL_encounters(guild_name);
         $instances = json_decode($fetchWCLencounters['wcLogsZones'], true);
         foreach ($instances as $instance) {
             foreach ($instance['encounters'] as $fight) {
                 $encounter[$fight['id']] = $fight['name'];
             }
         }
         // Difficulties
         $difficulties = array(2 => '[LFR]', 3 => '[N]', 4 => '[H]', 5 => '[M]');
         if ($data['RankingData'] != null) {
             try {
                 foreach ($data['RankingData'] as $charRankData) {
                     // Calculate the ranking percentage
                     $data['CharacterRankings'][] = array('reportID' => $charRankData['reportID'], 'fightID' => $charRankData['fightID'], 'name' => $encounter[$charRankData['encounter']], 'difficulty' => $difficulties[$charRankData['difficulty']], 'rankPerc' => 94 - round(@$charRankData['rank'] / $charRankData['outOf'] * 100, 0), 'rank' => $charRankData['rank'], 'outOf' => $charRankData['outOf']);
                 }
             } catch (Exception $e) {
                 // Error in Rank data
             }
         }
         // Raids
         $raids = array("RaidName" => "Name");
         foreach ($data['Data']['progression']['raids'] as $charRaidData) {
             //Take all the raids for the character and put them into an array with each raid boss below that
             $raids[$charRaidData['name']] = $charRaidData['bosses'];
         }
         if (@is_array($raids["Highmaul"])) {
             //Stop warning/notice
             foreach ($raids["Highmaul"] as $HMBosses) {
                 //For each in HM sub array, take and print a line with each sub array boss and details.
                 // echo var_dump($raids);
                 //Determine color for block
                 if (@$HMBosses['normalKills'] >= 1) {
                     $normalKillstatus = 'raidBossKGreen';
                 } else {
                     $normalKillstatus = 'raidBossKRed';
                 }
                 if (@$HMBosses['heroicKills'] >= 1) {
                     $heroicKillStatus = 'raidBossKGreen';
                 } else {
                     $heroicKillStatus = 'raidBossKRed';
                 }
                 if (@$HMBosses['mythicKills'] >= 1) {
                     $mythicKillStatus = 'raidBossKGreen';
                 } else {
                     $mythicKillStatus = 'raidBossKRed';
                 }
                 //Boss kill times
                 $NbossTime = date('h:ma | M d Y', substr(@$HMBosses['normalTimestamp'], 0, 10));
                 $HbossTime = date('h:ma | M d Y', substr(@$HMBosses['heroicTimestamp'], 0, 10));
                 $MbossTime = date('h:ma | M d Y', substr(@$HMBosses['mythicTimestamp'], 0, 10));
                 //Check boss time
                 if (@$HMBosses['normalTimestamp'] < '1072915260') {
                     $NbossTime = '0';
                 }
                 if (@$HMBosses['heroicTimestamp'] < '1072915260') {
                     $HbossTime = '0';
                 }
                 if (@$HMBosses['mythicTimestamp'] < '1072915260') {
                     $MbossTime = '0';
                 }
                 $data['CharacterProgress']['Highmaul'][] = array('Boss' => $HMBosses['name'], 'NormalKillstatus' => $normalKillstatus, 'HeroicKillStatus' => $heroicKillStatus, 'MythicKillStatus' => $mythicKillStatus, 'NbossTime' => $NbossTime, 'HbossTime' => $HbossTime, 'MbossTime' => $MbossTime, 'normalKills' => $HMBosses['normalKills'], 'heroicKills' => $HMBosses['heroicKills'], 'mythicKills' => $HMBosses['mythicKills']);
             }
         }
         if (@is_array($raids["Blackrock Foundry"])) {
             //Stop warning/notice
             foreach ($raids["Blackrock Foundry"] as $BLFBosses) {
                 //For each in HM sub array, take and print a line with each sub array boss and details.
                 //Determine color for block
                 if (@$BLFBosses['normalKills'] >= 1) {
                     $normalKillstatus = 'raidBossKGreen';
                 } else {
                     $normalKillstatus = 'raidBossKRed';
                 }
                 if (@$BLFBosses['heroicKills'] >= 1) {
                     $heroicKillStatus = 'raidBossKGreen';
                 } else {
                     $heroicKillStatus = 'raidBossKRed';
                 }
                 if (@$BLFBosses['mythicKills'] >= 1) {
                     $mythicKillStatus = 'raidBossKGreen';
                 } else {
                     $mythicKillStatus = 'raidBossKRed';
                 }
                 //Boss kill times
                 $NbossTime = date('h:ma | M d Y', substr(@$BLFBosses['normalTimestamp'], 0, 10));
                 $HbossTime = date('h:ma | M d Y', substr(@$BLFBosses['heroicTimestamp'], 0, 10));
                 $MbossTime = date('h:ma | M d Y', substr(@$BLFBosses['mythicTimestamp'], 0, 10));
                 //Check boss time
                 if (@$BLFBosses['normalTimestamp'] < '1072915260') {
                     $NbossTime = '0';
                 }
                 if (@$BLFBosses['heroicTimestamp'] < '1072915260') {
                     $HbossTime = '0';
                 }
                 if (@$BLFBosses['mythicTimestamp'] < '1072915260') {
                     $MbossTime = '0';
                 }
                 $data['CharacterProgress']['Blackrock'][] = array('Boss' => $BLFBosses['name'], 'NormalKillstatus' => $normalKillstatus, 'HeroicKillStatus' => $heroicKillStatus, 'MythicKillStatus' => $mythicKillStatus, 'NbossTime' => $NbossTime, 'HbossTime' => $HbossTime, 'MbossTime' => $MbossTime, 'normalKills' => $BLFBosses['normalKills'], 'heroicKills' => $BLFBosses['heroicKills'], 'mythicKills' => $BLFBosses['mythicKills']);
             }
         }
         build::page($data, 'roster/character');
     } else {
         build::page(null, 'roster/fetching');
         $this->fetch_new($character_data);
     }
 }
Ejemplo n.º 2
0
function claimCharacter()
{
    global $usrInfo;
    $char = $_GET['Char'];
    $serv = $_GET['Server'];
    $dbLookup = roster_db::lookup($char, $serv);
    // Result
    $claim = roster_db::claim($char, $serv, $usrInfo['Username'], json_decode($dbLookup->lookupData['Data'], true));
    if ($claim == true) {
        echo '
		<div id="claimCharCompleteWindow" class="wbox" data-height="110px" data-width="320px" data-max-width="100%">
			<div class="wbox-title">Character Claim</div>
			<div class="wbox-content">
				Character Claimed!
			</div>
			<div class="WBoxBtns">
				<input type="button" class="WBox-btn btn-blue aniObj" value="Cool!" onclick="wbox.close();">
			</div>
		</div>
		<script>
			wbox.show(\'claimCharCompleteWindow\');
		</script>';
    } else {
        echo '
		<div id="claimCharStepsWindow" class="wbox" data-height="110px" data-width="320px" data-max-width="100%">
			<div class="wbox-title">Steps to claim character</div>
			<div class="wbox-content">
				To claim this character you must unequip the following: Helm, Shoulders, & Main Hand.  After that, reload your character and click Claim again!
			</div>
			<div class="WBoxBtns">
				<input type="button" class="WBox-btn btn-blue aniObj" value="Got it!" onclick="wbox.close();">
			</div>
		</div>
		<script>
			wbox.show(\'claimCharStepsWindow\');
		</script>';
    }
    checkUserDat();
}