diff --git a/Source/Contents/Actors/GroundScope.cpp b/Source/Contents/Actors/GroundScope.cpp index b2e5b028f..7e799fbbb 100644 --- a/Source/Contents/Actors/GroundScope.cpp +++ b/Source/Contents/Actors/GroundScope.cpp @@ -160,16 +160,21 @@ void CGroundScope::Render(int argument) { const char* name; std::uint32_t tint = color; - if (this->m_skillId == 0x7F0) { - name = g_serviceOptions.Get(0xE5) ? "effect\\mineffect\\new_poisonsmoke\\new_poisonsmoke_cast\\poi_magic_circle_1.tga" - : "effect\\new_poisonsmoke\\new_poisonsmoke_cast\\poi_magic_circle_1.tga"; - } else if (this->m_skillId == 0x8A5) { - name = "effect\\new_comet\\new_comet_cast_magicrune\\new_comet_cast_magicrune.tga"; - } else if (this->m_skillId == 0x149E) { - name = "effect\\competentia\\competentia_cast_bottom\\com_rune_01.tga"; - tint = static_cast(static_cast(static_cast(color >> 24) * 0.6f)) << 24 | 0xFFFFFF; - } else { - name = "effect\\magic_target.tga"; + switch (this->m_skillId) { + case 0x7F0: + name = g_serviceOptions.Get(0xE5) ? "effect\\mineffect\\new_poisonsmoke\\new_poisonsmoke_cast\\poi_magic_circle_1.tga" + : "effect\\new_poisonsmoke\\new_poisonsmoke_cast\\poi_magic_circle_1.tga"; + break; + case 0x8A5: + name = "effect\\new_comet\\new_comet_cast_magicrune\\new_comet_cast_magicrune.tga"; + break; + case 0x149E: + name = "effect\\competentia\\competentia_cast_bottom\\com_rune_01.tga"; + tint = static_cast(static_cast(static_cast(color >> 24) * 0.6f)) << 24 | 0xFFFFFF; + break; + default: + name = "effect\\magic_target.tga"; + break; } CTexture* texture = g_texMgr.Load(name, 0, false, true, false); diff --git a/Source/Contents/CashEmotion/CashEmotionMgr.cpp b/Source/Contents/CashEmotion/CashEmotionMgr.cpp index 032d0d090..6c8ea681d 100644 --- a/Source/Contents/CashEmotion/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotion/CashEmotionMgr.cpp @@ -1131,11 +1131,13 @@ bool CCashEmotionMgr::AddEmotion(int packId, int emotionId, const char* name, in bool inserted = false; auto it = this->m_emotionsByPack.find(packId); if (this->m_emotionsByPack.end() != it) { - return it->second.try_emplace(emotionId, packId, emotionId, name, actionIndex, frameIndex, actId, sprId).second; + auto result = it->second.try_emplace(emotionId, packId, emotionId, name, actionIndex, frameIndex, actId, sprId); + return result.second; } CashEmotionTable table; - if (table.try_emplace(emotionId, packId, emotionId, name, actionIndex, frameIndex, actId, sprId).second == true) { + auto result = table.try_emplace(emotionId, packId, emotionId, name, actionIndex, frameIndex, actId, sprId); + if (result.second == true) { inserted = this->m_emotionsByPack.emplace(packId, table).second; } diff --git a/Source/Contents/Events/CheckAttendanceMgr.cpp b/Source/Contents/Events/CheckAttendanceMgr.cpp index 6b1094b5d..6aaef1681 100644 --- a/Source/Contents/Events/CheckAttendanceMgr.cpp +++ b/Source/Contents/Events/CheckAttendanceMgr.cpp @@ -178,25 +178,26 @@ int CCheckAttendanceMgr::L_InsertCheckAttendanceReward(lua_State* state) { const int day = static_cast(lua_tonumber(state, -3)); const int item = static_cast(lua_tonumber(state, -2)); - std::string message; if (item == 0) { lua_pushboolean(state, 0); - message = FormatOwnedString("[InsertCheckAttendanceReward] Check ItemID : %d", 0); - } else { - const int count = static_cast(lua_tonumber(state, -1)); - if (count < 1) { - lua_pushboolean(state, 0); - message = FormatOwnedString("[InsertCheckAttendanceReward] Check ItemCnt : [%d] %d", item, count); - } else if (g_checkAttendanceMgr->m_rewards.insert(std::make_pair(day, lcReward(item, count))).second) { - lua_pushboolean(state, 1); - lua_pushstring(state, "good"); - return 2; - } else { - lua_pushboolean(state, 0); - message = FormatOwnedString("[InsertCheckAttendanceReward] Check RewardInfo : %d [%s] %d", day, item, count); - } + lua_pushstring(state, FormatOwnedString("[InsertCheckAttendanceReward] Check ItemID : %d", 0).c_str()); + return 2; } - lua_pushstring(state, message.c_str()); + const int count = static_cast(lua_tonumber(state, -1)); + if (count <= 0) { + lua_pushboolean(state, 0); + lua_pushstring(state, FormatOwnedString("[InsertCheckAttendanceReward] Check ItemCnt : [%d] %d", item, count).c_str()); + return 2; + } + + if (!g_checkAttendanceMgr->m_rewards.insert(std::make_pair(day, lcReward(item, count))).second) { + lua_pushboolean(state, 0); + lua_pushstring(state, FormatOwnedString("[InsertCheckAttendanceReward] Check RewardInfo : %d [%s] %d", day, item, count).c_str()); + return 2; + } + + lua_pushboolean(state, 1); + lua_pushstring(state, "good"); return 2; } diff --git a/Source/Contents/Events/SpecialPopupMgr.cpp b/Source/Contents/Events/SpecialPopupMgr.cpp index 3ec6818ee..c04208e1f 100644 --- a/Source/Contents/Events/SpecialPopupMgr.cpp +++ b/Source/Contents/Events/SpecialPopupMgr.cpp @@ -92,13 +92,13 @@ bool CSpecialPopupMgr::Init() { return false; } - if (lua_toboolean(luaState.GetState(), -2)) { - return true; + if (!lua_toboolean(luaState.GetState(), -2)) { + std::string message = std::string("error found :") + lua_tostring(luaState.GetState(), -1); + MessageBoxA(NULL, message.c_str(), "CSpecialPopupMgr", 0); + return false; } - std::string message = std::string("error found :") + lua_tostring(luaState.GetState(), -1); - MessageBoxA(NULL, message.c_str(), "CSpecialPopupMgr", 0); - return false; + return true; } // OFFSET: 0x007A7DB0 diff --git a/Source/Contents/Items/ItemNaming.cpp b/Source/Contents/Items/ItemNaming.cpp index 7fbb1d43a..3cc44ea71 100644 --- a/Source/Contents/Items/ItemNaming.cpp +++ b/Source/Contents/Items/ItemNaming.cpp @@ -86,7 +86,7 @@ bool ITEM_INFO::HasCards() const { const bool first = g_itemCardNames.contains(CardId(*this, 0)); const unsigned id = static_cast(std::atoi(this->itemId.c_str())); - if (id - 9001u <= 498 || id - 10000u <= 999 || CardId(*this, 0) == 254 || CardId(*this, 0) == 255 || !Equipment(*this)) { + if (id - 9001u <= 498 || id - 10000u <= 999 || CardId(*this, 0) == 254 || CardId(*this, 0) == 255 || Equipment(*this) != true) { return first; } diff --git a/Source/Contents/Items/JobCodeForItem.cpp b/Source/Contents/Items/JobCodeForItem.cpp index b7452bf3e..70e70b511 100644 --- a/Source/Contents/Items/JobCodeForItem.cpp +++ b/Source/Contents/Items/JobCodeForItem.cpp @@ -434,10 +434,10 @@ bool CJobCodeForItem::IsJobAllowed(int job, unsigned long code) { switch (code) { case 0xFFFFE: { auto group = this->m_jobGroups.find(0); - if (group == this->m_jobGroups.end()) { - return false; + if (group != this->m_jobGroups.end()) { + return group->second.end() == group->second.find(job); } - return group->second.end() == group->second.find(job); + return false; } case 0xFFFFF: return true; diff --git a/Source/Contents/Messenger/MessengerMember.cpp b/Source/Contents/Messenger/MessengerMember.cpp index cefdae4c0..d098f1d3a 100644 --- a/Source/Contents/Messenger/MessengerMember.cpp +++ b/Source/Contents/Messenger/MessengerMember.cpp @@ -1156,7 +1156,7 @@ void UIMessengerGroupWnd::OnLBtnDown(int x, int y) { gameMode->TargetActorByAid(member.accountId); MessengerMember selectedMember = this->MemberAtIndex(this->selected); - if (this->mode == 1 && !g_session.m_lockMouse && !g_windowMgr.HasMiniPartyMember(selectedMember.accountId)) { + if (this->mode == 1 && g_session.m_lockMouse != true && g_windowMgr.HasMiniPartyMember(selectedMember.accountId) != true) { gameMode->SetDragIds(29, this->selected); if (!g_windowMgr.transientWnd) { UIDragMiniPartyWnd* window = new (std::nothrow) UIDragMiniPartyWnd(selectedMember); @@ -1172,7 +1172,7 @@ void UIMessengerGroupWnd::OnLBtnDown(int x, int y) { int index = 0; for (const MessengerMember& entry : this->members) { - if (this->scrollTop * this->columns <= index && entry.valid && entry.accountId == selectedMember.accountId) { + if (index >= this->scrollTop * this->columns && entry.valid && entry.accountId == selectedMember.accountId) { CGameActor* actor = entry.accountId == g_session.m_aid ? gameMode->scene->player : static_cast(gameMode->scene->GetGameActorByAID(entry.accountId));