Jump to content

Distraught

Honorable Member
  • Posts

    194
  • Joined

  • Last visited

  • Days Won

    23
  • Feedback

    0%

Everything posted by Distraught

  1. actually i dont believe theres anything u need of those old stuff (except for if u r a bank, they stay legacy) and if u dont even remember why dont u just post out the errors then?
  2. Actually the game and db need those libraries and not the other way around.
  3. Why do you want to use that toolset? Wouldn’t be easier to just change it to the one you have?
  4. Yep, it’s called debugger. Btw you wrote a comment before you thought it could be caused by the auto keywords. Actually that’s exactly the same as you were writing iterators because the compiler interprets them what they are. Auto is not an actual type, just a shorthand. That’s why you have to initialize those variables at the same time to let the compiler know what it is going to be (except for decltype(auto)s, that got into the standard later for telling the compiler we don’t know the type yet but that’s neither a type as you can’t change after initialization).
  5. You cannot rely on an “it works” neither. For example vc++ optimizes out overindexing an array in debug mode. Each compiler has its own routines. If something is only working in a specific environment than it’s not working.
  6. How was that vector initialized? Never trust on an “i think”. If it’s filled with raw pointers, a clear does not free the memory it points to. If it stores smart pointers than their lifetimes’ are managed. Post the declarations, because there are many more reason for it. What problem you’ve fallen into is called dangling pointers. It occurs when you have invalidated pointers as their memory is freed but they are unable to check because they are not set to nullptr. This can lead to a lot of other error because something is surely not okay there. Don’t hide the errors, solve them as it will just always get worse. The easiest way is to store shared pointers and use weak pointers when you access any of the elements so that you can check their validity. If it’s a common base class consider making it usable with intrusive pointers as the specifications allow.
  7. Are the libraries listed after the object files of your executable? Because linking in gcc is working like it throws away everything else except for what it actually needs. So if your library is before the object files, it won’t link anything from them because there’s no dependency yet. Try something like g++ x.o y.o z.o -l:cryptopp.a Also make sure that you have the same defines related to cryptopp when building game. If it doesn’t help, take cryptopp source files and try listing them directly in the game build script, it’s called fuckin static linking.
  8. Are you sure you calculating the hash the same way for the patchlist and the patcher too?
  9. Store the time (a fix point in the future) it will get unusable at creation (and calculate the remaning as their difference) instead of saving how much you still have.
  10. whats the connection between boost and another library with its own preproc macros? btw using older or newer boost wont change anything as the developers didnt really use it except for some containers and bindings but they all are in the stl now so you can get rid of boost (anyway even if u wanna take som funcs from that, boost have bcp so u can extract only the needed parts and not carrying about 10k files for nothing)
  11. i didnt check it yet in its original context but u said it was an assertion... actually it's the purpose of them (they only get triggered in debug mode as they're for the developers) but by looking at what u copied here, the easiest solution would be to clamp the distance like changing this part m_fDistance = D3DXVec3Length(&m_v3View);  if (std::isnan(m_fDistance)) // 19 august 2018 { std::string s_m_fDistance = std::to_string(m_fDistance); //CScreen s; s.UpdateViewMatrix(); // scos TraceError("SetViewMatrix : m_fDistance is NaN, value %s", s_m_fDistance.c_str()); } assert(m_fDistance >= 0); // problem to this one line m_fDistance = std::max(0, D3DXVec3Length(&m_v3View)) ; as its just about rendering we dont have to be really strict and it should actually solve the problem
  12. after a fast check i found the definition in misc.cpp with some macros around it maybe a working but dirty solution is to force CRYPTOPP_BOOL_ALIGN16 macro to be defined so the function will be too, to achieve this add #define CRYPTOPP_BOOL_ALIGN16 1 to config.h (to the end to make sure it wont change) and recompile cryptopp
  13. add -static-libstdc++ flag to your cxxflags or cflags or whatever u use to link it statically
  14. [OFF] Actually why do you use calloc? It's unnecessary to set them to 0. You'll call your constructor so it'll change the values there and by the way BSDs have a process that nulls out all the free memory.
  15. Hey guys, Actually I just found a strange error. I changed the O2 optimalization flag to O3 and compiled the game and db and after all the CHs crash except for the auth. I changed them back to O2, recompiled and still this error. Put back the backup game and db and still this error. There's nothing in the syserr, only the PIDs (thats why I know that only auth is running).
  16. M2 Download Center Download Here ( Internal ) Heyhoo újra Equipable pencil item to make your chat colorful. Client side we only gonna work in the UserInterface: Open packet.h Search: typedef struct packet_chatting { BYTE header; WORD size; BYTE type; DWORD dwVID; BYTE bEmpire; } TPacketGCChat; Replace: typedef struct packet_chatting { BYTE header; WORD size; BYTE type; DWORD dwVID; BYTE bEmpire; BYTE TypingColor; } TPacketGCChat; Open PythonNetworkStreamPhaseGame.cpp and search for RecvChatPacket function. In this func. search for TPacketGCChat kChat; TPacketGCChat kChat; char buf[1024 + 1]; char line[1024 + 1]; Add after: string colored_p; string colored_buf; Go down till _snprintf(line, sizeof(line), "%s", p); Add it before: switch (kChat.TypingColor) { case 1: colored_p = "|cff00ffff" + string(p) + "|r"; colored_buf = "|cff00ffff" + string(buf) + "|r"; break; case 2: colored_p = "|cffff0000" + string(p) + "|r"; colored_buf = "|cffff0000" + string(buf) + "|r"; break; case 3: colored_p = "|cffADFF2F" + string(p) + "|r"; colored_buf = "|cffADFF2F" + string(buf) + "|r"; break; case 4: colored_p = "|cffFF4500" + string(p) + "|r"; colored_buf = "|cffFF4500" + string(buf) + "|r"; break; case 5: colored_p = "|cffC67171" + string(p) + "|r"; colored_buf = "|cffC67171" + string(buf) + "|r"; break; default: colored_p = string(p); colored_buf = string(buf); break; } Modify the mentioned line from _snprintf(line, sizeof(line), "%s", p); to _snprintf(line, sizeof(line), "%s", colored_p.c_str()); Find in this func if (pkInstChatter->IsPC()) CPythonChat::Instance().AppendChat(kChat.type, buf); Modify the line to CPythonChat::Instance().AppendChat(kChat.type, colored_buf.c_str()); Compile client binary. We have to add a new item subtype to the dump_proto. In ItemCSVReader.cpp search for get_Item_SubType_Value func. and modify arSub16 array: string arSub16[] = { "UNIQUE_NONE", "UNIQUE_BOOK", "UNIQUE_SPECIAL_RIDE", "UNIQUE_SPECIAL_MOUNT_RIDE", "UNIQUE_COLOR", "UNIQUE_5", "UNIQUE_6", "UNIQUE_7", "UNIQUE_8", "UNIQUE_9", "USE_SPECIAL"}; Compile. Server side: game directory: Open packet.h Search for typedef struct packet_chat // 가변 패킷 { BYTE header; WORD size; BYTE type; DWORD id; BYTE bEmpire; } TPacketGCChat; Modify like: typedef struct packet_chat // 가변 패킷 { BYTE header; WORD size; BYTE type; DWORD id; BYTE bEmpire; BYTE TypingColor; } TPacketGCChat; Open input_main.cpp and search for Chat func. Find the pack_chat.header = HEADER_GC_CHAT; pack_chat.size = sizeof(TPacketGCChat) + len; pack_chat.type = pinfo->type; pack_chat.id = ch->GetVID(); part and modify like: pack_chat.header = HEADER_GC_CHAT; pack_chat.size = sizeof(TPacketGCChat) + len; pack_chat.type = pinfo->type; pack_chat.id = ch->GetVID(); pack_chat.TypingColor = ch->GetTypingColor(); Open char.h and search for bool m_bWalking; Add before: BYTE TypingColor; Search: bool IsStateMove() const { return IsState((CState&)m_stateMove); } Add before: BYTE GetTypingColor() { return TypingColor; } BYTE SetTypingColor(BYTE _c) { TypingColor = _c; } Open char.cpp, search for Initialize func. Put it before: TypingColor = 0; Open item.cpp and search for EquipTo func. You'll see this at the beginning: if (!ch) { sys_err("EquipTo: nil character"); return false; } Add after: if(GetType() == ITEM_UNIQUE && GetSubType() == UNIQUE_COLOR) ch->SetTypingColor(GetValue(1)); Find the Unequip func. Search for this part: if (this != m_pOwner->GetWear(GetCell() - INVENTORY_MAX_NUM)) { sys_err("m_pOwner->GetWear() != this"); return false; } Add after: if(GetType() == ITEM_UNIQUE && GetSubType() == UNIQUE_COLOR) m_pOwner->SetTypingColor(0); common/item_length.h: Search for enum EUniqueSubTypes { UNIQUE_NONE, UNIQUE_BOOK, UNIQUE_SPECIAL_RIDE, UNIQUE_SPECIAL_MOUNT_RIDE, }; Modify like enum EUniqueSubTypes { UNIQUE_NONE, UNIQUE_BOOK, UNIQUE_SPECIAL_RIDE, UNIQUE_SPECIAL_MOUNT_RIDE, UNIQUE_COLOR, }; Compile game. DB: open ProtoReader.cpp and search for get_Item_SubType_Value func. Modify arSub16 array like static string arSub16[] = { "UNIQUE_NONE", "UNIQUE_BOOK", "UNIQUE_SPECIAL_RIDE", "UNIQUE_SPECIAL_MOUNT_RIDE", "UNIQUE_COLOR", "UNIQUE_5", "UNIQUE_6", "UNIQUE_7", "UNIQUE_8", "UNIQUE_9", "USE_SPECIAL"}; Compile. item_proto: 20111 pencil_cyan ITEM_UNIQUE UNIQUE_COLOR 1 ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_STACK | ANTI_MYSHOP LOG WEAR_SHIELD 0 0 0 0 0 LIMIT_NONE 0 LIMIT_NONE 0 APPLY_NONE 0 APPLY_NONE 0 APPLY_NONE 0 0 1 0 0 0 0 0 0 0 20112 pencil_cyan ITEM_UNIQUE UNIQUE_COLOR 1 ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_STACK | ANTI_MYSHOP LOG WEAR_SHIELD 0 0 0 0 0 LIMIT_NONE 0 LIMIT_NONE 0 APPLY_NONE 0 APPLY_NONE 0 APPLY_NONE 0 0 2 0 0 0 0 0 0 0 20113 pencil_cyan ITEM_UNIQUE UNIQUE_COLOR 1 ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_STACK | ANTI_MYSHOP LOG WEAR_SHIELD 0 0 0 0 0 LIMIT_NONE 0 LIMIT_NONE 0 APPLY_NONE 0 APPLY_NONE 0 APPLY_NONE 0 0 3 0 0 0 0 0 0 0 20114 pencil_cyan ITEM_UNIQUE UNIQUE_COLOR 1 ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_STACK | ANTI_MYSHOP LOG WEAR_SHIELD 0 0 0 0 0 LIMIT_NONE 0 LIMIT_NONE 0 APPLY_NONE 0 APPLY_NONE 0 APPLY_NONE 0 0 4 0 0 0 0 0 0 0 20115 pencil_cyan ITEM_UNIQUE UNIQUE_COLOR 1 ANTI_DROP | ANTI_SELL | ANTI_GIVE | ANTI_STACK | ANTI_MYSHOP LOG WEAR_SHIELD 0 0 0 0 0 LIMIT_NONE 0 LIMIT_NONE 0 APPLY_NONE 0 APPLY_NONE 0 APPLY_NONE 0 0 5 0 0 0 0 0 0 0 item_names: 20111 Ceruza 20112 Ceruza 20113 Ceruza 20114 Ceruza 20115 Ceruza item_list: 20111 ETC icon/item/color_cyan.tga 20112 ETC icon/item/color_red.tga 20113 ETC icon/item/color_green.tga 20114 ETC icon/item/color_orange.tga 20115 ETC icon/item/color_brown.tga Icons are attached.
  17. M2 Download Center Download Here ( Internal ) Hey guyz Here's an image to see what is it about. Just coloring guild names for the top3 rank. (gold,silver,bronze) Let's start with the server side. Open char.cpp and search for void CHARACTER::SendGuildName(CGuild* pGuild) Modify like: void CHARACTER::SendGuildName(CGuild* pGuild) { if (NULL == pGuild) return; DESC *desc = GetDesc(); if (NULL == desc) return; if (m_known_guild.find(pGuild->GetID()) != m_known_guild.end()) return; m_known_guild.insert(pGuild->GetID()); TPacketGCGuildName pack; memset(&pack, 0x00, sizeof(pack)); pack.header = HEADER_GC_GUILD; pack.subheader = GUILD_SUBHEADER_GC_GUILD_NAME; pack.size = sizeof(TPacketGCGuildName); pack.guildID = pGuild->GetID(); memcpy(pack.guildName, pGuild->GetName(), GUILD_NAME_MAX_LEN); pack.guildRank = CGuildManager::instance().GetRank(pGuild); desc->Packet(&pack, sizeof(pack)); } Open packet.h and search for typedef struct packet_guild_name_t Modify the struct like: typedef struct packet_guild_name_t { BYTE header; WORD size; BYTE subheader; DWORD guildID; char guildName[GUILD_NAME_MAX_LEN]; int guildRank; } TPacketGCGuildName; Compile the game file. And now the client side. We'll only work in UserInterface. In PythonGuild.h search for typedef std::map<DWORD, std::string> TGuildNameMap; Modify like: typedef std::map<DWORD, GuildNameRank> TGuildNameMap; Put it before that line: struct GuildNameRank { std::string name; int rank; }; Search for: void RegisterGuildName(DWORD dwID, const char * c_szName); Modify like: void RegisterGuildName(DWORD dwID, const char * c_szName, int rank); Open PythonGuild.cpp-t and search for RegisterGuildName function: Modify: void CPythonGuild::RegisterGuildName(DWORD dwID, const char * c_szName, int rank) { GuildNameRank gnr; gnr.name = std::string(c_szName); gnr.rank = rank; m_GuildNameMap.insert(make_pair(dwID, gnr)); } Now search for GetGuildName Modify: bool CPythonGuild::GetGuildName(DWORD dwID, std::string * pstrGuildName) { if (m_GuildNameMap.end() == m_GuildNameMap.find(dwID)) return false; switch (m_GuildNameMap[dwID].rank) { case 1: *pstrGuildName = "|cffFFC125" + m_GuildNameMap[dwID].name + "|r"; break; case 2: *pstrGuildName = "|cff888888" + m_GuildNameMap[dwID].name + "|r"; break; case 3: *pstrGuildName = "|cffCD661D" + m_GuildNameMap[dwID].name + "|r"; break; default: *pstrGuildName = m_GuildNameMap[dwID].name; break; } return true; } Open PythonNetworkStreamPhaseGame.cpp and search for case GUILD_SUBHEADER_GC_GUILD_NAME: Replace the case: case GUILD_SUBHEADER_GC_GUILD_NAME: { DWORD dwID; char szGuildName[GUILD_NAME_MAX_LEN+1]; int guildRank; int iPacketSize = int(GuildPacket.size) - sizeof(GuildPacket); int nItemSize = sizeof(dwID) + GUILD_NAME_MAX_LEN + sizeof(guildRank); assert(iPacketSize%nItemSize==0 && "GUILD_SUBHEADER_GC_GUILD_NAME"); for (; iPacketSize > 0;) { if (!Recv(sizeof(dwID), &dwID)) return false; if (!Recv(GUILD_NAME_MAX_LEN, &szGuildName)) return false; if (!Recv(sizeof(guildRank), &guildRank)) return false; szGuildName[GUILD_NAME_MAX_LEN] = 0; //Tracef(" >> GulidName [%d : %s]\n", dwID, szGuildName); CPythonGuild::Instance().RegisterGuildName(dwID, szGuildName, guildRank); iPacketSize -= nItemSize; } break; } Compile the client binary! We're all done
  18. Hey guyz I just made a lil system to log players ram and cpu mhz into the db anonymously. Let's start with the client. Opena packet.hand search for HEADER_CG_MARK_LOGIN = 100, Add before: HEADER_CG_SYS_INFO_BY_DISTRAUGHT = 99, Go down to typedef struct command_mark_login Add before: struct sys_info_by_distraught { BYTE header; float RAM; int CPU; }; Search for this in PythonNetworkStream.h: bool SendSpecial(int nLen, void * pvBuf); Add before: bool SendSYSInfo(); Open PythonNetworkStreamPhaseGame.cpp and after BOOL gs_bEmpireLanuageEnable = TRUE; add: //SYS INFO BY DISTRAUGHT #define _WIN32_WINNT 0x0501 float GetRAM() { MEMORYSTATUSEX memstat; memstat.dwLength = sizeof(memstat); GlobalMemoryStatusEx(&memstat); return (float)memstat.ullTotalPhys / (1024 * 1024 * 1024); } int GetCPUSpeedMHz() { char Buffer[MAX_PATH]; unsigned long BufSize = MAX_PATH; unsigned long ulMHz = MAX_PATH; HKEY hKey; long lError = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0, KEY_READ, &hKey); if (lError != ERROR_SUCCESS) return 0; RegQueryValueEx(hKey, "~MHz", NULL, NULL, (LPBYTE)&ulMHz, &BufSize); return ulMHz; } bool CPythonNetworkStream::SendSYSInfo() { std::ifstream check("sentsys.txt"); if (check.good()) { int i = 0; check >> i; if (i > 0) return false; } check.close(); sys_info_by_distraught packet; packet.header = HEADER_CG_SYS_INFO_BY_DISTRAUGHT; packet.RAM = GetRAM(); packet.CPU = GetCPUSpeedMHz(); if (!Send(sizeof(packet), &packet)) return false; std::ofstream save("sentsys.txt"); save << "1"; save.close(); return SendSequence(); } //SYS INFO END Open PythonNetworkStreamPhaseLogin.cpp search for function SendLoginPacket. Inside this function search for: if (!Send(sizeof(LoginPacket), &LoginPacket)) add before: SendSYSInfo(); Now look for SendLoginPacketNew function and do the same. Compile client binary. And now the server. Open packet.h -t and search for HEADER_CG_REFINE = 96, add after: HEADER_CG_SYS_INFO_BY_DISTRAUGHT = 99, Look for typedef struct SPacketGGSetup Add before: struct sys_info_by_distraught { BYTE header; float RAM; int CPU; }; Open packet_info.cpp and search for Set(HEADER_CG_TEXT, sizeof(TPacketCGText), "Text", false); add before: Add elé: Set(HEADER_CG_SYS_INFO_BY_DISTRAUGHT, sizeof(sys_info_by_distraught), "SYSInfo", true); Open input.h and look for CInputLogin class. Inside search for virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData); Add after: void SaveSYSInfo(const char* data); Open input_login.cpp-t and look for Analyze function. Inside look for case HEADER_CG_PONG: add before: case HEADER_CG_SYS_INFO_BY_DISTRAUGHT: SaveSYSInfo(c_pData); break; Look for int CInputLogin::Analyze(LPDESC d, BYTE bHeader, const char * c_pData) add before: void CInputLogin::SaveSYSInfo(const char* data) { sys_info_by_distraught* packet = (sys_info_by_distraught*)data; DBManager::instance().Query("INSERT INTO system_info(ram, cpu, sent_at) VALUES (%f, %d, CURDATE());", packet->RAM, packet->CPU); return; } Compile the game. Run this query in the player db: DROP TABLE IF EXISTS `system_info`; CREATE TABLE `system_info` ( `ram` float(12,0) DEFAULT NULL, `cpu` int(12) DEFAULT NULL, `sent_at` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; You'll find the system infos in the play/system_info table. If you want players to send their RAM and CPU again, just upload a sentsys.txt file with a content of just a 0 to the main directory of the client to your patchserver.
  19. look for UseItemEx function in char_item.cpp and add to the begining: if(item->GetVnum() == 12345) { if(cannot_dead) ResetArmada(); else SetArmada(); }
  20. M2 Download Center Download Here ( Internal ) Hey guyz, I didn't find it anywhere so coded a new one. 1. Upload the files to your site. 2. Change IP and DB login data in the PHP file 3. Upload your item_list.txt and icon folder next to the PHP file. (convert all tga to png with the converter attached) 4. Call the PHP file xy.php?name=charactername (you can use like an iframe for ranklist, whatevs) Here's a converter too: Put your icon folder next to the exe and execute it. It will convert all tga image to png without changing the folder construction.
  21. M2 Download Center Download Here ( Internal ) Hey guyz, I just made a lil tool for the community. You can edit your item and mob_proto.txt with as a table. Put those txt files next to the program. There's some kinda run query function in it. You can run the simplest queries with it like "update Level*10" which will multiplicate all the Level values by 10. Only update function is available yet and without where. Operators you can use: +, -, *, /, = Download
  22. oh really, that's right and he also missed this check too so that's why the big difference in runtime if (!it->second.pCharacter) { ++it; continue; }
×
×
  • 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.