Jump to content

Ikarus_

Developer
  • Posts

    402
  • Joined

  • Last visited

  • Days Won

    20
  • Feedback

    0%

Everything posted by Ikarus_

  1. now we should be affixed;) copy it again , I had not closed a round parenthesis (now is fixed)
  2. /* * PLAYER CREATE */ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerCreatePacket* packet) { char queryStr[QUERY_MAX_LEN]; int queryLen; int player_id; // 한 계정에 X초 내로 캐릭터 생성을 할 수 없다. time_by_id_map_t::iterator it = s_createTimeByAccountID.find(packet->account_id); if (it != s_createTimeByAccountID.end()) { time_t curtime = time(0); if (curtime - it->second < 30) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } } queryLen = snprintf(queryStr, sizeof(queryStr), "SELECT pid%u FROM player_index%s WHERE id=%d", packet->account_index + 1, GetTablePostfix(), packet->account_id); std::auto_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr)); if (pMsg0->Get()->uiNumRows != 0) { if (!pMsg0->Get()->pSQLResult) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } MYSQL_ROW row = mysql_fetch_row(pMsg0->Get()->pSQLResult); DWORD dwPID = 0; str_to_number(dwPID, row[0]); if (row[0] && dwPID > 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); sys_log(0, "ALREADY EXIST AccountChrIdx %d ID %d", packet->account_index, dwPID); return; } } else { //begin fix no insert into player index if(packet->account_index != 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } else { char szQueryInsert[100] = "\0"; snprintf(szQueryInsert , sizeof(szQueryInsert) , "INSERT INTO player_index (id , pid1 , pid2 , pid3 , pid4 ) VALUES( '%u' , 0,0,0,0 )",packet->account_id); delete(CDBManager::instance().DirectQuery(szQueryInsert)); } //end fix } if (g_stLocale == "sjis") snprintf(queryStr, sizeof(queryStr), "SELECT COUNT(*) as count FROM player%s WHERE name='%s' collate sjis_japanese_ci", GetTablePostfix(), packet->player_table.name); else snprintf(queryStr, sizeof(queryStr), "SELECT COUNT(*) as count FROM player%s WHERE name='%s'", GetTablePostfix(), packet->player_table.name); std::auto_ptr<SQLMsg> pMsg1(CDBManager::instance().DirectQuery(queryStr)); if (pMsg1->Get()->uiNumRows) { if (!pMsg1->Get()->pSQLResult) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } MYSQL_ROW row = mysql_fetch_row(pMsg1->Get()->pSQLResult); if (*row[0] != '0') { sys_log(0, "ALREADY EXIST name %s, row[0] %s query %s", packet->player_table.name, row[0], queryStr); peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); return; } } else { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } queryLen = snprintf(queryStr, sizeof(queryStr), "INSERT INTO player%s " "(id, account_id, name, level, st, ht, dx, iq, " "job, voice, dir, x, y, z, " "hp, mp, random_hp, random_sp, horse_appearance, stat_point, stamina, part_base, part_main, part_hair, gold, playtime, " "skill_level, quickslot) " "VALUES(0, %u, '%s', %d, %d, %d, %d, %d, " "%d, %d, %d, %d, %d, %d, %d, " "%d, %d, %d, %d, %d, %d, %d, 0, %d, 0, ", GetTablePostfix(), packet->account_id, packet->player_table.name, packet->player_table.level, packet->player_table.st, packet->player_table.ht, packet->player_table.dx, packet->player_table.iq, packet->player_table.job, packet->player_table.voice, packet->player_table.dir, packet->player_table.x, packet->player_table.y, packet->player_table.z, packet->player_table.hp, packet->player_table.sp, packet->player_table.sRandomHP, packet->player_table.sRandomSP, packet->player_table.sHorse_appearance, packet->player_table.stat_point, packet->player_table.stamina, packet->player_table.part_base, packet->player_table.part_base, packet->player_table.gold); sys_log(0, "PlayerCreate accountid %d name %s level %d gold %lld, st %d ht %d job %d", packet->account_id, packet->player_table.name, packet->player_table.level, packet->player_table.gold, packet->player_table.st, packet->player_table.ht, packet->player_table.job); static char text[4096 + 1]; CDBManager::instance().EscapeString(text, packet->player_table.skills, sizeof(packet->player_table.skills)); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s', ", text); if (g_test_server) sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot)); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text); std::auto_ptr<SQLMsg> pMsg2(CDBManager::instance().DirectQuery(queryStr)); if (g_test_server) sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); if (pMsg2->Get()->uiAffectedRows <= 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); sys_log(0, "ALREADY EXIST3 query: %s AffectedRows %lu", queryStr, pMsg2->Get()->uiAffectedRows); return; } player_id = pMsg2->Get()->uiInsertID; snprintf(queryStr, sizeof(queryStr), "UPDATE player_index%s SET pid%d=%d WHERE id=%d", GetTablePostfix(), packet->account_index + 1, player_id, packet->account_id); std::auto_ptr<SQLMsg> pMsg3(CDBManager::instance().DirectQuery(queryStr)); if (pMsg3->Get()->uiAffectedRows <= 0) { sys_err("QUERY_ERROR: %s", queryStr); snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), player_id); CDBManager::instance().DirectQuery(queryStr); peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } TPacketDGCreateSuccess pack; memset(&pack, 0, sizeof(pack)); pack.bAccountCharacterIndex = packet->account_index; pack.player.dwID = player_id; strlcpy(pack.player.szName, packet->player_table.name, sizeof(pack.player.szName)); pack.player.byJob = packet->player_table.job; pack.player.byLevel = 1; pack.player.dwPlayMinutes = 0; pack.player.byST = packet->player_table.st; pack.player.byHT = packet->player_table.ht; pack.player.byDX = packet->player_table.dx; pack.player.byIQ = packet->player_table.iq; pack.player.wMainPart = packet->player_table.part_base; pack.player.x = packet->player_table.x; pack.player.y = packet->player_table.y; peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_SUCCESS, dwHandle, sizeof(TPacketDGCreateSuccess)); peer->Encode(&pack, sizeof(TPacketDGCreateSuccess)); sys_log(0, "7 name %s job %d", pack.player.szName, pack.player.byJob); s_createTimeByAccountID[packet->account_id] = time(0); } try to change it in this way..... is not the best way to solve the problem, but not too bad. Let us know if it works;) sorry I've investigated some more about your mistake... I think I've found another problem... now I tell you but wait a second before doing the test.
  3. this inserts in player, I asked you to look for player_index
  4. if you try to search INSERT INTO player_index do you get some results in the file?
  5. I sincerely think that the problem is in clientmanagerlogin. cpp. where the game creates (if it doesn't exist) the new line in player_index tables... in my files the method that does this is called RESULT_LOGIN_BY_KEY by chance have you modified this method or some other method within this file?
  6. the error tell you if (pMsg3->Get()->uiAffectedRows <= 0) { sys_err("QUERY_ERROR: %s", queryStr); snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), player_id); CDBManager::instance().DirectQuery(queryStr); peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0); return; } This happens if there is any problem with the player_index table... check what this query does not go well UPDATE player_index%s SET pid%d=%d WHERE id=%d checks that the table exists and that it has columns with the same name that is used in this query
  7. I suggest you change with this bool CHARACTER::ChangeCoins(DWORD dwVnum) { int iCount = 0; for(int i = 0 ; i < VOUCHER_NUM ; i++) { if(dwVnum == cdwVoucherVnum[i]) { iCount = ciVoucherCountDR[i]; break; } } if(iCount ==0) return false; SQLMsg* pMsg = AccountDB::instance().DirectQuery("UPDATE account.account SET coins = coins + '%ld' WHERE id = '%d'", iCount,GetAID()); bool bSucc = (pMsg->uiSQLErrno == 0); delete(pMsg); if (!bSucc) { sys_err("[MD] Nu pot fi predate!(a aparut o eroare)"); } else { LogManager::instance().CoinsLog(GetAID() , GetPlayerID() , dwVnum , iCount); ChatPacket(CHAT_TYPE_INFO,"<SYSTEM> You received [%d]DR ",iCount); } return bSucc; } if you don't delete pMsg you get memory leak... change in char_item (UseItem / UseItemEx) your's script with this switch (item->GetVnum()) { //Vnums case 80014: // 100 DR/Coins case 80015: // 500 DR/Coins case 80016: // 1000 DR/Coins case 80017: if (ChangeCoins(item->GetVnum())) { item->SetCount(item->GetCount() - 1); } else { ChatPacket(CHAT_TYPE_INFO, "A aparut o eroare. Contactati administratorul."); } return 1; break; default: break; } add in constants.cpp and constants.h //constants.cpp (end of file) const DWORD cdwVoucherVnum[VOUCHER_NUM] = { 80014, 80015, 80016, 80017 } const int ciVoucherCountDR[VOUCHER_NUM] = { 100, 500, 1000, 50 } //constants.h (end of file) #define VOUCHER_NUM 4 extern const DWORD cdwVoucherVnum[VOUCHER_NUM]; extern const int ciVoucherCountDR[VOUCHER_NUM]; add in log.cpp and log.h //log.cpp void LogManager::CoinsLog( DWORD dwAID , dwPlayerID , DWORD dwVnum , int iCount) { Query("INSERT INTO voucher_log (id , account_id , item_vnum , coins , data) VALUES('%u' , '%u' , '%u' , '%u' , NOW() )",dwPlayerID , dwAID , dwVnum , iCount ); } log.h //under public CoinsLog(DWORD dwAID , dwPlayerID , DWORD dwVnum , int iCount); Let me know if you have problems... I have not tested it but should do everything you ask for Fixed the chat packet error *
  8. in your files apparently the part that I am interested in is referred to in PutPlayerCache I would also need to see this too.... If you get tired you can also send it all the file on pastebin, otherwise at least this other method
  9. show me your method QUERY_PLAYER_SAVE (please use pastebin..) you can find that method in db/src/clientmanagerplayer.cpp
  10. copy paste (please use pastebin) your methods __QUERY_PLAYER_CREATE into ClientManagerPlayer.cpp
  11. You have not pasted the definitions of the methods referred to in the error... for your knowledge the definitions are found (almost always, except for the implicit inline functions) in the ". cpp" (source file) files of the class of belonging.
  12. I give you a clue... If you take a short int (max value + (2^16)/2 and min-value - (2^16)/2) and set it on the maximum value, after which sum 1, its value will become the minimum value... the same for all signed data types.. make the necessary considerations bye bye
  13. at beginnig of the file write COUNT_SLOT = player.INVENTORY_PAGE_SIZE than in the for cicle replace player.INVENTORY_PAGE_SIZE with COUNT_SLOT
  14. i've solved that problem... It' a C++ FuncClassMemberCall ... Search : "OnOverInItem" (with Apex "") in src client and post the result.
  15. Use the debugMode of launcher to read the output in log.txt
  16. The VDI (if it really contains sourcemt2) is a compiler machine, a machine built specifically to compile the file game and the db file with their necessary lib. Find guides on how to compile very detailed online... The 3 folders you've shown are probably already in the vdi... other than the source code of metin2. Server: Contains game source, db and respective lib (libthecore, libgame, libsql, ect.) Extern: contains lib and includes files that you need to include in the code metin2 but as an "external" code from which the folder name... are standard lib and not written by ymir. Tools: Contains the source code of metin2 tools such as packmaker and world editor... On how to use the folders on these folders to compile, the web is full, use the search
  17. try to change "i" with "index" , I think that "i" is something else. replace this : with this :
  18. I think you should pass through tar the extern you use in the local compiler machine -> on the vps and try again... To compress extern in tar you can use the command tar -cf folder (space) file_name. tar example : cd /usr/home/ tar -cf game game.tar to untar it in vps: put it in cd /usr/home (for example) cd /usr/home/ tar -xf game.tar
  19. a stupid question.... do you have an import player among imports of uiinventory?
  20. post system.py under spoiler (or on pastebin)
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.