Batch #18234 by eAthena: 1 byte-identical, 3 confirmed by peer review. - fn_12655 UISubChatHisWnd::OnCreate: byte-identical - fn_13136 UIListBoxAgitMenu::SendMsg: logic confirmed by peer review - fn_09297 UIRequestJoinPartyMgr::Advance: logic confirmed by peer review - fn_10017 UIRodexContentsWnd::GetItemAtPoint: logic confirmed by peer review Peer-reviewed-by: Yommy, alisonrag, br4yan, ragnarok-clanker, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
195 lines
6.5 KiB
C++
195 lines
6.5 KiB
C++
#include "Client/Mode/ModeMessage.h"
|
|
#include "UI/Guild/UIAgitWnd.h"
|
|
#include "UI/Window/UIEnums.h"
|
|
#include "Client/Mode/CMode.h"
|
|
#include "Client/Mode/ModeMgr.h"
|
|
#include "Client/Replay/Replay.h"
|
|
#include "Client/Session/Session.h"
|
|
#include "Contents/Guild/GuildInfo.h"
|
|
#include "Contents/Guild/GuildMgr.h"
|
|
#include "Contents/Tables/MessageTable.h"
|
|
#include "Render/Renderer.h"
|
|
#include "Resource/Bitmap/BitmapResource.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "Resource/Bitmap/SkinPalette.h"
|
|
#include "Resource/Bitmap/TextureNames.h"
|
|
#include "Script/LuaScript.h"
|
|
#include "UI/Buttons/UIButton.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
#include "Utility/Text/FormatString.h"
|
|
|
|
#include "Resource/MSGSTRINGID.h"
|
|
#include <cstddef>
|
|
#include <cstring>
|
|
#include <windows.h>
|
|
|
|
// OFFSET: 0x009537B0
|
|
// FUNCTION: fn_12992
|
|
UIAgitMessageBox::UIAgitMessageBox()
|
|
: UIFrameWnd(0), m_agitId(0) {
|
|
}
|
|
|
|
// OFFSET: 0x0095D580
|
|
// FUNCTION: fn_13068
|
|
void UIAgitMessageBox::Paint() {
|
|
this->DrawTitleBar(true, LookupMessage(MSI_USESKILL_FAIL_AP_INSUFFICIENT), 0);
|
|
this->DrawPanelBackground(17, 0, "");
|
|
this->DrawButtonBar(2, 0, 1);
|
|
}
|
|
|
|
// OFFSET: 0x00961260
|
|
// FUNCTION: fn_13122
|
|
int UIAgitMessageBox::SendMsg(UIWindow*, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
|
|
if (message == UM_COMMAND) {
|
|
const int response = static_cast<int>(a);
|
|
this->RecordResponse(response, b, c, d);
|
|
switch (response) {
|
|
case ID_YES:
|
|
g_modeMgr.GetGameMode()->SendMsg(MM_REQ_MOVE_GUILD_AGIT, this->m_agitId, 0, 0, 0);
|
|
g_windowMgr.Schedule(this);
|
|
break;
|
|
case ID_NO:
|
|
g_windowMgr.Schedule(this);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 188;
|
|
}
|
|
|
|
// OFFSET: 0x0095D570
|
|
// FUNCTION: fn_13067
|
|
void UIListBoxAgit::OnCreate(int width, int height) {
|
|
UIListBox::OnCreate(width, height);
|
|
}
|
|
|
|
// OFFSET: 0x00960090
|
|
// FUNCTION: fn_13092
|
|
void UIListBoxAgit::OnLBtnDown(int x, int y) {
|
|
if (this->parent) {
|
|
UIListBox::OnLBtnDown(x, y);
|
|
this->parent->SendMsg(nullptr, UM_HIDE_AGIT_MENU, 0, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009604B0
|
|
// FUNCTION: fn_13106
|
|
void UIListBoxAgit::OnRBtnDown(int x, int y) {
|
|
if (this->parent) {
|
|
UIListBox::OnLBtnDown(x, y);
|
|
if (this->selected < 0) {
|
|
this->parent->SendMsg(nullptr, UM_HIDE_AGIT_MENU, 0, 0, 0, 0);
|
|
return;
|
|
}
|
|
this->parent->SendMsg(nullptr, UM_SHOW_AGIT_MENU, this->geometry.width + this->geometry.x - 3, this->geometry.y - y % this->lineHeight + y + 2, 0, 0);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x0095F9E0
|
|
// FUNCTION: fn_13081
|
|
void UIListBoxAgitMenu::Paint() {
|
|
unsigned red, green, blue;
|
|
SkinPaletteChannels(ResourceMgr::Instance(), 6, 6, red, green, blue);
|
|
this->ClearSurface(RGB(red, green, blue));
|
|
SkinPaletteChannels(ResourceMgr::Instance(), 2, 2, red, green, blue);
|
|
this->FillRegion(1, 1, this->geometry.width - 2, this->geometry.height - 2, RGB(red, green, blue));
|
|
|
|
auto* leftUp = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\sysboxs_lu.bmp")));
|
|
this->DrawBitmap(0, 0, leftUp, false);
|
|
auto* leftDown = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\sysboxs_ld.bmp")));
|
|
this->DrawBitmap(0, this->geometry.height - leftDown->image.height, leftDown, false);
|
|
auto* rightUp = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\sysboxs_ru.bmp")));
|
|
this->DrawBitmap(this->geometry.width - rightUp->image.width, 0, rightUp, false);
|
|
auto* rightDown = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\sysboxs_rd.bmp")));
|
|
this->DrawBitmap(this->geometry.width - rightDown->image.width, this->geometry.height - rightDown->image.height, rightDown, false);
|
|
|
|
SkinPaletteChannels(ResourceMgr::Instance(), 6, 2, red, green, blue);
|
|
for (int index = 0; index < 2; ++index) {
|
|
if (index == this->selected) {
|
|
this->FillRegion(3, this->lineHeight * index + 1, this->geometry.width - 6, this->lineHeight - 2, RGB(red, green, blue));
|
|
}
|
|
this->DrawTextAt(3, this->lineHeight * index + 1, this->lines[index].c_str(), 0, 0, 12, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009600D0
|
|
// FUNCTION: fn_13093
|
|
void UIListBoxAgitMenu::OnLBtnDown(int x, int y) {
|
|
UIListBox::OnLBtnDown(x, y);
|
|
this->SendMsg(nullptr, UM_MENU_SELECTED, this->selected, 0, 0, 0);
|
|
if (this->parent) {
|
|
this->parent->SendMsg(nullptr, UM_HIDE_AGIT_MENU, 0, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00960160
|
|
// FUNCTION: fn_13096
|
|
void UIListBoxAgitMenu::OnMouseHover(int x, int y) {
|
|
const int previous = this->selected;
|
|
int line;
|
|
if (x < 0 || x >= this->geometry.width || y < 0 || y >= this->geometry.height) {
|
|
line = -1;
|
|
} else {
|
|
line = y / this->lineHeight;
|
|
|
|
if (line < 0) {
|
|
line = 0;
|
|
}
|
|
|
|
line = std::min(line, 1);
|
|
}
|
|
|
|
this->selected = line;
|
|
if (previous != line) {
|
|
this->Invalidate();
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00964F80
|
|
// FUNCTION: fn_13136
|
|
int UIListBoxAgitMenu::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
|
|
if (message != UM_MENU_SELECTED) {
|
|
return this->UIListBox::SendMsg(sender, message, a, b, c, d);
|
|
}
|
|
|
|
switch (a) {
|
|
case 0: {
|
|
if (g_session.GetSiegeMode() == 1) {
|
|
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_TOOLTIP_OF_OPTIONOFF_BTN)), 0xFF, 0, 0, 0);
|
|
return 0;
|
|
}
|
|
|
|
char* agitName = nullptr;
|
|
GuildInfo* guildInfo = &g_guildInfo;
|
|
uint16_t agitId = static_cast<uint16_t>(guildInfo->GetAgitId(this->m_agitIndex));
|
|
|
|
g_session.m_hotkeyScript->Call("get_agit_name", "d>s", agitId, &agitName);
|
|
if (strnlen(agitName, 256) != 0) {
|
|
int costZeny = 0;
|
|
g_session.m_hotkeyScript->Call("get_agit_costzeny", "db>d", agitId, 0, &costZeny);
|
|
int costGuildPoint = 0;
|
|
g_session.m_hotkeyScript->Call("get_agit_costzeny", "db>d", agitId, 1, &costGuildPoint);
|
|
|
|
UIAgitMessageBox* box = new UIAgitMessageBox();
|
|
const char* text = FormatString(LookupMessage(MSI_NOT_LEARN_BASIC_SKILL), agitName, costZeny, costGuildPoint);
|
|
box->InitializeMessageBox(text, 310, 130);
|
|
|
|
int x = g_renderer->viewport.centerX - box->geometry.width / 2;
|
|
int y = g_renderer->viewport.centerY - box->geometry.height / 2;
|
|
box->Move(x, y);
|
|
box->m_agitId = agitId;
|
|
g_windowMgr.AddRendered(box);
|
|
}
|
|
break;
|
|
}
|
|
case 1: {
|
|
CMode* mode = g_modeMgr.GetGameMode();
|
|
GuildInfo* guildInfo = &g_guildInfo;
|
|
uint16_t agitId = static_cast<uint16_t>(guildInfo->GetAgitId(this->m_agitIndex));
|
|
mode->SendMsg(MM_REQ_AGIT_INVESTMENT, agitId, 0, 0, 0);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|