Jump to content
metin2dev

Distraught

Members
  • Content count

    65
  • Joined

  • Last visited

  • Days Won

    3

Distraught last won the day on May 9

Distraught had the most liked content!

Community Reputation

29 Good

About Distraught

  • Rank
    Friendly
  • Birthday 01/23/1998

Profile Information

  • Gender
    Male
  • Location
    Budapest

Contact Methods

  • Skype
    bordenslade

Recent Profile Visitors

717 profile views
  1. Distraught

    c++ Pencil

    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. icon.rar
  2. 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
  3. 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.
  4. Distraught

    open Double bonus on mount

    http://metin2hungary.net/index.php/topic,199248.0.html
  5. Distraught

    open Block damage with selected vnum

    look for UseItemEx function in char_item.cpp and add to the begining: if(item->GetVnum() == 12345) { if(cannot_dead) ResetArmada(); else SetArmada(); }
  6. Distraught

    Equipment viewer for web + converter

    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. All files are in the attachment.tga_to_png.rar eq_viewer_by_Distraught.rar
  7. Distraught

    item and mob_proto editor (for txt)

    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
  8. 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; }
  9. Acutally you both are right. @metin2-factory says the ++i is running faster than the i++. It's true because i++ stores the old value and returns that and after adds 1 to the value of i. ++i only adds 1 and doesn't store the old value. BUT @Tasho is also right. I checked the runtime of both of our code (ran it 1.000.000 times and then calculated an average value). His code runs about 2x times faster than mine because of the optimalizations he did.
  10. Hey guyz, Today I made a small release. It's a new LUA function to check if all the members of the party have the specified item (and then it removes it). Let's start to make it work! Open party.h and search for: GetMemberMinLevel(); After add this: bool CheckItem(int targyID); Save and close the file. Open party.cpp and and the code below the function GetMemberMaxLevel: bool CParty::CheckItem(int targyID) { int dbszam = 0; itertype(m_memberMap) it = m_memberMap.begin(); while (it!=m_memberMap.end()) { if (!it->second.pCharacter) { ++it; continue; } if(it->second.pCharacter->CountSpecifyItem(targyID) > 0) dbszam++; ++it; } if(GetNearMemberCount() <= dbszam) { itertype(m_memberMap) it2 = m_memberMap.begin(); while (it2!=m_memberMap.end()) { if (!it2->second.pCharacter) { ++it2; continue; } if(it2->second.pCharacter->CountSpecifyItem(targyID) > 0) it2->second.pCharacter->RemoveSpecifyItem(targyID); ++it2; } }else{return false;} return true; } Save the file and close it. Open questlua_party.cpp and add this function: int party_check_item(lua_State* L) { DWORD item_vnum; if (lua_isnumber(L,1)) { item_vnum = (DWORD)lua_tonumber(L, 1); } else { lua_pushboolean(L, 0); return 1; } LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (ch->GetParty()) lua_pushboolean(L,ch->GetParty()->CheckItem(item_vnum)); else lua_pushboolean(L, 0); return 1; } Add the line below after { "is_in_dungeon", party_is_in_dungeon }, { "check_item", party_check_item }, Compile the game and we're done. In quests it will return a boolean value. You can use it like: if party.check_item(72702) then d.join(207) end In this case it checks if all the party members have the item with the ID of 72702 and then it removes from them and warps them to the dungeon. Don't copy it or at least mention my name!
  11. Distraught

    Quest checker

    Hey guyz, I made a quest checker that reads your quest and if it has any error then the program shows so. Download
  12. Distraught

    Wolfman Enterpage

    Hey guyz, I just made a simple but sexy enterpage. Demo Download Feel free to use
  13. Distraught

    open Warrior's tattoo

    its kinda similar
  14. Distraught

    open RemoveFromCharacter Game Core

    when u get this error? ath throwing items out?
  15. Distraught

    open Core is shutting down, why?

    compile your game without stripping it and then debug it to let us see what happened
×