

aakarsh98
Membro Avançado1 Seguidor
Últimos Visitantes
O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.
aakarsh98's Achievements
-
aakarsh98 começou a seguir Ajuste/Hook interface , W2pp Ranking and mysql , ItemIcon, ItemList e 1 outro
-
void sendranking2(const int conn) { if (pMob[conn].MOB.CurrentScore.Level < 1000) { auto mob = GetMobFromIndex(conn); auto user = GetUserFromIndex(conn); int totalkill = GetTotKill(conn); int curkill = GetCurKill(conn); int altar = pMob[conn].extra.score; int wins = pMob[conn].extra.scorewins; if (wins <= 0) wins = 0; char dir[100]; time_t now = time(0); tm when; localtime_s(&when, &now); int score = 0; FILE* fp; if (mob->extra.ClassMaster == MORTAL) { sprintf_s(dir, "../../Common/RankingApp/Ranking2/%s.txt", mob->MOB.MobName); } else { sprintf_s(dir, "../../Common/RankingApp/Ranking2/%s_.txt", mob->MOB.MobName); } fopen_s(&fp, dir, "w"); int Evolucao = 0; int sub = 0; int slot = pUser[conn].Slot; if (mob->extra.ClassMaster == MORTAL) Evolucao = 0; if (mob->extra.ClassMaster == ARCH) Evolucao = 1; if (mob->extra.ClassMaster == CELESTIAL) Evolucao = 2; if (mob->extra.ClassMaster == CELESTIALCS || mob->extra.ClassMaster == SCELESTIAL) { Evolucao = 3; sub = 1; } int levelranking = mob->MOB.CurrentScore.Level * 3 + 1; score = wins + altar; if (Evolucao == 2) score += 0; if (Evolucao == 3) score += 0; if (Evolucao == 4) score += 0; int mobclan = mob->MOB.Clan; if (pMob[conn].extra.clanmode == 1) { mobclan = 9; } else if (pMob[conn].extra.clanmode == 2) { mobclan = 10; } if (fp == NULL) { printf("[Erro ao gerar ranking \n"); return; } else { fprintf_s(fp, "%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", mob->MOB.MobName, mob->MOB.CurrentScore.Level, mob->MOB.Class, Evolucao, mobclan, mob->MOB.Guild, mob->MOB.GuildLevel, score, totalkill, sub, mob->extra.QuestInfo.Celestial.SubCelestialLevel, mob->extra.QuestInfo.Celestial.CelestialLevel, slot); fclose(fp); return; } } return; } trying to implement this to send data to me website need help. also how do i use the mysql functions to actively update data between db server and my sql data base.
-
can you share that tool please.
-
unfortunately its not that simple.
-
I have been trying to figure out how to change/set item icon for various items in the item list, one example is item 751 which is the dragon emblem, in the itemlist.csv its associated to icon 47 in the csv document, when i open the itemicon.bin its set to 132 when i open itemicon01.wyt, the icon is situated in 2nd row 7th column, i am confused, if someone can help me understand this better, it will be helpful.
-
Existe release 7.54 pronta para produção e/ou pura?
aakarsh98 respondeu ao pergunta de 987987987 em WYD - Dúvidas
i am interested in one as well. -
wish that is possible in all the client versions, finding source codes is so tough.
-
nvm, the function calls were using API, thank you all for the suggestions.
-
I think i did not communicate correctly, I did run and test the Telnet command on both my personal pc and vps, its connecting and receiving data from the hosting site. so now i am debugging the MySQL function within the source code to see how the functions are called and how its responding.
-
aakarsh98 obteve troféu Bronze
-
great, so i tested this and everything works, i even tested this on my own pc trying to connect and access the database. i think its the problem with the code or how it references it. this is the mysql.h header file #include <mysql.h> #include <stdint.h> #pragma comment(lib, "libmysql.lib") #include "singleton.h" #define HOST "localhost" #define USER "root" #define PASS "123456" #define PORT 3306 #define DB "wydsite" extern int contador; extern char xQuery[1000]; extern char mQuery[1000]; extern char hQuery[1000]; extern char xMsg[1000]; extern char xRow[400]; extern char xMAC[400]; extern char xIP[400]; extern char* xPass; class cSQL : public Singleton<cSQL> { protected: friend class Singleton<cSQL>; cSQL() {} virtual ~cSQL() {} cSQL(const cSQL&) = delete; cSQL& operator=(const cSQL&) = delete; public: static MYSQL* wStart(); static MYSQL_RES* wRes(MYSQL* sql, char* query); static bool wQuery(char* query); static char* wInfo(char* query); static int iInfo(char* query); static int Cont(char* query); static void wLog(char* acc, char* pers, char* mensagem, char* type); static long long lInfo(char* query); }; uint32_t convert(const char* name); lets assume that i have replaced the database values correctly. this file below is the .cpp that defines the function, i think its not efficently reading and updating data from the datbase when its hosted on another server, however when i was testing on local machine, it seems to work fine. so if anyone has suggestions on how to fix it , that would be nice. #include "Basedef.h" #include <Windows.h> #include <stdio.h> #include <fcntl.h> #include <time.h> #include <math.h> #include <io.h> #include <errno.h> #include "wMySQL.h" HANDLE hThread; HANDLE ThreadLog; unsigned long iID; int contador = 0; char xQuery[1000]; char mQuery[1000]; char hQuery[1000]; char xMsg[1000]; char xRow[400]; char xMAC[400]; char xIP[400]; char* xPass; unsigned long lID; MYSQL* cSQL::wStart() { MYSQL* wSQL = mysql_init(NULL); try { my_bool reconnect = 1; mysql_options(wSQL, MYSQL_OPT_RECONNECT, &reconnect); mysql_options(wSQL, MYSQL_OPT_COMPRESS, 0); mysql_options(wSQL, MYSQL_OPT_CONNECT_TIMEOUT, "300"); if (!mysql_real_connect(wSQL, HOST, USER, PASS, DB, PORT, NULL, 0)) { printf("[wMySQL][TMSVR] Ocorreu um erro na conexão.\n\t\tErro: %s\n", mysql_error(wSQL)); return wSQL; } return wSQL; } catch (...) { return wSQL; } } MYSQL_RES* cSQL::wRes(MYSQL* sql, char* query) { try { if (mysql_query(sql, query)) { printf("[wMySQL][wRes] Erro na execução da wRes.\nQuery: %s\n\t\tErro: %s\n", query, mysql_error(sql)); mysql_close(sql); return NULL; } MYSQL_RES* result = mysql_store_result(sql); mysql_close(sql); if (result) return result; return NULL; } catch (...) { return NULL; } } void cSQL::wLog(char* acc, char* pers, char* mensagem, char* type) { time_t rawtime; struct tm* timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); sprintf(logQuery, "INSERT INTO `log` (`ID`, `Conta`, `Char`, `Mensagem`, `Data`, `Tipo`) VALUES(NULL, '%s', '%s', '%s', '%d/%d/%d %d:%d:%d', '%s')", acc, pers, mensagem, timeinfo->tm_mday, (timeinfo->tm_mon + 1), (timeinfo->tm_year + 1900), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, type); ////ThreadLog = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)wQuery, (void*)logQuery, 0, &lID); //cSQL::wQuery(xQuery); auto& pc = cSQL::instance(); MYSQL* wSQL = pc.wStart(); if (mysql_query(wSQL, logQuery)) { printf("[wMySQL][Log] Erro na execução da wQuery.\n\t\tErro: %s\n", mysql_error(wSQL)); mysql_close(wSQL); //ExitThread(0); return; } mysql_close(wSQL); printf("[%02d/%02d/%d][%02d:%02d:%02d][%s - %s] %s\n", timeinfo->tm_mday, (timeinfo->tm_mon + 1), (timeinfo->tm_year + 1900), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, acc, pers, mensagem); return; } /// Executes a query. bool cSQL::wQuery(char* query) { try { auto& pc = cSQL::instance(); MYSQL* wSQL = pc.wStart(); if (mysql_query(wSQL, query)) { printf("[wMySQL][wQuery] Erro na execução da wQuery.\n\t\tErro: %s\n", mysql_error(wSQL)); mysql_close(wSQL); //ExitThread(0); return FALSE; } mysql_close(wSQL); //ExitThread(0); return TRUE; } catch (...) { return FALSE; } } int cSQL::Cont(char* query) { int res = 0; auto& cnt = cSQL::instance(); MYSQL* wSQL = cnt.wStart(); MYSQL_RES* result = cnt.wRes(wSQL, query); if (result == NULL) { printf("[wMySQL][wInfo]: Ocorreu um erro ao retornar Dados.\n"); //mysql_free_result(sq.result); //mysql_close(sq.wSQL); return res; } res = (int)mysql_num_rows(result); mysql_free_result(result); mysql_close(wSQL); return res; } int cSQL::iInfo(char* query) { int res = 0; MYSQL_ROW row; auto& cnt = cSQL::instance(); MYSQL* wSQL = cnt.wStart(); MYSQL_RES* result = cnt.wRes(wSQL, query); if (result == NULL) { printf("[wMySQL][wInfo]: Ocorreu um erro ao retornar Dados.\n"); //mysql_free_result(sq.result); //mysql_close(sq.wSQL); return res; } while ((row = mysql_fetch_row(result)) != NULL) res = atoi(row[0]); mysql_free_result(result); mysql_close(wSQL); return res; } long long cSQL::lInfo(char* query) { long long res = 0; MYSQL_ROW row; auto& cnt = cSQL::instance(); MYSQL* wSQL = cnt.wStart(); MYSQL_RES* result = cnt.wRes(wSQL, query); if (result == NULL) { printf("[wMySQL][wInfo]: Ocorreu um erro ao retornar Dados.\n"); //mysql_free_result(sq.result); //mysql_close(sq.wSQL); return res; } while ((row = mysql_fetch_row(result)) != NULL) res = atoll(row[0]); mysql_free_result(result); mysql_close(wSQL); return res; } char* cSQL::wInfo(char* query) { MYSQL_ROW row; auto& cnt = cSQL::instance(); MYSQL* wSQL = cnt.wStart(); MYSQL_RES* result = cnt.wRes(wSQL, query); if (result == NULL) { printf("[wMySQL][wInfo]: Ocorreu um erro ao retornar Dados.\n"); //mysql_free_result(sq.result); //mysql_close(sq.wSQL); return (char*)"0"; } char res[1000]; memset(res, 0, sizeof(char)); while ((row = mysql_fetch_row(result)) != NULL) strcpy(res, row[0]); mysql_free_result(result); mysql_close(wSQL); return res; } uint32_t convert(const char* name) { uint32_t val = uint32_t(name[3]) + (uint32_t(name[2]) << 8) + (uint32_t(name[1]) << 16) + (uint32_t(name[0]) << 24); return val; }
-
aakarsh98 começou a seguir W2 - Editor de ItemList , Website and database linking , AJUDA SOUCER THE NEW WOLRD. e 1 outro
-
can you help me out in pvt, i have put in the details correctly, but the main tm/db server doesnt seem to call and utilize it.
-
//#define HOST "localhost" //#define USER "root" //#define PASS "123456" //#define PORT 3306 //#define DB "wydsite" what should be the values when using a hosting service, through cpanel and myphp. need help setting this when the main server is on a different device/ip/vps adn the website/database is hosted on a different IP/domain.
-
This happens on server reset, and sometimes in the source code based on the date its set to reset.
-
i dont know how not to do that.
-
can you share the source code if possible please, its missing the bin to txt and txt to bin.