Jump to content

Kuqsal

Active Member
  • Posts

    128
  • Joined

  • Last visited

  • Feedback

    0%

About Kuqsal

Informations

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Kuqsal's Achievements

Community Regular

Community Regular (8/16)

  • Very Popular Rare
  • Collaborator Rare
  • First Post
  • Conversation Starter
  • Dedicated

Recent Badges

241

Reputation

  1. Dear friends, I found a SQL-side bug in the "Great Shop" system that was causing the `player.item` table to bloat. I have fixed it—the implementation is shown below—but I would like to ask for your opinion: do you consider this an optimized and correct fix? Thank you in advance for your comments, and I wish you success in life. void ITEM_MANAGER::SaveSingleItem(LPITEM item) { #ifdef ENABLE_FIX_SKIPSAVE_ITEM_LEAK if (item->GetSkipSave()) return; #endif if (!item->GetOwner()) { DWORD dwID = item->GetID(); DWORD dwOwnerID = item->GetLastOwnerPID(); db_clientdesc->DBPacketHeader(HEADER_GD_ITEM_DESTROY, 0, sizeof(DWORD) + sizeof(DWORD)); db_clientdesc->Packet(&dwID, sizeof(DWORD)); db_clientdesc->Packet(&dwOwnerID, sizeof(DWORD)); sys_log(1, "ITEM_DELETE %s:%u", item->GetName(), dwID); return; } sys_log(1, "ITEM_SAVE %s:%d in %s window %d", item->GetName(), item->GetID(), item->GetOwner()->GetName(), item->GetWindow()); TPlayerItem t; t.id = item->GetID(); t.window = item->GetWindow(); switch (t.window) { case EQUIPMENT: t.pos = item->GetCell() - INVENTORY_MAX_NUM; break; #ifdef ENABLE_BELT_INVENTORY_EX case INVENTORY: if (BELT_INVENTORY_SLOT_START <= item->GetCell() && BELT_INVENTORY_SLOT_END > item->GetCell()) { t.window = BELT_INVENTORY; t.pos = item->GetCell() - BELT_INVENTORY_SLOT_START; break; } #endif default: t.pos = item->GetCell(); break; } t.count = item->GetCount(); t.vnum = item->GetOriginalVnum(); switch (t.window) { case SAFEBOX: case MALL: t.owner = item->GetOwner()->GetDesc()->GetAccountTable().id; break; default: t.owner = item->GetOwner()->GetPlayerID(); break; } thecore_memcpy(t.alSockets, item->GetSockets(), sizeof(t.alSockets)); thecore_memcpy(t.aAttr, item->GetAttributes(), sizeof(t.aAttr)); #ifdef ENABLE_SOULBIND_SYSTEM t.sealbind = item->GetSealBindTime(); #endif db_clientdesc->DBPacketHeader(HEADER_GD_ITEM_SAVE, 0, sizeof(TPlayerItem)); db_clientdesc->Packet(&t, sizeof(TPlayerItem)); } LPITEM ITEM_MANAGER::CreateItem(DWORD vnum, DWORD count, DWORD id, bool bTryMagic, int iRarePct, bool bSkipSave) --inside #ifdef ENABLE_FIX_SKIPSAVE_ITEM_LEAK item->SetSkipSave(bSkipSave); #else item->SetSkipSave(false); #endif @ Amun @ martysama0134 @ Intel @ Karbust @ Geoffrey @ Mali @ Owsap @ Distraught
  2. Dear friends, I am thinking about converting my x32 client to x64; do you think that makes sense? How difficult is it to convert to x64? How many days do you think it would take?
  3. This problem with bout ?
  4. Fix item_manager.cpp Search: int ITEM_MANAGER::RealNumber(DWORD vnum) { int bot, top, mid; bot = 0; top = m_vec_prototype.size(); TItemTable * pTable = &m_vec_prototype[0]; while (1) { mid = (bot + top) >> 1; if ((pTable + mid)->dwVnum == vnum) return (mid); if (bot >= top) return (-1); if ((pTable + mid)->dwVnum > vnum) top = mid - 1; else bot = mid + 1; } } //Chance: int ITEM_MANAGER::RealNumber(DWORD vnum) { if (m_vec_prototype.empty()) return -1; int bot = 0; int top = m_vec_prototype.size() - 1; TItemTable * pTable = &m_vec_prototype[0]; while (bot <= top) { int mid = (bot + top) >> 1; if (pTable[mid].dwVnum == vnum) return mid; if (pTable[mid].dwVnum > vnum) top = mid - 1; else bot = mid + 1; } return -1; } ==53198==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x2d001758 at pc 0x00ab8378 bp 0xffbfa080 sp 0xffbfa078 READ of size 4 at 0x2d001758 thread T0 #0 0x00ab8377 in ITEM_MANAGER::RealNumber(unsigned int) /usr/test/GameSource/Server/game/src/item_manager.cpp:645:23 #1 0x00ab8377 in ITEM_MANAGER::GetTable(unsigned int) /usr/test/GameSource/Server/game/src/item_manager.cpp:612:13 #2 0x00862670 in CHARACTER::RefreshGift() /usr/test/GameSource/Server/game/src/char.cpp:5696:61 #3 0x00861ae9 in gift_refresh_event(boost::intrusive_ptr<event>, long) /usr/test/GameSource/Server/game/src/char.cpp:5556:6 #4 0x00a0c6d0 in event_process(int) /usr/test/GameSource/Server/game/src/event.cpp:143:15 #5 0x00cb1159 in heartbeat(std::__1::unique_ptr<heart, std::__1::default_delete<heart>>&, int) /usr/test/GameSource/Server/game/src/main.cpp:257:23 #6 0x00cb6123 in idle() /usr/test/GameSource/Server/game/src/main.cpp:917:3 #7 0x00cb36d4 in main /usr/test/GameSource/Server/game/src/main.cpp:567:9 #8 0x214bd494 in __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:157:7 #9 0x00733637 in _start /usr/src/lib/csu/i386/crt1_s.S:84 0x2d001758 is located 168 bytes before 1216656-byte region [0x2d001800,0x2d12a890) allocated by thread T0 here: #0 0x007d36b7 in operator new(unsigned int) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:86:3 #1 0x00ac79c3 in void* std::__1::__libcpp_operator_new[abi:se190107]<unsigned int>(unsigned int) /usr/include/c++/v1/new:265:10 #2 0x00ac79c3 in std::__1::__libcpp_allocate[abi:se190107](unsigned int, unsigned int) /usr/include/c++/v1/new:289:10 #3 0x00ac79c3 in std::__1::allocator<SItemTable>::allocate[abi:se190107](unsigned int) /usr/include/c++/v1/__memory/allocator.h:118:32 #4 0x00ac79c3 in std::__1::__allocation_result<std::__1::allocator_traits<std::__1::allocator<SItemTable>>::pointer> std::__1::__allocate_at_least[abi:se190107]<std::__1::allocator<SItemTable>>(std::__1::allocator<SItemTable>&, unsigned int) /usr/include/c++/v1/__memory/allocate_at_least.h:41:19 #5 0x00ac79c3 in std::__1::__split_buffer<SItemTable, std::__1::allocator<SItemTable>&>::__split_buffer(unsigned int, unsigned int, std::__1::allocator<SItemTable>&) /usr/include/c++/v1/__split_buffer:353:25 #6 0x00ac79c3 in std::__1::vector<SItemTable, std::__1::allocator<SItemTable>>::__append(unsigned int) /usr/include/c++/v1/vector:1171:49 #7 0x00ab64b0 in std::__1::vector<SItemTable, std::__1::allocator<SItemTable>>::resize(unsigned int) /usr/include/c++/v1/vector:1796:11 #8 0x00ab64b0 in ITEM_MANAGER::Initialize(SItemTable*, int) /usr/test/GameSource/Server/game/src/item_manager.cpp:71:18 #9 0x00a69a73 in CInputDB::Boot(char const*) /usr/test/GameSource/Server/game/src/input_db.cpp:782:28 #10 0x00a75ca3 in CInputDB::Analyze(DESC*, unsigned char, char const*) /usr/test/GameSource/Server/game/src/input_db.cpp:2580:3 #11 0x00a77c26 in CInputDB::Process(DESC*, void const*, int, int&) /usr/test/GameSource/Server/game/src/input_db.cpp:3032:7 #12 0x009dd314 in DESC::ProcessInput() /usr/test/GameSource/Server/game/src/desc.cpp:332:30 #13 0x00cb664b in io_loop(fdwatch*) /usr/test/GameSource/Server/game/src/main.cpp #14 0x00cb61ea in idle() /usr/test/GameSource/Server/game/src/main.cpp:929:7 #15 0x00cb36d4 in main /usr/test/GameSource/Server/game/src/main.cpp:567:9 #16 0x214bd494 in __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:157:7 #17 0x00733637 in _start /usr/src/lib/csu/i386/crt1_s.S:84 #18 0xffbfed97 (<unknown module>) SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/test/GameSource/Server/game/src/item_manager.cpp:645:23 in ITEM_MANAGER::RealNumber(unsigned int)
  5. Search: peer->Encode(&m_vec_banwordTable[0], sizeof(TBanwordTable) * m_vec_banwordTable.size()); Charge: if (!m_vec_banwordTable.empty()) peer->Encode(m_vec_banwordTable.data(), sizeof(TBanwordTable) * m_vec_banwordTable.size()); You will encounter problems with your files when converting from GCC to clang++, and this fix will be necessary. Enjoy Your Work
  6. I think he is doesnt sell cuz I can try to contact he cant give any answer.
  7. Guys I need advice for offlineshop please Thx now
  8. //Search int event_process(int pulse) //Change int event_process(int pulse) { long new_time; int num_events = 0; while (pulse >= cxx_q.GetTopKey()) { TQueueElement * pElem = cxx_q.Dequeue(); if (pElem->bCancel) { cxx_q.Delete(pElem); continue; } new_time = pElem->iKey; LPEVENT the_event = pElem->pvData; long processing_time = event_processing_time(the_event); cxx_q.Delete(pElem); #ifdef EVENT_PROCESS_HEAP_UP_FREE the_event->q_el = NULL; #endif the_event->is_processing = TRUE; if (!the_event->info) { the_event->q_el = NULL; ContinueOnFatalError(); } else { //sys_log(0, "EVENT: %s %d event %p info %p", the_event->file, the_event->line, the_event, the_event->info); new_time = (the_event->func) (get_pointer(the_event), processing_time); if (new_time <= 0 || the_event->is_force_to_end) { the_event->q_el = NULL; } else { the_event->q_el = cxx_q.Enqueue(the_event, new_time, pulse); the_event->is_processing = FALSE; } } ++num_events; } return num_events; } //Search void event_destroy(void) //Change void event_destroy(void) { TQueueElement * pElem; while ((pElem = cxx_q.Dequeue())) { LPEVENT the_event = (LPEVENT) pElem->pvData; if (!pElem->bCancel) { // no op here } cxx_q.Delete(pElem); #ifdef EVENT_PROCESS_HEAP_UP_FREE the_event->q_el = NULL; #endif } }
  9. Dear colleagues, I am a Metin2 developer, but I cannot use AddressSanitizer on FreeBSD 14.xx with LLVM 17. When I enable the detect_leaks = 1 option, it unfortunately reports ‘not supported’. I am aware that FreeBSD does not have the stop-the-world feature like Linux, but is there any way to work around this or a better approach? Other than Valgrind, it cannot keep up with the database and ends up crashing with a core dump [Hidden Content]
  10. If u can click " key U can understand
  11. However, since I’ve disabled the sequence system, the client still calls return SendSequence(); internally — and I think that’s what might be causing the unknown header issue. I’ve researched this quite a bit, but my suspicion is that the problem is either due to a missing entry in packet_info.cpp or related to the SendSequence() function itself. I also noticed that in many developers’ patches, some packet definitions might be missing, for example: HEADER_CG_CHARACTER_MOVE HEADER_CG_GIVE_ITEM Could anyone help me figure this out? My files is this PythonNetworkStreamPhaseGame.cpp and packet_info.cpp Thank you in advance for your help! #include "stdafx.h" #include "../../common/stl.h" #include "constants.h" #include "packet_info.h" #include "HackShield_Impl.h" #include "XTrapManager.h" CPacketInfo::CPacketInfo() : m_pCurrentPacket(NULL), m_dwStartTime(0) { } CPacketInfo::~CPacketInfo() { itertype(m_pPacketMap) it = m_pPacketMap.begin(); for ( ; it != m_pPacketMap.end(); ++it) { M2_DELETE(it->second); } } void CPacketInfo::Set(int header, int iSize, const char * c_pszName, bool bSeq) { if (m_pPacketMap.find(header) != m_pPacketMap.end()) return; TPacketElement * element = M2_NEW TPacketElement; element->iSize = iSize; element->stName.assign(c_pszName); element->iCalled = 0; element->dwLoad = 0; #ifdef ENABLE_SEQUENCE_SYSTEM element->bSequencePacket = bSeq; if (element->bSequencePacket) element->iSize += sizeof(BYTE); #endif m_pPacketMap.insert(std::map<int, TPacketElement *>::value_type(header, element)); } bool CPacketInfo::Get(int header, int * size, const char ** c_ppszName) { std::map<int, TPacketElement *>::iterator it = m_pPacketMap.find(header); if (it == m_pPacketMap.end()) return false; *size = it->second->iSize; *c_ppszName = it->second->stName.c_str(); m_pCurrentPacket = it->second; return true; } #ifdef ENABLE_SEQUENCE_SYSTEM bool CPacketInfo::IsSequence(int header) { TPacketElement * pkElement = GetElement(header); return pkElement ? pkElement->bSequencePacket : false; } void CPacketInfo::SetSequence(int header, bool bSeq) { TPacketElement * pkElem = GetElement(header); if (pkElem) { if (bSeq) { if (!pkElem->bSequencePacket) pkElem->iSize++; } else { if (pkElem->bSequencePacket) pkElem->iSize--; } pkElem->bSequencePacket = bSeq; } } #endif TPacketElement * CPacketInfo::GetElement(int header) { std::map<int, TPacketElement *>::iterator it = m_pPacketMap.find(header); if (it == m_pPacketMap.end()) return NULL; return it->second; } void CPacketInfo::Start() { assert(m_pCurrentPacket != NULL); m_dwStartTime = get_dword_time(); } void CPacketInfo::End() { ++m_pCurrentPacket->iCalled; m_pCurrentPacket->dwLoad += get_dword_time() - m_dwStartTime; } void CPacketInfo::Log(const char * c_pszFileName) { FILE * fp; fp = fopen(c_pszFileName, "w"); if (!fp) return; std::map<int, TPacketElement *>::iterator it = m_pPacketMap.begin(); fprintf(fp, "Name Called Load Ratio\n"); while (it != m_pPacketMap.end()) { TPacketElement * p = it->second; ++it; fprintf(fp, "%-16s %-10d %-10u %.2f\n", p->stName.c_str(), p->iCalled, p->dwLoad, p->iCalled != 0 ? (float) p->dwLoad / p->iCalled : 0.0f); } fclose(fp); } ///--------------------------------------------------------- CPacketInfoCG::CPacketInfoCG() { Set(HEADER_CG_TEXT, sizeof(TPacketCGText), "Text", false); Set(HEADER_CG_HANDSHAKE, sizeof(TPacketCGHandshake), "Handshake", false); Set(HEADER_CG_TIME_SYNC, sizeof(TPacketCGHandshake), "TimeSync", true); Set(HEADER_CG_MARK_LOGIN, sizeof(TPacketCGMarkLogin), "MarkLogin", false); Set(HEADER_CG_MARK_IDXLIST, sizeof(TPacketCGMarkIDXList), "MarkIdxList", false); Set(HEADER_CG_MARK_CRCLIST, sizeof(TPacketCGMarkCRCList), "MarkCrcList", false); Set(HEADER_CG_MARK_UPLOAD, sizeof(TPacketCGMarkUpload), "MarkUpload", false); #ifdef _IMPROVED_PACKET_ENCRYPTION_ Set(HEADER_CG_KEY_AGREEMENT, sizeof(TPacketKeyAgreement), "KeyAgreement", false); #endif Set(HEADER_CG_GUILD_SYMBOL_UPLOAD, sizeof(TPacketCGGuildSymbolUpload), "SymbolUpload", false); Set(HEADER_CG_SYMBOL_CRC, sizeof(TPacketCGSymbolCRC), "SymbolCRC", false); Set(HEADER_CG_LOGIN, sizeof(TPacketCGLogin), "Login", true); Set(HEADER_CG_LOGIN2, sizeof(TPacketCGLogin2), "Login2", true); Set(HEADER_CG_LOGIN3, sizeof(TPacketCGLogin3), "Login3", true); Set(HEADER_CG_LOGIN5_OPENID, sizeof(TPacketCGLogin5), "Login5", true); //OpenID Set(HEADER_CG_ATTACK, sizeof(TPacketCGAttack), "Attack", true); Set(HEADER_CG_CHAT, sizeof(TPacketCGChat), "Chat", true); Set(HEADER_CG_WHISPER, sizeof(TPacketCGWhisper), "Whisper", true); Set(HEADER_CG_CHARACTER_SELECT, sizeof(TPacketCGPlayerSelect), "Select", true); Set(HEADER_CG_CHARACTER_CREATE, sizeof(TPacketCGPlayerCreate), "Create", true); Set(HEADER_CG_CHARACTER_DELETE, sizeof(TPacketCGPlayerDelete), "Delete", true); Set(HEADER_CG_ENTERGAME, sizeof(TPacketCGEnterGame), "EnterGame", true); Set(HEADER_CG_ITEM_USE, sizeof(TPacketCGItemUse), "ItemUse", true); Set(HEADER_CG_ITEM_DROP, sizeof(TPacketCGItemDrop), "ItemDrop", true); Set(HEADER_CG_ITEM_DROP2, sizeof(TPacketCGItemDrop2), "ItemDrop2", true); Set(HEADER_CG_ITEM_MOVE, sizeof(TPacketCGItemMove), "ItemMove", true); Set(HEADER_CG_ITEM_PICKUP, sizeof(TPacketCGItemPickup), "ItemPickup", true); #ifdef WJ_NEW_DROP_DIALOG Set(HEADER_CG_ITEM_DESTROY, sizeof(TPacketCGItemDestroy), "ItemDestroy", true); Set(HEADER_CG_ITEM_SELL, sizeof(TPacketCGItemSell), "ItemSell", true); #endif Set(HEADER_CG_QUICKSLOT_ADD, sizeof(TPacketCGQuickslotAdd), "QuickslotAdd", true); Set(HEADER_CG_QUICKSLOT_DEL, sizeof(TPacketCGQuickslotDel), "QuickslotDel", true); Set(HEADER_CG_QUICKSLOT_SWAP, sizeof(TPacketCGQuickslotSwap), "QuickslotSwap", true); Set(HEADER_CG_SHOP, sizeof(TPacketCGShop), "Shop", true); Set(HEADER_CG_ON_CLICK, sizeof(TPacketCGOnClick), "OnClick", true); Set(HEADER_CG_EXCHANGE, sizeof(TPacketCGExchange), "Exchange", true); Set(HEADER_CG_CHARACTER_POSITION, sizeof(TPacketCGPosition), "Position", true); Set(HEADER_CG_SCRIPT_ANSWER, sizeof(TPacketCGScriptAnswer), "ScriptAnswer", true); Set(HEADER_CG_SCRIPT_BUTTON, sizeof(TPacketCGScriptButton), "ScriptButton", true); Set(HEADER_CG_QUEST_INPUT_STRING, sizeof(TPacketCGQuestInputString), "QuestInputString", true); Set(HEADER_CG_QUEST_CONFIRM, sizeof(TPacketCGQuestConfirm), "QuestConfirm", true); Set(HEADER_CG_MOVE, sizeof(TPacketCGMove), "Move", true); Set(HEADER_CG_SYNC_POSITION, sizeof(TPacketCGSyncPosition), "SyncPosition", true); Set(HEADER_CG_FLY_TARGETING, sizeof(TPacketCGFlyTargeting), "FlyTarget", true); Set(HEADER_CG_ADD_FLY_TARGETING, sizeof(TPacketCGFlyTargeting), "AddFlyTarget", true); Set(HEADER_CG_SHOOT, sizeof(TPacketCGShoot), "Shoot", true); Set(HEADER_CG_USE_SKILL, sizeof(TPacketCGUseSkill), "UseSkill", true); Set(HEADER_CG_ITEM_USE_TO_ITEM, sizeof(TPacketCGItemUseToItem), "UseItemToItem", true); Set(HEADER_CG_TARGET, sizeof(TPacketCGTarget), "Target", true); Set(HEADER_CG_WARP, sizeof(TPacketCGWarp), "Warp", true); Set(HEADER_CG_MESSENGER, sizeof(TPacketCGMessenger), "Messenger", true); Set(HEADER_CG_PARTY_REMOVE, sizeof(TPacketCGPartyRemove), "PartyRemove", true); Set(HEADER_CG_PARTY_INVITE, sizeof(TPacketCGPartyInvite), "PartyInvite", true); Set(HEADER_CG_PARTY_INVITE_ANSWER, sizeof(TPacketCGPartyInviteAnswer), "PartyInviteAnswer", true); Set(HEADER_CG_PARTY_SET_STATE, sizeof(TPacketCGPartySetState), "PartySetState", true); Set(HEADER_CG_PARTY_USE_SKILL, sizeof(TPacketCGPartyUseSkill), "PartyUseSkill", true); Set(HEADER_CG_PARTY_PARAMETER, sizeof(TPacketCGPartyParameter), "PartyParam", true); Set(HEADER_CG_EMPIRE, sizeof(TPacketCGEmpire), "Empire", true); Set(HEADER_CG_SAFEBOX_CHECKOUT, sizeof(TPacketCGSafeboxCheckout), "SafeboxCheckout", true); Set(HEADER_CG_SAFEBOX_CHECKIN, sizeof(TPacketCGSafeboxCheckin), "SafeboxCheckin", true); Set(HEADER_CG_SAFEBOX_ITEM_MOVE, sizeof(TPacketCGItemMove), "SafeboxItemMove", true); #ifdef WJ_PRIVATESHOP_SEARCH_SYSTEM Set(HEADER_CG_PRIVATE_SHOP_SEARCH, sizeof(TPacketCGPrivateShopSearch), "PrivateShopSearch", true); Set(HEADER_CG_PRIVATE_SHOP_SEARCH_CLOSE, sizeof(TPacketCGPrivateShopSearchClose), "PrivateShopSearchClose", true); Set(HEADER_CG_PRIVATE_SHOP_SEARCH_BUY_ITEM, sizeof(TPacketCGPrivateShopSearchBuyItem), "PrivateShopSearchBuyItem", true); #endif Set(HEADER_CG_GUILD, sizeof(TPacketCGGuild), "Guild", true); Set(HEADER_CG_ANSWER_MAKE_GUILD, sizeof(TPacketCGAnswerMakeGuild), "AnswerMakeGuild", true); Set(HEADER_CG_FISHING, sizeof(TPacketCGFishing), "Fishing", true); Set(HEADER_CG_ITEM_GIVE, sizeof(TPacketCGGiveItem), "ItemGive", true); Set(HEADER_CG_HACK, sizeof(TPacketCGHack), "Hack", true); Set(HEADER_CG_MYSHOP, sizeof(TPacketCGMyShop), "MyShop", true); Set(HEADER_CG_REFINE, sizeof(TPacketCGRefine), "Refine", true); Set(HEADER_CG_CHANGE_NAME, sizeof(TPacketCGChangeName), "ChangeName", true); #ifdef ENABLE_CSHIELD Set(HEADER_CG_CSHIELD, sizeof(TPacketCGCShield), "CShield", false); Set(HEADER_CG_CSHIELD_DATA, sizeof(TPacketCGCShieldData), "CShieldData", false); #endif #ifdef ENABLE_EXTERNAL_REPORTS Set(HEADER_CG_CSHIELD_REPORT, sizeof(TPacketCGCShieldReport), "CShieldReport", false); #endif #ifdef ENABLE_CAPTCHA Set(HEADER_CG_CAPTCHA, sizeof(TPacketCGCaptcha), "Captcha", false); #endif Set(HEADER_CG_CLIENT_VERSION, sizeof(TPacketCGClientVersion), "Version", true); Set(HEADER_CG_CLIENT_VERSION2, sizeof(TPacketCGClientVersion2), "Version", true); Set(HEADER_CG_PONG, sizeof(BYTE), "Pong", true); Set(HEADER_CG_MALL_CHECKOUT, sizeof(TPacketCGSafeboxCheckout), "MallCheckout", true); Set(HEADER_CG_SCRIPT_SELECT_ITEM, sizeof(TPacketCGScriptSelectItem), "ScriptSelectItem", true); Set(HEADER_CG_PASSPOD_ANSWER, sizeof(TPacketCGPasspod), "PasspodAnswer", true); Set(HEADER_CG_HS_ACK, sizeof(TPacketGCHSCheck), "HackShieldResponse", false); Set(HEADER_CG_XTRAP_ACK, sizeof(TPacketXTrapCSVerify), "XTrapResponse", false); Set(HEADER_CG_DRAGON_SOUL_REFINE, sizeof(TPacketCGDragonSoulRefine), "DragonSoulRefine", false); Set(HEADER_CG_STATE_CHECKER, sizeof(BYTE), "ServerStateCheck", false); #ifdef __SEND_TARGET_INFO__ Set(HEADER_CG_TARGET_INFO_LOAD, sizeof(TPacketCGTargetInfoLoad), "TargetInfoLoad" ); #endif #ifdef ITEM_SHOP Set(HEADER_CG_ITEMSHOP_PROCESS, sizeof(TCGItemShopProcess), "ItemShop"); #endif #ifdef ENABLE_SHOW_CHEST_DROP Set(HEADER_CG_CHEST_DROP_INFO, sizeof(TPacketCGChestDropInfo), "ChestDropInfo", true); #endif #ifdef ENABLE_NEW_BATTLE_PASS Set(HEADER_CG_BATTLE_PASS, sizeof(TBattlePassCGPacket), "BattlePass", true); #endif } CPacketInfoCG::~CPacketInfoCG() { Log("packet_info.txt"); } //////////////////////////////////////////////////////////////////////////////// CPacketInfoGG::CPacketInfoGG() { Set(HEADER_GG_SETUP, sizeof(TPacketGGSetup), "Setup", false); Set(HEADER_GG_LOGIN, sizeof(TPacketGGLogin), "Login", false); Set(HEADER_GG_LOGOUT, sizeof(TPacketGGLogout), "Logout", false); Set(HEADER_GG_RELAY, sizeof(TPacketGGRelay), "Relay", false); Set(HEADER_GG_NOTICE, sizeof(TPacketGGNotice), "Notice", false); #ifdef ENABLE_FULL_NOTICE Set(HEADER_GG_BIG_NOTICE, sizeof(TPacketGGNotice), "BigNotice", false); #endif Set(HEADER_GG_SHUTDOWN, sizeof(TPacketGGShutdown), "Shutdown", false); Set(HEADER_GG_GUILD, sizeof(TPacketGGGuild), "Guild", false); Set(HEADER_GG_SHOUT, sizeof(TPacketGGShout), "Shout", false); Set(HEADER_GG_DISCONNECT, sizeof(TPacketGGDisconnect), "Disconnect", false); Set(HEADER_GG_MESSENGER_ADD, sizeof(TPacketGGMessenger), "MessengerAdd", false); Set(HEADER_GG_MESSENGER_REMOVE, sizeof(TPacketGGMessenger), "MessengerRemove", false); Set(HEADER_GG_FIND_POSITION, sizeof(TPacketGGFindPosition), "FindPosition", false); Set(HEADER_GG_WARP_CHARACTER, sizeof(TPacketGGWarpCharacter), "WarpCharacter", false); Set(HEADER_GG_MESSENGER_MOBILE, sizeof(TPacketGGMessengerMobile), "MessengerMobile", false); Set(HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX, sizeof(TPacketGGGuildWarMapIndex), "GuildWarMapIndex", false); Set(HEADER_GG_TRANSFER, sizeof(TPacketGGTransfer), "Transfer", false); Set(HEADER_GG_XMAS_WARP_SANTA, sizeof(TPacketGGXmasWarpSanta), "XmasWarpSanta", false); Set(HEADER_GG_XMAS_WARP_SANTA_REPLY, sizeof(TPacketGGXmasWarpSantaReply), "XmasWarpSantaReply", false); Set(HEADER_GG_RELOAD_CRC_LIST, sizeof(BYTE), "ReloadCRCList", false); Set(HEADER_GG_CHECK_CLIENT_VERSION, sizeof(BYTE), "CheckClientVersion", false); Set(HEADER_GG_LOGIN_PING, sizeof(TPacketGGLoginPing), "LoginPing", false); // BLOCK_CHAT Set(HEADER_GG_BLOCK_CHAT, sizeof(TPacketGGBlockChat), "BlockChat", false); // END_OF_BLOCK_CHAT Set(HEADER_GG_SIEGE, sizeof(TPacketGGSiege), "Siege", false); Set(HEADER_GG_MONARCH_NOTICE, sizeof(TPacketGGMonarchNotice), "MonarchNotice", false); Set(HEADER_GG_MONARCH_TRANSFER, sizeof(TPacketMonarchGGTransfer), "MonarchTransfer", false); Set(HEADER_GG_PCBANG_UPDATE, sizeof(TPacketPCBangUpdate), "PCBangUpdate", false); Set(HEADER_GG_CHECK_AWAKENESS, sizeof(TPacketGGCheckAwakeness), "CheckAwakeness", false); #ifdef ENABLE_LOG_NOTIFICATIONS Set(HEADER_GG_CSHIELD_LOG_NOTIFICATION, sizeof(TPacketGGCShieldLogNotification), "CShieldLogNotification", false); #endif #ifdef FATE_ROULETTE Set(HEADER_GG_FATE_ROULLETTE, sizeof(TPacketGGFateRoulette), "FateRoulette",false); #endif } CPacketInfoGG::~CPacketInfoGG() { Log("p2p_packet_info.txt"); }
  12. #ifndef __INC_METIN_II_STL_H__ #define __INC_METIN_II_STL_H__ #include <vector> #include <string> #include <map> #include <list> #include <functional> #include <stack> #include <set> // #ifdef __GNUC__ // #include <ext/functional> // #endif #ifndef itertype #define itertype(v) __typeof((v).begin()) #endif inline void stl_lowers(std::string& rstRet) { for (size_t i = 0; i < rstRet.length(); ++i) rstRet[i] = tolower(rstRet[i]); } struct stringhash { size_t operator () (const std::string & str) const { const unsigned char * s = (const unsigned char*) str.c_str(); const unsigned char * end = s + str.size(); size_t h = 0; while (s < end) { h *= 16777619; h ^= *(s++); } return h; } }; // code from tr1/functional_hash.h // template<typename T> // struct hash; // template<typename _Tp> // struct hash<_Tp*> // : public std::__unary_function<_Tp*, std::size_t> // { // std::size_t // operator()(_Tp* __p) const // { return reinterpret_cast<std::size_t>(__p); } // }; template<typename T> struct hash; template<typename _Tp> struct hash<_Tp*> { std::size_t operator()(_Tp* __p) const { return reinterpret_cast<std::size_t>(__p); } }; namespace std { template <class container, class Pred> void erase_if (container & a, typename container::iterator first, typename container::iterator past, Pred pred) { while (first != past) if (pred(*first)) a.erase(first++); else ++first; } template <class container> void wipe(container & a) { typename container::iterator first, past; first = a.begin(); past = a.end(); while (first != past) delete *(first++); a.clear(); } template <class container> void wipe_second(container & a) { typename container::iterator first, past; first = a.begin(); past = a.end(); while (first != past) { delete first->second; ++first; } a.clear(); } // template <typename T> T MIN(T a, T b) // { // return a < b ? a : b; // } // template <typename T> T MAX(T a, T b) // { // return a > b ? a : b; // } // template <typename T> T MINMAX(T min, T value, T max) // { // T tv; // tv = (min > value ? min : value); // return (max < tv) ? max : tv; // } template <class _Ty> // class void_mem_fun_t : public unary_function<_Ty *, void> // { // public: // explicit void_mem_fun_t(void (_Ty::*_Pm)()) : _Ptr(_Pm) // { // } // void operator()(_Ty* p) const // { // ((p->*_Ptr)()); // } // private: // void (_Ty::*_Ptr)(); // }; class void_mem_fun_t { public: explicit void_mem_fun_t(void (_Ty::*_Pm)()) : _Ptr(_Pm) { } void operator()(_Ty* p) const { ((p->*_Ptr)()); } private: void (_Ty::*_Ptr)(); }; template<class _Ty> inline void_mem_fun_t<_Ty> void_mem_fun(void (_Ty::*_Pm)()) { return (void_mem_fun_t<_Ty>(_Pm)); } template<class _Ty> class void_mem_fun_ref_t { public: explicit void_mem_fun_ref_t(void (_Ty::*_Pm)()) : _Ptr(_Pm) {} void operator()(_Ty& x) const { return ((x.*_Ptr)()); } private: void (_Ty::*_Ptr)(); }; template<class _Ty> inline void_mem_fun_ref_t<_Ty> void_mem_fun_ref(void (_Ty::*_Pm)()) { return (void_mem_fun_ref_t< _Ty>(_Pm)); } }; #endif Fixed version
  13. " #!/bin/sh IPF="ipfw -q add" ipfw -q -f flush #loopback $IPF 10 allow all from any to any via lo0 $IPF 20 deny all from any to 127.0.0.0/8 $IPF 30 deny all from 127.0.0.0/8 to any $IPF 40 deny tcp from any to any frag # stateful $IPF 50 check-state $IPF 60 allow tcp from any to any established $IPF 70 allow all from any to any out keep-state $IPF 80 allow icmp from any to any # open port ftp (20, 21), ssh (22), mail (25) #http (80), https (443), dns (53), mysql (3306) default_udp_yes_ports='53' default_tcp_yes_ports='22 53 3306' default_tcp_no_ports='' # here auth PORTs for "NORM"/"..." thing metin2_udp_yes_ports='30001' # here PORTs metin2_tcp_yes_ports='30001 30003 30005 30007 30009 30011 30013 30015 30017 30019 30021 30023 30025 30027 30029 30031 30033 30035 30037 30039 30041 30043' # here DB_PORTs and P2P_PORTs metin2_tcp_no_ports='30000 30002 30004 30006 30008 30010 30012 30014 30016 30018 30020 30022 30024 30026 30028 30030 30032 30034 30036 30038 30040 30042 30044' # merge lists udp_yes_ports="$default_udp_yes_ports $metin2_udp_yes_ports" tcp_yes_ports="$default_tcp_yes_ports $metin2_tcp_yes_ports" tcp_nop_ports="$default_tcp_no_ports $metin2_tcp_no_ports" # white ip list white_sites='31.58.245.51' # block tcp/udp ports for val in $tcp_nop_ports; do $IPF 2220 allow all from 127.0.0.0/8 to any $val for whitez in $white_sites; do $IPF 2210 allow tcp from $whitez to any $val in $IPF 2210 allow tcp from 127.0.0.0/8 to $whitez $val out done $IPF 2230 deny all from any to me $val done # unblock tcp ports for val in $tcp_yes_ports; do $IPF 2200 allow tcp from any to any $val in limit src-addr 20 $IPF 2210 allow tcp from any to any $val out done # unblock udp ports for val in $udp_yes_ports; do $IPF 2200 allow udp from any to any $val in limit src-addr 20 $IPF 2210 allow udp from any to any $val out done " I think This ipfw.rule is enought for port sec
  14. def NotifyChannelState(self, addrKey, state): try: stateName = serverinfo.STATE_DICT[state] except: stateName = serverinfo.STATE_NONE regionID = int(addrKey / 1000) serverID = int(addrKey / 10) % 100 channelID = addrKey % 10 try: serverinfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName self.__Fill_Up_ChannelList() except: pass
  15. void CHARACTER::ChangeEquip(int index, bool bIgnore) { if (GetSkillLevel(SKILL_ADDITIONAL_PAGE) == 0) return; if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen()) { ChatPacket(CHAT_TYPE_INFO, "You can't change equipment page while you're doing something else."); return; } if (!bIgnore) { if (index == GetEquipIndex()) return; } int iPulse = thecore_pulse(); if (iPulse - GetEquipLoadTime() < PASSES_PER_SEC(5)) { ChatPacket(CHAT_TYPE_INFO, "You'll need to wait 5 seconds in order to do that again."); return; } SetEquipIndex(index); switch (index) { case FIRST_TYPE_EQUIPMENT: { if (secondEquip.size()) { for (auto secondIndex = secondEquip.begin(); secondIndex != secondEquip.end(); ++secondIndex) secondIndex->second->StopEquipEvent(); } if (firstEquip.size()) { for (auto firstIndex = firstEquip.begin(); firstIndex != firstEquip.end(); ++firstIndex) firstIndex->second->StartEquipEvent(); } } break; case SECOND_TYPE_EQUIPMENT: { if (firstEquip.size()) { for (auto firstIndex = firstEquip.begin(); firstIndex != firstEquip.end(); ++firstIndex) firstIndex->second->StopEquipEvent(); } if (secondEquip.size()) { for (auto secondIndex = secondEquip.begin(); secondIndex != secondEquip.end(); ++secondIndex) secondIndex->second->StartEquipEvent(); } } break; } ComputePoints(); //Added //BuffOnAttr_RemoveBuffsFromItem(this); //maybe work SetEquipLoadTime(); CheckMaximumPoints(); ComputeBattlePoints(); UpdatePacket(); if (IsAffectFlag(AFF_GWIGUM)) RemoveAffect(SKILL_GWIGEOM); if (IsAffectFlag(AFF_GEOMGYEONG)) RemoveAffect(SKILL_GEOMKYUNG); ChatPacket(CHAT_TYPE_COMMAND, "SetEquipmentPage %d", index); if (!bIgnore) ChatPacket(CHAT_TYPE_INFO, "The equipment page was changed."); }
×
×
  • 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.