-
Total de itens
346 -
Registro em
-
Última visita
-
Dias Ganhos
1
Tipo de Conteúdo
Perfis
Fóruns
Calendário
Publique
Atualizações de Status postados por Wase Wiss
-
Man, aki deu esse aki aki
Spoiler////////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
////////////////////////////////////////////////////////////////////////
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
#include "otpch.h"
#include "otsystem.h"#include <iostream>
#include <fstream>
#include <iomanip>#ifndef WINDOWS
#include <unistd.h>
#include <termios.h>
#else
#include <conio.h>
#endif
#include <boost/config.hpp>#include <openssl/rsa.h>
#include <openssl/bn.h>
#include <openssl/err.h>#include "server.h"
#ifdef __LOGIN_SERVER__
#include "gameservers.h"
#endif
#include "networkmessage.h"#include "game.h"
#include "chat.h"
#include "tools.h"#include "protocollogin.h"
#include "protocolgame.h"
#include "protocolold.h"
#include "protocolhttp.h"#include "status.h"
#include "manager.h"
#ifdef __OTADMIN__
#include "admin.h"
#endif#include "configmanager.h"
#include "scriptmanager.h"
#include "databasemanager.h"#include "iologindata.h"
#include "ioban.h"#include "outfit.h"
#include "vocation.h"
#include "group.h"#include "monsters.h"
#ifdef __OTSERV_ALLOCATOR__
#include "allocator.h"
#endif
#ifdef __EXCEPTION_TRACER__
#include "exception.h"
#endif
#ifndef __OTADMIN__
#include "textlogger.h"
#endif#ifdef __NO_BOOST_EXCEPTIONS__
#include <exception>inline void boost::throw_exception(std::exception const & e)
{
std::clog << "Boost exception: " << e.what() << std::endl;
}
#endifRSA* g_RSA;
ConfigManager g_config;
Game g_game;
Chat g_chat;
Monsters g_monsters;
Npcs g_npcs;boost::mutex g_loaderLock;
boost::condition_variable g_loaderSignal;
boost::unique_lock<boost::mutex> g_loaderUniqueLock(g_loaderLock);
std::list<std::pair<uint32_t, uint32_t> > serverIps;bool argumentsHandler(StringVec args)
{
StringVec tmp;
for(StringVec::iterator it = args.begin(); it != args.end(); ++it)
{
if((*it) == "--help")
{
std::clog << "Usage:\n"
"\n"
"\t--config=$1\t\tAlternate configuration file path.\n"
"\t--data-directory=$1\tAlternate data directory path.\n"
"\t--ip=$1\t\t\tIP address of the server.\n"
"\t\t\t\tShould be equal to the global IP.\n"
"\t--login-port=$1\tPort for login server to listen on.\n"
"\t--game-port=$1\tPort for game server to listen on.\n"
"\t--admin-port=$1\tPort for admin server to listen on.\n"
"\t--manager-port=$1\tPort for manager server to listen on.\n"
"\t--status-port=$1\tPort for status server to listen on.\n";
#ifndef WINDOWS
std::clog << "\t--runfile=$1\t\tSpecifies run file. Will contain the pid\n"
"\t\t\t\tof the server process as long as run status.\n";
#endif
std::clog << "\t--log=$1\t\tWhole standard output will be logged to\n"
"\t\t\t\tthis file.\n"
"\t--closed\t\t\tStarts the server as closed.\n";
return false;
}if((*it) == "--version" || (*it) == "-V")
{
std::clog << SOFTWARE_NAME << ", version " << SOFTWARE_VERSION << " (" << SOFTWARE_CODENAME << ")\n"
"Compiled with " << BOOST_COMPILER << " at " << __DATE__ << ", " << __TIME__ << ".\n"
"A server developed by Elf, Talaturen, Stian, Slawkens, KaczooH and Kornholijo.\n"
"Visit our forum for updates, support and resources: http://otland.net.\n";
return false;
}tmp = explodeString((*it), "=");
if(tmp[0] == "--config")
g_config.setString(ConfigManager::CONFIG_FILE, tmp[1]);
else if(tmp[0] == "--data-directory")
g_config.setString(ConfigManager::DATA_DIRECTORY, tmp[1]);
else if(tmp[0] == "--ip")
g_config.setString(ConfigManager::IP, tmp[1]);
else if(tmp[0] == "--login-port")
g_config.setNumber(ConfigManager::LOGIN_PORT, atoi(tmp[1].c_str()));
else if(tmp[0] == "--game-port")
g_config.setNumber(ConfigManager::GAME_PORT, atoi(tmp[1].c_str()));
else if(tmp[0] == "--admin-port")
g_config.setNumber(ConfigManager::ADMIN_PORT, atoi(tmp[1].c_str()));
else if(tmp[0] == "--manager-port")
g_config.setNumber(ConfigManager::MANAGER_PORT, atoi(tmp[1].c_str()));
else if(tmp[0] == "--status-port")
g_config.setNumber(ConfigManager::STATUS_PORT, atoi(tmp[1].c_str()));
#ifndef WINDOWS
else if(tmp[0] == "--runfile")
g_config.setString(ConfigManager::RUNFILE, tmp[1]);
#endif
else if(tmp[0] == "--log")
g_config.setString(ConfigManager::OUTPUT_LOG, tmp[1]);
else if(tmp[0] == "--closed")
g_config.setBool(ConfigManager::START_CLOSED, true);
else if(tmp[0] == "--no-script")
g_config.setBool(ConfigManager::SCRIPT_SYSTEM, false);
}return true;
}#ifndef WINDOWS
int32_t getch()
{
struct termios oldt;
tcgetattr(STDIN_FILENO, &oldt);struct termios newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);int32_t ch = getchar();
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
return ch;
}void signalHandler(int32_t sig)
{
switch(sig)
{
case SIGHUP:
Dispatcher::getInstance().addTask(createTask(
boost::bind(&Game::saveGameState, &g_game, false)));
break;case SIGTRAP:
g_game.cleanMap();
break;case SIGCHLD:
g_game.proceduralRefresh();
break;case SIGUSR1:
Dispatcher::getInstance().addTask(createTask(
boost::bind(&Game::setGameState, &g_game, GAMESTATE_CLOSED)));
break;case SIGUSR2:
g_game.setGameState(GAMESTATE_NORMAL);
break;case SIGCONT:
Dispatcher::getInstance().addTask(createTask(
boost::bind(&Game::reloadInfo, &g_game, RELOAD_ALL, 0)));
break;case SIGQUIT:
Dispatcher::getInstance().addTask(createTask(
boost::bind(&Game::setGameState, &g_game, GAMESTATE_SHUTDOWN)));
break;case SIGTERM:
Dispatcher::getInstance().addTask(createTask(
boost::bind(&Game::shutdown, &g_game)));
break;default:
break;
}
}void runfileHandler(void)
{
std::ofstream runfile(g_config.getString(ConfigManager::RUNFILE).c_str(), std::ios::trunc | std::ios::out);
runfile.close();
}
#else
int32_t getch()
{
return (int32_t)getchar();
}
#endifvoid allocationHandler()
{
puts("Allocation failed, server out of memory!\nDecrease size of your map or compile in a 64-bit mode.");
char buffer[1024];
delete fgets(buffer, 1024, stdin);
exit(-1);
}void startupErrorMessage(std::string error = "")
{
if(error.length() > 0)
std::clog << std::endl << "> ERROR: " << error << std::endl;getch();
exit(-1);
}void otserv(StringVec args, ServiceManager* services);
int main(int argc, char* argv[])
{
StringVec args = StringVec(argv, argv + argc);
if(argc > 1 && !argumentsHandler(args))
return 0;std::set_new_handler(allocationHandler);
ServiceManager servicer;
g_config.startup();#ifdef __OTSERV_ALLOCATOR_STATS__
boost::thread(boost::bind(&allocatorStatsThread, (void*)NULL));
// TODO: shutdown this thread?
#endif
#ifdef __EXCEPTION_TRACER__
ExceptionHandler mainExceptionHandler;
mainExceptionHandler.InstallHandler();
#endif
#ifndef WINDOWS// ignore sigpipe...
struct sigaction sigh;
sigh.sa_handler = SIG_IGN;
sigh.sa_flags = 0;sigemptyset(&sigh.sa_mask);
sigaction(SIGPIPE, &sigh, NULL);// register signals
signal(SIGHUP, signalHandler); //save
signal(SIGTRAP, signalHandler); //clean
signal(SIGCHLD, signalHandler); //refresh
signal(SIGUSR1, signalHandler); //close server
signal(SIGUSR2, signalHandler); //open server
signal(SIGCONT, signalHandler); //reload all
signal(SIGQUIT, signalHandler); //save & shutdown
signal(SIGTERM, signalHandler); //shutdown
#endifOutputHandler::getInstance();
Dispatcher::getInstance().addTask(createTask(boost::bind(otserv, args, &servicer)));g_loaderSignal.wait(g_loaderUniqueLock);
boost::this_thread::sleep(boost::posix_time::milliseconds(10000));
if(servicer.isRunning())
{
std::clog << ">> " << g_config.getString(ConfigManager::SERVER_NAME) << " server Online!" << std::endl << std::endl;
servicer.run();
}
else
std::clog << ">> " << g_config.getString(ConfigManager::SERVER_NAME) << " server Offline! No services available..." << std::endl << std::endl;#ifdef __EXCEPTION_TRACER__
mainExceptionHandler.RemoveHandler();
#endif
return 0;
}void otserv(StringVec, ServiceManager* services)
{
srand((uint32_t)OTSYS_TIME());
#if defined(WINDOWS)
SetConsoleTitle(SOFTWARE_NAME);#endif
g_game.setGameState(GAMESTATE_STARTUP);
#if !defined(WINDOWS) && !defined(__ROOT_PERMISSION__)
if(!getuid() || !geteuid())
{
std::clog << "> WARNING: " << SOFTWARE_NAME << " has been executed as super user! It is "
<< "recommended to run as a normal user." << std::endl << "Continue? (y/N)" << std::endl;
char buffer = getch();
if(buffer != 121 && buffer != 89)
startupErrorMessage("Aborted.");
}
#endifstd::clog << SOFTWARE_NAME << ", version " << SOFTWARE_VERSION << " (" << SOFTWARE_CODENAME << ")" << std::endl
<< "Compiled with " << BOOST_COMPILER << " at " << __DATE__ << ", " << __TIME__ << "." << std::endl
<< "A server developed by Elf, Talaturen, Stian, Slawkens, KaczooH and Kornholijo." << std::endl
<< "Visit our forum for updates, support and resources: http://otland.net." << std::endl << std::endl;
std::stringstream ss;
#ifdef __DEBUG__
ss << " GLOBAL";
#endif
#ifdef __DEBUG_MOVESYS__
ss << " MOVESYS";
#endif
#ifdef __DEBUG_CHAT__
ss << " CHAT";
#endif
#ifdef __DEBUG_EXCEPTION_REPORT__
ss << " EXCEPTION-REPORT";
#endif
#ifdef __DEBUG_HOUSES__
ss << " HOUSES";
#endif
#ifdef __DEBUG_LUASCRIPTS__
ss << " LUA-SCRIPTS";
#endif
#ifdef __DEBUG_MAILBOX__
ss << " MAILBOX";
#endif
#ifdef __DEBUG_NET__
ss << " NET";
#endif
#ifdef __DEBUG_NET_DETAIL__
ss << " NET-DETAIL";
#endif
#ifdef __DEBUG_RAID__
ss << " RAIDS";
#endif
#ifdef __DEBUG_SCHEDULER__
ss << " SCHEDULER";
#endif
#ifdef __DEBUG_SPAWN__
ss << " SPAWNS";
#endif
#ifdef __SQL_QUERY_DEBUG__
ss << " SQL-QUERIES";
#endifstd::string debug = ss.str();
if(!debug.empty())
std::clog << ">> Debugging:" << debug << "." << std::endl;std::clog << ">> Loading config (" << g_config.getString(ConfigManager::CONFIG_FILE) << ")" << std::endl;
if(!g_config.load())
startupErrorMessage("Unable to load " + g_config.getString(ConfigManager::CONFIG_FILE) + "!");// silently append trailing slash
std::string path = g_config.getString(ConfigManager::DATA_DIRECTORY);
g_config.setString(ConfigManager::DATA_DIRECTORY, path.erase(path.find_last_not_of("/") + 1) + "/");path = g_config.getString(ConfigManager::LOGS_DIRECTORY);
g_config.setString(ConfigManager::LOGS_DIRECTORY, path.erase(path.find_last_not_of("/") + 1) + "/");std::clog << "> Opening logs" << std::endl;
Logger::getInstance()->open();IntegerVec cores = vectorAtoi(explodeString(g_config.getString(ConfigManager::CORES_USED), ","));
if(cores[0] != -1)
{
#ifdef WINDOWS
int32_t mask = 0;
for(IntegerVec::iterator it = cores.begin(); it != cores.end(); ++it)
mask += 1 << (*it);SetProcessAffinityMask(GetCurrentProcess(), mask);
}std::stringstream mutexName;
mutexName << "forgottenserver_" << g_config.getNumber(ConfigManager::WORLD_ID);CreateMutex(NULL, FALSE, mutexName.str().c_str());
if(GetLastError() == ERROR_ALREADY_EXISTS)
startupErrorMessage("Another instance of The Forgotten Server is already running with the same worldId.\nIf you want to run multiple servers, please change the worldId in configuration file.");std::string defaultPriority = asLowerCaseString(g_config.getString(ConfigManager::DEFAULT_PRIORITY));
if(defaultPriority == "realtime")
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
else if(defaultPriority == "high")
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
else if(defaultPriority == "higher")
SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);#else
#ifndef MACOS
cpu_set_t mask;
CPU_ZERO(&mask);
for(IntegerVec::iterator it = cores.begin(); it != cores.end(); ++it)
CPU_SET((*it), &mask);sched_setaffinity(getpid(), (int32_t)sizeof(mask), &mask);
}
#endifstd::string runPath = g_config.getString(ConfigManager::RUNFILE);
if(runPath != "" && runPath.length() > 2)
{
std::ofstream runFile(runPath.c_str(), std::ios::trunc | std::ios::out);
runFile << getpid();
runFile.close();
atexit(runfileHandler);
}if(!nice(g_config.getNumber(ConfigManager::NICE_LEVEL))) {}
#endif
std::string encryptionType = asLowerCaseString(g_config.getString(ConfigManager::ENCRYPTION_TYPE));
if(encryptionType == "md5")
{
g_config.setNumber(ConfigManager::ENCRYPTION, ENCRYPTION_MD5);
std::clog << "> Using MD5 encryption" << std::endl;
}
else if(encryptionType == "sha1")
{
g_config.setNumber(ConfigManager::ENCRYPTION, ENCRYPTION_SHA1);
std::clog << "> Using SHA1 encryption" << std::endl;
}
else if(encryptionType == "sha256")
{
g_config.setNumber(ConfigManager::ENCRYPTION, ENCRYPTION_SHA256);
std::clog << "> Using SHA256 encryption" << std::endl;
}
else if(encryptionType == "sha512")
{
g_config.setNumber(ConfigManager::ENCRYPTION, ENCRYPTION_SHA512);
std::clog << "> Using SHA512 encryption" << std::endl;
}
else if(encryptionType == "vahash")
{
g_config.setNumber(ConfigManager::ENCRYPTION, ENCRYPTION_VAHASH);
std::clog << "> Using VAHash encryption" << std::endl;
}
else
{
g_config.setNumber(ConfigManager::ENCRYPTION, ENCRYPTION_PLAIN);
std::clog << "> Using plaintext encryption" << std::endl << std::endl
<< "> WARNING: This method is completely unsafe!" << std::endl
<< "> Please set encryptionType = \"sha1\" (or any other available method) in config.lua" << std::endl;
boost::this_thread::sleep(boost::posix_time::seconds(30));
}std::clog << ">> Checking software version...";
if(xmlDocPtr doc = xmlParseFile(VERSION_CHECK))
{
xmlNodePtr p, root = xmlDocGetRootElement(doc);
if(!xmlStrcmp(root->name, (const xmlChar*)"versions"))
{
p = root->children->next;
if(!xmlStrcmp(p->name, (const xmlChar*)"entry"))
{
std::string version;
int32_t patch, build, timestamp;bool tmp = false;
if(readXMLString(p, "version", version) && version != SOFTWARE_VERSION)
tmp = true;if(readXMLInteger(p, "patch", patch) && patch > VERSION_PATCH)
tmp = true;if(readXMLInteger(p, "build", build) && build > VERSION_BUILD)
tmp = true;if(readXMLInteger(p, "timestamp", timestamp) && timestamp > VERSION_TIMESTAMP)
tmp = true;if(tmp)
{
std::clog << " ";
if(version.find("_SVN") == std::string::npos)
std::clog << "running sub version, please mind it's unstable and only for testing purposes!";
else
std::clog << "outdated, please consider upgrading!";std::clog << std::endl << "> Current version information - version: "
<< SOFTWARE_VERSION << ", patch: " << VERSION_PATCH
<< ", build: " << VERSION_BUILD << ", timestamp: " << VERSION_TIMESTAMP
<< "." << std::endl << "> Latest version information - version: "
<< version << ", patch: " << patch << ", build: " << build
<< ", timestamp: " << timestamp << "." << std::endl;
if(g_config.getBool(ConfigManager::CONFIRM_OUTDATED_VERSION) &&
asLowerCaseString(version).find("_svn") == std::string::npos)
{
std::clog << "Continue? (y/N)" << std::endl;
char buffer = getch();
if(buffer != 121 && buffer != 89)
startupErrorMessage("Aborted.");
}
}
else
std::clog << "up to date!" << std::endl;
}
else
std::clog << "failed checking - malformed entry." << std::endl;
}
else
std::clog << "failed checking - malformed file." << std::endl;xmlFreeDoc(doc);
}
else
std::clog << "failed - could not parse remote file (are you connected to any network?)" << std::endl;std::clog << ">> Loading RSA key" << std::endl;
g_RSA = RSA_new();BN_dec2bn(&g_RSA->p, g_config.getString(ConfigManager::RSA_PRIME1).c_str());
BN_dec2bn(&g_RSA->q, g_config.getString(ConfigManager::RSA_PRIME2).c_str());
BN_dec2bn(&g_RSA->d, g_config.getString(ConfigManager::RSA_PRIVATE).c_str());
BN_dec2bn(&g_RSA->n, g_config.getString(ConfigManager::RSA_MODULUS).c_str());
BN_dec2bn(&g_RSA->e, g_config.getString(ConfigManager::RSA_PUBLIC).c_str());
// TODO: dmp1, dmq1, iqmp?
// This check will verify keys set in config.lua
if(!RSA_check_key(g_RSA))
{
std::stringstream s;
s << "OpenSSL failed - ";
ERR_load_crypto_strings();
s << ERR_error_string(ERR_get_error(), NULL);
startupErrorMessage(s.str());
}
std::clog << ">> Starting SQL connection" << std::endl;
Database* db = Database::getInstance();
if(db && db->isConnected())
{
std::clog << ">> Running Database Manager" << std::endl;
if(DatabaseManager::getInstance()->isDatabaseSetup())
{
uint32_t version = 0;
do
{
version = DatabaseManager::getInstance()->updateDatabase();
if(!version)
break;std::clog << "> Database has been updated to version: " << version << "." << std::endl;
}
while(version < VERSION_DATABASE);
}
else
startupErrorMessage("The database you have specified in config.lua is empty, please import schemas/<engine>.sql to the database.");DatabaseManager::getInstance()->checkTriggers();
DatabaseManager::getInstance()->checkEncryption();
if(g_config.getBool(ConfigManager::OPTIMIZE_DATABASE) && !DatabaseManager::getInstance()->optimizeTables())
std::clog << "> No tables were optimized." << std::endl;
}
else
startupErrorMessage("Couldn't estabilish connection to SQL database!");std::clog << ">> Loading items (OTB)" << std::endl;
if(Item::items.loadFromOtb(getFilePath(FILE_TYPE_OTHER, "items/items.otb")))
startupErrorMessage("Unable to load items (OTB)!");std::clog << ">> Loading items (XML)" << std::endl;
if(!Item::items.loadFromXml())
{
std::clog << "Unable to load items (XML)! Continue? (y/N)" << std::endl;
char buffer = getch();
if(buffer != 121 && buffer != 89)
startupErrorMessage("Unable to load items (XML)!");
}std::clog << ">> Loading groups" << std::endl;
if(!Groups::getInstance()->loadFromXml())
startupErrorMessage("Unable to load groups!");std::clog << ">> Loading vocations" << std::endl;
if(!Vocations::getInstance()->loadFromXml())
startupErrorMessage("Unable to load vocations!");std::clog << ">> Loading outfits" << std::endl;
if(!Outfits::getInstance()->loadFromXml())
startupErrorMessage("Unable to load outfits!");std::clog << ">> Loading chat channels" << std::endl;
if(!g_chat.loadFromXml())
startupErrorMessage("Unable to load chat channels!");if(g_config.getBool(ConfigManager::SCRIPT_SYSTEM))
{
std::clog << ">> Loading script systems" << std::endl;
if(!ScriptManager::getInstance()->loadSystem())
startupErrorMessage();
}
else
ScriptManager::getInstance();std::clog << ">> Loading mods..." << std::endl;
if(!ScriptManager::getInstance()->loadMods())
startupErrorMessage();#ifdef __LOGIN_SERVER__
std::clog << ">> Loading game servers" << std::endl;
if(!GameServers::getInstance()->loadFromXml(true))
startupErrorMessage("Unable to load game servers!");#endif
std::clog << ">> Loading experience stages" << std::endl;
if(!g_game.loadExperienceStages())
startupErrorMessage("Unable to load experience stages!");std::clog << ">> Loading monsters" << std::endl;
if(!g_monsters.loadFromXml())
{
std::clog << "Unable to load monsters! Continue? (y/N)" << std::endl;
char buffer = getch();
if(buffer != 121 && buffer != 89)
startupErrorMessage("Unable to load monsters!");
}std::clog << ">> Loading map and spawns..." << std::endl;
if(!g_game.loadMap(g_config.getString(ConfigManager::MAP_NAME)))
startupErrorMessage();std::clog << ">> Checking world type... ";
std::string worldType = asLowerCaseString(g_config.getString(ConfigManager::WORLD_TYPE));
if(worldType == "open" || worldType == "2" || worldType == "openpvp")
{
g_game.setWorldType(WORLDTYPE_OPEN);
std::clog << "Open PvP" << std::endl;
}
else if(worldType == "optional" || worldType == "1" || worldType == "optionalpvp")
{
g_game.setWorldType(WORLDTYPE_OPTIONAL);
std::clog << "Optional PvP" << std::endl;
}
else if(worldType == "hardcore" || worldType == "3" || worldType == "hardcorepvp")
{
g_game.setWorldType(WORLDTYPE_HARDCORE);
std::clog << "Hardcore PvP" << std::endl;
}
else
{
std::clog << std::endl;
startupErrorMessage("Unknown world type: " + g_config.getString(ConfigManager::WORLD_TYPE));
}std::clog << ">> Initializing game state and binding services..." << std::endl;
g_game.setGameState(GAMESTATE_INIT);
IPAddressList ipList;std::string ip = g_config.getString(ConfigManager::IP);
if(asLowerCaseString(ip) == "auto")
{
// TODO: automatic shit
}IPAddress m_ip;
if(ip.size())
{
std::clog << "> Global IP address: ";
uint32_t resolvedIp = inet_addr(ip.c_str());
if(resolvedIp == INADDR_NONE)
{
struct hostent* host = gethostbyname(ip.c_str());
if(!host)
{
std::clog << "..." << std::endl;
startupErrorMessage("Cannot resolve " + ip + "!");
}resolvedIp = *(uint32_t*)host->h_addr;
}serverIps.push_front(std::make_pair(resolvedIp, 0));
m_ip = boost::asio::ip::address_v4(swap_uint32(resolvedIp));ipList.push_back(m_ip);
std::clog << m_ip.to_string() << std::endl;
}ipList.push_back(boost::asio::ip::address_v4(INADDR_LOOPBACK));
if(!g_config.getBool(ConfigManager::BIND_ONLY_GLOBAL_ADDRESS))
{
char hostName[128];
if(!gethostname(hostName, 128))
{
if(hostent* host = gethostbyname(hostName))
{
std::stringstream s;
for(uint8_t** addr = (uint8_t**)host->h_addr_list; addr[0] != NULL; addr++)
{
uint32_t resolved = swap_uint32(*(uint32_t*)(*addr));
if(m_ip.to_v4().to_ulong() == resolved)
continue;ipList.push_back(boost::asio::ip::address_v4(resolved));
serverIps.push_front(std::make_pair(*(uint32_t*)(*addr), 0x0000FFFF));s << (int32_t)(addr[0][0]) << "." << (int32_t)(addr[0][1]) << "."
<< (int32_t)(addr[0][2]) << "." << (int32_t)(addr[0][3]) << "\t";
}if(s.str().size())
std::clog << "> Local IP address(es): " << s.str() << std::endl;
}
}serverIps.push_front(std::make_pair(LOCALHOST, 0xFFFFFFFF));
if(m_ip.to_v4().to_ulong() != LOCALHOST)
ipList.push_back(boost::asio::ip::address_v4(LOCALHOST));
}
else if(ipList.size() < 2)
startupErrorMessage("Unable to bind any IP address! You may want to disable \"bindOnlyGlobalAddress\" setting in config.lua");services->add<ProtocolStatus>(g_config.getNumber(ConfigManager::STATUS_PORT), ipList);
services->add<ProtocolManager>(g_config.getNumber(ConfigManager::MANAGER_PORT), ipList);
#ifdef __OTADMIN__
services->add<ProtocolAdmin>(g_config.getNumber(ConfigManager::ADMIN_PORT), ipList);
#endif//services->add<ProtocolHTTP>(8080, ipList);
if(
#ifdef __LOGIN_SERVER__
true
#else
!g_config.getBool(ConfigManager::LOGIN_ONLY_LOGINSERVER)
#endif
)
{
services->add<ProtocolLogin>(g_config.getNumber(ConfigManager::LOGIN_PORT), ipList);
services->add<ProtocolOldLogin>(g_config.getNumber(ConfigManager::LOGIN_PORT), ipList);
}services->add<ProtocolGame>(g_config.getNumber(ConfigManager::GAME_PORT), ipList);
services->add<ProtocolOldGame>(g_config.getNumber(ConfigManager::LOGIN_PORT), ipList);
std::clog << "> Bound ports: ";std::list<uint16_t> ports = services->getPorts();
for(std::list<uint16_t>::iterator it = ports.begin(); it != ports.end(); ++it)
std::clog << (*it) << "\t";std::clog << std::endl << ">> Everything smells good, server is starting up..." << std::endl;
g_game.start(services);
g_game.setGameState(g_config.getBool(ConfigManager::START_CLOSED) ? GAMESTATE_CLOSED : GAMESTATE_NORMAL);
g_loaderSignal.notify_all();
}
E TAMBÉM EM BAIXO MOSTROU ISSO AKI, MAN POR FAVOR SE PODER MIM AJUDA MIM AJUDA AEW POR FAVOR MESMO
-
Man, eu baixei essa TFS-3884 já compilada
eu tentei por online, porém quando eu tentor ligar um sv da um erro, que fala que "Unable to load config.lua", e eu já compilei a source e peguei o the forgotten server, e também já o substituir-l, só que mesmo assim não vai, será que você poderia mim ajudar ?
-
O man eu baixei esse negocio aki
só que agora esse negocio aew de trunk.r3884 eu não sei oque é, você poderia mim explicar oque fazer com isso ?
-
Sabe a Distro do seu server ? Aquele arquivo.exe que liga seu servidor ? Então esses arquivos que você baixo são as source daquilo, essas source compiladas se tornam aquele exe.
As source são tudo que seu Servidor faz, com as source você pode fazer grandes alterações no server, coisa que um Script não pode fazer, todos os grandes Servidores, tem as source do Server, pois para trazer de fatos novidades e inovações, você precisará delas. Procure mais no fórum e você verá do que estou falando! xD
-
aah, só que na outra pasta, ja tem esse arquivo exe, ent que dizer que a source ja foi compilada né, só que na pasta tem esse aquivo exe, mais ta faltando as pasta DATA, DOC, MODS e SCHEMAS e o consig.lua, só que nesta pasta da source
tem essas pasta, ent eu tenho que pegar desta pasta e copiar para a pasta onde ta o exe ?
-
-
Man, poderia mim explicar um negocio pra mim por favor ?
SpoilerEu uso ot serv derivado de nautibia, e eu quera saber uma coisa, pra que server cada pasta daquela fica na pasta data, por que eu não entendo muita daquelas pasta, ae eu queria saber + ou menos assim, a pasta actions, quais são os system que vão nela, e assim por diante, se você poder explica cada pasta u lhe agradeceria KK, desde já orbigado pela atenção
-
Mano, eu mudei o sv para 8.60, e agora as spells sai diferente, olha
SpoilerEu fiz um topico pedindo ajuda mais ninguém respondeu, se você poder min ajuda, agradeço
-
Foi bem isso que eu fiz KK, tem mais de uma semana eu sem conseguir arrumar esse erro, hoje que eu abrir dois config.lua e fui olhando e vi isso ae, e arrumei KK, mano poderia min ajudar com esse erro aki ? por favor
SpoilerPor favor
Mano, eu criei um tópico, mais meu amigo não consegue entrar no tópico, é porque não foi aprovado ainda ?
-
Mano, eu não consigo instalar o war system, da erro quando eu uso o comando, esse erro aki
00:48 You Cannot execute this talkactions.
-
Minha Primeira sprite KK, oque você acha ? devo tentar ir em frente ou desisto ?
- Mostrar comentários anteriores %s mais
-
'-' blz
Man, mim fala um Mapa de nto que da para eu editar ? o Nto Force eu to achando aquele mapa meio chato .-.
Man eu baixei esse servidor aki de dbz
http://www.xtibia.com/forum/topic/241282-dragon-ball-evolution-source-linux-ubuntu-1204-e-windows/
Só que eu não entendo nd de source, você pode mim explicar como faço para ligar esse servidor ? porque eu nunca vi um ot assim '-'
-
o mano, eu tenho uma script aki, que é para em determinada transformação, sair um effect, só que alguns effect fica do lado do player, tem como você modifica a script e por para mudar o lugar do effect ? mudar apenas o effect que agente querer, se poder min ajuda, agradeço.
Spoiler}
function onThink(interval)
for _, pid in ipairs(getPlayersOnline()) do
local effect = effects[getPlayerVocation(pid)]
if(effect) then
doSendMagicEffect(getCreaturePos(pid), effect)
end
endreturn true
end -
O mano, poderia editar essa script para min por favor, eu queria que podes-se mudar a posição de tal effect, é por por que quando adiciono outro effect diferente buga, fica aparecendo do lado do player, será que teria como por para configurar os effect ? onde cada vai aparecer, por favor min ajuda :D
Spoilerlocal effects = {
--_GOKU_--
[4] = 106,
[5] = 85,
[6] = 106,
[8] = 87,[13] = 84,
[14] = 84,
[15] = 89,
[16] = 244,
[473] = 115,--_VEGETA_--
[21] = 85,
[22] = 106,
[23] = 106,[28] = 84,
[29] = 84,
[30] = 89,
[31] = 244,
[474] = 41,--_PICCOLO_--
[34] = 109,[39] = 104,
[41] = 88,
[43] = 88,
[44] = 104,--_C17_--
[49] = 87,[51] = 84,
[52] = 93,
[54] = 87,
[55] = 90,
[56] = 96,--_GOHAN_--
[60] = 106,[68] = 84,
[69] = 89,
[70] = 90,--_TRUNKS_--
[75] = 85,[79] = 85,
[80] = 84,
[81] = 89,
[82] = 90,
[490] = 244,--_CELL_--
[88] = 107,
[89] = 104,
[90] = 104,
[91] = 106,
[92] = 104,
[93] = 89,
[94] = 71,--_FREEZA_--
[102] = 84,
[103] = 84,
[104] = 84,
[105] = 84,
[106] = 84,
[107] = 84,
[108] = 84,
[109] = 89,
[110] = 113,--_MAJIN BOO_--
[118] = 109,
[119] = 92,
[120] = 92,
[121] = 105,
[122] = 92,
[123] = 92,
[124] = 91,
[125] = 91,
[126] = 101,
[475] = 89,--_BROLY_--
[131] = 85,[135] = 98,
[136] = 84,
[137] = 84,
[138] = 89,
[139] = 244,--_C18_--
[144] = 87,[146] = 87,
[147] = 93,
[149] = 87,
[150] = 86,
[151] = 90,--_UUB_--
[156] = 84,[157] = 84,
[158] = 84,
[159] = 84,
[160] = 84,
[161] = 96,
[162] = 89,
[163] = 90,--_GOTEN_--
[169] = 106,
[170] = 85,[174] = 85,
[175] = 85,
[176] = 90,
[177] = 84,--_CHIBI TRUNKS_--
[183] = 106,
[184] = 85,[188] = 85,
[189] = 85,
[190] = 90,
[191] = 84,--_COOLER_--
[198] = 86,
[199] = 86,
[200] = 86,
[201] = 87,
[202] = 89,
[203] = 86,
[204] = 85,
[493] = 90,
[205] = 96,--_DENDE_--
[215] = 88,
[216] = 102,
[217] = 240,--_TSUFUL_--
[219] = 84,
[220] = 87,
[221] = 84,
[222] = 84,[223] = 84,
[224] = 84,
[227] = 96,
[228] = 89,
[229] = 96,--_BARDOCK_--
[235] = 85,[237] = 109,
[238] = 106,
[239] = 85,
[240] = 84,
[241] = 84,
[242] = 89,
[243] = 90,--_KURIRIN_--
[250] = 107,
[252] = 107,
[253] = 84,
[254] = 89,
[255] = 89,--_PAN_--
[260] = 87,[261] = 107,
[262] = 106,
[263] = 106,
[264] = 84,
[265] = 84,
[266] = 89,
[267] = 90,--_KAIO_--
[272] = 86,[273] = 91,
[274] = 86,
[276] = 86,
[277] = 86,
[278] = 86,
[279] = 90,--_VIDEL_--
[285] = 106,
[286] = 106,
[287] = 106,
[288] = 106,
[289] = 87,
[290] = 87,
[291] = 41,--_JANEMBA_--
[297] = 84,
[298] = 84,
[299] = 110,
[300] = 84,
[301] = 84,
[302] = 86,
[303] = 90,
[491] = 89,--_TENSHINHAN_--
[307] = 107,
[308] = 107,[310] = 107,
[312] = 85,
[313] = 84,
[314] = 108,
[315] = 108,--_JENK_--
[322] = 109,
[325] = 84,
[326] = 87,
[327] = 98,--_RADITZ_--
[332] = 85,[333] = 106,
[334] = 106,
[335] = 106,
[336] = 85,
[337] = 84,
[338] = 89,
[339] = 90,--_C16_--
[344] = 106,[346] = 88,
[347] = 95,
[348] = 106,
[349] = 97,
[350] = 98,
[351] = 96,--_TURLES_--
[355] = 106,
[356] = 87,[358] = 94,
[360] = 106,
[361] = 84,
[362] = 89,
[363] = 90,--_BULMA_--
[368] = 87,[371] = 106,
[372] = 87,
[373] = 84,
[374] = 87,
[375] = 89,--_SHENRON_--
[380] = 89,[381] = 89,
[382] = 87,
[383] = 85,
[384] = 89,
[385] = 90,
[386] = 84,
[387] = 84,--_VEGETTO_--
[390] = 106,
[392] = 85,[393] = 106,
[394] = 106,
[395] = 85,
[396] = 85,
[397] = 84,
[398] = 89,
[399] = 244,--_TAPION_--
[404] = 84,[405] = 96,
[406] = 96,
[409] = 87,
[410] = 87,
[411] = 84,
[412] = 90,
[476] = 89,--_KAME_--
[423] = 89,
[424] = 85,--_KING VEGETA_--
[429] = 85,[432] = 85,
[434] = 89,
[435] = 84,
[436] = 84,--_KAGOME_--
[440] = 106,
[441] = 85,[445] = 106,
[446] = 244,
[447] = 84,
[448] = 115,--_ZAIKO_--
[451] = 106,
[452] = 106,
[453] = 98,[455] = 85,
[456] = 85,
[457] = 106,
[458] = 88,
[459] = 96,
[460] = 96,
[477] = 90,--_CHILLED_--
[466] = 84,
[467] = 84,
[468] = 84,
[469] = 84,
[470] = 105,
[471] = 96,
[472] = 86,
[492] = 89,--_C8_--
[480] = 106,
[481] = 106,
[482] = 89,
[483] = 106,
[545] = 105,
[557] = 114,
[486] = 97,
[487] = 244,
[488] = 98,
[489] = 96,
[569] = 102,
[581] = 101,
[593] = 99,
[606] = 90,
[607] = 90,
[633] = 90,
[608] = 90,
[633] = 102,
[645] = 90,
[657] = 90,
[669] = 41,
[670] = 90,
[671] = 90,
[673] = 115,
[699] = 104,
[712] = 90,
[713] = 90,
[711] = 90,
[687] = 115,
[674] = 116,
[675] = 108,
[672] = 90,
[726] = 90,
[738] = 90,
[750] = 113,
[751] = 90,
[752] = 90,
[754] = 24,
[753] = 100,
[766] = 90,
[767] = 115,
[768] = 115,
[769] = 115,
[770] = 115,
[806] = 98,
[794] = 102,
[782] = 93,
[818] = 105,
[830] = 105,
[842] = 104,
[847] = 90,
[849] = 90,
[850] = 90,
[848] = 90,
[851] = 98,
[852] = 104,
[854] = 98,
[855] = 101,
[856] = 108,
[853] = 100,
[868] = 107,
[880] = 98,
[846] = 90,
[881] = 90,
[882] = 90,
[883] = 90,
[884] = 90,
[885] = 90,
[886] = 90,
[887] = 90,
[888] = 90,
[889] = 90,
[890] = 90,
[891] = 90,
[892] = 90,
[893] = 90,
[894] = 90,
[895] = 90,
[896] = 90,
[897] = 90,
[898] = 90,
[899] = 41,
[900] = 41,
[913] = 90,
[914] = 41,
[915] = 41,
[916] = 41,
[917] = 41,
--_Goku God_--
[521] = 24
}function onThink(interval)
for _, pid in ipairs(getPlayersOnline()) do
local effect = effects[getPlayerVocation(pid)]
if(effect) then
doSendMagicEffect(getCreaturePos(pid), effect)
end
endreturn true
end-
Eu não criei por que se ajuda-se aki eu poderia lhe da rep + do mesmo jeito, mais vou criar aki kk
O @Vodkart aki o link do tópico
-
O mano, você poderia descompilar o cliente do nto Infinity para me ? PF
-
Man, eu estou com o servidor Pokemon Dash v10.1 aki, só que não contem open source, você sabe se tem alguma source compatível com esse servidor ? OBS: ele tem Level system, creio que você já sabia disso, mas poderia ter esquecido né
- Mostrar comentários anteriores %s mais
-
Quer aumentar efeitos ? Procure, corra atrás, a parada do client sim, só aceita mais de 255 se você fazer o client ler em uint_16, não precisa de DLL, use um programa chamado OLLYDBG, com ele você pode fazer essa alteração, e o seu old-client poder ler quantos efeitos quiser. Não vou ensinar, nem tente pergunta, se quiser procure tutoriais aqui mesmo no TK de como aumentar os efeitos até 255 no old client, se não está contente com 255, mude para OTClient ou dêh um jeito de descobrir como fazer o client normal ler em uint_16.
-
Man, serpa que você poderia mim ajudar em um negocio no cliente ? eu queria saber se você poderia mim ajudar a mudar o negocio do cliente de uint8 para uint16, será que você poderia mim ajudar ? eu sou estou te pedindo isso porque pra mim você é muito inteligente e poderia saber '-'
-
Ae mano, depois que a gente usa a dll de extender o cliente, o object builder não abre mais o spr, será que tem algum jeito de arrumar isso ?
-
Man, aquela source la é compatível com o servidor do nto force ?
-
Man, eu baixei um cliente aki de Nto que tem mais de 400 effect, ae na pasta do cliente ta o dat, pic e spr, e veio o tibia normal, será que se eu pegar esse tibia e por o ip do meu server da certo ? se de certo poderia min explicar como achar o ip do cliente ? por que eu não sei o ip do cliente
-
Man, mim explica como faço para balancear as vocations ? pra elas não ser mais forte que as outras e não ter mais vida que as outras e tals '-'
-
Man, pode mim explicar qual a função de cada pasta no otserv derivado ? no Nto force mesmo, aquelas pasta que fica dentro da pasta data, qual a função de cada uma ? os sistemas que vão nelas são quais ? system que que ?
-
Actions Como o nome já diz, são ações, exemplo você clica em um item e é teleportado pro Templo, é ali que vai Scripts assim,
talkactions o nome já diz tudo, talk = falar e actions já sabe, talk actions = falar ação = você falar algo e acontece, são os comandos
/t /goto você falar o comando e acontece a ação, movementes são movimentos, serve mais pra tiles(pisos), tipo você passa em um lugar mais só passa se for vip, se for da staff, se tiver graduação, se tiver item e esses tipos.
Spell onde fica os poderes que no caso do Nto são os jutsus, creature scripts são mais pra ações nos Players, globaleventes já diz tudo, são eventos global que acontece pro servidor inteiro, como o save, o clean, torneios, eventos e etc..
xml são onde fica as configs principais do Server, world nem preciso falar, NPC também nem preciso falar, e lib são onde fica arquivos de configurações de funções, são onde fica arquivos importantes do Server, onde concentra configurações de funções.
Posso ta errado.
Cara são perguntas bestas que você poderia saber olhando as Scripts, olhando o que tem dentro, abrindo o glooge translate e traduzindo as palavras, então vou fazer assim, perguntas que você pode achar facilmente e sozinho, se procurar com vontade, não irei responder, deixarei falando sozinho. Se quiser alguma ajuda crie um tópico, agora não me peça pra responder coisa simples que já existe, ou que você pode saber apenas se presta atenção nas palavras!
Até! xD
-