From: Hendrik B. <nh...@us...> - 2010-07-05 20:56:30
|
Update of /cvsroot/arianne/stendhal_website/content/account In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv980/content/account Modified Files: createcharacter.php Log Message: ported random outfit code Index: createcharacter.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/content/account/createcharacter.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** createcharacter.php 5 Jul 2010 20:27:04 -0000 1.3 --- createcharacter.php 5 Jul 2010 20:56:22 -0000 1.4 *************** *** 12,15 **** --- 12,19 ---- } + public function getBodyTagAttributes() { + return 'onload="random()"'; + } + function writeContent() { if (!isset($_SESSION['username'])) { *************** *** 78,81 **** --- 82,87 ---- currentOutfit = [1, 0, 0, 1]; maxOutfit = [44, 21, 15, 53]; + maxRndOutfit = [26, 15, 5, 15]; + outfitNames = ["hair", "head", "player_base", "dress"]; *************** *** 109,113 **** } ! function updateAll(i) { for (i = 0; i < 4; i++) { document.getElementById("outfit" + i).style.backgroundImage = "url('/data/sprites/outfit/" + outfitNames[i] + "_" + currentOutfit[i] + ".png')"; --- 115,126 ---- } ! function random() { ! for (i = 0; i < 4; i++) { ! currentOutfit[i] = parseInt(Math.random() * maxRndOutfit[i]) + 1; ! } ! updateAll(); ! } ! ! function updateAll() { for (i = 0; i < 4; i++) { document.getElementById("outfit" + i).style.backgroundImage = "url('/data/sprites/outfit/" + outfitNames[i] + "_" + currentOutfit[i] + ".png')"; *************** *** 117,120 **** --- 130,135 ---- document.getElementById("canvas").style.backgroundImage = "url('/images/outfit/" + outfitCode + ".png')"; } + + </script> <?php |