Ir para conteúdo

Featured Replies

Postado

Bom dia, estou precisando de ajudar para configurar meu o auto-updater do meu OTC, já tentei em vários tópicos até mesmo de fóruns gringos, mas nenhum deu certo no meu, se alguém se disponibilizar a me ajudar, posso até pagar pelo serviço, obrigado!

Postado
  • Autor
6 horas atrás, Aksz disse:

Olá, boa tarde, tudo bem?
Poste aqui o problema que deu, para tentarmos lhe ajudar

Na verdade eu não sei nem por onde eu começo, mas vou tentar mostrar o que eu fiz:

 

Na pasta do OTC:

init.lua:
eu mechi apenas no website e no updater, acho que é isso:
 

Spoiler
-- CONFIG
APP_NAME = "Tibia"  -- important, change it, it's name for config dir and files in appdata
APP_VERSION = 1341       -- client version for updater and login to identify outdated client
DEFAULT_LAYOUT = "retro" -- on android it's forced to "mobile", check code bellow
 
-- If you don't use updater or other service, set it to updater = ""
Services = {
  website = "http://www.oldersretro.com", -- currently not used
  updater = "http://www.oldersretro.com/updater/updater.php",
  stats = "",
  crash = "",
  feedback = "",
  status = ""
}
 
-- Servers accept http login url, websocket login url or ip:port:version
Servers = {
  Meuserver = "26.15.60.79:7171:772"
}
 
--Server = "ws://otclient.ovh:3000/"
--Server = "ws://127.0.0.1:88/"
--USE_NEW_ENERGAME = true -- uses entergamev2 based on websockets instead of entergame
ALLOW_CUSTOM_SERVERS = false -- if true it shows option ANOTHER on server list
 
g_app.setName("Tibia")
-- CONFIG END
 
-- print first terminal message
g_logger.info(os.date("== application started at %b %d %Y %X"))
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ') made by ' .. g_app.getAuthor() .. ' built on ' .. g_app.getBuildDate() .. ' for arch ' .. g_app.getBuildArch())
 
if not g_resources.directoryExists("/data") then
  g_logger.fatal("Data dir doesn't exist.")
end
 
if not g_resources.directoryExists("/modules") then
  g_logger.fatal("Modules dir doesn't exist.")
end
 
-- settings
g_configs.loadSettings("/config.otml")
 
-- set layout
local settings = g_configs.getSettings()
local layout = DEFAULT_LAYOUT
if g_app.isMobile() then
  layout = "mobile"
elseif settings:exists('layout') then
  layout = settings:getValue('layout')
end
g_resources.setLayout(layout)
 
-- load mods
g_modules.discoverModules()
g_modules.ensureModuleLoaded("corelib")
 
local function loadModules()
  -- libraries modules 0-99
  g_modules.autoLoadModules(99)
  g_modules.ensureModuleLoaded("gamelib")
 
  -- client modules 100-499
  g_modules.autoLoadModules(499)
  g_modules.ensureModuleLoaded("client")
 
  -- game modules 500-999
  g_modules.autoLoadModules(999)
  g_modules.ensureModuleLoaded("game_interface")
 
  -- mods 1000-9999
  g_modules.autoLoadModules(9999)
end
 
-- report crash
if type(Services.crash) == 'string' and Services.crash:len() > 4 and g_modules.getModule("crash_reporter") then
  g_modules.ensureModuleLoaded("crash_reporter")
end
 
-- run updater, must use data.zip
if type(Services.updater) == 'string' and Services.updater:len() > 4
  and g_resources.isLoadedFromArchive() and g_modules.getModule("updater") then
  g_modules.ensureModuleLoaded("updater")
  return Updater.init(loadModules)
end
loadModules()


Já no htdocs/updater/updater.php:
mechi no $files_dir e $files_url:

Spoiler
<?php
// CONFIG
$files_dir = "/xampp/htdocs/updater/tibia-client/";
$files_url = "http://www.oldersretro.com/updater/tibia-client/";
$files_and_dirs = array("data", "modules", "layouts", "mods", "init.lua");
$checksum_file = "checksums.txt";
$checksum_update_interval = 60; // seconds
$binaries = array(
    "WIN32-WGL" => "otclient_gl.exe",
    "WIN32-EGL" => "otclient_dx.exe"
);
// CONFIG END
 
function sendError($error) {
    echo(json_encode(array("error" => $error)));
    die();    
}
 
$data = json_decode(file_get_contents("php://input"));
if(!$data) {
   sendError("Invalid input data");
}
 
$version = isset($data->version) ?  $data->version : 0; // APP_VERSION from init.lua
$build = isset($data->build) ?  $data->build : ""; // 2.4, 2.4.1, 2.5, etc
$os = isset($data->os) ?  $data->os : "unknown"; // android, windows, mac, linux, unknown
$platform = isset($data->platform) ?  $data->platform : ""; // WIN32-WGL, X11-GLX, ANDROID-EGL, etc
//$args = isset($data->args) ? $data->args : []; // custom args when calling Updater.check()
$binary = isset($binaries[$platform]) ? $binaries[$platform] : "";
 
$cache = null;
$cache_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $checksum_file;
if (file_exists($cache_file) && (filemtime($cache_file) + $checksum_update_interval > time())) {
    $cache = json_decode(file_get_contents($cache_file), true);
}
if(!$cache) { // update cache
    $dir = realpath($files_dir);
    $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
    $cache = array();
    foreach ($rii as $file) {
        if (!$file->isFile())
            continue;
        $path = str_replace($dir, '', $file->getPathname());
        $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
        $cache[$path] = hash_file("crc32b", $file->getPathname());
    }
    file_put_contents($cache_file . ".tmp", json_encode($cache));
    rename($cache_file . ".tmp", $cache_file);
}
$ret = array("url" => $files_url, "files" => array(), "keepFiles" => false);
foreach($cache as $file => $checksum) {
    $base = trim(explode("/", ltrim($file, "/"))[0]);
    if(in_array($base, $files_and_dirs)) {
        $ret["files"][$file] = $checksum;
    }
    if($base == $binary && !empty($binary)) {
        $ret["binary"] = array("file" => $file, "checksum" => $checksum);
    }
}
 
echo(json_encode($ret, JSON_PRETTY_PRINT));
 
?>

após isso, joguei todos os arquivos do OTC na pasta htdocs\updater\tibia-client

sabe me dizer o que fiz de errado?

 

Editado por yuriowns (veja o histórico de edições)

  • 2 weeks later...
Postado
  • Autor
2 horas atrás, FeeTads disse:

as pastas, modules, mods, data e o init.lua estão zipados dentro da pasta junto com o client do otc?
aqui tem um tutorial sobre o otcv8

sim, agora eu consegui fazer com que o client atualize, mas toda vez da timeout ou um erro no restart, sabe o que seria?

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo