setReadOnly(); $userID = Session::getUserID(); $db = DB::db(); $connect=$db->get(); increaseRefresh("부대편성", 1); $me = $db->queryFirstRow('SELECT no,nation,troop FROM general WHERE owner=%i', $userID); $troops = []; foreach($db->query('SELECT troop,name,no FROM troop WHERE nation = %i', $me['nation']) as $rawTroop){ $troops[$rawTroop['troop']] = [ 'troop'=>$rawTroop['troop'], 'name'=>$rawTroop['name'], 'no'=>$rawTroop['no'], 'users'=>[] ]; } foreach($db->query( 'SELECT no,name,turntime,troop,city FROM general WHERE troop!=0 AND nation = %i ORDER BY turntime ASC', $me['nation'] ) as $general ){ if(!key_exists($general['troop'], $troops)){ trigger_error("올바르지 않은 부대 소속 {$general['no']}, {$general['name']} : {$general['troop']}"); continue; } $general['cityText'] = CityConst::byID($general['city'])->name; $troops[$general['troop']]['users'][] = $general; } if($troops){ foreach($db->query( 'SELECT no,name,picture,imgsvr,turntime,city,turn0,turn1,turn2,turn3,turn4,turn5,troop FROM general WHERE no IN %li', array_column($troops, 'no') ) as $troopLeader ){ $imageTemp = GetImageURL($troopLeader['imgsvr']); $troopLeader['pictureFullPath'] = "$imageTemp/{$troopLeader['picture']}"; $troopLeader['cityText'] = CityConst::byID($troopLeader['city'])->name; $troopLeader['turnText'] = join('
', [ '1 : '.((DecodeCommand($troopLeader['turn0'])[0] == 26)?'집합':'~'), '2 : '.((DecodeCommand($troopLeader['turn1'])[0] == 26)?'집합':'~'), '3 : '.((DecodeCommand($troopLeader['turn2'])[0] == 26)?'집합':'~'), '4 : '.((DecodeCommand($troopLeader['turn3'])[0] == 26)?'집합':'~'), '5 : '.((DecodeCommand($troopLeader['turn4'])[0] == 26)?'집합':'~'), ]); $troops[$troopLeader['troop']]['leader'] = $troopLeader; } } uasort($troops, function($lhs, $rhs){ return $lhs['leader']['turntime']<=>$rhs['leader']['turntime']; }) ?> <?=UniqueConst::$serverName?>: 부대편성
부 대 편 성
$troop) { $troopLeader = $troop['leader']; $genlistText = []; $cityText = $troopLeader['cityText']; $cityID = $troopLeader['city']; $leaderID = $troopLeader['no']; foreach ($troop['users'] as $troopUser) { $spanClass = 'troopUser'; if ($troopUser['city'] !== $cityID) { $spanClass.= ' diffCity'; } if ($troopUser['no'] == $leaderID) { $spanClass.= ' leader'; } $genlistText[] = "{$troopUser['name']}【{$troopUser['cityText']}】"; } $genlistText = sprintf('%s (%d명)', join(', ', $genlistText), count($genlistText)); ?> $troop) { ?>
선 택 부 대 정 보 부 대 장 장 수 부대장행동
'>
");background-size:64px;'> 
【턴】
 
");background-size:64px;'> 
【턴】

부 대 명