generate(strval($avatarId), $sansEnv, $ver); } public function getFinal($part, $partV, $theme, $themes, $sP) { $colors = $themes[$partV][$theme][$part]; $svgString = $sP[$partV][$part]; if (preg_match_all('/#(.*?)+(?=;)/', $svgString, $result)) { $i = 0; foreach ($result[0] as $var) { $pos = strpos($svgString, $var); if ($pos !== false) { $svgString = substr_replace($svgString, $colors[$i], $pos, strlen($var)); } $i++; } } $resultFinal = $svgString; return $resultFinal; } public function generate($avatarId, $sansEnv, $ver) { $themes = []; // Robo $themes['00']['A']['env'] = ['#ff2f2b']; $themes['00']['A']['clo'] = ['#fff', '#000']; $themes['00']['A']['head'] = ['#fff']; $themes['00']['A']['mouth'] = ['#fff', '#000', '#000']; $themes['00']['A']['eyes'] = ['#000', 'none', '#00FFFF']; $themes['00']['A']['top'] = ['#fff', '#fff']; $themes['00']['B']['env'] = ['#ff1ec1']; $themes['00']['B']['clo'] = ['#000', '#fff']; $themes['00']['B']['head'] = ['#ffc1c1']; $themes['00']['B']['mouth'] = ['#fff', '#000', '#000']; $themes['00']['B']['eyes'] = ['#FF2D00', '#fff', 'none']; $themes['00']['B']['top'] = ['#a21d00', '#fff']; $themes['00']['C']['env'] = ['#0079b1']; $themes['00']['C']['clo'] = ['#0e00b1', '#d1fffe']; $themes['00']['C']['head'] = ['#f5aa77']; $themes['00']['C']['mouth'] = ['#fff', '#000', '#000']; $themes['00']['C']['eyes'] = ['#0c00de', '#fff', 'none']; $themes['00']['C']['top'] = ['#acfffd', '#acfffd']; // Girl $themes['01']['A']['env'] = ['#a50000']; $themes['01']['A']['clo'] = ['#f06', '#8e0039']; $themes['01']['A']['head'] = ['#85492C']; $themes['01']['A']['mouth'] = ['#000']; $themes['01']['A']['eyes'] = ['#000', '#ff9809']; $themes['01']['A']['top'] = ['#ff9809', '#ff9809', 'none', 'none']; $themes['01']['B']['env'] = ['#40E83B']; $themes['01']['B']['clo'] = ['#00650b', '#62ce5a']; $themes['01']['B']['head'] = ['#f7c1a6']; $themes['01']['B']['mouth'] = ['#6e1c1c']; $themes['01']['B']['eyes'] = ['#000', '#ff833b']; $themes['01']['B']['top'] = ['#67FFCC', 'none', 'none', '#ecff3b']; $themes['01']['C']['env'] = ['#ff2c2c']; $themes['01']['C']['clo'] = ['#fff', '#000']; $themes['01']['C']['head'] = ['#ffce8b']; $themes['01']['C']['mouth'] = ['#000']; $themes['01']['C']['eyes'] = ['#000', '#0072ff']; $themes['01']['C']['top'] = ['#ff9809', 'none', '#ffc809', 'none']; // Blonde $themes['02']['A']['env'] = ['#ff7520']; $themes['02']['A']['clo'] = ['#d12823']; $themes['02']['A']['head'] = ['#fee3c5']; $themes['02']['A']['mouth'] = ['#d12823']; $themes['02']['A']['eyes'] = ['#000', 'none']; $themes['02']['A']['top'] = ['#000', 'none', 'none', '#FFCC00', 'red']; $themes['02']['B']['env'] = ['#ff9700']; $themes['02']['B']['clo'] = ['#000']; $themes['02']['B']['head'] = ['#d2ad6d']; $themes['02']['B']['mouth'] = ['#000']; $themes['02']['B']['eyes'] = ['#000', '#00ffdc']; $themes['02']['B']['top'] = ['#fdff00', '#fdff00', 'none', 'none', 'none']; $themes['02']['C']['env'] = ['#26a7ff']; $themes['02']['C']['clo'] = ['#d85cd7']; $themes['02']['C']['head'] = ['#542e02']; $themes['02']['C']['mouth'] = ['#f70014']; $themes['02']['C']['eyes'] = ['#000', 'magenta']; $themes['02']['C']['top'] = ['#FFCC00', '#FFCC00', '#FFCC00', '#ff0000', 'yellow']; // Evilnormie $themes['03']['A']['env'] = ['#6FC30E']; $themes['03']['A']['clo'] = ['#b4e1fa', '#5b5d6e', '#515262', '#a0d2f0', '#a0d2f0']; $themes['03']['A']['head'] = ['#fae3b9']; $themes['03']['A']['mouth'] = ['#fff', '#000']; $themes['03']['A']['eyes'] = ['#000']; $themes['03']['A']['top'] = ['#8eff45', '#8eff45', 'none', 'none']; $themes['03']['B']['env'] = ['#00a58c']; $themes['03']['B']['clo'] = ['#000', 'none', 'none', 'none', 'none']; $themes['03']['B']['head'] = ['#FAD2B9']; $themes['03']['B']['mouth'] = ['#fff', '#000']; $themes['03']['B']['eyes'] = ['#000']; $themes['03']['B']['top'] = ['#FFC600', 'none', '#FFC600', 'none']; $themes['03']['C']['env'] = ['#ff501f']; $themes['03']['C']['clo'] = ['#000', '#ff0000', '#ff0000', '#7d7d7d', '#7d7d7d']; $themes['03']['C']['head'] = ['#fff3dc']; $themes['03']['C']['mouth'] = ['#d2001b', 'none']; $themes['03']['C']['eyes'] = ['#000']; $themes['03']['C']['top'] = ['#D2001B', 'none', 'none', '#D2001B']; // Country $themes['04']['A']['env'] = ['#fc0']; $themes['04']['A']['clo'] = ['#901e0e', '#ffbe1e', '#ffbe1e', '#c55f54']; $themes['04']['A']['head'] = ['#f8d9ad']; $themes['04']['A']['mouth'] = ['#000', 'none', '#000', 'none']; $themes['04']['A']['eyes'] = ['#000']; $themes['04']['A']['top'] = ['#583D00', '#AF892E', '#462D00', '#a0a0a0']; $themes['04']['B']['env'] = ['#386465']; $themes['04']['B']['clo'] = ['#fff', '#333', '#333', '#333']; $themes['04']['B']['head'] = ['#FFD79D']; $themes['04']['B']['mouth'] = ['#000', '#000', '#000', '#000']; $themes['04']['B']['eyes'] = ['#000']; $themes['04']['B']['top'] = ['#27363C', '#5DCAD4', '#314652', '#333']; $themes['04']['C']['env'] = ['#DFFF00']; $themes['04']['C']['clo'] = ['#304267', '#aab0b1', '#aab0b1', '#aab0b1']; $themes['04']['C']['head'] = ['#e6b876']; $themes['04']['C']['mouth'] = ['#50230a', '#50230a', '#50230a', '#50230a']; $themes['04']['C']['eyes'] = ['#000']; $themes['04']['C']['top'] = ['#333', '#afafaf', '#222', '#6d3a1d']; // Johnyold $themes['05']['A']['env'] = ['#a09300']; $themes['05']['A']['clo'] = ['#c7d4e2', '#435363', '#435363', '#141720', '#141720', '#e7ecf2', '#e7ecf2']; $themes['05']['A']['head'] = ['#f5d4a6']; $themes['05']['A']['mouth'] = ['#000', '#cf9f76']; $themes['05']['A']['eyes'] = ['#000', '#000', '#000', '#000', '#000', '#000', '#fff', '#fff', '#fff', '#fff', '#000', '#000']; $themes['05']['A']['top'] = ['none', '#fdff00']; $themes['05']['B']['env'] = ['#b3003e']; $themes['05']['B']['clo'] = ['#000', '#435363', '#435363', '#000', 'none', '#e7ecf2', '#e7ecf2']; $themes['05']['B']['head'] = ['#f5d4a6']; $themes['05']['B']['mouth'] = ['#000', '#af9f94']; $themes['05']['B']['eyes'] = ['#9ff3ff;opacity:0.96', '#000', '#9ff3ff;opacity:0.96', '#000', '#2f508a', '#000', '#000', '#000', 'none', 'none', 'none', 'none']; $themes['05']['B']['top'] = ['#ff9a00', '#ff9a00']; $themes['05']['C']['env'] = ['#884f00']; $themes['05']['C']['clo'] = ['#ff0000', '#fff', '#fff', '#141720', '#141720', '#e7ecf2', '#e7ecf2']; $themes['05']['C']['head'] = ['#c57b14']; $themes['05']['C']['mouth'] = ['#000', '#cf9f76']; $themes['05']['C']['eyes'] = ['none', '#000', 'none', '#000', '#5a0000', '#000', '#000', '#000', 'none', 'none', 'none', 'none']; $themes['05']['C']['top'] = ['#efefef', 'none']; // Asian $themes['06']['A']['env'] = ['#8acf00']; $themes['06']['A']['clo'] = ['#ee2829', '#ff0']; $themes['06']['A']['head'] = ['#ffce73']; $themes['06']['A']['mouth'] = ['#fff', '#000']; $themes['06']['A']['eyes'] = ['#000']; $themes['06']['A']['top'] = ['#000', '#000', 'none', '#000', '#ff4e4e', '#000']; $themes['06']['B']['env'] = ['#00d2a3']; $themes['06']['B']['clo'] = ['#0D0046', '#ffce73']; $themes['06']['B']['head'] = ['#ffce73']; $themes['06']['B']['mouth'] = ['#000', 'none']; $themes['06']['B']['eyes'] = ['#000']; $themes['06']['B']['top'] = ['#000', '#000', '#000', 'none', '#ffb358', '#000', 'none', 'none']; $themes['06']['C']['env'] = ['#ff184e']; $themes['06']['C']['clo'] = ['#000', 'none']; $themes['06']['C']['head'] = ['#ffce73']; $themes['06']['C']['mouth'] = ['#ff0000', 'none']; $themes['06']['C']['eyes'] = ['#000']; $themes['06']['C']['top'] = ['none', 'none', 'none', 'none', 'none', '#ffc107', 'none', 'none']; // Punk $themes['07']['A']['env'] = ['#00deae']; $themes['07']['A']['clo'] = ['#ff0000']; $themes['07']['A']['head'] = ['#ffce94']; $themes['07']['A']['mouth'] = ['#f73b6c', '#000']; $themes['07']['A']['eyes'] = ['#e91e63', '#000', '#e91e63', '#000', '#000', '#000']; $themes['07']['A']['top'] = ['#dd104f', '#dd104f', '#f73b6c', '#dd104f']; $themes['07']['B']['env'] = ['#181284']; $themes['07']['B']['clo'] = ['#491f49', '#ff9809', '#491f49']; $themes['07']['B']['head'] = ['#f6ba97']; $themes['07']['B']['mouth'] = ['#ff9809', '#000']; $themes['07']['B']['eyes'] = ['#c4ffe4', '#000', '#c4ffe4', '#000', '#000', '#000']; $themes['07']['B']['top'] = ['none', 'none', '#d6f740', '#516303']; $themes['07']['C']['env'] = ['#bcf700']; $themes['07']['C']['clo'] = ['#ff14e4', '#000', '#14fffd']; $themes['07']['C']['head'] = ['#7b401e']; $themes['07']['C']['mouth'] = ['#666', '#000']; $themes['07']['C']['eyes'] = ['#00b5b4', '#000', '#00b5b4', '#000', '#000', '#000']; $themes['07']['C']['top'] = ['#14fffd', '#14fffd', '#14fffd', '#0d3a62']; // Afrohair $themes['08']['A']['env'] = ['#0df']; $themes['08']['A']['clo'] = ['#571e57', '#ff0']; $themes['08']['A']['head'] = ['#f2c280']; $themes['08']['A']['mouth'] = ['#ff0000']; $themes['08']['A']['eyes'] = ['#795548', '#000']; $themes['08']['A']['top'] = ['#de3b00', 'none']; $themes['08']['B']['env'] = ['#B400C2']; $themes['08']['B']['clo'] = ['#0D204A', '#00ffdf']; $themes['08']['B']['head'] = ['#ca8628']; $themes['08']['B']['mouth'] = ['#1a1a1a']; $themes['08']['B']['eyes'] = ['#cbbdaf', '#000']; $themes['08']['B']['top'] = ['#000', '#000']; $themes['08']['C']['env'] = ['#ffe926']; $themes['08']['C']['clo'] = ['#00d6af', '#000']; $themes['08']['C']['head'] = ['#8c5100']; $themes['08']['C']['mouth'] = ['#7d0000']; $themes['08']['C']['eyes'] = ['none', '#000']; $themes['08']['C']['top'] = ['#f7f7f7', 'none']; // Normie female $themes['09']['A']['env'] = ['#4aff0c']; $themes['09']['A']['clo'] = ['#101010', '#fff', '#fff']; $themes['09']['A']['head'] = ['#dbbc7f']; $themes['09']['A']['mouth'] = ['#000']; $themes['09']['A']['eyes'] = ['#000', 'none', 'none']; $themes['09']['A']['top'] = ['#531148', '#531148', '#531148', 'none']; $themes['09']['B']['env'] = ['#FFC107']; $themes['09']['B']['clo'] = ['#033c58', '#fff', '#fff']; $themes['09']['B']['head'] = ['#dbc97f']; $themes['09']['B']['mouth'] = ['#000']; $themes['09']['B']['eyes'] = ['none', '#fff', '#000']; $themes['09']['B']['top'] = ['#FFEB3B', '#FFEB3B', 'none', '#FFEB3B']; $themes['09']['C']['env'] = ['#FF9800']; $themes['09']['C']['clo'] = ['#b40000', '#fff', '#fff']; $themes['09']['C']['head'] = ['#E2AF6B']; $themes['09']['C']['mouth'] = ['#000']; $themes['09']['C']['eyes'] = ['none', '#fff', '#000']; $themes['09']['C']['top'] = ['#ec0000', '#ec0000', 'none', 'none']; // Older $themes['10']['A']['env'] = ['#104c8c']; $themes['10']['A']['clo'] = ['#354B65', '#3D8EBB', '#89D0DA', '#00FFFD']; $themes['10']['A']['head'] = ['#cc9a5c']; $themes['10']['A']['mouth'] = ['#222', '#fff']; $themes['10']['A']['eyes'] = ['#000', '#000']; $themes['10']['A']['top'] = ['#fff', '#fff', 'none']; $themes['10']['B']['env'] = ['#0DC15C']; $themes['10']['B']['clo'] = ['#212121', '#fff', '#212121', '#fff']; $themes['10']['B']['head'] = ['#dca45f']; $themes['10']['B']['mouth'] = ['#111', '#633b1d']; $themes['10']['B']['eyes'] = ['#000', '#000']; $themes['10']['B']['top'] = ['none', '#792B74', '#792B74']; $themes['10']['C']['env'] = ['#ffe500']; $themes['10']['C']['clo'] = ['#1e5e80', '#fff', '#1e5e80', '#fff']; $themes['10']['C']['head'] = ['#e8bc86']; $themes['10']['C']['mouth'] = ['#111', 'none']; $themes['10']['C']['eyes'] = ['#000', '#000']; $themes['10']['C']['top'] = ['none', 'none', '#633b1d']; // Firehair $themes['11']['A']['env'] = ['#4a3f73']; $themes['11']['A']['clo'] = ['#e6e9ee', '#f1543f', '#ff7058', '#fff', '#fff']; $themes['11']['A']['head'] = ['#b27e5b']; $themes['11']['A']['mouth'] = ['#191919', '#191919']; $themes['11']['A']['eyes'] = ['#000', '#000', '#57FFFD']; $themes['11']['A']['top'] = ['#ffc', '#ffc', '#ffc']; $themes['11']['B']['env'] = ['#00a08d']; $themes['11']['B']['clo'] = ['#FFBA32', '#484848', '#4e4e4e', '#fff', '#fff']; $themes['11']['B']['head'] = ['#ab5f2c']; $themes['11']['B']['mouth'] = ['#191919', '#191919']; $themes['11']['B']['eyes'] = ['#000', '#ff23fa;opacity:0.39', '#000']; $themes['11']['B']['top'] = ['#ff90f4', '#ff90f4', '#ff90f4']; $themes['11']['C']['env'] = ['#22535d']; $themes['11']['C']['clo'] = ['#000', '#ff2500', '#ff2500', '#fff', '#fff']; $themes['11']['C']['head'] = ['#a76c44']; $themes['11']['C']['mouth'] = ['#191919', '#191919']; $themes['11']['C']['eyes'] = ['#000', 'none', '#000']; $themes['11']['C']['top'] = ['none', '#00efff', 'none']; // Blond $themes['12']['A']['env'] = ['#2668DC']; $themes['12']['A']['clo'] = ['#2385c6', '#b8d0e0', '#b8d0e0']; $themes['12']['A']['head'] = ['#ad8a60']; $themes['12']['A']['mouth'] = ['#000', '#4d4d4d']; $themes['12']['A']['eyes'] = ['#7fb5a2', '#d1eddf', '#301e19']; $themes['12']['A']['top'] = ['#fff510', '#fff510']; $themes['12']['B']['env'] = ['#643869']; $themes['12']['B']['clo'] = ['#D67D1B', '#b8d0e0', '#b8d0e0']; $themes['12']['B']['head'] = ['#CC985A', 'none0000']; $themes['12']['B']['mouth'] = ['#000', '#ececec']; $themes['12']['B']['eyes'] = ['#1f2644', '#9b97ce', '#301e19']; $themes['12']['B']['top'] = ['#00eaff', 'none']; $themes['12']['C']['env'] = ['#F599FF']; $themes['12']['C']['clo'] = ['#2823C6', '#b8d0e0', '#b8d0e0']; $themes['12']['C']['head'] = ['#C7873A']; $themes['12']['C']['mouth'] = ['#000', '#4d4d4d']; $themes['12']['C']['eyes'] = ['#581b1b', '#FF8B8B', '#000']; $themes['12']['C']['top'] = ['none', '#9c0092']; // Ateam $themes['13']['A']['env'] = ['#d10084']; $themes['13']['A']['clo'] = ['#efedee', '#00a1e0', '#00a1e0', '#efedee', '#ffce1c']; $themes['13']['A']['head'] = ['#b35f49']; $themes['13']['A']['mouth'] = ['#3a484a', '#000']; $themes['13']['A']['eyes'] = ['#000']; $themes['13']['A']['top'] = ['#000', 'none', '#000', 'none']; $themes['13']['B']['env'] = ['#E6C117']; $themes['13']['B']['clo'] = ['#efedee', '#ec0033', '#ec0033', '#efedee', '#f2ff05']; $themes['13']['B']['head'] = ['#ffc016']; $themes['13']['B']['mouth'] = ['#4a3737', '#000']; $themes['13']['B']['eyes'] = ['#000']; $themes['13']['B']['top'] = ['#ffe900', '#ffe900', 'none', '#ffe900']; $themes['13']['C']['env'] = ['#1d8c00']; $themes['13']['C']['clo'] = ['#e000cb', '#fff', '#fff', '#e000cb', '#ffce1c']; $themes['13']['C']['head'] = ['#b96438']; $themes['13']['C']['mouth'] = ['#000', '#000']; $themes['13']['C']['eyes'] = ['#000']; $themes['13']['C']['top'] = ['#53ffff', '#53ffff', 'none', 'none']; // Rasta $themes['14']['A']['env'] = ['#fc0065']; $themes['14']['A']['clo'] = ['#708913', '#fdea14', '#708913', '#fdea14', '#708913']; $themes['14']['A']['head'] = ['#DEA561']; $themes['14']['A']['mouth'] = ['#444', '#000']; $themes['14']['A']['eyes'] = ['#000']; $themes['14']['A']['top'] = ['#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f', '#32393f']; $themes['14']['B']['env'] = ['#81f72e']; $themes['14']['B']['clo'] = ['#ff0000', '#ffc107', '#ff0000', '#ffc107', '#ff0000']; $themes['14']['B']['head'] = ['#ef9831']; $themes['14']['B']['mouth'] = ['#6b0000', '#000']; $themes['14']['B']['eyes'] = ['#000']; $themes['14']['B']['top'] = ['#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', '#FFFAAD', 'none', 'none', 'none', 'none']; $themes['14']['C']['env'] = ['#00D872']; $themes['14']['C']['clo'] = ['#590D00', '#FD1336', '#590D00', '#FD1336', '#590D00']; $themes['14']['C']['head'] = ['#c36c00']; $themes['14']['C']['mouth'] = ['#56442b', '#000']; $themes['14']['C']['eyes'] = ['#000']; $themes['14']['C']['top'] = ['#004E4C', '#004E4C', '#004E4C', '#004E4C', '#004E4C', '#004E4C', '#004E4C', '#004E4C', '#004E4C', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none']; // Meta $themes['15']['A']['env'] = ['#111']; $themes['15']['A']['clo'] = ['#000', '#00FFFF']; $themes['15']['A']['head'] = ['#755227']; $themes['15']['A']['mouth'] = ['#fff', '#000']; $themes['15']['A']['eyes'] = ['black', '#008;opacity:0.67', 'aqua']; $themes['15']['A']['top'] = ['#fff', '#fff', '#fff', '#fff', '#fff']; $themes['15']['B']['env'] = ['#00D0D4']; $themes['15']['B']['clo'] = ['#000', '#fff']; $themes['15']['B']['head'] = ['#755227']; $themes['15']['B']['mouth'] = ['#fff', '#000']; $themes['15']['B']['eyes'] = ['black', '#1df7ff;opacity:0.64', '#fcff2c']; $themes['15']['B']['top'] = ['#fff539', 'none', '#fff539', 'none', '#fff539']; $themes['15']['C']['env'] = ['#DC75FF']; $themes['15']['C']['clo'] = ['#000', '#FFBDEC']; $themes['15']['C']['head'] = ['#997549']; $themes['15']['C']['mouth'] = ['#fff', '#000']; $themes['15']['C']['eyes'] = ['black', 'black', 'aqua']; $themes['15']['C']['top'] = ['#00fffd', 'none', 'none', 'none', 'none']; // Optimization $sP = []; $svgStart = ''; $svgEnd = ''; $env = ''; $head = ''; $str = 'stroke-linecap:round;stroke-linejoin:round;stroke-width:'; // SHAPES // Robo $sP['00']['env'] = $env; $sP['00']['clo'] = ''; $sP['00']['head'] = $head; $sP['00']['mouth'] = ''; $sP['00']['eyes'] = ''; $sP['00']['top'] = ''; // Girl $sP['01'] = []; $sP['01']['env'] = $env; $sP['01']['clo'] = ''; $sP['01']['head'] = $head; $sP['01']['mouth'] = ''; $sP['01']['eyes'] = ''; $sP['01']['top'] = ''; // Blonde $sP['02'] = []; $sP['02']['env'] = $env; $sP['02']['clo'] = ''; $sP['02']['head'] = $head; $sP['02']['mouth'] = ''; $sP['02']['eyes'] = ''; $sP['02']['top'] = ''; // Guy $sP['03'] = []; $sP['03']['env'] = $env; $sP['03']['clo'] = ''; $sP['03']['head'] = $head; $sP['03']['mouth'] = ''; $sP['03']['eyes'] = ''; $sP['03']['top'] = ''; // Country $sP['04'] = []; $sP['04']['env'] = $env; $sP['04']['clo'] = ''; $sP['04']['head'] = $head; $sP['04']['mouth'] = ''; $sP['04']['eyes'] = ''; $sP['04']['top'] = ''; // Geeknot $sP['05'] = []; $sP['05']['env'] = $env; $sP['05']['clo'] = ''; $sP['05']['head'] = $head; $sP['05']['mouth'] = ''; $sP['05']['eyes'] = ''; $sP['05']['top'] = ''; // Asian $sP['06'] = []; $sP['06']['env'] = $env; $sP['06']['clo'] = ''; $sP['06']['head'] = $head; $sP['06']['mouth'] = ''; $sP['06']['eyes'] = ''; $sP['06']['top'] = ''; // Punk $sP['07'] = []; $sP['07']['env'] = $env; $sP['07']['clo'] = ''; $sP['07']['head'] = $head; $sP['07']['mouth'] = ''; $sP['07']['eyes'] = ''; $sP['07']['top'] = ''; // Afrohair $sP['08'] = []; $sP['08']['env'] = $env; $sP['08']['clo'] = ''; $sP['08']['head'] = $head; $sP['08']['mouth'] = ''; $sP['08']['eyes'] = ''; $sP['08']['top'] = ''; // Normie Female $sP['09'] = []; $sP['09']['env'] = $env; $sP['09']['clo'] = ''; $sP['09']['head'] = $head; $sP['09']['mouth'] = ''; $sP['09']['eyes'] = ''; $sP['09']['top'] = ''; // Older $sP['10'] = []; $sP['10']['env'] = $env; $sP['10']['clo'] = ''; $sP['10']['head'] = $head; $sP['10']['mouth'] = ''; $sP['10']['eyes'] = ''; $sP['10']['top'] = ''; // Firehair $sP['11'] = []; $sP['11']['env'] = $env; $sP['11']['clo'] = ''; $sP['11']['head'] = $head; $sP['11']['mouth'] = ''; $sP['11']['eyes'] = ''; $sP['11']['top'] = ''; // Blond $sP['12'] = []; $sP['12']['env'] = $env; $sP['12']['clo'] = ''; $sP['12']['head'] = $head; $sP['12']['mouth'] = ''; $sP['12']['eyes'] = ''; $sP['12']['top'] = ''; // Ateam $sP['13'] = []; $sP['13']['env'] = $env; $sP['13']['clo'] = ''; $sP['13']['head'] = $head; $sP['13']['mouth'] = ''; $sP['13']['eyes'] = ''; $sP['13']['top'] = ''; // Rasta $sP['14'] = []; $sP['14']['env'] = $env; $sP['14']['clo'] = ''; $sP['14']['head'] = $head; $sP['14']['mouth'] = ''; $sP['14']['eyes'] = ''; $sP['14']['top'] = ''; // Meta $sP['15'] = []; $sP['15']['env'] = $env; $sP['15']['clo'] = ''; $sP['15']['head'] = $head; $sP['15']['mouth'] = ''; $sP['15']['eyes'] = ''; $sP['15']['top'] = ''; // Multiavatar algorithm $hash = ''; if (strlen($avatarId) == 0) { return $hash; } $sha256Hash = hash('sha256', $avatarId); $sha256Numbers = preg_replace('/[^0-9]/', '', $sha256Hash); $hash = substr($sha256Numbers, 0, 12); // Parts $p = []; // Get parts (range 0-47) $p['env'] = $hash[0].''.$hash[1]; $p['env'] = round((47 / 100) * (int) $p['env']); // Freeze a single part // e.g. '0' = 01A; '16' = 01B; '32' = 01C; '1' = 02A; '17' = 02B; // p['env'] = '16'; $p['clo'] = $hash[2].''.$hash[3]; $p['clo'] = round((47 / 100) * (int) $p['clo']); // p['clo'] = '16'; $p['head'] = $hash[4].''.$hash[5]; $p['head'] = round((47 / 100) * (int) $p['head']); // p['head'] = '01'; $p['mouth'] = $hash[6].''.$hash[7]; $p['mouth'] = round((47 / 100) * (int) $p['mouth']); // p['mouth'] = '16'; $p['eyes'] = $hash[8].''.$hash[9]; $p['eyes'] = round((47 / 100) * (int) $p['eyes']); // p['eyes'] = '16'; $p['top'] = $hash[10].''.$hash[11]; $p['top'] = round((47 / 100) * (int) $p['top']); // p['top'] = '25'; // Get parts (range 0-15) + define themes foreach ($p as $key => $part) { $nr = $part; if ($nr > 31) { $nr = $nr - 32 .''; if ($nr < 10) { $nr = '0'.$nr; } $p[$key] = $nr.'C'; } elseif ($nr > 15) { $nr = $nr - 16; if ($nr < 10) { $nr = '0'.$nr; } $p[$key] = $nr.'B'; } else { if ($nr < 10) { $p[$key] = '0'.$nr.'A'; } else { $p[$key] = $nr.'A'; } } } // Get the SVG code for each part $final = []; foreach ($p as $key => $part) { $partV = substr($p[$key], 0, 2); $theme = substr($p[$key], 2, 3); if ($ver != null) { $partV = $ver['part']; $theme = $ver['theme']; } // Freeze a single base version // $partV = '00'; $theme = 'A'; $final[$key] = $this->getFinal($key, $partV, $theme, $themes, $sP); } // Without 'env' if ($sansEnv) { $final['env'] = ''; } return $svgStart.$final['env'].$final['head'].$final['clo'].$final['top'].$final['eyes'].$final['mouth'].$svgEnd; } }