-
Posts
2151 -
Joined
-
Last visited
-
Feedback
100%
Content Type
Forums
Store
Feature Plan
Release Notes
Docs
Events
Everything posted by Metin2 Dev
-
fix Fix Accessory Bug - 0 Minutes when Create a Jewel
Metin2 Dev replied to Metin2 Dev's topic in Bug Fixes
Good idea. -
When you try to remove a player from party with target button, it will not work.
-
Item Proto / Mob Proto
Metin2 Dev replied to Fr3zy94's topic in Paid Support / Searching / Recruiting
https://mega.nz/#!s8NxiBoD!8YgUJnrtRTBYr9cv1ZeOa9mVA3V9kZzzqr7hI1tg8Sw mob_proto has the structure changed and i can't decrypt (yet).- 1 reply
-
- 1
-
-
fix Fix Accessory Bug - 0 Minutes when Create a Jewel
Metin2 Dev replied to Metin2 Dev's topic in Bug Fixes
I seen this on 2089 game (3-4 years ago), but is not actually a bug and the "fix" is not in server source. Check item_proto -> GainSocket collumn (for accessories need to pe 0) =))) I don't know why you try to fix everything on server source. To look smart ? if (table->bGainSocketPct) item->AlterToSocketItem(table->bGainSocketPct); -
fix Fix Accessory Bug - 0 Minutes when Create a Jewel
Metin2 Dev replied to Metin2 Dev's topic in Bug Fixes
Yes is true... Now is free! -
item_manager.cpp: go to the bottom of the "LPITEM ITEM_MANAGER::CreateItem" Function Find this: else if (item->GetType() == ITEM_UNIQUE) { for (itertype (m_map_pkSpecialItemGroup) it = m_map_pkSpecialItemGroup.begin(); it != m_map_pkSpecialItemGroup.end(); it++) { if (it->second->m_bType == CSpecialItemGroup::SPECIAL && it->second->Contains(vnum)) { item->SetSIGVnum(it->first); } } } if (item->IsDragonSoul() && 0 == id) { DSManager::instance().DragonSoulItemInitialize(item); } return item; } REPLACE WITH THIS: else if (item->GetType() == ITEM_UNIQUE) { for (itertype (m_map_pkSpecialItemGroup) it = m_map_pkSpecialItemGroup.begin(); it != m_map_pkSpecialItemGroup.end(); it++) { if (it->second->m_bType == CSpecialItemGroup::SPECIAL && it->second->Contains(vnum)) { item->SetSIGVnum(it->first); } } } //FIX!!! if (item->IsAccessoryForSocket()) { item->SetSocket(0, 0); item->SetSocket(1, 0); item->SetSocket(2, 0); } //END OF FIX!!! if (item->IsDragonSoul() && 0 == id) { DSManager::instance().DragonSoulItemInitialize(item); } return item; } THIS FIX NOW IS FREE, MARTY SAMA SELL THIS FOR 20€... THAT NOOB!
-
You need to write #Dumb
-
1. Make a guild 2. Put that code in uiGuild.py in OnUpdate function net.SendGuildPostCommentPacket("") 3. In your console type "top" and check "mysql" process 4. Check your table player.guild_comment to... Fix: ## 1.guild.h // 1.1.Search: EventMap m_GuildInviteEventMap; // 1.1.Add after: protected: int m_guildPostCommentPulse; ## 2.guild.cpp // 2.1.Search function: void CGuild::AddComment(LPCHARACTER ch, const std::string& str) { ... } // 2.1.Replace with: void CGuild::AddComment(LPCHARACTER ch, const std::string& str) { if (str.length() > GUILD_COMMENT_MAX_LEN || str.length() == 0) // Added string null verification return; // Compare last pulse with current pulse and notify the player if (m_guildPostCommentPulse > thecore_pulse()) { int deltaInSeconds = ((m_guildPostCommentPulse / PASSES_PER_SEC(1)) - (thecore_pulse() / PASSES_PER_SEC(1))); int minutes = deltaInSeconds / 60; int seconds = (deltaInSeconds - (minutes * 60)); ch->ChatPacket(CHAT_TYPE_INFO, "You can post a new comment in: %02d minutes and %02d seconds!", minutes, seconds); return; } char text[GUILD_COMMENT_MAX_LEN * 2 + 1]; DBManager::instance().EscapeString(text, sizeof(text), str.c_str(), str.length()); DBManager::instance().FuncAfterQuery(void_bind(std::bind1st(std::mem_fun(&CGuild::RefreshCommentForce),this),ch->GetPlayerID()), "INSERT INTO guild_comment%s(guild_id, name, notice, content, time) VALUES(%u, '%s', %d, '%s', NOW())", get_table_postfix(), m_data.guild_id, ch->GetName(), (str[0] == '!') ? 1 : 0, text); // Set comment pulse to 10 minutes m_guildPostCommentPulse = thecore_pulse() + PASSES_PER_SEC(10*60); }
-
didnt work, if i press save he not save it and also when i press load he not load anything
-
threeway_war.cpp #include "stdafx.h" #include "threeway_war.h" #include "../../common/length.h" #include "../../common/tables.h" #include "p2p.h" #include "locale_service.h" #include "packet.h" #include "char.h" #include "questmanager.h" #include "questlua.h" #include "start_position.h" #include "char_manager.h" #include "sectree_manager.h" #include "regen.h" #include "log.h" extern int test_server; extern int passes_per_sec; CThreeWayWar::CThreeWayWar() { Initialize(); } CThreeWayWar::~CThreeWayWar() { RegisterUserMap_.clear(); ReviveTokenMap_.clear(); } void CThreeWayWar::Initialize() { RegenFlag_ = 0; memset( KillScore_, 0, sizeof(KillScore_) ); RegisterUserMap_.clear(); ReviveTokenMap_.clear(); } int CThreeWayWar::GetKillScore( BYTE empire ) const { if( empire <= 0 || empire >= EMPIRE_MAX_NUM ) { sys_err("ThreeWayWar::GetKillScore Wrong Empire variable"); return 0; } return KillScore_[empire-1]; } void CThreeWayWar::SetKillScore( BYTE empire, int count ) { if( empire <= 0 || empire >= EMPIRE_MAX_NUM ) { sys_err("ThreeWayWar::SetKillScore Wrong Empire variable"); return; } KillScore_[empire-1] = count; } void CThreeWayWar::SetReviveTokenForPlayer(DWORD PlayerID, int count) { if (0 == PlayerID) return; ReviveTokenMap_[PlayerID] = count; } int CThreeWayWar::GetReviveTokenForPlayer(DWORD PlayerID) { if (0 == PlayerID) return 0; return ReviveTokenMap_[PlayerID]; } void CThreeWayWar::DecreaseReviveTokenForPlayer(DWORD PlayerID) { if (0 == PlayerID) return; ReviveTokenMap_[PlayerID] = ReviveTokenMap_[PlayerID] - 1; } bool CThreeWayWar::LoadSetting(const char* szFileName) { char szPath[1024]; snprintf( szPath, sizeof(szPath), "%s/%s", LocaleService_GetBasePath().c_str(), szFileName); FILE* pf = fopen( szPath, "r" ); if (NULL == pf) { sys_err("[ThreeWayWar] Cannot open file: <%s>", szPath ); return false; } char szLine[256]; char szSungziName[128]; char szPassName[3][128]; while( NULL != fgets(szLine, 256, pf) ) { if (0 == strncmp(szLine, "sungzi:", 7)) { struct ForkedSungziMapInfo sungziinfo; sscanf( szLine+7, "%d %d %d %d %d %d %d %s", &sungziinfo.m_iForkedSung, &sungziinfo.m_iForkedSungziStartPosition[0][0], &sungziinfo.m_iForkedSungziStartPosition[0][1], &sungziinfo.m_iForkedSungziStartPosition[1][0], &sungziinfo.m_iForkedSungziStartPosition[1][1], &sungziinfo.m_iForkedSungziStartPosition[2][0], &sungziinfo.m_iForkedSungziStartPosition[2][1], szSungziName); sungziinfo.m_stMapName = static_cast<std::string>(szSungziName); SungZiInfoMap_.push_back( sungziinfo ); MapIndexSet_.insert( sungziinfo.m_iForkedSung ); } else if (0 == strncmp(szLine, "pass:", 5)) { struct ForkedPassMapInfo passinfo; sscanf( szLine+5, "%d %d %d %s %d %d %d %s %d %d %d %s", &passinfo.m_iForkedPass[0], &passinfo.m_iForkedPassStartPosition[0][0], &passinfo.m_iForkedPassStartPosition[0][1], szPassName[0], &passinfo.m_iForkedPass[1], &passinfo.m_iForkedPassStartPosition[1][0], &passinfo.m_iForkedPassStartPosition[1][1], szPassName[1], &passinfo.m_iForkedPass[2], &passinfo.m_iForkedPassStartPosition[2][0], &passinfo.m_iForkedPassStartPosition[2][1], szPassName[2] ); passinfo.m_stMapName[0] = static_cast<std::string>(szPassName[0]); passinfo.m_stMapName[1] = static_cast<std::string>(szPassName[1]); passinfo.m_stMapName[2] = static_cast<std::string>(szPassName[2]); PassInfoMap_.push_back( passinfo ); MapIndexSet_.insert( passinfo.m_iForkedPass[0] ); MapIndexSet_.insert( passinfo.m_iForkedPass[1] ); MapIndexSet_.insert( passinfo.m_iForkedPass[2] ); } } fclose(pf); return true; } const ForkedPassMapInfo& CThreeWayWar::GetEventPassMapInfo() const { const size_t idx = quest::CQuestManager::instance().GetEventFlag( "threeway_war_pass_idx" ); return PassInfoMap_[idx]; } const ForkedSungziMapInfo& CThreeWayWar::GetEventSungZiMapInfo() const { const size_t idx = quest::CQuestManager::instance().GetEventFlag( "threeway_war_sungzi_idx" ); return SungZiInfoMap_[idx]; } bool CThreeWayWar::IsThreeWayWarMapIndex(int iMapIndex) const { return MapIndexSet_.find(iMapIndex) != MapIndexSet_.end(); } bool CThreeWayWar::IsSungZiMapIndex(int iMapIndex) const { std::vector<ForkedSungziMapInfo>::const_iterator it = SungZiInfoMap_.begin(); for( ; it != SungZiInfoMap_.end() ; ++it ) { if (iMapIndex == it->m_iForkedSung) { return true; } } return false; } void CThreeWayWar::RandomEventMapSet() { const size_t pass_idx = number( 0, PassInfoMap_.size()-1 ); const size_t sung_idx = number( 0, SungZiInfoMap_.size()-1 ); quest::CQuestManager::instance().RequestSetEventFlag( "threeway_war_sungzi_idx", sung_idx ); quest::CQuestManager::instance().RequestSetEventFlag( "threeway_war_pass_idx", pass_idx ); } bool CThreeWayWar::IsRegisteredUser(DWORD PlayerID) const { boost::unordered_map<DWORD, DWORD>::const_iterator iter = RegisterUserMap_.find(PlayerID); if (iter == RegisterUserMap_.end()) { return false; } return true; } void CThreeWayWar::RegisterUser(DWORD PlayerID) { if (0 == PlayerID) return; RegisterUserMap_.insert( std::make_pair(PlayerID, PlayerID) ); } void CThreeWayWar::onDead(LPCHARACTER pChar, LPCHARACTER pkKiller) { if (!pChar->IsPC()) return; if (GetRegenFlag() == -1) return; DecreaseReviveTokenForPlayer( pChar->GetPlayerID() ); if (!IsSungZiMapIndex(pChar->GetMapIndex())) return; if (NULL == pkKiller || !pkKiller->IsPC()) return; if (pChar->GetEmpire() == pkKiller->GetEmpire()) return; int nKillScore = GetKillScore(pkKiller->GetEmpire()); if (nKillScore >= 0) { nKillScore += 1; SetKillScore(pkKiller->GetEmpire(), nKillScore); } const int nVictoryScore = quest::CQuestManager::instance().GetEventFlag("threeway_war_kill_count"); if (GetRegenFlag() == 0) { if (nKillScore != 0 && (nKillScore % 5) == 0) { char szBuf[80 + 1]; snprintf(szBuf, sizeof(szBuf), "Shinsoo: [%d/%d] - Chunjo: [%d/%d] - Jinno: [%d/%d]", GetKillScore(1), nVictoryScore, GetKillScore(2), nVictoryScore, GetKillScore(3), nVictoryScore); SendNoticeMap(szBuf, GetSungziMapIndex(), false); } int nEliminatedEmpireCount = 0; BYTE bLoseEmpire = 0; for (int n = 1; n < 4; ++n) { if (GetKillScore(n) < nVictoryScore) { ++nEliminatedEmpireCount; bLoseEmpire = n; } } if (nEliminatedEmpireCount == 1) { SetKillScore(1, 0); SetKillScore(2, 0); SetKillScore(3, 0); SetKillScore(bLoseEmpire, -1); quest::warp_all_to_map_my_empire_event_info *info; info = AllocEventInfo<quest::warp_all_to_map_my_empire_event_info>(); info->m_lMapIndexFrom = GetSungziMapIndex(); info->m_lMapIndexTo = EMPIRE_START_MAP(bLoseEmpire); info->m_x = EMPIRE_START_X(bLoseEmpire); info->m_y = EMPIRE_START_Y(bLoseEmpire); info->m_bEmpire = bLoseEmpire; event_create(quest::warp_all_to_map_my_empire_event, info, PASSES_PER_SEC(5)); const std::string Nation(EMPIRE_NAME(bLoseEmpire)); char szNotice[512+1]; snprintf(szNotice, sizeof(szNotice), "<EmpireWar> The empire %s has lost the war.", Nation.c_str()); BroadcastNotice(szNotice); char szBuf[80 + 1]; snprintf(szBuf, sizeof(szBuf), "[%s] You'll be teleported to your own village...", Nation.c_str()); SendNoticeMap(szBuf, GetSungziMapIndex(), false); SetRegenFlag(1); } } else if (GetRegenFlag() == 1) { if (nKillScore != 0 && (nKillScore % 2) == 0) { char szBuf[80 + 1]; if (GetKillScore(1) != -1 && GetKillScore(2) != -1 && GetKillScore(3) == -1) { snprintf(szBuf, sizeof(szBuf), "Shinsoo: [%d/%d] - Chunjo: [%d/%d]", GetKillScore(1), nVictoryScore, GetKillScore(2), nVictoryScore); }else if (GetKillScore(1) != -1 && GetKillScore(2) == -1 && GetKillScore(3) != -1) { snprintf(szBuf, sizeof(szBuf), "Shinsoo: [%d/%d] - Jinno: [%d/%d]", GetKillScore(1), nVictoryScore, GetKillScore(3), nVictoryScore); }else if (GetKillScore(1) == -1 && GetKillScore(2) != -1 && GetKillScore(3) != -1) { snprintf(szBuf, sizeof(szBuf), "Chunjo: [%d/%d] - Jinno: [%d/%d]", GetKillScore(2), nVictoryScore, GetKillScore(3), nVictoryScore); } SendNoticeMap(szBuf, GetSungziMapIndex(), false); } int nVictoryEmpireIndex = 0; for (int n = 1; n < 4; ++n) { nKillScore = GetKillScore(n); if (nKillScore == -1) continue; if (nKillScore >= nVictoryScore) { nVictoryEmpireIndex = n; break; } } if (nVictoryEmpireIndex == 0) return; for (int n = 1; n < 4; ++n) { if (n != nVictoryEmpireIndex && GetKillScore(n) != -1) { BYTE bLoseEmpire = n; quest::warp_all_to_map_my_empire_event_info * info; info = AllocEventInfo<quest::warp_all_to_map_my_empire_event_info>(); info->m_lMapIndexFrom = GetSungziMapIndex(); info->m_lMapIndexTo = EMPIRE_START_MAP(bLoseEmpire); info->m_x = EMPIRE_START_X(bLoseEmpire); info->m_y = EMPIRE_START_Y(bLoseEmpire); info->m_bEmpire = bLoseEmpire; event_create(quest::warp_all_to_map_my_empire_event, info, PASSES_PER_SEC(5)); const std::string LoseNation(EMPIRE_NAME(bLoseEmpire)); char szBuf[80 + 1]; snprintf(szBuf, sizeof(szBuf), "[%s] You'll be teleported to your own village...", LoseNation.c_str()); SendNoticeMap(szBuf, GetSungziMapIndex(), false); } } const std::string EmpireName(EMPIRE_NAME(nVictoryEmpireIndex)); char szNotice3[512+1]; snprintf(szNotice3, sizeof(szNotice3), "<EmpireWar> The war was won by %s!", EmpireName.c_str()); BroadcastNotice(szNotice3); char szBuf[160 + 1]; snprintf(szBuf, sizeof(szBuf), "[%s] Congrats guys, you win the war. You'll be teleported to your own village!", EmpireName.c_str()); SendNoticeMap(szBuf, GetSungziMapIndex(), false); SetRegenFlag(-1); quest::CQuestManager::instance().EraseEventFlag("threeway_war"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_dead_count"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_kill_count"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_open_gate1"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_open_gate2"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_open_gate3"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_pass_idx"); quest::CQuestManager::instance().EraseEventFlag("threeway_war_sungzi_idx"); quest::warp_all_to_map_my_empire_event_info * info; info = AllocEventInfo<quest::warp_all_to_map_my_empire_event_info>(); info->m_lMapIndexFrom = GetSungziMapIndex(); info->m_lMapIndexTo = EMPIRE_START_MAP(nVictoryEmpireIndex); info->m_x = EMPIRE_START_X(nVictoryEmpireIndex); info->m_y = EMPIRE_START_Y(nVictoryEmpireIndex); info->m_bEmpire = nVictoryEmpireIndex; event_create(quest::warp_all_to_map_my_empire_event, info, PASSES_PER_SEC(30)); } } struct FDestroyAllEntity { void operator() (LPENTITY ent) { if (true == ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = static_cast<LPCHARACTER>(ent); if (false == ch->IsPC()) { ch->Dead(); } } } }; void CThreeWayWar::RemoveAllMonstersInThreeWay() const { std::set<int>::const_iterator iter = MapIndexSet_.begin(); while( iter != MapIndexSet_.end() ) { LPSECTREE_MAP pSecMap = SECTREE_MANAGER::instance().GetMap( *iter ); if (NULL != pSecMap) { FDestroyAllEntity f; pSecMap->for_each( f ); } ++iter; } } const char* GetSungziMapPath() { static char s_szMapPath[128]; snprintf(s_szMapPath, sizeof(s_szMapPath), "%s/map/%s/", LocaleService_GetBasePath().c_str(), CThreeWayWar::instance().GetEventSungZiMapInfo().m_stMapName.c_str()); return s_szMapPath; } const char* GetPassMapPath( BYTE bEmpire ) { if (bEmpire > 0 && bEmpire < EMPIRE_MAX_NUM) { static char s_szMapPath[128]; snprintf(s_szMapPath, sizeof(s_szMapPath), "%s/map/%s/", LocaleService_GetBasePath().c_str(), CThreeWayWar::instance().GetEventPassMapInfo().m_stMapName[bEmpire-1].c_str()); return s_szMapPath; } return NULL; } int GetPassMapIndex( BYTE bEmpire ) { if (bEmpire > 0 && bEmpire < EMPIRE_MAX_NUM) { return CThreeWayWar::instance().GetEventPassMapInfo().m_iForkedPass[bEmpire-1]; } return 0; } int GetPassStartX( BYTE bEmpire ) { if (bEmpire > 0 && bEmpire < EMPIRE_MAX_NUM) { return CThreeWayWar::instance().GetEventPassMapInfo().m_iForkedPassStartPosition[bEmpire-1][0]; } return 0; } int GetPassStartY( BYTE bEmpire ) { if (bEmpire > 0 && bEmpire < EMPIRE_MAX_NUM) { return CThreeWayWar::instance().GetEventPassMapInfo().m_iForkedPassStartPosition[bEmpire-1][1]; } return 0; } int GetSungziMapIndex() { return CThreeWayWar::instance().GetEventSungZiMapInfo().m_iForkedSung; } int GetSungziStartX( BYTE bEmpire ) { if (bEmpire > 0 && bEmpire < EMPIRE_MAX_NUM) { return CThreeWayWar::instance().GetEventSungZiMapInfo().m_iForkedSungziStartPosition[bEmpire-1][0]; } return 0; } int GetSungziStartY( BYTE bEmpire ) { if (bEmpire > 0 && bEmpire < EMPIRE_MAX_NUM) { return CThreeWayWar::instance().GetEventSungZiMapInfo().m_iForkedSungziStartPosition[bEmpire-1][1]; } return 0; } threeway_war.h #ifndef THREE_WAY_WAR_EVENT_ #define THREE_WAY_WAR_EVENT_ #include <boost/unordered_map.hpp> #include "../../common/stl.h" struct ForkedSungziMapInfo { int m_iForkedSung; int m_iForkedSungziStartPosition[3][2]; std::string m_stMapName; }; struct ForkedPassMapInfo { int m_iForkedPass[3]; int m_iForkedPassStartPosition[3][2]; std::string m_stMapName[3]; }; class CThreeWayWar : public singleton<CThreeWayWar> { public: CThreeWayWar (); virtual ~CThreeWayWar (); void Initialize (); bool LoadSetting (const char* szFileName); int GetKillScore (BYTE empire) const; void SetKillScore (BYTE empire, int count); void SetReviveTokenForPlayer (DWORD PlayerID, int count); int GetReviveTokenForPlayer (DWORD PlayerID); void DecreaseReviveTokenForPlayer (DWORD PlayerID); const ForkedPassMapInfo& GetEventPassMapInfo () const; const ForkedSungziMapInfo& GetEventSungZiMapInfo () const; bool IsThreeWayWarMapIndex (int iMapIndex) const; bool IsSungZiMapIndex (int iMapIndex) const; void RandomEventMapSet (); void RegisterUser (DWORD PlayerID); bool IsRegisteredUser (DWORD PlayerID) const; void onDead (LPCHARACTER pChar, LPCHARACTER pKiller); void SetRegenFlag (int flag) { RegenFlag_ = flag; } int GetRegenFlag () const { return RegenFlag_; } void RemoveAllMonstersInThreeWay () const; private: int KillScore_[3]; int RegenFlag_; std::set<int> MapIndexSet_; std::vector<ForkedPassMapInfo> PassInfoMap_; std::vector<ForkedSungziMapInfo> SungZiInfoMap_; boost::unordered_map<DWORD, DWORD> RegisterUserMap_; boost::unordered_map<DWORD, int> ReviveTokenMap_; }; const char* GetSungziMapPath(); const char* GetPassMapPath( BYTE bEmpire ); int GetPassMapIndex( BYTE bEmpire ); int GetSungziMapIndex(); int GetSungziStartX( BYTE bEmpire ); int GetSungziStartY( BYTE bEmpire ); int GetPassStartX( BYTE bEmpire ); int GetPassStartY( BYTE bEmpire ); #endif /* THREE_WAY_WAR_EVENT_ */ Implement the ERASEEVENTFLAG FUNCTION! FORKEDMAPINDEX.txt #sungzi: mapindex startposX startposY startposX startposY startposX startposY #pass: mapindex1 startposX startposY mapindex2 startposX startposY mapindex3 startposX startposY sungzi: 114 948100 36500 937100 22000 953200 18500 metin2_map_sungzi pass: 118 1150400 182400 metin2_map_sungzi_flame_hill_01 119 1150400 284800 metin2_map_sungzi_flame_hill_02 120 1150400 387200 metin2_map_sungzi_flame_hill_03 TO LET THE SYSTEM WORKING WITHOUT PROBLEM, YOUR NPC THAT START THE WAR MUST BE IN CH99!
-
this code can be executed only by Staff... Why a gm have to sql inject the server? Just use this for take care: char text[160+1]; DBManager::instance().EscapeString(text, sizeof(text), "KORAY NOOB", strlen("KORAY NOOB"));
-
...
-
cmd.cpp ACMD(do_erase_event_flag); { "eraseeventflag", do_erase_event_flag, 0, POS_DEAD, GM_HIGH_WIZARD }, cmd_gm.cpp ACMD(do_erase_event_flag) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!(*arg1)) return; quest::CQuestManager::instance().EraseEventFlag(arg1); ch->ChatPacket(CHAT_TYPE_INFO, "EraseEventFlag %s", arg1); sys_log(0, "EraseEventFlag %s", arg1); } questmanager.h void EraseEventFlag(const string& name); questmanager.cpp #include "db.h" void CQuestManager::EraseEventFlag(const string& name) { itertype(m_mapEventFlag) it; for (it = m_mapEventFlag.begin(); it != m_mapEventFlag.end(); ++it) { const string& flagname = it->first; if (flagname.compare(name) == 0) { m_mapEventFlag.erase(it); char szName[160+1]; //CAUSE KORAY DOESN'T UNDERSTAND NOTHING DBManager::instance().EscapeString(szName, sizeof(szName), name.c_str(), strlen(name.c_str())); char szQuery[1024+1]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM player.quest%s WHERE szName='%s';", get_table_postfix(), szName); DBManager::instance().DirectQuery(szQuery); break; } } } questlua_game.cpp int game_erase_event_flag(lua_State* L) { CQuestManager& q = CQuestManager::instance(); if (lua_isstring(L,1)) q.EraseEventFlag(lua_tostring(L,1)); return 0; } { "erase_event_flag", game_erase_event_flag }, KEEP A LOT OF EVENTS FLAG IS A BIG PROBLEM, A LOT OF SERVER CRASH DAILY FOR THIS PROBLEM! THIS FUNCTION IS FREE FOR ALL!!! NOT AS MARTYSAMA THAT SELL THIS FOR 10€...
-
Just a visual error. If is that important for you: ## uiaffectshower.py ## Search: if level==0: self.horseImage=None else: ## Replace with: if level==0: self.horseImage=None self.__ArrangeImageList() else:
-
Offline Shop duplicate bug
Metin2 Dev replied to Human's topic in Community Support - Questions & Answers
This bug is old =) Very old. In : void COfflineShopManager::TakeItem(LPCHARACTER ch, BYTE bPos) Search: "FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); Replace with: "FROM %soffline_shop_item WHERE owner_id = %u and pos = %d and status = 1", get_table_postfix(), ch->GetPlayerID(), bPos); -
[Hidden Content] Are you sure total money will be -475000 ? In your code is no condition and your print of nTotalMoney is wrong , a unsigned variable should be printed with %u. Ofc if you print a unsigned variable with signed type it will make automaticaly conversion. (Like you put (int) before variable). [Hidden Content] So Mali61, if you really want to use that condition try like that: (or use @xP3NG3Rx code , is better) case POINT_GOLD: { unsigned int nTotalMoney = GetGold() + amount; if (nTotalMoney > GOLD_MAX) { return; }else if ((int)nTotalMoney < 0) { return; }else{ SetGold(GetGold() + amount); val = GetGold(); } }
-
unsigned int nTotalMoney if(nTotalMoney < 0) Really ? nTotalMoney never can be negative.
-
Find the function: void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast) Find the case: POINT_GOLD And put this: case POINT_GOLD: { unsigned int nTotalMoney = GetGold() + amount; if (nTotalMoney > GOLD_MAX) { return; }else if (nTotalMoney < 0) { return; }else{ SetGold(GetGold() + amount); val = GetGold(); } } break; Your YANGS never been negatives!
-
Sbugga PG (Unstucker) Without Delay - InGame!
Metin2 Dev replied to Metin2 Dev's topic in Programming & Scripts
Thanks but these guys are only angry with me cause i post this idea that a lot of people like MartySama sell for a lot of money... -
Sbugga PG (Unstucker) Without Delay - InGame!
Metin2 Dev replied to Metin2 Dev's topic in Programming & Scripts
WHY ALL PEOPLE CREATE SBUG PG IN PHP? This is fucking better than that! -
Sbugga PG (Unstucker) Without Delay - InGame!
Metin2 Dev replied to Metin2 Dev's topic in Programming & Scripts
If your player go in a invalid map or is bugged, can warp to the own empire city! -
Input_DB.cpp -> PlayerLoad function: void CInputDB::PlayerLoad(LPDESC d, const char * data) { TPlayerTable * pTab = (TPlayerTable *) data; if (!d) return; long lMapIndex = pTab->lMapIndex; long lPosX = pTab->x; long lPosY = pTab->y; int lEmpire = d->GetAccountTable().bEmpire; //MAP INDEX NULL (MAYBE WHEN YOU CREATE THE CHARACTER) if (lMapIndex == 0) { if (SECTREE_MANAGER::instance().GetMapIndex(lPosX, lPosY) == 0) //IF YOU CREATE THE CHARACTER RETURN TRUE NOT FALSE { lMapIndex = EMPIRE_START_MAP(lEmpire); lPosX = EMPIRE_START_X(lEmpire); lPosY = EMPIRE_START_Y(lEmpire); }else{ //YOU CREATE THE CHARACTER AND CHARACTER START IN THE RIGHT POSITION! lMapIndex = EMPIRE_START_MAP(lEmpire); lPosX = CREATE_START_X(lEmpire) + number(-300, 300); lPosY = CREATE_START_Y(lEmpire) + number(-300, 300); } } //CHECK IF IS A VALID LOCATION else if (!SECTREE_MANAGER::instance().IsValidLocation(lMapIndex, lPosX, lPosY, lEmpire)) { lMapIndex = EMPIRE_START_MAP(lEmpire); lPosX = EMPIRE_START_X(lEmpire); lPosY = EMPIRE_START_Y(lEmpire); } //CHECK IF NEED SBUG PG std::string PgName=std::string("/server/game/pg_bugged/")+std::string(pTab->name)+std::string(".txt"); struct stat sbug; if (stat(PgName.c_str(), &sbug) == 0) { remove(PgName.c_str()); lMapIndex = EMPIRE_START_MAP(lEmpire); lPosX = EMPIRE_START_X(lEmpire); lPosY = EMPIRE_START_Y(lEmpire); sys_err("<SbugPGSystem> %s was moved to the own empire. (Index: %d - X:%d, Y:%d)", pTab->name, EMPIRE_START_MAP(lEmpire), EMPIRE_START_X(lEmpire), EMPIRE_START_Y(lEmpire)); } //SET NEW MAP INDEX AND COORDS pTab->lMapIndex = lMapIndex; pTab->x = lPosX; pTab->y = lPosY; if (d->GetCharacter() || d->IsPhase(PHASE_GAME)) { LPCHARACTER p = d->GetCharacter(); sys_err("login state already has main state (character %s %p)", p->GetName(), get_pointer(p)); return; } if (NULL != CHARACTER_MANAGER::Instance().FindPC(pTab->name)) { sys_err("InputDB: PlayerLoad : %s already exist in game", pTab->name); return; } LPCHARACTER ch = CHARACTER_MANAGER::instance().CreateCharacter(pTab->name, pTab->id); ch->BindDesc(d); ch->SetPlayerProto(pTab); ch->SetEmpire(d->GetEmpire()); d->BindCharacter(ch); { TPacketGGLogin p; p.bHeader = HEADER_GG_LOGIN; strlcpy(p.szName, ch->GetName(), sizeof(p.szName)); p.dwPID = ch->GetPlayerID(); p.bEmpire = ch->GetEmpire(); p.lMapIndex = SECTREE_MANAGER::instance().GetMapIndex(ch->GetX(), ch->GetY()); p.bChannel = g_bChannel; P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGLogin)); char buf[51]; snprintf(buf, sizeof(buf), "%s %d %d %ld %d", inet_ntoa(ch->GetDesc()->GetAddr().sin_addr), ch->GetGold(), g_bChannel, ch->GetMapIndex(), ch->GetAlignment()); LogManager::instance().CharLog(ch, 0, "LOGIN", buf); } d->SetPhase(PHASE_LOADING); ch->MainCharacterPacket(); long lPublicMapIndex = lMapIndex >= 10000 ? lMapIndex / 10000 : lMapIndex; const TMapRegion * rMapRgn = SECTREE_MANAGER::instance().GetMapRegion(lPublicMapIndex); if( rMapRgn ) { DESC_MANAGER::instance().SendClientPackageSDBToLoadMap( d, rMapRgn->strMapName.c_str() ); } if (!map_allow_find(lPublicMapIndex)) { sys_err("InputDB::PlayerLoad : entering %d map is not allowed here (name: %s, empire %u)", lMapIndex, pTab->name, d->GetEmpire()); ch->SetWarpLocation(EMPIRE_START_MAP(d->GetEmpire()), EMPIRE_START_X(d->GetEmpire()) / 100, EMPIRE_START_Y(d->GetEmpire()) / 100); d->SetPhase(PHASE_CLOSE); return; } quest::CQuestManager::instance().BroadcastEventFlagOnLogin(ch); for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i) ch->SetQuickslot(i, pTab->quickslot[i]); ch->PointsPacket(); ch->SkillLevelPacket(); sys_log(0, "InputDB: player_load %s %dx%dx%d LEVEL %d MOV_SPEED %d JOB %d ATG %d DFG %d GMLv %d", pTab->name, ch->GetX(), ch->GetY(), ch->GetZ(), ch->GetLevel(), ch->GetPoint(POINT_MOV_SPEED), ch->GetJob(), ch->GetPoint(POINT_ATT_GRADE), ch->GetPoint(POINT_DEF_GRADE), ch->GetGMLevel()); ch->QuerySafeboxSize(); CXTrapManager::instance().CreateClientSession( ch ); } Sectree_manager.h Sectree_manager.cpp bool SECTREE_MANAGER::IsValidLocation(long lMapIndex, long x, long y, BYTE empire) { LPSECTREE_MAP pkSectreeMap = GetMap(lMapIndex); if (!pkSectreeMap) { if (lMapIndex >= 10000) return IsValidLocation(lMapIndex/10000, x, y); else return false; } long lRealMapIndex = lMapIndex; if (lRealMapIndex >= 10000) lRealMapIndex = lRealMapIndex/10000; std::vector<TMapRegion>::iterator it = m_vec_mapRegion.begin(); while (it != m_vec_mapRegion.end()) { TMapRegion & rRegion = *(it++); if (rRegion.index == lRealMapIndex) { LPSECTREE tree = pkSectreeMap->Find(x, y); if (!tree) return false; return true; } } return false; } questlua_global.cpp int _sbugga_pg(lua_State* L) { if (!lua_isstring(L, 1)) return 0; if (!lua_isstring(L, 2)) return 0; if (!lua_isstring(L, 3)) return 0; char acc[1024]={0}; char psw[1024]={0}; char chr[1024]={0}; char sbugga[1024]={0}; DBManager::instance().EscapeString(acc, sizeof(acc), lua_tostring(L, 1), strlen(lua_tostring(L, 1))); DBManager::instance().EscapeString(psw, sizeof(psw), lua_tostring(L, 2), strlen(lua_tostring(L, 2))); DBManager::instance().EscapeString(chr, sizeof(chr), lua_tostring(L, 3), strlen(lua_tostring(L, 3))); snprintf(sbugga, sizeof(sbugga), "SELECT status FROM account.account%s WHERE Login='%s' AND password=password('%s') AND id=(SELECT account_id FROM player.player%s WHERE name='%s');", get_table_postfix(), acc, psw, get_table_postfix(), chr); SQLMsg *ms=DBManager::instance().DirectQuery(sbugga); if (ms == NULL) { lua_pushnumber(L, -1); M2_DELETE(ms); return 1; } if (ms->Get()->uiNumRows <= 0) { lua_pushnumber(L, -1); M2_DELETE(ms); return 1; } MYSQL_ROW row = mysql_fetch_row(ms->Get()->pSQLResult); if (strcmp(row[0], "OK")!=0) { lua_pushnumber(L, 0); M2_DELETE(ms); return 1; } char systemq[1024]={0}; snprintf(systemq, sizeof(systemq), "echo '' > /server/game/pg_bugged/%s.txt", chr); system(systemq); lua_pushnumber(L, 1); M2_DELETE(ms); return 1; } And at the end of the file remember the: { "sbugga_pg", _sbugga_pg }, The folder /server/game/pg_bugged/ need to be create in your FTP of server. QUEST EXAMPLE: quest sbug_pg begin state start begin when 11000.chat."My character is bugged..." or 11002.chat."My character is bugged..." or 11004.chat."My character is bugged..." begin say_title("Sbug-Pg Tool: ") say("") if get_time() <= pc.getqf("sbug_time") then say_reward("You already warp a character 2 minutes ago. Wait pls.") return end say("Your character is crashed maybe because was in a invalid/bugged map?") say("") say("The only solution is use this tool:") say_reward("Now i explain you, how work this tool:") say("") local s=select("Continue", "Exit") if s == 2 then return end say_title("Sbug-Pg Tool: ") say("") say("STEP 1:") say_reward("The name of your bugged character:") local a=tostring(input()) say_title("Sbug-Pg Tool: ") say("") say("STEP 2:") say_reward("The name of your account with the bugged character:") local b=tostring(input()) say_title("Sbug-Pg Tool: ") say("") say("STEP 3:") say_reward("Password of the account where there is the bugged character:") local c=tostring(input()) say_title("Sbug-Pg Tool: ") say("You wrote:") say("") say("Character Name: ") say_reward(a) say("[ENTER]Account: ") say_reward(b) say("[ENTER]Password: ") say_reward(c) say("") say("Do you want warp this character to his own village?") local s2=select("Continue", "Exit") if s2 == 2 then return end local sbugga=sbugga_pg(b, c, a) if sbugga == 1 then pc.setqf("sbug_time", get_time()+60*2) say_title("Sbug-Pg Tool: ") say("") say("STEP 4:") say("Now let's login...") say("You will be in your own village!") elseif sbugga == 0 then say("This account is banned.") elseif sbugga == -1 then say("Incorrect id or password.") end end end end
-
Hey devs! What is correct structure of Pack/Index file and how it works? I have seen a few examples and I'm a bit confused. What are the differences between those: * ETC * PC * Locale_US D:/Ymir Work/UI/ ETC D:/Ymir Work/PC/ PC Locale/ Locale_US Data/ ETC Data/ PC Data/ Locale_US And which way is the best to use? Thanks for all your replies.
-
[Hidden Content] [Hidden Content] d:/ymir work/ui/game/myshop_deco/select_btn_01.sub ...
- 19 replies
-
- 53
-
-
-
-
