-
Posts
270 -
Joined
-
Last visited
-
Days Won
38 -
Feedback
100%
Content Type
Forums
Store
Feature Plan
Release Notes
Docs
Events
Everything posted by Distraught
-
Cannont allocate memory
Distraught replied to KeeA's topic in Community Support - Questions & Answers
[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. -
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).
-
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.
-
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
-
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.
-
Double bonus on mount
Distraught replied to Fenix2009's topic in Community Support - Questions & Answers
[Hidden Content],199248.0.html -
Block damage with selected vnum
Distraught replied to avertuss's topic in Community Support - Questions & Answers
look for UseItemEx function in char_item.cpp and add to the begining: if(item->GetVnum() == 12345) { if(cannot_dead) ResetArmada(); else SetArmada(); } -
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.
-
- 69
-
-
-
-
-
-
-
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
- 9 replies
-
- 676
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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.
-
M2 Download Center Download Here ( Internal ) Hey guyz, Today I made a small release. It's a new LUA function to check if all members of a party have a 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(DWORD vnum, DWORD count); Save and close the file. Open party.cpp and and the code below the function GetMemberMaxLevel: bool CParty::CheckItem(DWORD vnum, DWORD count) { bool success = std::all_of(m_memberMap.begin(), m_memberMap.end(), [vnum, count] (const auto& pair) { LPCHARACTER ch = pair.second.pCharacter; if (!ch) return true; return ch->CountSpecifyItem(vnum) >= count; }); if (!success) return false; std::for_each(m_memberMap.begin(), m_memberMap.end(), [vnum, count] (const auto& pair) { LPCHARACTER ch = pair.second.pCharacter; if (!ch) return; ch->RemoveSpecifyItem(vnum, count); }); return true; } Save the file and close it. Open questlua_party.cpp and add this function: int party_check_item(lua_State* L) { if (!lua_isnumber(L, 1) || lua_isnumber(L, 2)) { lua_pushboolean(L, false); return 1; } DWORD vnum = lua_tonumber(L, 1); DWORD count = lua_tonumber(L, 2); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) { lua_pushboolean(L, false); return 1; } LPPARTY party = ch->GetParty(); if (!party) { if (ch->CountSpecifyItem(vnum) < count) { lua_pushboolean(L, false); return 1; } ch->RemoveSpecifyItem(vnum, count); lua_pushboolean(L, true); return 1; } lua_pushboolean(L, party->CheckItem(vnum, count)); 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, 1) then d.join(207) end In this case it checks if all the party members have the item with the vnum 72702, if so, it removes from them and warps them to the dungeon. Don't copy it or at least mention my name!
- 24 replies
-
- 10
-
-
-
-
M2 Download Center Download Here ( Internal ) Hey guyz, I made a quest checker that reads your quest and if it has any error then the program shows so. Download
- 2 replies
-
- 41
-
-
-
-
-
M2 Download Center Download Here ( Internal ) Hey guyz, I just made a simple but sexy enterpage. Download Feel free to use
- 1 reply
-
- 9
-
-
-
-
-
its kinda similar
-
RemoveFromCharacter Game Core
Distraught replied to cekaskartos8's topic in Community Support - Questions & Answers
when u get this error? ath throwing items out? -
Core is shutting down, why?
Distraught replied to Metin2Place's topic in Community Support - Questions & Answers
compile your game without stripping it and then debug it to let us see what happened -
you can just easily set limittype 0 and 1, etc to have more limits at the same time
-
Help for editing C++
Distraught replied to antrikos91's topic in Community Support - Questions & Answers
coding new systems is not a magic, start learning c++ and you'll be able to do so [Hidden Content]- 1 reply
-
- 1
-
-
Item giving armor shining
Distraught replied to mateo7788's topic in Community Support - Questions & Answers
in the pythinnetworkstreamphasegamitem.cpp modify case ARMOR_RING like this: case ARMOR_RING: CInstanceBase * pInstance = CPythonCharacterManager::Instance().GetInstancePtr(kSpecialEffect.vid); pInstance->CInstanceBase::ArmorRing(); break; may it gonna work -
Shop range showing distance
Distraught replied to ae5140's topic in Community Support - Questions & Answers
sqrt((targetX-yourX)^2 + (targetY-yourY)^2) -
Restrict items on QuickSlots
Distraught replied to zeimpekis9's topic in Community Support - Questions & Answers
open char_quickslot.cpp and search for: if (pItem->IsDragonSoul()) return; modify: if (pItem->IsDragonSoul() || pItem->GetVnum() == YOURITEMID) return; If you wanna add more items: if (pItem->IsDragonSoul() || pItem->GetVnum() == YOURITEMID || pItem->GetVnum() == YOURITEMID2 || pItem->GetVnum() == YOURITEMID3) return; I'm working now so I couldn't test it, but I think it's gonna work. -
then search for BeginAttack or something like that in char_battle.cpp and check that
-
Item giving armor shining
Distraught replied to mateo7788's topic in Community Support - Questions & Answers
go to game/src/char_item.cp and search for: else if (true == CItemVnumHelper::IsLovePendant(dwVnum)) after put something like: if (item->GetVnum() == YOURITEMID) { this->EffectPacket(ARMOR_RING); } Then search for: bool CHARACTER::UnequipItem(LPITEM item) to this function put this: if (item->GetVnum() == YOURITEMID) { this->EffectPacket(ARMOR_RING); } go to common/length.h and search for: SE_EQUIP_LOVE_PENDANT, then put this under: ARMOR_RING, Now you can compile your game. open UserInterface/PythonNetworkStreamPhaseGameItem.cpp in your client source and search for: case SE_EQUIP_LOVE_PENDANT: after put these: case ARMOR_RING: CInstanceBase::ArmorRing(); break; Go to InstanceBase.h and search for: void OnUntargeted(); Add under: void ArmorRing(); Search for: m_armorRefineEffect; Add under: bool ringeffect; Now go to InstanceBase.cpp and at the beginning declare it: bool ringeffect = false; now search for: void CInstanceBase::__ClearArmorRefineEffect() After this function put this: void CInstanceBase::ArmorRing() { if (!ringeffect) { __AttachEffect(EFFECT_REFINED + EFFECT_BODYARMOR_SPECIAL5); ringeffect = true; } else { __DetachEffect(EFFECT_REFINED + EFFECT_BODYARMOR_SPECIAL5); ringeffect = false; } } Now compile it. I couldn't test it, cause I'm working now but I think it's gonna work. -
if you attack a mob, do you also have to wait a few seconds to make it attack you?
