// Load Server configuration void CWorldServer::LoadConfigurations( char* file ) { //Database Config.SQLServer.pcServer = ConfigGetString ( file, "mysql_host", "localhost" ); Config.SQLServer.pcDatabase = ConfigGetString ( file, "mysql_database", "roseon_beta" ); Config.SQLServer.pcUserName = ConfigGetString ( file, "mysql_user", "root" ); Config.SQLServer.pcPassword = ConfigGetString ( file, "mysql_pass", "" ); Config.SQLServer.pcPort = ConfigGetInt ( file, "mysql_port", 3306 ); //Server Config.ServerID = ConfigGetInt ( file, "serverid", 1 ); Config.ServerType = ConfigGetInt ( file, "servertype", 2 ); Config.WorldPort = ConfigGetInt ( file, "serverport", 29200 ); Config.WorldIP = ConfigGetString ( file, "serverip", "127.0.0.1" ); Config.ParentID = ConfigGetInt ( file, "parentid", 1 ); Config.ServerName = ConfigGetString ( file, "servername", "Channel" ); Config.MaxConnections = ConfigGetInt ( file, "maxconnections", 100 ); Config.Connection = ConfigGetInt ( file, "connection", 0 ); Config.LanIP = ConfigGetString ( file, "lanip", "192.168.0.1" ); Config.LanSubnet = ConfigGetString ( file, "lansubmask", "192.168.0" ); //World Config.MinimumAccessLevel = ConfigGetInt ( file, "minimal_access_level", 100 ); Config.usethreads = ConfigGetInt ( file, "usethreads", 0 )==0?false:true; Config.WELCOME_MSG = ConfigGetString ( file, "welcome_msg", "Welcome to Rose Online" ); Log (MSG_INFO, "osRose - http://forum.dev-osrose.com"); //Password Config.LoginPass = ConfigGetInt ( file, "loginpass", 123456 ); Config.CharPass = ConfigGetInt ( file, "charpass", 123456 ); Config.WorldPass = ConfigGetInt ( file, "worldpass", 123456 ); if(Config.AUTOSAVE==1) Log( MSG_INFO, "Autosaving Every %i minutes", Config.SAVETIME/60 ); LoadCommandLevels(); }
void UpdateDrives(HWND hWnd) { int i, hdbi, hdci, hddi; wchar_t hdb[256], hdc[256], hdd[256]; hdbi = hdci = hddi = -1; if(hWnd) { SendMessage(GetDlgItem(hWnd, IDC_HDB), CB_RESETCONTENT, 0, 0); SendMessage(GetDlgItem(hWnd, IDC_HDB), CB_ADDSTRING, 0, (LPARAM)GetString(IDS_LISTNONE)); SendMessage(GetDlgItem(hWnd, IDC_HDB), CB_SETCURSEL, 0, 0); SendMessage(GetDlgItem(hWnd, IDC_HDC), CB_RESETCONTENT, 0, 0); SendMessage(GetDlgItem(hWnd, IDC_HDC), CB_ADDSTRING, 0, (LPARAM)GetString(IDS_LISTNONE)); SendMessage(GetDlgItem(hWnd, IDC_HDC), CB_SETCURSEL, 0, 0); SendMessage(GetDlgItem(hWnd, IDC_HDD), CB_RESETCONTENT, 0, 0); SendMessage(GetDlgItem(hWnd, IDC_HDD), CB_ADDSTRING, 0, (LPARAM)GetString(IDS_LISTNONE)); SendMessage(GetDlgItem(hWnd, IDC_HDD), CB_SETCURSEL, 0, 0); } gDriveCount = EnumerateDrives(gDrives, DRIVE_MAX); ConfigGetString(L"hdb", hdb); ConfigGetString(L"hdc", hdc); ConfigGetString(L"hdd", hdd); for(i=0; i<gDriveCount; i++) { if(wcscmp(hdb, gDrives[i].path) == 0) hdbi = i; else if(wcscmp(hdc, gDrives[i].path) == 0) hdci = i; else if(wcscmp(hdd, gDrives[i].path) == 0) hddi = i; if(hWnd) { SendMessage(GetDlgItem(hWnd, IDC_HDB), CB_ADDSTRING, 0, (LPARAM)gDrives[i].desc); SendMessage(GetDlgItem(hWnd, IDC_HDC), CB_ADDSTRING, 0, (LPARAM)gDrives[i].desc); SendMessage(GetDlgItem(hWnd, IDC_HDD), CB_ADDSTRING, 0, (LPARAM)gDrives[i].desc); } } if(hdbi == -1) ConfigPutString(L"hdb", L""); else if(hWnd) SendMessage(GetDlgItem(hWnd, IDC_HDB), CB_SETCURSEL, (WPARAM)hdbi+1, 0); if(hdci == -1) ConfigPutString(L"hdc", L""); else if(hWnd) SendMessage(GetDlgItem(hWnd, IDC_HDC), CB_SETCURSEL, (WPARAM)hdci+1, 0); if(hddi == -1) ConfigPutString(L"hdd", L""); else if(hWnd) SendMessage(GetDlgItem(hWnd, IDC_HDD), CB_SETCURSEL, (WPARAM)hddi+1, 0); }
void ShowSetupDialog(HWND hWnd, HWND hCaller, UINT uMsg) { wchar_t serverIP[256]; wchar_t checkAutoStart[256]; wchar_t checkWrite[256]; RECT desktopRect, dialogRect; POINT showPos; if(gSetupShown) { ShowWindow(hWnd, SW_HIDE); gSetupShown = FALSE; return; } UpdateDrives(hWnd); UpdateInterfaces(hWnd); SetDlgItemText(hWnd, IDC_STATUS, TranslateServerStatus()); wcscpy_s(serverIP, 256, GetString(IDS_SERVER_ETH0)); wcscat_s(serverIP, 256, QEMU_IP); SetDlgItemText(hWnd, IDC_ETH0, serverIP); ConfigGetString(L"autostart", checkAutoStart); ConfigGetString(L"rw", checkWrite); if(wcscmp(checkAutoStart, L"yes") == 0) SendMessage(GetDlgItem(hWnd, IDC_AUTOSERVER), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); else SendMessage(GetDlgItem(hWnd, IDC_AUTOSERVER), BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); if(wcscmp(checkWrite, L"yes") == 0) SendMessage(GetDlgItem(hWnd, IDC_MOUNTRW), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); else SendMessage(GetDlgItem(hWnd, IDC_MOUNTRW), BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); if(ConfigStartupQuery(GetString(IDS_NAME))) SendMessage(GetDlgItem(hWnd, IDC_AUTOSTART), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); else SendMessage(GetDlgItem(hWnd, IDC_AUTOSTART), BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); GetClientRect(GetDesktopWindow(), &desktopRect); GetWindowRect(hWnd, &dialogRect); showPos.x = (desktopRect.right - (dialogRect.right - dialogRect.left)) / 2; showPos.y = (desktopRect.bottom - (dialogRect.bottom - dialogRect.top)) / 2; SetWindowPos(hWnd, HWND_TOPMOST, showPos.x, showPos.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); gSetupShown = TRUE; }
// Load Server configuration void CCharServer::LoadConfigurations( char* file ) { //Database Config.SQLServer.pcServer = ConfigGetString ( file, "mysql_host", "localhost" ); Config.SQLServer.pcDatabase = ConfigGetString ( file, "mysql_database", "fate" ); Config.SQLServer.pcUserName = ConfigGetString ( file, "mysql_user", "root" ); Config.SQLServer.pcPassword = ConfigGetString ( file, "mysql_pass", "0urf4t3" ); Config.SQLServer.pcPort = ConfigGetInt ( file, "mysql_port", 3306 ); //Server Config.ServerID = ConfigGetInt ( file, "serverid", 1 ); Config.ServerType = ConfigGetInt ( file, "servertype", 1 ); Config.CharIP = ConfigGetString ( file, "serverip", "209.141.43.6" ); Config.CharPort = ConfigGetInt ( file, "serverport", 29100 ); Config.ParentID = ConfigGetInt ( file, "parentid", 0 ); Config.ServerName = ConfigGetString ( file, "servername", "FableRose" ); Config.Connection = ConfigGetInt ( file, "connection", 0 ); Config.LanIP = ConfigGetString ( file, "lanip", "192.168.1.20" ); Config.LanSubnet = ConfigGetString ( file, "lansubmask", "255.255.255.0" ); //Char Config.usethreads = ConfigGetInt ( file, "usethreads", 0 )==0?false:true; Config.DeleteTime = ConfigGetInt ( file, "deletetime", 36000 ); Config.MinimumAccessLevel = ConfigGetInt ( file, "accesslevel", 100 ); //Password Config.LoginPass = ConfigGetInt ( file, "loginpass", 123456 ); Config.CharPass = ConfigGetInt ( file, "charpass", 123456 ); Config.WorldPass = ConfigGetInt ( file, "worldpass", 123456 ); }
// Load Server configuration void CLoginServer::LoadConfigurations( char* file ) { //Database Config.SQLServer.pcServer = ConfigGetString ( file, "mysql_host", "localhost" ); Config.SQLServer.pcDatabase = ConfigGetString ( file, "mysql_database", "roseon_beta" ); Config.SQLServer.pcUserName = ConfigGetString ( file, "mysql_user", "root" ); Config.SQLServer.pcPassword = ConfigGetString ( file, "mysql_pass", "" ); Config.SQLServer.pcPort = ConfigGetInt ( file, "mysql_port", 3306 ); //Server Config.ServerID = ConfigGetInt ( file, "serverid", 0 ); Config.ServerType = ConfigGetInt ( file, "servertype", 0 ); Config.LoginIP = ConfigGetString ( file, "serverip", "127.0.0.1" ); Config.LoginPort = ConfigGetInt ( file, "serverport", 29000 ); Config.ServerName = ConfigGetString ( file, "servername", "Loginserver" ); Config.Connection = ConfigGetInt ( file, "connection", 0 ); Config.LanIP = ConfigGetString ( file, "lanip", "192.168.0.1" ); Config.LanSubnet = ConfigGetString ( file, "lansubmask", "192.168.0" ); //Passwords Config.LoginPass = ConfigGetInt ( file, "loginpass", 123456 ); Config.CharPass = ConfigGetInt ( file, "charpass", 123456 ); Config.WorldPass = ConfigGetInt ( file, "worldpass", 123456 ); //Login Config.MinimumAccessLevel = ConfigGetInt ( file, "accesslevel", 100 ); Config.usethreads = ConfigGetInt ( file, "usethreads", 0 )==0?false:true; Config.CreateLoginAccount = ConfigGetInt ( file, "CreateLoginAccount", 0 )==0?false:true; Config.checkGameGuard = ConfigGetInt ( file, "checkGameGuard", 1)==0?false:true; }
void UpdateInterfaces(HWND hWnd) { wchar_t iface_uid[256]; int iface_index; NET_IFACE *iface; ConfigGetString(L"net_uid", iface_uid); gInterfaceCount = EnumerateInterfaces(gInterfaces, IFACE_MAX); iface = ResolveInterface(iface_uid, &iface_index, gInterfaces, gInterfaceCount); if(hWnd) { int i, list_index=0; SendMessage(GetDlgItem(hWnd, IDC_IFNAME), CB_RESETCONTENT, 0, 0); SendMessage(GetDlgItem(hWnd, IDC_IFNAME), CB_ADDSTRING, 0, (LPARAM)GetString(IDS_LISTNONE)); SetDlgItemText(hWnd, IDC_TAP, GetString(IDS_LISTNONE)); for(i=0; i<gInterfaceCount; i++) SendMessage(GetDlgItem(hWnd, IDC_IFNAME), CB_ADDSTRING, 0, (LPARAM)gInterfaces[i].fname); if(iface) list_index = iface_index+1; SendMessage(GetDlgItem(hWnd, IDC_IFNAME), CB_SETCURSEL, (WPARAM)list_index, 0); } if(!iface) { ConfigPutString(L"net_uid", L""); ConfigPutString(L"net_name", L""); } else { ConfigPutString(L"net_name", iface->fname); if(hWnd) SetDlgItemText(hWnd, IDC_TAP, iface->fname); } }
void ServerStart(HWND hWnd, HWND hCaller, UINT uMsg) { wchar_t qemu[256]; wchar_t path[256]; wchar_t hdb[256], hdc[256], hdd[256]; wchar_t net_name[256]; wchar_t qemu_args[2048]; STARTUPINFO si; HANDLE hStatusThread; memset(&si, 0, sizeof(STARTUPINFO)); ConfigGetString(L"qemu", qemu); ConfigGetString(L"path", path); if(wcslen(qemu) == 0 || wcslen(path) == 0) return; UpdateDrives(NULL); UpdateInterfaces(NULL); ConfigGetString(L"hdb", hdb); ConfigGetString(L"hdc", hdc); ConfigGetString(L"hdd", hdd); ConfigGetString(L"net_name", net_name); if(wcslen(net_name) == 0) { MessageBox(NULL, GetString(IDS_ERROR_NONET), GetString(IDS_CAPTION), MB_ICONEXCLAMATION | MB_OK); return; } if(wcslen(hdb) == 0 && wcslen(hdc) == 0 && wcslen(hdd) == 0) { MessageBox(NULL, GetString(IDS_ERROR_NODRIVE), GetString(IDS_CAPTION), MB_ICONEXCLAMATION | MB_OK); return; } wsprintf(qemu_args, L"\"%s\" -L . -m %d -net nic,model=%s -net tap,ifname=\"%s\" -hda %s", qemu, QEMU_MEM, QEMU_NIC, net_name, QEMU_SERVERIMG); if(wcslen(hdb) > 0) wsprintf(qemu_args, L"%s -hdb %s", qemu_args, hdb); if(wcslen(hdc) > 0) wsprintf(qemu_args, L"%s -hdc %s", qemu_args, hdc); if(wcslen(hdd) > 0) wsprintf(qemu_args, L"%s -hdd %s", qemu_args, hdd); wcscat_s(qemu_args, 2048, QEMU_ARGS); GetStartupInfo(&si); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; if(!CreateProcess(qemu, qemu_args, NULL, NULL, FALSE, 0, NULL, path, &si, &gServer)) { MessageBox(NULL, GetString(IDS_ERROR_START), GetString(IDS_CAPTION), MB_ICONSTOP | MB_OK); return; } hStatusThread = CreateThread(NULL, 0, StatusThread, (LPVOID)hWnd, 0, NULL); CloseHandle(hStatusThread); }
void SetupDialogOK(HWND hWnd, HWND hCaller, UINT uMsg) { int hdbi, hdci, hddi; int autostartCheck, onlogonCheck; int writeCheck; hdbi = SendMessage(GetDlgItem(hWnd, IDC_HDB), CB_GETCURSEL, 0, 0); hdci = SendMessage(GetDlgItem(hWnd, IDC_HDC), CB_GETCURSEL, 0, 0); hddi = SendMessage(GetDlgItem(hWnd, IDC_HDD), CB_GETCURSEL, 0, 0); autostartCheck = SendMessage(GetDlgItem(hWnd, IDC_AUTOSERVER), BM_GETCHECK, 0, 0); onlogonCheck = SendMessage(GetDlgItem(hWnd, IDC_AUTOSTART), BM_GETCHECK, 0, 0); writeCheck = SendMessage(GetDlgItem(hWnd, IDC_MOUNTRW), BM_GETCHECK, 0, 0); if(autostartCheck == BST_CHECKED) ConfigPutString(L"autostart", L"yes"); else ConfigPutString(L"autostart", L"no"); if(writeCheck == BST_CHECKED) ConfigPutString(L"rw", L"yes"); else ConfigPutString(L"rw", L"no"); if(onlogonCheck == BST_CHECKED) { wchar_t fullPath[MAX_PATH]; ConfigGetString(L"path", fullPath); wcscat_s(fullPath, MAX_PATH, L"\\"); wcscat_s(fullPath, MAX_PATH, GetString(IDS_SELF)); ConfigStartupAdd(GetString(IDS_NAME), fullPath); } else ConfigStartupRemove(GetString(IDS_NAME)); if(hdbi == 0) ConfigPutString(L"hdb", L""); else ConfigPutString(L"hdb", gDrives[hdbi-1].path); if(hdci == 0) ConfigPutString(L"hdc", L""); else ConfigPutString(L"hdc", gDrives[hdci-1].path); if(hddi == 0) ConfigPutString(L"hdd", L""); else ConfigPutString(L"hdd", gDrives[hddi-1].path); ShowWindow(hWnd, SW_HIDE); if(gServer.hProcess) { if(MessageBox(NULL, GetString(IDS_MSG_RESTART), GetString(IDS_CAPTION), MB_ICONQUESTION | MB_YESNO) == IDYES) ServerRestart(hWnd, hCaller, uMsg); } gSetupShown = FALSE; }
void QueryDNSListenTCPStart(void) { static ThreadHandle Unused; if(Inited == FALSE) return; INFO("Starting TCP socket %s:%d successfully.\n", ConfigGetString(&ConfigInfo, "LocalInterface"), ConfigGetInt32(&ConfigInfo, "LocalPort") ); CREATE_THREAD(QueryDNSListenTCP, NULL, Unused); #ifdef WIN32 CloseHandle(Unused); #endif /* WIN32 */ }
DWORD WINAPI StatusThread(LPVOID lpParameter) { int i, ctl_ret; wchar_t mount_rw[256]; HWND hConfigDialog = (HWND)lpParameter; EnterCriticalSection(&gThreadSection); ConfigGetString(L"rw", mount_rw); SetServerStatus(ServerStarting); PostMessage(hConfigDialog, WM_STATUSCHANGE, 0, 0); for(i=0; i<BOOT_WAIT; i++) { ctl_ret = SendCtl(QEMU_IP_ANSI, "default", NET_TIMEOUT); if(GetServerStatus() != ServerStarting) { LeaveCriticalSection(&gThreadSection); ExitThread(1); } if(ctl_ret == 0) break; } if(ctl_ret == 0) { if(GetServerStatus() != ServerStarting) { LeaveCriticalSection(&gThreadSection); ExitThread(1); } if(wcscmp(mount_rw, L"yes") == 0) { if(SendCtl(QEMU_IP_ANSI, "rw", NET_TIMEOUT) != 0) MessageBox(NULL, GetString(IDS_CTL_FAILED), GetString(IDS_CAPTION), MB_ICONEXCLAMATION | MB_OK); gMountRw = TRUE; } if(GetServerStatus() == ServerStarting) SetServerStatus(ServerRunning); } else if(GetServerStatus() != ServerStopped) SetServerStatus(ServerUnknown); PostMessage(hConfigDialog, WM_STATUSCHANGE, 0, 0); LeaveCriticalSection(&gThreadSection); ExitThread(0); return 2L; }
// Load commands from commands.ini [by Paul_T] void CWorldServer::LoadCommandLevels( void ) { Config.Command_Addquest = ConfigGetInt ( "commands.ini", "addquest", 299 ); Config.Command_AllSkill = ConfigGetInt ( "commands.ini", "allskill", 299 ); Config.Command_GMSkills = ConfigGetInt ( "commands.ini", "gmskills", 299 ); Config.Command_Ani = ConfigGetInt ( "commands.ini", "ani", 299 ); Config.Command_Ann = ConfigGetInt ( "commands.ini", "ann", 299 ); Config.Command_AtkModif = ConfigGetInt ( "commands.ini", "atkmodif", 299 ); Config.Command_Ban = ConfigGetInt ( "commands.ini", "ban", 299 ); Config.Command_BonusXp = ConfigGetInt ( "commands.ini", "bonusxp", 299 ); //LMA: bonusxp Config.Command_Broadcast = ConfigGetInt ( "commands.ini", "broadcast", 299 ); Config.Command_Buff = ConfigGetInt ( "commands.ini", "buff", 299 ); Config.Command_cart = ConfigGetInt ( "commands.ini", "cart", 299 ); // all Cart Parts Config.Command_Cfmode = ConfigGetInt ( "commands.ini", "cfmode", 299 ); Config.Command_cg = ConfigGetInt ( "commands.ini", "castlegear", 299 ); //get all CastleGear Parts Config.Command_Cha = ConfigGetInt ( "commands.ini", "cha", 299 ); Config.Command_ChangeFairyWait = ConfigGetInt ( "commands.ini", "changefairywait", 299 ); Config.Command_ChangeFairyStay = ConfigGetInt ( "commands.ini", "changefairystay", 299 ); Config.Command_ChangeFairyTestMode = ConfigGetInt ( "commands.ini", "changefairytestmode", 299 ); Config.Command_Class = ConfigGetInt ( "commands.ini", "class", 299 ); Config.Command_ConfigReset = ConfigGetInt ( "commands.ini", "ConfigReset", 299 ); Config.Command_Convert = ConfigGetInt ( "commands.ini", "convert", 299 ); Config.Command_Debuff = ConfigGetInt ( "commands.ini", "debuff", 299 ); Config.Command_DelSkills = ConfigGetInt ( "commands.ini", "delskills", 299 ); Config.Command_DelSpawn = ConfigGetInt ( "commands.ini", "delspawn", 299 ); Config.Command_Dev = ConfigGetInt ( "commands.ini", "dev", 299 ); Config.Command_DQuest = ConfigGetInt ( "commands.ini", "dquest", 299 ); Config.Command_Drop = ConfigGetInt ( "commands.ini", "drop", 299 ); Config.Command_DSpawn = ConfigGetInt ( "commands.ini", "dspawn", 299 ); Config.Command_ESpawn = ConfigGetInt ( "commands.ini", "espawn", 299 ); Config.Command_Event = ConfigGetInt ( "commands.ini", "event", 299 ); //Event Config.Command_EventIfo = ConfigGetInt ( "commands.ini", "eventifo", 299 ); //LMA: Events for IFO Objects Config.Command_Exp = ConfigGetInt ( "commands.ini", "exp", 299 ); Config.Command_Face = ConfigGetInt ( "commands.ini", "face", 299 ); Config.Command_fskill = ConfigGetInt ( "commands.ini", "fskill", 299 ); //LMA: Force a skill for a monster. Config.Command_Give2 = ConfigGetInt ( "commands.ini", "give2", 299 ); Config.Command_GiveClanRp = ConfigGetInt ( "commands.ini", "giveclanrp", 299 ); //Reward points Config.Command_GiveClanp = ConfigGetInt ( "commands.ini", "giveclanp", 299 ); //Clan points Config.Command_GiveFairy = ConfigGetInt ( "commands.ini", "givefairy", 299 ); Config.Command_GiveZuly = ConfigGetInt ( "commands.ini", "givezuly", 299 ); Config.Command_GlobalTime = ConfigGetInt ( "commands.ini", "globaldelay", 30 ); Config.Command_GlobalPrefix = ConfigGetString ( "commands.ini", "globalprefix", "[Broadcast]" ); Config.Command_GmList = ConfigGetInt ( "commands.ini", "gmlist", 299 ); Config.Command_Go = ConfigGetInt ( "commands.ini", "go", 299 ); Config.Command_Goto = ConfigGetInt ( "commands.ini", "goto", 299 ); Config.Command_GoToMap = ConfigGetInt ( "commands.ini", "gotomap", 299 ); Config.Command_grid = ConfigGetInt ( "commands.ini", "grid", 299 ); //LMA: maps grids. Config.Command_Hair = ConfigGetInt ( "commands.ini", "hair", 299 ); Config.Command_Heal = ConfigGetInt ( "commands.ini", "heal", 299 ); Config.Command_Here = ConfigGetInt ( "commands.ini", "here", 299 ); Config.Command_Hide = ConfigGetInt ( "commands.ini", "hide", 299 ); Config.Command_HitModif = ConfigGetInt ( "commands.ini", "hitmodif", 299 ); Config.Command_HurtHim = ConfigGetInt ( "commands.ini", "hurthim", 299 ); Config.Command_Info = ConfigGetInt ( "commands.ini", "info", 299 ); Config.Command_IQuest = ConfigGetInt ( "commands.ini", "iquest", 299 ); Config.Command_Item = ConfigGetInt ( "commands.ini", "item", 299 ); Config.Command_ItemStat = ConfigGetInt ( "commands.ini", "itemstat", 299 ); Config.Command_Job = ConfigGetInt ( "commands.ini", "job", 299 ); Config.Command_Kick = ConfigGetInt ( "commands.ini", "kick", 299 ); Config.Command_KillInRange = ConfigGetInt ( "commands.ini", "killinrange", 299 ); Config.Command_Level = ConfigGetInt ( "commands.ini", "level", 299 ); Config.Command_LevelUp = ConfigGetInt ( "commands.ini", "levelup", 299 ); Config.Command_Listquest = ConfigGetInt ( "commands.ini", "listquest", 299 ); Config.Command_Listqflag = ConfigGetInt ( "commands.ini", "listqflag", 299 ); Config.Command_Listqvar = ConfigGetInt ( "commands.ini", "listqvar", 299 ); Config.Command_ManageFairy = ConfigGetInt ( "commands.ini", "managefairy", 299 ); Config.Command_MaxStats = ConfigGetInt ( "commands.ini", "maxstats", 299 ); //MaxStats Config.Command_Mdmg = ConfigGetInt ( "commands.ini", "mdmg", 299 ); Config.Command_Mon = ConfigGetInt ( "commands.ini", "mon", 299 ); Config.Command_Mon2 = ConfigGetInt ( "commands.ini", "mon2", 299 ); Config.Command_Monster = ConfigGetInt ( "commands.ini", "monster", 299 ); Config.Command_Move = ConfigGetInt ( "commands.ini", "move", 299 ); Config.Command_Moveto = ConfigGetInt ( "commands.ini", "moveto", 299 ); Config.Command_Mute = ConfigGetInt ( "commands.ini", "mute", 299 ); Config.Command_Npc = ConfigGetInt ( "commands.ini", "npc", 299 ); Config.Command_NpcObjVar = ConfigGetInt ( "commands.ini", "npcobjvar", 299 ); Config.Command_NpcSetObjVar = ConfigGetInt ( "commands.ini", "npcsetobjvar", 299 ); Config.Command_NpcLtb = ConfigGetInt ( "commands.ini", "npcltb", 299 ); Config.Command_Pak = ConfigGetInt ( "commands.ini", "pak", 299 ); Config.Command_Pak2 = ConfigGetInt ( "commands.ini", "pak2", 299 ); Config.Command_Pakm = ConfigGetInt ( "commands.ini", "pakm", 299 ); Config.Command_Partylvl = ConfigGetInt ( "commands.ini", "partylvl", 299); Config.Command_Pdmg = ConfigGetInt ( "commands.ini", "pdmg", 299 ); Config.Command_PlayerInfo = ConfigGetInt ( "commands.ini", "playerinfo", 299 ); Config.Command_Pvp = ConfigGetInt ( "commands.ini", "pvp", 299 ); Config.Command_RaiseCG = ConfigGetInt ( "commands.ini", "raisecg", 299 ); Config.Command_Rate = ConfigGetInt ( "commands.ini", "rate", 299 ); Config.Command_Reborn = ConfigGetInt ( "commands.ini", "reborn", 299 ); //Reborn by core Config.Command_Refine = ConfigGetInt ( "commands.ini", "refine", 299 ); //Refine by PurpleYouko Config.Command_Reload = ConfigGetInt ( "commands.ini", "reload", 299 ); Config.Command_ReloadQuest = ConfigGetInt ( "commands.ini", "reloadquest", 299 ); Config.Command_Rules = ConfigGetInt ( "commands.ini", "rules", 99 ); Config.Command_Save = ConfigGetInt ( "commands.ini", "save", 299 ); Config.Command_ServerInfo = ConfigGetInt ( "commands.ini", "serverinfo", 299 ); Config.Command_Set = ConfigGetInt ( "commands.ini", "set", 299 ); Config.Command_Setqflag = ConfigGetInt ( "commands.ini", "setqflag", 299 ); Config.Command_Setqvar = ConfigGetInt ( "commands.ini", "setqvar", 299 ); Config.Command_Settime = ConfigGetInt ( "commands.ini", "settime", 299 ); Config.Command_SetUW = ConfigGetInt ( "commands.ini", "setuw", 299 ); Config.Command_SetUWnb = ConfigGetInt ( "commands.ini", "setuwnb", 299 ); Config.Command_ShopType = ConfigGetInt ( "commands.ini", "shoptype", 299 ); Config.Command_Shutdown = ConfigGetInt ( "commands.ini", "shutdown", 299 ); Config.Command_SpeedModif = ConfigGetInt ( "commands.ini", "speedmodif", 299 ); Config.Command_SSpawn = ConfigGetInt ( "commands.ini", "sspawn", 299 ); Config.Command_Stat = ConfigGetInt ( "commands.ini", "stat", 299 ); Config.Command_Summon = ConfigGetInt ( "commands.ini", "summon", 299 ); Config.Command_TargetInfo = ConfigGetInt ( "commands.ini", "targetinfo", 299 ); Config.Command_Tele = ConfigGetInt ( "commands.ini", "tele", 299 ); Config.Command_TeleToMe = ConfigGetInt ( "commands.ini", "teletome", 299 ); Config.Command_Transx = ConfigGetInt ( "commands.ini", "transx", 299 ); Config.Command_Union = ConfigGetInt ( "commands.ini", "union", 299 ); Config.Command_UnionPoints = ConfigGetInt ( "commands.ini", "unionpoints", 299 ); Config.Command_Who = ConfigGetInt ( "commands.ini", "who", 299 ); Config.Command_Who2 = ConfigGetInt ( "commands.ini", "who2", 299 ); }
// Load commands from commands.ini [by Paul_T] void CWorldServer::LoadCommandLevels( void ) { Config.Command_Ani = ConfigGetInt ( "commands.ini", "ani", 299 ); Config.Command_Ann = ConfigGetInt ( "commands.ini", "ann", 299 ); Config.Command_Ban = ConfigGetInt ( "commands.ini", "ban", 299 ); Config.Command_Cha = ConfigGetInt ( "commands.ini", "cha", 299 ); Config.Command_ChangeFairyWait = ConfigGetInt ( "commands.ini", "changefairywait", 299 ); Config.Command_ChangeFairyStay = ConfigGetInt ( "commands.ini", "changefairystay", 299 ); Config.Command_ChangeFairyTestMode = ConfigGetInt ( "commands.ini", "changefairytestmode", 299 ); Config.Command_Class = ConfigGetInt ( "commands.ini", "class", 299 ); Config.Command_Convert = ConfigGetInt ( "commands.ini", "convert", 299 ); Config.Command_Cfmode = ConfigGetInt ( "commands.ini", "cfmode", 299 ); Config.Command_DelSpawn = ConfigGetInt ( "commands.ini", "delspawn", 299 ); Config.Command_DQuest = ConfigGetInt ( "commands.ini", "dquest", 299 ); Config.Command_Drop = ConfigGetInt ( "commands.ini", "drop", 299 ); Config.Command_DSpawn = ConfigGetInt ( "commands.ini", "dspawn", 299 ); Config.Command_ESpawn = ConfigGetInt ( "commands.ini", "espawn", 299 ); Config.Command_Exp = ConfigGetInt ( "commands.ini", "exp", 299 ); Config.Command_Face = ConfigGetInt ( "commands.ini", "face", 299 ); Config.Command_Give2 = ConfigGetInt ( "commands.ini", "give2", 299 ); Config.Command_GiveClanRp = ConfigGetInt ( "commands.ini", "giveclanrp", 299 ); //Reward points Config.Command_GiveFairy = ConfigGetInt ( "commands.ini", "givefairy", 299 ); Config.Command_GiveZuly = ConfigGetInt ( "commands.ini", "givezuly", 299 ); Config.Command_GmList = ConfigGetInt ( "commands.ini", "gmlist", 299 ); Config.Command_Go = ConfigGetInt ( "commands.ini", "go", 299 ); Config.Command_Goto = ConfigGetInt ( "commands.ini", "goto", 299 ); Config.Command_GoToMap = ConfigGetInt ( "commands.ini", "gotomap", 299 ); Config.Command_Hair = ConfigGetInt ( "commands.ini", "hair", 299 ); Config.Command_Heal = ConfigGetInt ( "commands.ini", "heal", 299 ); Config.Command_Here = ConfigGetInt ( "commands.ini", "here", 299 ); Config.Command_Hide = ConfigGetInt ( "commands.ini", "hide", 299 ); Config.Command_Info = ConfigGetInt ( "commands.ini", "info", 299 ); Config.Command_IQuest = ConfigGetInt ( "commands.ini", "iquest", 299 ); Config.Command_Item = ConfigGetInt ( "commands.ini", "item", 299 ); Config.Command_AllSkill = ConfigGetInt ( "commands.ini", "allskill", 299 ); Config.Command_DelSkills = ConfigGetInt ( "commands.ini", "delskills", 299 ); Config.Command_Job = ConfigGetInt ( "commands.ini", "job", 299 ); Config.Command_Kick = ConfigGetInt ( "commands.ini", "kick", 299 ); Config.Command_KillInRange = ConfigGetInt ( "commands.ini", "killinrange", 299 ); Config.Command_Level = ConfigGetInt ( "commands.ini", "level", 299 ); Config.Command_LevelUp = ConfigGetInt ( "commands.ini", "levelup", 299 ); Config.Command_ManageFairy = ConfigGetInt ( "commands.ini", "managefairy", 299 ); Config.Command_HurtHim = ConfigGetInt ( "commands.ini", "hurthim", 299 ); Config.Command_Mdmg = ConfigGetInt ( "commands.ini", "mdmg", 299 ); Config.Command_Mon = ConfigGetInt ( "commands.ini", "mon", 299 ); Config.Command_Mon2 = ConfigGetInt ( "commands.ini", "mon2", 299 ); Config.Command_Monster = ConfigGetInt ( "commands.ini", "monster", 299 ); Config.Command_Move = ConfigGetInt ( "commands.ini", "move", 299 ); Config.Command_Moveto = ConfigGetInt ( "commands.ini", "moveto", 299 ); Config.Command_Mute = ConfigGetInt ( "commands.ini", "mute", 299 ); Config.Command_Event = ConfigGetInt ( "commands.ini", "event", 299 ); //Event Config.Command_Npc = ConfigGetInt ( "commands.ini", "npc", 299 ); Config.Command_Pak = ConfigGetInt ( "commands.ini", "pak", 299 ); Config.Command_Pak2 = ConfigGetInt ( "commands.ini", "pak2", 299 ); Config.Command_Pakm = ConfigGetInt ( "commands.ini", "pakm", 299 ); Config.Command_Partylvl = ConfigGetInt ( "commands.ini", "partylvl", 299); Config.Command_PlayerInfo = ConfigGetInt ( "commands.ini", "playerinfo", 299 ); Config.Command_Pdmg = ConfigGetInt ( "commands.ini", "pdmg", 299 ); Config.Command_Pvp = ConfigGetInt ( "commands.ini", "pvp", 299 ); Config.Command_Rate = ConfigGetInt ( "commands.ini", "rate", 299 ); Config.Command_Reborn = ConfigGetInt ( "commands.ini", "reborn", 299 ); //Reborn by core Config.Command_Reload = ConfigGetInt ( "commands.ini", "reload", 299 ); Config.Command_ReloadQuest = ConfigGetInt ( "commands.ini", "reloadquest", 299 ); Config.Command_Rules = ConfigGetInt ( "commands.ini", "rules", 99 ); Config.Command_Save = ConfigGetInt ( "commands.ini", "save", 299 ); Config.Command_ServerInfo = ConfigGetInt ( "commands.ini", "serverinfo", 299 ); Config.Command_Set = ConfigGetInt ( "commands.ini", "set", 299 ); Config.Command_Settime = ConfigGetInt ( "commands.ini", "settime", 299 ); Config.Command_ShopType = ConfigGetInt ( "commands.ini", "shoptype", 299 ); Config.Command_BonusXp = ConfigGetInt ( "commands.ini", "bonusxp", 299 ); //LMA: bonusxp Config.Command_Shutdown = ConfigGetInt ( "commands.ini", "shutdown", 299 ); Config.Command_SSpawn = ConfigGetInt ( "commands.ini", "sspawn", 299 ); Config.Command_Stat = ConfigGetInt ( "commands.ini", "stat", 299 ); Config.Command_Summon = ConfigGetInt ( "commands.ini", "summon", 299 ); Config.Command_TargetInfo = ConfigGetInt ( "commands.ini", "targetinfo", 299 ); Config.Command_Tele = ConfigGetInt ( "commands.ini", "tele", 299 ); Config.Command_TeleToMe = ConfigGetInt ( "commands.ini", "teletome", 299 ); Config.Command_Transx = ConfigGetInt ( "commands.ini", "transx", 299 ); Config.Command_grid = ConfigGetInt ( "commands.ini", "grid", 299 ); //LMA: maps grids. Config.Command_Who = ConfigGetInt ( "commands.ini", "who", 299 ); Config.Command_Who2 = ConfigGetInt ( "commands.ini", "who2", 299 ); Config.Command_Broadcast = ConfigGetInt ( "commands.ini", "broadcast", 299 ); Config.Command_GlobalTime = ConfigGetInt ( "commands.ini", "globaldelay", 30 ); Config.Command_GlobalPrefix = ConfigGetString ( "commands.ini", "globalprefix", "[Broadcast]" ); Config.Command_MaxStats = ConfigGetInt ( "commands.ini", "maxstats", 299 ); //MaxStats }
// Load Server configuration void CWorldServer::LoadConfigurations( char* file ) { //Database Config.SQLServer.pcServer = ConfigGetString ( file, "mysql_host", "localhost" ); Config.SQLServer.pcDatabase = ConfigGetString ( file, "mysql_database", "roseon_beta" ); Config.SQLServer.pcUserName = ConfigGetString ( file, "mysql_user", "root" ); Config.SQLServer.pcPassword = ConfigGetString ( file, "mysql_pass", "" ); Config.SQLServer.pcPort = ConfigGetInt ( file, "mysql_port", 3306 ); //Server Config.ServerID = ConfigGetInt ( file, "serverid", 1 ); Config.ServerType = ConfigGetInt ( file, "servertype", 2 ); Config.WorldPort = ConfigGetInt ( file, "serverport", 29200 ); Config.WorldIP = ConfigGetString ( file, "serverip", "127.0.0.1" ); Config.ParentID = ConfigGetInt ( file, "parentid", 1 ); Config.ServerName = ConfigGetString ( file, "servername", "Channel" ); Config.MaxConnections = ConfigGetInt ( file, "maxconnections", 100 ); Config.Connection = ConfigGetInt ( file, "connection", 0 ); Config.LanIP = ConfigGetString ( file, "lanip", "192.168.0.1" ); Config.LanSubnet = ConfigGetString ( file, "lansubmask", "192.168.0" ); //World Config.MinimumAccessLevel = ConfigGetInt ( file, "minimal_access_level", 100 ); Config.usethreads = ConfigGetInt ( file, "usethreads", 0 )==0?false:true; Config.EXP_RATE = ConfigGetInt ( file, "exp_rate", 10 ); Config.DROP_RATE = ConfigGetInt ( file, "drop_rate", 1 ); Config.DROP_TYPE = ConfigGetInt ( file, "drop_type", 2 ); Config.ZULY_RATE = ConfigGetInt ( file, "zuly_rate", 1 ); Config.WELCOME_MSG = ConfigGetString ( file, "welcome_msg", "Welcome to Rose Online" ); Config.AUTOSAVE = ConfigGetInt ( file, "autosave", 0 ); Config.SAVETIME = ConfigGetInt ( file, "savetime", 3600 ); Config.MapDelay = ConfigGetInt ( file, "mapdelay", 10 ); Config.WorldDelay = ConfigGetInt ( file, "worlddelay", 200 ); Config.VisualDelay = ConfigGetInt ( file, "visualdelay", 500 ); Config.Partygap = ConfigGetInt ( file, "partygap", 10 ); Config.MaxStat = ConfigGetInt ( file, "maxstat", 254 ); Config.FairyMode = ConfigGetInt ( file, "fairy", 1 ); Config.FairyStay = ConfigGetInt ( file, "fairystay", 20 ); Config.FairyWait = ConfigGetInt ( file, "fairywait", 15 ); Config.FairyMax = ConfigGetInt ( file, "fairymax", 0); Config.FairyTestMode = ConfigGetInt ( file, "fairytestmode", 1); Config.PlayerDmg = ConfigGetInt ( file, "playerdmg", 120); Config.MonsterDmg = ConfigGetInt ( file, "monsterdmg", 100); Config.Cfmode = ConfigGetInt ( file, "cfmode", 0); Config.osRoseVer = ConfigGetInt ( file, "osRoseVer", 79); Config.testgrid = ConfigGetInt ( file, "testgrid", 0); //LMA: maps tests grids (0=usual, 1=grid) Config.jrose = ConfigGetInt ( file, "jrose", 0); //LMA: Special code for jRose handling (163) Log (MSG_INFO, "osRose Revision %i", Config.osRoseVer ); //LMA: jRose. if(Config.jrose==1) Log (MSG_INFO, "Handling ONLY jRose client."); else Log (MSG_INFO, "Handling ONLY RoseNA client."); //Password Config.LoginPass = ConfigGetInt ( file, "loginpass", 123456 ); Config.CharPass = ConfigGetInt ( file, "charpass", 123456 ); Config.WorldPass = ConfigGetInt ( file, "worldpass", 123456 ); if(Config.AUTOSAVE==1) Log( MSG_INFO, "Autosaving Every %i minutes", Config.SAVETIME/60 ); LoadCommandLevels(); }
/* Functions */ int QueryDNSListenTCPInit(void) { static struct _Address ListenAddr; const char *LocalAddr = ConfigGetString(&ConfigInfo, "LocalInterface"); int LocalPort = ConfigGetInt32(&ConfigInfo, "LocalPort"); int AddrLen; Family = GetAddressFamily(LocalAddr); ListenSocketTCP = socket(Family, SOCK_STREAM, IPPROTO_TCP); if(ListenSocketTCP == INVALID_SOCKET) { int ErrorNum = GET_LAST_ERROR(); char ErrorMessage[320]; ErrorMessage[0] = '\0'; GetErrorMsg(ErrorNum, ErrorMessage, sizeof(ErrorMessage)); ERRORMSG("Creating TCP socket failed. %d : %s\n", ErrorNum, ErrorMessage); return -1; } memset(&ListenAddr, 0, sizeof(ListenAddr)); if( Family == AF_INET ) { FILL_ADDR4(ListenAddr.Addr.Addr4, AF_INET, LocalAddr, LocalPort); AddrLen = sizeof(struct sockaddr); } else { char Addr[LENGTH_OF_IPV6_ADDRESS_ASCII] = {0}; sscanf(LocalAddr, "[%s]", Addr); ListenAddr.Addr.Addr6.sin6_family = Family; ListenAddr.Addr.Addr6.sin6_port = htons(LocalPort); IPv6AddressToNum(Addr, &(ListenAddr.Addr.Addr6.sin6_addr)); AddrLen = sizeof(struct sockaddr_in6); } if( bind(ListenSocketTCP, (struct sockaddr*)&(ListenAddr.Addr), AddrLen) != 0 ) { int ErrorNum = GET_LAST_ERROR(); char ErrorMessage[320]; ErrorMessage[0] = '\0'; GetErrorMsg(ErrorNum, ErrorMessage, sizeof(ErrorMessage)); ERRORMSG("Opening TCP socket failed. %d : %s\n", ErrorNum, ErrorMessage); return -2; } if( listen(ListenSocketTCP, 16) == SOCKET_ERROR ) { int ErrorNum = GET_LAST_ERROR(); char ErrorMessage[320]; ErrorMessage[0] = '\0'; GetErrorMsg(ErrorNum, ErrorMessage, sizeof(ErrorMessage)); ERRORMSG("Opening TCP socket failed. %d : %s\n", ErrorNum, ErrorMessage); return -3; } Inited = TRUE; return 0; }
static int TCPRecv(RecvInfo *Info) { SOCKET Socket = Info -> Socket; CompatibleAddr Peer = Info -> Peer; int state; char ResultBuffer[1024]; ExtendableBuffer Buffer; /* Sockets to server */ SOCKET TCPSocket = INVALID_SOCKET; SOCKET UDPSocket = INVALID_SOCKET; SOCKET *PrimarySocketPtr; SOCKET *SecondarySocketPtr; DNSQuaryProtocol PrimaryProtocol; char ProtocolStr[8] = {0}; strncpy(ProtocolStr, ConfigGetString(&ConfigInfo, "PrimaryServer"), 3); StrToLower(ProtocolStr); if( strcmp(ProtocolStr, "tcp") == 0 ) { PrimaryProtocol = DNS_QUARY_PROTOCOL_TCP; PrimarySocketPtr = &TCPSocket; if( ConfigGetString(&ConfigInfo, "UDPServer") != NULL ) SecondarySocketPtr = &UDPSocket; else SecondarySocketPtr = NULL; } else { PrimaryProtocol = DNS_QUARY_PROTOCOL_UDP; PrimarySocketPtr = &UDPSocket; if( ConfigGetString(&ConfigInfo, "TCPServer") != NULL ) SecondarySocketPtr = &TCPSocket; else SecondarySocketPtr = NULL; } ExtendableBuffer_Init(&Buffer, 512, 10240); while(TRUE){ state = recv(Socket, ResultBuffer, sizeof(ResultBuffer), MSG_NOSIGNAL); if(GET_LAST_ERROR() == TCP_TIME_OUT) { break; } if( state < 1 ) { break; } Query(PrimarySocketPtr, SecondarySocketPtr, PrimaryProtocol, ResultBuffer, state, &Socket, &Peer, &Buffer); ExtendableBuffer_Reset(&Buffer); } CLOSE_SOCKET(TCPSocket); CLOSE_SOCKET(UDPSocket); CLOSE_SOCKET(Socket); if( Family == AF_INET ) { INFO("Closed TCP connection to %s:%d\n", inet_ntoa(Peer.Addr4.sin_addr), Peer.Addr4.sin_port); } else { char Addr[LENGTH_OF_IPV6_ADDRESS_ASCII] = {0}; IPv6AddressToAsc(&(Peer.Addr6.sin6_addr), Addr); INFO("Closed TCP connection to %s:%d\n", Addr, Peer.Addr6.sin6_port); } SafeFree(Info); EXIT_THREAD(0); }