Decompile fn_12756 (UISeekPartyMBWnd::SendMsg)
Batch #7689 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_12756 UISeekPartyMBWnd::SendMsg: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, secret, Snow Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
a3e992dfb1
commit
1cd4479e57
3 changed files with 173 additions and 4 deletions
|
|
@ -1,7 +1,153 @@
|
|||
#include "UI/Window/UISeekPartyMBWnd.h"
|
||||
#include "Contents/MessageTable.h"
|
||||
#include "Contents/UserData/NormalItemSlots.h"
|
||||
#include "Network/Connection/Connection.h"
|
||||
#include "Network/Packets/PacketId.h"
|
||||
#include "Network/Packets/PacketLengths.h"
|
||||
#include "UI/Buttons/UICheckBox.h"
|
||||
#include "UI/Edit/UIEditCtrl.h"
|
||||
#include "UI/Lists/UIComboBoxDefWnd.h"
|
||||
#include "UI/Window/UISeekPartyWnd.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
#include "UI/Window/WindowDialogs.h"
|
||||
#include "UI/Window/WindowManagerWindows.h"
|
||||
#include "Utility/Text/FormatString.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
namespace {
|
||||
#pragma pack(push, 1)
|
||||
struct PACKET_CZ_PARTY_BOOKING_REQ_REGISTER {
|
||||
/* 0000 */ short packetType;
|
||||
/* 0002 */ PARTY_BOOKING_DETAIL detail;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
||||
|
||||
// OFFSET: 0x00939EE0
|
||||
// FUNCTION: fn_12756
|
||||
int UISeekPartyMBWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
|
||||
WindowDialogs& dialogs = *reinterpret_cast<WindowDialogs*>(&g_windowMgr);
|
||||
|
||||
switch (message) {
|
||||
case 6:
|
||||
switch (a) {
|
||||
case 184: {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
this->m_registration.detail.job[i] = -1;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int category = 0; category < 8; ++category) {
|
||||
std::map<unsigned short, UICheckBox*>& checks = this->m_jobChecks[category];
|
||||
for (auto it = checks.begin(); it != checks.end(); ++it) {
|
||||
if (it->second->geometry.unknown_0030) {
|
||||
if (count < 6) {
|
||||
this->m_registration.detail.job[count] = it->first;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
dialogs.Confirm(LookupMessage(1768), 0, true, false, 0, "Message", 280, 120, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (count > 6) {
|
||||
char text[100];
|
||||
std::memset(text, 0, sizeof(text));
|
||||
std::sprintf(text, LookupMessage(1769), count);
|
||||
dialogs.Confirm(text, 0, true, false, 0, "Message", 280, 120, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
std::string level(this->m_levelEdit->Text());
|
||||
for (unsigned int i = 0; i < level.size(); ++i) {
|
||||
if (level[i] < '/' || level[i] > '9') {
|
||||
dialogs.Confirm(LookupMessage(1770), 0, true, false, 0, "Message", 280, 120, 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
this->m_registration.detail.level = static_cast<short>(std::atoi(this->m_levelEdit->Text()));
|
||||
g_partyBookingLevelLimit = this->m_registration.detail.level;
|
||||
const int maximum = g_partyBookingLevelMax;
|
||||
if (this->m_registration.detail.level >= 1 && this->m_registration.detail.level <= maximum) {
|
||||
this->m_registration.detail.mapId = static_cast<short>((this->m_type + 1) * 256 | this->m_subType);
|
||||
if (!this->m_frameContext->windows.CloseWindow(164)) {
|
||||
PACKET_CZ_PARTY_BOOKING_REQ_REGISTER packet;
|
||||
packet.packetType = ID_CZ_PARTY_BOOKING_REQ_REGISTER;
|
||||
packet.detail = this->m_registration.detail;
|
||||
GetRagConnection().Send(g_packetLengths.FixedLength(packet.packetType), &packet);
|
||||
}
|
||||
} else {
|
||||
char text[260];
|
||||
std::memset(text, 0, sizeof(text));
|
||||
StringFormat(text, sizeof(text), static_cast<std::size_t>(-1), LookupMessage(2601), maximum);
|
||||
dialogs.Confirm(text, 0, true, false, 0, "Message", 280, 120, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 185:
|
||||
case 201:
|
||||
this->m_frameContext->windows.CloseWindow(168);
|
||||
this->m_frameContext->windows.CloseWindow(170);
|
||||
break;
|
||||
case 202:
|
||||
if (this->m_minimized) {
|
||||
this->Resize(this->geometry.width, this->m_restoreHeight);
|
||||
} else {
|
||||
this->m_restoreHeight = this->geometry.height;
|
||||
this->Resize(this->geometry.width, 17);
|
||||
}
|
||||
|
||||
this->m_minimized = !this->m_minimized;
|
||||
this->Invalidate();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
this->m_saved = reinterpret_cast<SeekPartyMBWndInfo*>(a);
|
||||
if (!this->m_saved->IsValid()) {
|
||||
this->m_saved->Reset();
|
||||
}
|
||||
|
||||
this->Move(this->m_saved->x, this->m_saved->y);
|
||||
this->SendMsg(nullptr, 14, 3, this->m_saved->width, this->m_saved->height, 0);
|
||||
this->SendMsg(nullptr, 23, 0, 0, 0, 0);
|
||||
break;
|
||||
case 39:
|
||||
if (sender == this->m_typeCombo) {
|
||||
const int key = a + 2;
|
||||
this->m_subTypeCombo->Clear();
|
||||
auto found = this->m_subTypes.find(key);
|
||||
if (found != this->m_subTypes.end()) {
|
||||
const std::vector<std::pair<std::string, int>> entries = found->second;
|
||||
for (auto it = entries.begin(); it != entries.end(); ++it) {
|
||||
const std::pair<std::string, int> entry = *it;
|
||||
this->m_subTypeCombo->AddOption(entry.first.c_str(), entry.second);
|
||||
}
|
||||
}
|
||||
|
||||
this->m_type = static_cast<short>(a);
|
||||
this->m_subTypeCombo->Select(0);
|
||||
this->m_subType = 0;
|
||||
} else if (sender == this->m_subTypeCombo) {
|
||||
this->m_subType = static_cast<short>(a);
|
||||
} else if (sender == this->m_jobCategoryCombo) {
|
||||
this->ShowJobCategory(a);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return UIFrameWnd::SendMsg(sender, message, a, b, c, d);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00944370
|
||||
// FUNCTION: fn_12831
|
||||
|
|
|
|||
|
|
@ -1,33 +1,53 @@
|
|||
#ifndef RAGNAROK_SOURCE_UI_WINDOW_UISEEKPARTYMBWND_H
|
||||
#define RAGNAROK_SOURCE_UI_WINDOW_UISEEKPARTYMBWND_H
|
||||
|
||||
#include "Contents/Party/PartyBookingInfo.h"
|
||||
#include "UI/Window/UIFrameWnd.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
struct UIButtonContext;
|
||||
struct SeekPartyMBWndInfo;
|
||||
class UICheckBox;
|
||||
class UIComboBoxDefWnd;
|
||||
class UIEditCtrl;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct SeekPartyRegistration {
|
||||
/* 0000 */ PARTY_BOOKING_DETAIL detail;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class UISeekPartyMBWnd : public UIFrameWnd {
|
||||
public:
|
||||
void Slot11() override;
|
||||
void Paint() override;
|
||||
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
|
||||
void CreateJobChecks();
|
||||
void InitJobCategoryCombo();
|
||||
void ShowJobCategory(int category);
|
||||
|
||||
protected:
|
||||
/* 00BC */ unsigned char unknown_00BC[0x14];
|
||||
/* 00BC */ unsigned char unknown_00BC[8];
|
||||
/* 00C4 */ UIEditCtrl* m_levelEdit;
|
||||
/* 00C8 */ UIComboBoxDefWnd* m_typeCombo;
|
||||
/* 00CC */ UIComboBoxDefWnd* m_subTypeCombo;
|
||||
/* 00D0 */ UIComboBoxDefWnd* m_jobCategoryCombo;
|
||||
/* 00D4 */ unsigned char unknown_00D4[0x30];
|
||||
/* 0104 */ std::map<unsigned short, UICheckBox*> m_jobChecks[8];
|
||||
/* 0144 */ unsigned char unknown_0144[0x18];
|
||||
/* 0144 */ unsigned char unknown_0144[8];
|
||||
/* 014C */ std::map<int, std::vector<std::pair<std::string, int>>> m_subTypes;
|
||||
/* 0154 */ unsigned char unknown_0154[8];
|
||||
/* 015C */ int m_jobCategory;
|
||||
/* 0160 */ unsigned char unknown_0160[0x8];
|
||||
/* 0160 */ short m_type;
|
||||
/* 0162 */ short m_subType;
|
||||
/* 0164 */ int m_restoreHeight;
|
||||
/* 0168 */ unsigned char m_minimized;
|
||||
/* 0169 */ unsigned char unknown_0169[0x13];
|
||||
/* 0169 */ SeekPartyRegistration m_registration;
|
||||
/* 0179 */ unsigned char unknown_0179[3];
|
||||
/* 017C */ SeekPartyMBWndInfo* m_saved;
|
||||
UIButtonContext* m_controls;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ class UIStaticText;
|
|||
struct UIButtonContext;
|
||||
struct SeekPartyWndInfo;
|
||||
|
||||
extern int g_partyBookingLevelLimit;
|
||||
extern int g_partyBookingLevelMax;
|
||||
|
||||
class UISeekPartyWnd : public UIFrameWnd {
|
||||
public:
|
||||
void Slot11() override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue