Postado Dezembro 11, 2021 3 anos Salve galera, to com problema no meu Gesior. Eu mudei o sistema de Exp Stage de Xml por Lua e acrescentei isso no config.lua: experienceStages = { { minlevel = 1, maxlevel = 7, multiplier = 10 }, { minlevel = 8, maxlevel = 100, multiplier = 50 }, { minlevel = 101, maxlevel = 150, multiplier = 40 }, { minlevel = 151, maxlevel = 160, multiplier = 30 }, { minlevel = 161, maxlevel = 170, multiplier = 20 }, { minlevel = 171, maxlevel = 180, multiplier = 10 }, { minlevel = 181, maxlevel = 190, multiplier = 5 }, { minlevel = 191, maxlevel = 200, multiplier = 3 }, { minlevel = 201, maxlevel = 300, multiplier = 1 }, { minlevel = 301, maxlevel = 310, multiplier = 0.8 }, { minlevel = 311, maxlevel = 320, multiplier = 0.7 }, { minlevel = 321, maxlevel = 330, multiplier = 0.6 }, { minlevel = 331, maxlevel = 340, multiplier = 0.5 }, { minlevel = 341, maxlevel = 350, multiplier = 0.4 }, { minlevel = 351, multiplier = 0.3 } } Contudo, por conta de agora o config.lua estar utilizando " { " o site não funciona mais, aparecendo esse erro: Parse error: syntax error, unexpected '{', expecting ';' in C:\xampp\htdocs\classes\configlua.php(56) : eval()'d code on line 1 configlua.php <?php if(!defined('INITIALIZED')) exit; class ConfigLUA extends Errors // NOT SAFE CLASS, LUA CONFIG CAN BE EXECUTED AS PHP CODE { private $config; public function __construct($path = false) { if($path) $this->loadFromFile($path); } public function loadFromFile($path) { if(Website::fileExists($path)) { $content = Website::getFileContents($path); $this->loadFromString($content); } else { new Error_Critic('#C-2', 'ERROR: <b>#C-2</b> : Class::ConfigLUA - LUA config file doesn\'t exist. Path: <b>' . $path . '</b>'); } } public function fileExists($path) { return Website::fileExists($path); } public function loadFromString($string) { $lines = explode("\n", $string); if(count($lines) > 0) foreach($lines as $ln => $line) { $tmp_exp = explode('=', $line, 2); if(count($tmp_exp) >= 2) { $key = trim($tmp_exp[0]); if(substr($key, 0, 2) != '--') { $value = trim($tmp_exp[1]); if(is_numeric($value)) $this->config[ $key ] = (float) $value; elseif(in_array(substr($value, 0 , 1), array("'", '"')) && in_array(substr($value, -1 , 1), array("'", '"'))) $this->config[ $key ] = (string) substr(substr($value, 1), 0, -1); elseif(in_array($value, array('true', 'false'))) $this->config[ $key ] = ($value == 'true') ? true : false; else { foreach($this->config as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull $value = str_replace($tmp_key, $tmp_value, $value); $ret = @eval("return $value;"); if((string) $ret == '') // = parser error { new Error_Critic('', 'ERROR: <b>#C-1</b> : Class::ConfigLUA - Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]'); } $this->config[ $key ] = $ret; } } } } } public function getValue($key) { if(isset($this->config[ $key ])) return $this->config[ $key ]; else new Error_Critic('#C-3', 'ERROR: <b>#C-3</b> : Class::ConfigLUA - Key <b>' . $key . '</b> doesn\'t exist.'); } public function isSetKey($key) { return isset($this->config[ $key ]); } public function getConfig() { return $this->config; } } Alguém sabe como resolvo isso??? Editado Dezembro 12, 2021 3 anos por stauro (veja o histórico de edições)
Postado Dezembro 14, 2021 3 anos Diretor de Projetos @stauroEstá resolvido? se sim poderia compartilhar? como resolveu, obg! Contato :https://www.linkedin.com/in/rafhael-oliveira/Projetos :https://github.com/thetibiaking
Postado Dezembro 14, 2021 3 anos Autor Em 14/12/2021 em 14:15, HomeJobs disse: @stauroEstá resolvido? se sim poderia compartilhar? como resolveu, obg! Como resolve eu não sei, não manjo de programação. Mas com esse configlua.php resolveu o problema: <?php if(!defined('INITIALIZED')) exit; // NOT SAFE CLASS, LUA CONFIG CAN BE EXECUTED AS PHP CODE class ConfigLUA { private $config; public function __construct($path = false) { if($path) $this->loadFromFile($path); } public function loadFromFile($path) { if(Website::fileExists($path)) { $content = Website::getFileContents($path); $this->loadFromString($content); } else { throw new InvalidArgumentException('#C-2 LUA config file doesn\'t exist. Path: <b>' . $path . '</b>'); } } public function fileExists($path) { return Website::fileExists($path); } public function loadFromString($string) { $lines = explode("\n", $string); if(count($lines) > 0) foreach($lines as $ln => $line) { $tmp_exp = explode('=', $line, 2); if(count($tmp_exp) >= 2) { $key = trim($tmp_exp[0]); if(substr($key, 0, 2) != '--') { $value = trim($tmp_exp[1]); if(is_numeric($value)) $this->config[ $key ] = (float) $value; elseif(in_array(substr($value, 0 , 1), array("'", '"')) && in_array(substr($value, -1 , 1), array("'", '"'))) $this->config[ $key ] = (string) substr(substr($value, 1), 0, -1); elseif(in_array($value, array('true', 'false'))) $this->config[ $key ] = ($value == 'true') ? true : false; else { foreach($this->config as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull $value = str_replace($tmp_key, $tmp_value, $value); try { $ret = @eval("return $value;"); if ((string)$ret == '') // = parser error { throw new RuntimeException( '#C-1 - Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]' ); } $this->config[$key] = $ret; } catch(ParseError $e) { // skip LUA table errors } } } } } } public function getValue($key) { if(isset($this->config[ $key ])) return $this->config[ $key ]; else throw new RuntimeException('#C-3 Config key <b>' . $key . '</b> doesn\'t exist.'); } public function isSetKey($key) { return isset($this->config[ $key ]); } public function getConfig() { return $this->config; } }
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.