Problema con mod - funcion indefinida
Publicado: 12 Nov 2011, 18:27
Hola, tengo un problema.
Instale el siguiente mod, Recorded Game Mod 0.4.2.
La cosa es que lo que hace el mod es subir un adjunto(partida grabada de un video juego) en .zip y hacer una descripcion con imagenes de los detalles de la partida.
Pero al subir el game me sale el siguiente error.
Pero esta es la linea donde me marca error.
Entonces no se si sea un error de sintaxis o sea alguna variable que no se declaro o que se yo, soy nuevo en esto 
Sin embargo soy administrador de otra web que tiene el mismo mod (esa web no la arme yo).
Y busque la linea en el mismo archivo del mod para ver si habia cometido algun error y la linea es la misma, solo que en la otra pagina si funciona a la perfeccion.
Toda ayuda es bienvenida.
En este otro topic habia adjuntado el mod por un problema anterior.
http://www.phpbb-es.com/foro/soporte-mo ... 34176.html
Gracias.
Instale el siguiente mod, Recorded Game Mod 0.4.2.
La cosa es que lo que hace el mod es subir un adjunto(partida grabada de un video juego) en .zip y hacer una descripcion con imagenes de los detalles de la partida.
Pero al subir el game me sale el siguiente error.
Aqui esta el codigo del archivo.Fatal error: Call to undefined function imagerotate() in /home/a3724482/public_html/recmod/RecordedGameReader.php on line 620
Código: Seleccionar todo
<?php
/**
* RecordedGameReader
* @based in a Bari's implementation
* @Bari website: http://members.at.infoseek.co.jp/aocai
* @Bari MGX Preview: http://members.at.infoseek.co.jp/aocai/mgx_format.html
* @Bari Full MGX Documentation (.xls): http://members.at.infoseek.co.jp/aocai/mgx_format.lhz
*
* @author jose
* @date Domingo, Septiembre 17, 2006 5:34 AM
* @update: Monday, July 19, 2010 10:45 AM
**/
define ('MGX_COMPLETE', 1);
define ('MGX_FULL', 2);
define ('MGX_MAPNAME_ONLY', 3);
define ('MGX_PLAYERS_1V1', 1);
define ('MGX_PLAYERS_2V2', 2);
define ('MGX_PLAYERS_3V3', 3);
define ('MGX_PLAYERS_4V4', 4);
define ('MGX_PLAYERS_FFA', 5);
global $idCivToIdCivDb, $idMapToIdMapDb;
$idCivToIdCivDb = array (
1 => 9, // Ingleses
2 => 12, // franco
3 => 11, // godos
4 => 4, // teuton
5 => 8, // japos
6 => 15, // chinos
7 => 3, // biz
8 => 6, // persa
9 => 5, // sarra
10 => 18, // turco
11 => 17, // vika
12 => 7, // mongo
13 => 16, // celta
14 => 13, // espa
15 => 1, // azt
16 => 2, // maya
17 => 10, // hunos
18 => 14 // hunos
);
$idMapToIdMapDb = array (
9 => 0, // Arabia
10 => 1, // Archipelago
11 => 3, // Baltico
12 => 26, // Black Forest
13 => 5, // Costa
14 => 4, // Continental
15 => 12, // Lago crater
16 => 8, // Fortaleza
17 => 7, // Gold Rush
18 => 20, // Montañas
19 => 10, // Islas
20 => 16, // Mediterraneo
21 => 18, // Migra
22 => 25, // Rios
23 => 11, // TI
24 => 33, // Full Random ?
25 => 6, // scandinavia
26 => 19, // Mongolia
27 => 27, // yucatan
28 => 15, // Salt Marsh
29 => 2, // Arena
30 => 35, // King of the hill
31 => 22, // Oasis
32 => 13, // Gost lake
33 => 21, // Nomada
44 => 30, // Custom Map
48 => 28 // Blind Random
);
class RecordedGameReader
{
var $data;
var $header_len;
var $fileName;
var $mPlayersInfo;
var $mPlayersCount;
var $mMapId;
var $mapName;
var $mIdPlayerView;
var $mIdPlayerViewIndex;
var $readTime;
var $validMgx;
function RecordedGameReader ($recFile, $fileMap = '', $mapSize = 200)
{
$this->validMgx = FALSE;
$this->mapSize = $mapSize;
$this->fileName = $recFile;
$this->fileMap = $fileMap;
$this->deleteCoop = TRUE;
$this->mColors = array ();
}
function read ($analizeType = MGX_COMPLETE)
{
$this->setStart();
switch ($analizeType)
{
case MGX_COMPLETE:
$this->readFile ();
$this->analizeGame ();
break;
case MGX_FULL:
$this->ReadFile ();
$this->analizeGame ();
//$this->AnalizeChat ();
//$this->AnalizeBody ();
break;
case MGX_MAPNAME_ONLY:
$this->readFile ();
$this->analizeMap ();
break;
default:
break;
}
$this->setEnd();
unset ($this->last_seek);
unset ($this->data);
unset ($this->header_len);
unset ($this->body_data);
unset ($this->body_len);
return $this->validMgx;
}
function readString ($offSet, $len)
{
return substr ($this->data, $offSet, $len);
}
function readInt ($offSet, $inBody = FALSE)
{
(!$inBody) ? $varArray = unpack ("I", substr ($this->data, $offSet, 4)) : $varArray = unpack ("I", substr ($this->body_data, $offSet, 4));
return $varArray[1];
}
function readChar ($offSet, $inBody = FALSE)
{
(!$inBody) ? $varArray = unpack ("C", $this->data[$offSet]) : $varArray = unpack ("C", $this->body_data[$offSet]);
return $varArray[1];
}
function readShort ($offSet)
{
$varArray = unpack ("s", substr ($this->data, $offSet, 2));
return $varArray[1];
}
function readFloat ($offSet, $inBody = FALSE)
{
(!$inBody) ? $varArray = unpack ("f", substr ($this->data, $offSet, 4)) : $varArray = unpack ("f", substr ($this->body_data, $offSet, 4));
return $varArray[1];
}
function analizeGame ()
{
if (!$this->validMgx)
{
return FALSE;
}
global $idCivToIdCivDb, $idMapToIdMapDb;
$initStr = pack ("C*", 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0xF9, 0x3F);
$triggerPos = strpos ($this->data, $initStr) + 8;
$initStr = pack ("C*", 0x9D, 0xFF, 0xFF, 0xFF);
$pos = strrpos ($this->data, $initStr, - ($this->header_len - $triggerPos));
$pos += 12;
//Map ID
$this->mMapId = $idMapToIdMapDb[$this->readInt ($pos)];
$pos += 12;
$this->mPlayersInfo = array ();
$this->mPlayersKeyToIndex = array ();
for ($i = 0; $i < 9; $i++)
{
$index = $this->readInt ($pos);
$pos += 8;
$player_name_len = $this->readInt ($pos);
$pos += 4;
if ($index != 0)
{
$this->mPlayersInfo[$i] = array (
'Name' => $this->readString ($pos, $player_name_len),
'Key' => $index
);
if (!isset ($this->mPlayersKeyToIndex[$index]))
{
$this->mPlayersKeyToIndex[$index] = $i;
}
}
$pos += $player_name_len;
}
unset ($index);
unset ($player_name_len);
$pos = 0x0C;
$include_ai = $this->readInt ($pos);
$pos += 4;
if ($include_ai == 1)
{
$pos = 0x12;
$num_chat = $this->readShort ($pos);
$pos += 6;
for ($i = 0; $i < $num_chat; $i++)
{
$chat_len_work = $this->readInt ($pos);
$pos += 4 + $chat_len_work;
}
$pos += 6;
for ($i = 0; $i < 8; $i++)
{
$pos += 10;
$num_rule = $this->readShort ($pos);
$pos += 6 + (400 * $num_rule);
}
$pos += 5544;
unset ($num_chat);
unset ($chat_len_work);
unset ($num_rule);
}
unset ($include_ai);
$pos += 45;
$this->mIdPlayerView = $this->readChar ($pos);
if ($this->mIdPlayerView < 1 && $this->mIdPlayerView > 8)
{
$this->mIdPlayerView = 0;
$this->mIdPlayerViewIndex = 0;
}
else
{
$this->mIdPlayerViewIndex = $this->mPlayersKeyToIndex[$this->mIdPlayerView];
}
if ($this->mIdPlayerView < 1 && $this->mIdPlayerView > 8)
{
$this->mIdPlayerView = 0;
$this->mIdPlayerViewIndex = 0;
}
$pos += 2;
$this->mPlayersCount = $this->readChar ($pos) - 1;
$pos += 63;
$mMapSize_cx = $this->readint ($pos);
$pos += 4;
$mMapSize_cy = $this->readint ($pos);
$pos += 4;
$num_data = $this->readint ($pos);
$pos += 4;
for ($i = 0; $i < $num_data; $i++)
{
$pos += 1275;
$pos += ($mMapSize_cx * $mMapSize_cy);
$num_float = $this->readint ($pos);
if ($num_float != 0x29)
{
$error = 1;
break;
}
$pos += (4 * $num_float);
$pos += 4;
$pos += 4;
}
unset ($num_data);
$pos += 2;
$start = $pos;
$pos += $mMapSize_cx * $mMapSize_cy * 2;
$pos += 128;
$pos += $mMapSize_cx * $mMapSize_cy;
$pos += 15;
$pos += $this->mPlayersCount;
$pos += 863;
$j = $this->mPlayersCount;
$pos2 = $pos;
$j = 0;
$i = 1;
while ($j < $this->mPlayersCount)
{
$len = strlen ($this->mPlayersInfo[$i]['Name']) + 1;
$pos = strpos ($this->data, pack ("s", $len) . $this->mPlayersInfo[$i]['Name'], $pos2);
if ($pos)
{
$pos2 = $pos;
$pos += 2;
$pos += $len + 799;
$this->mPlayersInfo[$i]['x'] = $this->readFloat ($pos);
$pos += 4;
$this->mPlayersInfo[$i]['y'] = $this->readFloat ($pos);
$pos += 13;
$this->mPlayersInfo[$i]['Id_Civ'] = $idCivToIdCivDb[$this->readChar ($pos)];
$pos += 1;
$pos += 3;
$this->mPlayersInfo[$i]['Id_Color'] = $this->readChar ($pos);
$j++;
}
$i++;
}
if ($error == 0 && $this->fileMap != '')
{
$this->createMap ($mMapSize_cx, $mMapSize_cy, $start);
}
if ($this->mMapId == 44 || $this->mMapId == 30)
{
$mapPos = strpos ($this->data, pack('C*', 0xF6, 0x28, 0x9C, 0x3F));
$pos = $mapPos + 4433;
$len = $this->readShort ($pos);
$pos += 26 + $len;
$len = $this->readShort ($pos);
$str = $this->readString ($pos, $len);
$strList = explode("\n", $str);
if (count($strList) > 2)
{
$this->mapName = ltrim(strstr($strList[2], pack('C*', 58, 32)), pack('C*', 58, 32));
}
}
$pos = $triggerPos;
$pos += 1;
$trigger_num = $this->readInt ($pos);
$pos += 4;
for ($i = 0; $i < $trigger_num; $i++)
{
$pos += 18;
$length = $this->readInt ($pos); //Desc length
$pos += 4;
$pos += $length;
$length = $this->readInt ($pos); //name length
$pos += 4;
$pos += $length;
$effect_num = $this->readInt ($pos);
$pos += 4;
for($j = 0; $j < $effect_num; $j++)
{
$pos += 24;
$selected_num = $this->readInt ($pos);
if($selected_num == -1)
{
$selected_num = 0;
}
$pos += 4;
$pos += 72;
$length = $this->readInt ($pos); //msg text length
$pos += 4;
$pos += length;
$length = $this->readInt ($pos); //sound file name length
$pos += 4;
$pos += $length;
$pos += ($selected_num * 4);
}
$pos += ($effect_num * 4); //effect order
$condition_num = $this->readInt ($pos);
$pos += 4;
for ($j = 0; $j < $condition_num; $j++)
{
$pos += 72;
}
$pos += ($condition_num * 4); //condition order
unset ($trigger_num);
unset ($length);
unset ($effect_num);
unset ($selected_num);
}
$pos += ($trigger_num * 4); //trigger order
for($j = 0; $j < 8; $j++)
{
if ($this->readChar ($pos+$j) - 1 == 0)
{
$this->mPlayersInfo[$j+1]['team'] = 0;
}
else
{
$this->mPlayersInfo[$j+1]['team'] = $this->readChar ($pos + $j) - 1;
}
}
$pos += 8 + 13 + 4;
$this->gameTypeId = $this->readChar ($pos);
$this->refreshPlayers ();
}
function AnalizeMap ()
{
global $idMapToIdMapDb;
if (!$this->validMgx)
{
return FALSE;
}
$initStr = pack ("C*", 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0xF9, 0x3F);
$triggerPos = strpos ($this->data, $initStr) + 8;
$initStr = pack ("C*", 0x9D, 0xFF, 0xFF, 0xFF);
$pos = strrpos ($this->data, $initStr, - ($this->header_len - $triggerPos));
$pos += 12;
//Map ID
$this->mMapId = $idMapToIdMapDb[$this->readInt ($pos)];
if ($this->mMapId == 44 || $this->mMapId == 30)
{
$mapPos = strpos ($this->data, pack('C*', 0xF6, 0x28, 0x9C, 0x3F));
$pos = $mapPos + 4433;
$len = $this->readShort ($pos);
$pos += 26 + $len;
$len = $this->readShort ($pos);
$str = $this->readString ($pos, $len);
$strList = explode("\n", $str);
if (count($strList) > 2)
{
$this->mapName = ltrim(strstr($strList[2], pack('C*', 58, 32)), pack('C*', 58, 32));
}
}
}
function refreshPlayers ()
{
if ($this->deleteCoop)
{
for ($i = 0; $i < 9; $i++)
{
for ($j = 0; $j < 9; $j++)
{
if ($i != $j && $this->mPlayersInfo[$i]['Key'] == $this->mPlayersInfo[$j]['Key'])
{
unset ($this->mPlayersInfo[$j]);
}
}
}
}
else
{
for ($i = 0; $i < 9; $i++)
{
if ($this->mPlayersInfo[$i]['Key'] > 0)
{
if (!isset ($this->mPlayersInfo[$i]['Id_Civ']))
{
$index = $this->mPlayersKeyToIndex[$this->mPlayersInfo[$i]['Key']];
if ($this->mPlayersInfo[$index]['Key'] == $this->mPlayersInfo[$i]['Key'] && $index != $i)
{
if ($this->mPlayersInfo[$i]['team'] == 0)
{
$this->mPlayersInfo[$i]['team'] = $this->mPlayersInfo[$index]['Key'];
$this->mPlayersInfo[$index]['team'] = $this->mPlayersInfo[$index]['Key'];
}
$this->mPlayersInfo[$i]['Id_Civ'] = $this->mPlayersInfo[$index]['Id_Civ'];
$this->mPlayersInfo[$i]['Id_Color'] = $this->mPlayersInfo[$index]['Id_Color'];
}
}
}
}
}
@reset ($this->mPlayersInfo);
foreach ($this->mPlayersInfo as $key => $player)
{
if ($player['Name'] == '')
{
unset ($this->mPlayersInfo[$key]);
}
}
$this->gameStandar = TRUE;
switch ($this->mPlayersCount)
{
case 2:
$this->mPlayersInfo[1]['team'] = 1;
$this->mPlayersInfo[2]['team'] = 2;
break;
case 3:
case 5:
case 7:
$this->gameStandar = FALSE;
break;
case 4:
case 6:
case 8:
foreach ($this->mPlayersInfo as $player)
{
if ($player['team'] == 0)
{
$this->gameStandar = FALSE;
break;
}
}
break;
}
}
function readFile ()
{
$this->validMgx = FALSE;
$fp = @fopen ($this->fileName, 'r');
if ($fp)
{
$val = fread ($fp, 4);
fread ($fp, 4);
$len = unpack ("I", $val);
$len = $len[1];
if ($len > 0)
{
$this->data = fread ($fp, $len);
$this->header_len = strlen ($this->data);
$this->data = @gzinflate ($this->data);
if ($this->data != NULL)
{
if (strcmp ($this->readString (0, 7), 'VER 9.4') == 0)
{
$this->header_len = strlen ($this->data);
$this->validMgx = TRUE;
}
else
{
unset ($this->header_len);
unset ($this->data);
}
}
}
fclose ($fp);
}
else
{
$this->validMgx = FALSE;
}
}
function setStart ()
{
$this->initTime = explode (" ", microtime ());
$this->initTime = $this->initTime[1] + $this->initTime[0];
}
function setEnd ()
{
$this->ReadTime = explode(" ", microtime ());
$this->ReadTime = sprintf ("%.4f", $this->ReadTime[1] + $this->ReadTime[0] - $this->initTime);
unset ($this->initTime);
}
/**
* asdf very-slow new method <-
*
* @param mixed $xSize
* @param mixed $ySize
* @param mixed $start
*/
function createMap ($xSize, $ySize, $start)
{
$size = $xSize * $ySize;
$im = imagecreatetruecolor ($xSize, $ySize);
$posCol = $start;
for ($i = 0; $i < $xSize; $i++)
{
for ($j = 0; $j < $ySize; $j ++)
{
$colId = $this->readChar ($posCol);
$color = $this->getColorMap ($im, $colId);
imagesetpixel ($im, $j, $i, $color);
$posCol += 2;
}
}
$playersCount = count ($this->mPlayersInfo);
switch ($playersCount)
{
case 1:
case 2:
$radius = 1.33;
break;
case 3:
case 4:
$radius = 1;
break;
case 8:
$radius = 0.8;
break;
case 5:
case 6:
default:
$radius = 1;
break;
}
foreach ($this->mPlayersInfo as $player)
{
if (!isset ($player['Id_Color'])) continue;
imageellipse ($im, $player['x'], $player['y'], 20/$radius, 20/$radius, $this->getColorMap ($im, $player['Id_Color'] + 300));
imageellipse ($im, $player['x'], $player['y'], 19/$radius, 19/$radius, $this->getColorMap ($im, $player['Id_Color'] + 300));
imagefilledellipse($im, $player['x'], $player['y'], 10/$radius, 10/$radius, $this->getColorMap ($im, $player['Id_Color'] + 300));
}
$im = imagerotate($im, 45, 0, 1);
if (($xSize * 2) != $this->mapSize)
{
$x = imagesx ($im);
$y = imagesy ($im);
$aspecto = $ySize / $xSize;
$ancho = $this->mapSize;
$alto = abs ($ancho * $aspecto);
$imagen = imagecreatetruecolor ($ancho, $alto/2);
imagecopyresampled ($imagen, $im, 0, 0, 0, 0, $ancho, $alto/2, $x, $y);
imagedestroy ($im);
$im = $imagen;
unset ($imagen);
}
$transparent = imagecolorallocate($im, 0, 0, 1);
$pointsA = array (
0,0,
0,50,
100,0);
$pointsB = array (
100,0,
200,0,
200,50);
$pointsC = array (
0,50,
0,100,
100,100);
$pointsD = array (
100,100,
200,100,
200,50);
imagefilledpolygon ($im, $pointsA, 3, $transparent);
imagefilledpolygon ($im, $pointsB, 3, $transparent);
imagefilledpolygon ($im, $pointsC, 3, $transparent);
imagefilledpolygon ($im, $pointsD, 3, $transparent);
imagecolortransparent($im, $transparent);
imagepng ($im, PATH_TO_UPLOADED_MAPS . $this->fileMap);
imagedestroy ($im);
unset ($color);
}
function getColorMap (&$im, $id)
{
if (isset ($this->mColors[$id]))
{
return $this->mColors[$id];
}
switch ($id)
{
case 5:
case 0:
case 9:
case 12:
case 16:
$color = array (0x27, 0x99, 0x33);
break;
case 1:
case 15:
case 28:
$color = array (0xB6, 0x5D, 0x30);
break;
case 2:
case 14:
$color = array (0x78, 0xB4, 0xE8);
break;
case 3:
case 6:
case 11:
case 24:
case 25:
case 27:
case 40:
$color = array (0x52, 0xA2, 0xE4);
break;
case 4:
$color = array (0xB0, 0x92, 0x54);
break;
case 7:
case 8:
case 29:
case 30:
case 31:
$color = array (0x4d, 0x88, 0x82);
break;
case 10:
case 13:
case 17:
case 18:
case 19:
case 20:
case 21:
$color = array (0x15, 0x76, 0x15);
break;
case 22:
case 23:
$color = array (0xBB, 0x4A, 0x00);
break;
case 26:
$color = array (0x49, 0xEC, 0xFF);
break;
case 32:
case 33:
case 34:
case 36:
case 38:
case 39:
$color = array (0xFF, 0xD8, 0xC8);
break;
case 35:
case 37:
$color = array (0xF0, 0xC0, 0x98);
break;
case 300:
$color = array (255, 0, 0);
break;
case 301:
$color = array (0, 0, 255);
break;
case 302:
$color = array (0, 255, 0);
break;
case 303:
$color = array (0, 255, 255);
break;
case 304:
$color = array (255, 255, 0);
break;
case 305:
$color = array (255, 0, 255);
break;
case 306:
$color = array (185, 185, 185);
break;
case 307:
$color = array (1, 130, 255);
break;
default:
$color = array (0, 0, 0);
}
$this->mColors[$id] = imagecolorallocate ($im, $color[2], $color[1], $color[0]);
return $this->mColors[$id];
}
}
?>
Código: Seleccionar todo
$im = imagerotate($im, 45, 0, 1);

Sin embargo soy administrador de otra web que tiene el mismo mod (esa web no la arme yo).
Y busque la linea en el mismo archivo del mod para ver si habia cometido algun error y la linea es la misma, solo que en la otra pagina si funciona a la perfeccion.
Toda ayuda es bienvenida.
En este otro topic habia adjuntado el mod por un problema anterior.
http://www.phpbb-es.com/foro/soporte-mo ... 34176.html
Gracias.