#include "UI/Window/UINewMakeCharWnd.h" #include "Client/Mode/CMode.h" #include "Client/Session.h" #include "Contents/Actors/Pc.h" #include "Contents/Configuration/ServiceConfiguration.h" #include "Contents/MessageTable.h" #include "Contents/SpriteRidingOffset.h" #include "Render/DeviceContext/DeviceContext.h" #include "Render/Renderer.h" #include "Render/Textures/SpriteAtlas.h" #include "Render/Textures/SpritePixels.h" #include "Render/Textures/Texture.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ImfResource.h" #include "Resource/PaletteResource.h" #include "Resource/ResourceMgr.h" #include "Resource/Sprites/ActionResource.h" #include "Resource/Sprites/SpriteResource.h" #include "Resource/TextureNames.h" #include "UI/Window/UINewSelectCharWnd.h" #include #include #include #include // OFFSET: 0x007D9A50 // FUNCTION: fn_09609 UINewMakeCharWnd::UINewMakeCharWnd() : UIFrameWnd(*reinterpret_cast(nullptr), *reinterpret_cast(nullptr), 0), unknown_02C0(0), m_race(0), m_raceViews() { this->geometry.unknown_0034 = 0; const int* preset = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(10016, 0, 0, 0, 0)); this->m_stats[0] = static_cast(preset[0]); this->m_stats[1] = static_cast(preset[1]); this->m_stats[2] = static_cast(preset[2]); this->m_stats[3] = static_cast(preset[3]); this->m_stats[4] = static_cast(preset[4]); this->m_stats[5] = static_cast(preset[5]); this->m_headPalette = static_cast(preset[6]); this->m_head = static_cast(preset[7]); this->m_name[0] = 0; this->m_job = 0; this->m_level = 1; this->m_skillPoint = 1; this->m_status.jobPoint = 0; this->m_status.hp = 100; this->m_status.maxHp = 100; this->m_status.sp = 100; this->m_status.maxSp = 100; this->m_status.exp = 0; this->m_slot = g_selectedSlotIndex; this->m_headPalette = 0; this->m_bodyPalette = 0; this->m_shield = 0; this->unknown_0274 = 0; this->unknown_0276 = 0; this->m_costumeJob = 0; this->m_sex = static_cast(g_doramSex); this->m_viewX = 500; this->m_viewY = 228; this->unknown_01FC = 0; this->m_action = 0; this->m_frame = 0; this->m_raceActions[0].assign(GetBodyActionResourceName(this->m_job, this->m_sex, 0, 0)); this->m_raceSprites[0].assign(g_session.GetBodySprName(this->m_job, this->m_sex, 0, 0)); if (!g_session.IsDoramJob(this->m_job) && this->m_sex == 1 && this->m_head == 13) { this->m_head = 14; } int head = this->m_head; this->m_raceActions[1].assign(g_session.GetHeadActName(this->m_job, this->m_sex, &head)); this->m_raceSprites[1].assign(g_session.GetHeadSprName(this->m_job, this->m_sex, &head)); const int bodyPalette = this->m_bodyPalette; this->m_head = static_cast(head); this->m_racePaletteEnabled[1] = bodyPalette; if (bodyPalette > 0) { this->m_racePalettes[1].assign(g_session.GetBodyPalName(this->m_job, this->m_sex, bodyPalette, 0, 0, 0)); } const int headPalette = this->m_headPalette; this->m_racePaletteEnabled[0] = headPalette; if (headPalette > 0) { this->m_racePalettes[0].assign(g_session.GetHeadPalName(head, this->m_job, this->m_sex, headPalette)); } this->m_raceOffsets = GetBodyImfName(this->m_job, this->m_sex, this->m_head, this->m_costumeJob); this->unknown_035C = 0; this->m_startTime = timeGetTime(); this->unknown_0364 = 0; this->unknown_0368 = 0; this->unknown_02D0[0] = 0; this->unknown_02D0[1] = 0; this->unknown_02D0[2] = 0; this->unknown_02D0[3] = 0; this->unknown_02D0[4] = 0; this->unknown_02D0[5] = 0; this->unknown_0330[0] = 0; this->unknown_0330[1] = 0; this->unknown_0338 = 0; this->unknown_0354 = 0; } // OFFSET: 0x007DB320 // FUNCTION: fn_09617 void UIHairBitmap::Slot25(int x, int y) { if (this->parent) { this->parent->Slot25(x, y); } } // OFFSET: 0x007DB300 // FUNCTION: fn_09616 void UIHairBitmap::Slot26(int x, int y) { if (this->parent) { this->parent->Slot26(x, y); } } // OFFSET: 0x007DB380 // FUNCTION: fn_09620 void UIHairBitmap::Slot27(int x, int y) { if (this->parent) { this->parent->Slot27(x, y); } } // OFFSET: 0x007DB360 // FUNCTION: fn_09619 void UIHairBitmap::Slot28(int x, int y) { if (this->parent) { this->parent->Slot28(x, y); } } // OFFSET: 0x007DB3A0 // FUNCTION: fn_09621 void UIHairBitmap::Slot29(int x, int y) { if (this->parent) { this->parent->Slot29(x, y); } } // OFFSET: 0x007DB3C0 // FUNCTION: fn_09622 void UIHairBitmap::ResetCursor(int x, int y) { if (this->parent) { this->parent->ResetCursor(x, y); } } // OFFSET: 0x007DB340 // FUNCTION: fn_09618 void UIHairBitmap::Slot31(int x, int y) { if (this->parent) { this->parent->Slot31(x, y); } } // OFFSET: 0x007DB030 // FUNCTION: fn_09615 void UINewMakeCharWnd::Paint() { CBitmapRes* background = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\make_character_ver2\\bg_makeBg.bmp"))); this->DrawBitmap(0, 0, &background->image, false); this->DrawTextAt(this->m_context->fonts, this->m_context->locale, 0x2C, 0x11, LookupMessage(0xD1B), 0, 0, 0xC, 0x5F5F5F, 1, 0); for (int i = 0; i < 2; ++i) { CImfRes* offsets = static_cast(ResourceMgr::Instance().Load(this->m_raceOffsets.c_str())); CActRes* action = static_cast(ResourceMgr::Instance().Load(this->m_raceActions[i].c_str())); CSprRes* sprite = static_cast(ResourceMgr::Instance().Load(this->m_raceSprites[i].c_str())); const ActionFrame& frame = action->Frame(this->m_action, this->m_frame); POINT offset = offsets->GetLongPoint(i, this->m_action, this->m_frame); const std::uint32_t* palette = sprite->palette; if (i == 1) { CActRes* first = static_cast(ResourceMgr::Instance().Load(this->m_raceActions[0].c_str())); const ActionFrame& firstFrame = first->Frame(this->m_action, this->m_frame); if (frame.anchorCount != 0 && firstFrame.anchorCount != 0 && frame.anchors[0].unknown_0008 == firstFrame.anchors[0].unknown_0008) { offset.x += firstFrame.anchors[0].x - frame.anchors[0].x; offset.y += firstFrame.anchors[0].y - frame.anchors[0].y; } if (this->m_racePaletteEnabled[0] > 0) { palette = static_cast(ResourceMgr::Instance().Load(this->m_racePalettes[0].c_str()))->palette; } } else if (this->m_racePaletteEnabled[1] > 0) { palette = static_cast(ResourceMgr::Instance().Load(this->m_racePalettes[1].c_str()))->palette; } const SpriteFrameCell& cell = frame.Cell(i); if (cell.image == -1) { continue; } const SpriteRleImage* image = sprite->images[cell.imageType][cell.image]; SpriteAtlasRecord record{}; CTexture* texture; if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); } this->geometry.surface->DrawSurface( this->m_viewX + offset.x + cell.x, this->m_viewY + offset.y + cell.y, texture, static_cast(record.u0 * 256.0f), static_cast(record.v0 * 256.0f), image->width, image->height, cell.mirrored != 0, image->unknown_0004 + 1, image->unknown_0006 + 1, 0, 0 ); } } // OFFSET: 0x007DB3E0 // FUNCTION: fn_09623 void UINewMakeCharWnd::Slot19() { this->m_raceViews[this->m_race]->Invalidate(); } // OFFSET: 0x007DB400 // FUNCTION: fn_09624 int UIHairStyleButton::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { switch (message) { case 13: { bool previous = this->m_selected; this->m_selected = argument1 != 0; if (previous != (argument1 != 0)) { if (argument1) { this->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_select.bmp", 0, 0); this->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_select.bmp", 1, 0); } else { this->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_normal.bmp", 0, 0); this->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_over.bmp", 1, 0); } this->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_select.bmp", 2, 0); this->Invalidate(); } break; } case 40: { char name[128]; memset(name, 0, sizeof(name)); if (this->m_race == 0) { if (this->m_style > 22) { if (this->m_preview) { this->m_preview->Enable(0); this->InvalidateChildren(); } return 0; } this->m_preview->Enable(1); sprintf_s( name, this->m_sex == 0 ? "유저인터페이스\\make_character_ver2\\img_hairStyle_girl%02d.bmp" : "유저인터페이스\\make_character_ver2\\img_hairStyle%02d.bmp", this->m_style + 1 ); } else if (this->m_race == 1) { if (this->m_style > 5) { if (this->m_preview) { this->m_preview->Enable(0); this->InvalidateChildren(); } return 0; } this->m_preview->Enable(1); sprintf_s( name, this->m_sex == 0 ? "유저인터페이스\\make_character_ver2\\img_hairStyle_doramGirl%02d.bmp" : "유저인터페이스\\make_character_ver2\\img_hairStyle_doramBoy%02d.bmp", this->m_style + 1 ); } if (this->m_preview) { this->m_preview->SetBitmap(name, 0, 0); this->m_preview->SetBitmap(name, 1, 0); this->m_preview->SetBitmap(name, 2, 0); this->m_preview->SetBitmap("유저인터페이스\\make_character_ver2\\img_hairStyle_none.bmp", 3, 0); } this->InvalidateChildren(); break; } default: UIBitmapButton::SendMsg(sender, message, argument1, argument2, argument3, argument4); break; } return 0; } // OFFSET: 0x007DA290 // FUNCTION: fn_09613 void UIHairStyleButton::Slot15(int width, int height) { this->m_preview = new (std::nothrow) UIHairBitmap(*this->m_context, *this->m_buttonContext); this->m_preview->SetSize(36, 37); this->AddChild(this->m_preview); this->SendMsg(nullptr, 40, 0, 0, 0, 0); } // OFFSET: 0x007DBFD0 // FUNCTION: fn_09626 void UINewMakeCharWnd::sub_7DBFD0() { const std::string bodyAct = GetBodyActionResourceName(this->m_job, this->m_sex, this->m_job, 0); this->m_raceActions[0].assign(bodyAct); const std::string bodySpr = g_session.GetBodySprName(this->m_job, this->m_sex, this->m_job, 0); this->m_raceSprites[0].assign(bodySpr); int head = this->m_head; const std::string headAct = g_session.GetHeadActName(this->m_job, this->m_sex, &head); this->m_raceActions[1].assign(headAct); const std::string headSpr = g_session.GetHeadSprName(this->m_job, this->m_sex, &head); this->m_raceSprites[1].assign(headSpr); const int bodyPalette = this->m_bodyPalette; this->m_head = static_cast(head); this->m_racePaletteEnabled[1] = bodyPalette; if (bodyPalette > 0) { const std::string bodyPal = g_session.GetBodyPalName(this->m_job, this->m_sex, bodyPalette, this->m_job, 0, 0); this->m_racePalettes[1].assign(bodyPal); } const int headPalette = this->m_headPalette; this->m_racePaletteEnabled[0] = headPalette; if (headPalette > 0) { const std::string headPal = g_session.GetHeadPalName(head, this->m_job, this->m_sex, headPalette); this->m_racePalettes[0].assign(headPal); } this->m_raceOffsets = GetBodyImfName(this->m_job, this->m_sex, this->m_head, this->m_costumeJob); } // OFFSET: 0x007DA340 // FUNCTION: fn_09614 void UINewMakeCharWnd::Slot15(int width, int height) { UIBitmapButton* closeButton = new UIBitmapButton(*this->m_context, *this->m_controls); closeButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_close_normal.bmp", 0, 0); closeButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_close_over.bmp", 1, 0); closeButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_close_press.bmp", 2, 0); closeButton->SetSize(closeButton->BitmapWidth(), closeButton->BitmapHeight()); closeButton->Move(0x300, 9); closeButton->SetId(0xB9); this->AddChild(closeButton); UIBmpTextButton* makeButton = new UIBmpTextButton(*this->m_context, *this->m_controls); makeButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_make_normal.bmp", 0, 0); makeButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_make_over.bmp", 1, 0); makeButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_make_press.bmp", 2, 0); makeButton->SetSize(makeButton->BitmapWidth(), makeButton->BitmapHeight()); makeButton->Move(0x268, 0x17B); makeButton->SetText(LookupMessage(0xD11)); makeButton->AddTextStyle(0, 0xE, 0x313131, 1, 1, -1000, -1000); makeButton->AddTextStyle(1, 0xE, 0x313131, 1, 1, -1000, -1000); makeButton->AddTextStyle(2, 0xE, 0x313131, 1, 1, -1000, -1000); makeButton->SetId(0xB8); this->AddChild(makeButton); UIBmpTextButton* cancelButton = new UIBmpTextButton(*this->m_context, *this->m_controls); cancelButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_make_normal.bmp", 0, 0); cancelButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_make_over.bmp", 1, 0); cancelButton->SetBitmap("유저인터페이스\\make_character_ver2\\bt_make_press.bmp", 2, 0); cancelButton->SetSize(cancelButton->BitmapWidth(), cancelButton->BitmapHeight()); cancelButton->Move(0x19, 0x17B); cancelButton->SetText(LookupMessage(0xD17)); cancelButton->AddTextStyle(0, 0xE, 0x313131, 1, 1, -1000, -1000); cancelButton->AddTextStyle(1, 0xE, 0x313131, 1, 1, -1000, -1000); cancelButton->AddTextStyle(2, 0xE, 0x313131, 1, 1, -1000, -1000); cancelButton->SetId(0xB9); this->AddChild(cancelButton); this->m_nameEdit = new UIEditCtrl2(*this->m_context, *this->m_editContext); this->m_nameEdit->SetSize(0x82, 0x14); this->m_nameEdit->Move(0x1B3, 0x10C); this->m_nameEdit->maximum = 0x17; this->AddChild(this->m_nameEdit); UIDescriptRace* human = new UIDescriptRace(0); human->SetBitmap("유저인터페이스\\make_character_ver2\\img_human_off.bmp", 0, 0); human->SetBitmap("유저인터페이스\\make_character_ver2\\img_human_on.bmp", 1, 0); human->SetBitmap("유저인터페이스\\make_character_ver2\\img_human_on.bmp", 2, 0); human->SetSize(human->BitmapWidth(), human->BitmapHeight()); human->Move(0x15, 0x24); this->m_raceViews[0] = human; this->AddChild(human); UIDescriptRace* doram = new UIDescriptRace(1); const char* doramNormal; const char* doramActive; if (!g_doramCreationEnabled) { doramActive = "유저인터페이스\\make_character_ver2\\img_doram_comingSoon.bmp"; doramNormal = doramActive; } else { doramActive = "유저인터페이스\\make_character_ver2\\img_doram_on.bmp"; doramNormal = "유저인터페이스\\make_character_ver2\\img_doram_off.bmp"; } doram->SetBitmap(doramNormal, 0, 0); doram->SetBitmap(doramActive, 1, 0); doram->SetBitmap(doramActive, 2, 0); doram->SetSize(doram->BitmapWidth(), doram->BitmapHeight()); doram->Move(0x15, 0xCA); this->m_raceViews[1] = doram; this->AddChild(doram); this->m_genderButtons[1] = new UIBitmapButton(*this->m_context, *this->m_controls); this->m_genderButtons[1]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_male_off.bmp", 0, 0); this->m_genderButtons[1]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_male_over.bmp", 1, 0); this->m_genderButtons[1]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_male_press.bmp", 2, 0); this->m_genderButtons[1]->SetSize(this->m_genderButtons[1]->BitmapWidth(), this->m_genderButtons[1]->BitmapHeight()); this->m_genderButtons[1]->Move(0x1B5, 0x3B); this->m_genderButtons[1]->SetId(0x20D); this->AddChild(this->m_genderButtons[1]); this->m_genderButtons[0] = new UIBitmapButton(*this->m_context, *this->m_controls); this->m_genderButtons[0]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_female_off.bmp", 0, 0); this->m_genderButtons[0]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_female_over.bmp", 1, 0); this->m_genderButtons[0]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_female_press.bmp", 2, 0); this->m_genderButtons[0]->SetSize(this->m_genderButtons[0]->BitmapWidth(), this->m_genderButtons[0]->BitmapHeight()); this->m_genderButtons[0]->Move(500, 0x3B); this->m_genderButtons[0]->SetId(0x20D); this->AddChild(this->m_genderButtons[0]); if (this->m_sex == 1) { this->m_genderButtons[1]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_male_on.bmp", 0, 0); } else if (this->m_sex == 0) { this->m_genderButtons[0]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_female_on.bmp", 0, 0); } UIBitmapButton* leftTurn = new UIBitmapButton(*this->m_context, *this->m_controls); leftTurn->SetBitmap("유저인터페이스\\make_character_ver2\\bt_leftTurn_normal.bmp", 0, 0); leftTurn->SetBitmap("유저인터페이스\\make_character_ver2\\bt_leftTurn_over.bmp", 1, 0); leftTurn->SetBitmap("유저인터페이스\\make_character_ver2\\bt_leftTurn_press.bmp", 2, 0); leftTurn->SetSize(leftTurn->BitmapWidth(), leftTurn->BitmapHeight()); leftTurn->Move(0x1AA, 0xB3); leftTurn->SetId(0xE3); leftTurn->m_argument = 0; leftTurn->SetTooltip(LookupMessage(0x87E)); this->AddChild(leftTurn); UIBitmapButton* rightTurn = new UIBitmapButton(*this->m_context, *this->m_controls); rightTurn->SetBitmap("유저인터페이스\\make_character_ver2\\bt_rightTurn_normal.bmp", 0, 0); rightTurn->SetBitmap("유저인터페이스\\make_character_ver2\\bt_rightTurn_over.bmp", 1, 0); rightTurn->SetBitmap("유저인터페이스\\make_character_ver2\\bt_rightTurn_press.bmp", 2, 0); rightTurn->SetSize(rightTurn->BitmapWidth(), rightTurn->BitmapHeight()); rightTurn->Move(0x227, 0xB3); rightTurn->SetId(0xE2); rightTurn->m_argument = 0; rightTurn->SetTooltip(LookupMessage(0x87F)); this->AddChild(rightTurn); UIStaticText* hairStyleTitle = new UIStaticText(*this->m_context, *this->m_controls); hairStyleTitle->SetSize(100, 0xF); hairStyleTitle->SetText(LookupMessage(0xD12), 0); hairStyleTitle->SetColor(0x40, 0x40, 0x40); hairStyleTitle->SetFont(0, 0xB, 1, 0); hairStyleTitle->Move(0x261, 0x2E); this->AddChild(hairStyleTitle); for (int index = 0; index < 24; ++index) { this->m_hairStyleButtons[index] = new UIHairStyleButton(*this->m_context, *this->m_controls, index, this->m_sex); this->m_hairStyleButtons[index]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_normal.bmp", 0, 0); this->m_hairStyleButtons[index]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_over.bmp", 1, 0); this->m_hairStyleButtons[index]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_hairStyle_select.bmp", 2, 0); this->m_hairStyleButtons[index]->SetSize(0x24, 0x25); this->m_hairStyleButtons[index]->SetId(0x20C); this->m_hairStyleButtons[index]->Move((index % 4) * 0x26 + 0x25E, (index / 4) * 0x25 + 0x3B); this->AddChild(this->m_hairStyleButtons[index]); if (index == 0) { this->m_hairStyleButtons[0]->SendMsg(this, 13, 1, 0, 0, 0); } } UIStaticText* hairColorTitle = new UIStaticText(*this->m_context, *this->m_controls); hairColorTitle->SetSize(100, 0xF); hairColorTitle->SetText(LookupMessage(0xD13), 0); hairColorTitle->SetColor(0x40, 0x40, 0x40); hairColorTitle->SetFont(0, 0xB, 1, 0); hairColorTitle->Move(0x261, 0x11F); this->AddChild(hairColorTitle); char name[128]; memset(name, 0, sizeof(name)); for (int index = 0; index < 9; ++index) { UIBmpRadioBtn* button = new UIBmpRadioBtn(*this->m_context, *this->m_controls); memset(name, 0, 0x40); sprintf(name, "유저인터페이스\\make_character_ver2\\color%02d_off.bmp", index + 1); button->SetBitmap(name, 0); memset(name, 0, 0x40); sprintf(name, "유저인터페이스\\make_character_ver2\\color%02d_over.bmp", index + 1); button->SetBitmap(name, 1); memset(name, 0, 0x40); sprintf(name, "유저인터페이스\\make_character_ver2\\color%02d_on.bmp", index + 1); button->SetBitmap(name, 2); if (index == 0) { button->SendMsg(this, 13, 1, 0, 0, 0); } button->m_value = 0x1EF; button->Move((index % 5) * 0x1B + 0x26B, (index / 5) * 0x18 + 0x132); this->m_hairColorButtons[index] = button; this->AddChild(button); } InputFocus focus{g_windowMgr.hoverWindow}; focus.Set(this->m_nameEdit); this->m_message0 = 0xB8; } // OFFSET: 0x007DB630 // FUNCTION: fn_09625 int UINewMakeCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { if (message == 0) { char name[24] = {}; strcpy(name, this->m_nameEdit->Text()); memcpy(this->m_name, name, sizeof(this->m_name)); this->SendMsg(nullptr, 6, this->m_message0, 0, 0, 0); return 0; } if (message != 6) { if (message == 13) { this->m_race = static_cast(argument1); } return UIFrameWnd::SendMsg(sender, message, argument1, argument2, argument3, argument4); } switch (argument1) { case 0xB8: { for (int index = 0; index < 2; ++index) { if ((g_doramCreationEnabled || index != 1) && sender == this->m_raceViews[index]) { return 0; } } int messageId; if (this->m_nameEdit->Length() < 4) { messageId = 0x15; } else if (_mbsstr(reinterpret_cast(this->m_nameEdit->Text()), reinterpret_cast("")) != nullptr || _mbsstr(reinterpret_cast(this->m_nameEdit->Text()), reinterpret_cast("")) != nullptr) { messageId = 0xAFC; } else { int valid = 1; if (g_serviceType == 1) { valid = ValidateCharacterName(this->m_nameEdit->Text()); } int allowed = g_forbiddenWords.Allows(this->m_nameEdit->Text()); bool hasControlCharacter = g_session.HasControlCharacter(this->m_nameEdit->Text()); int blank = g_session.IsBlankString(this->m_nameEdit->Text()); if (!hasControlCharacter && allowed == 1 && valid == 1 && blank == 0) { if (this->m_nameEdit->Length() >= 24) { reinterpret_cast(&g_windowMgr)->Confirm(LookupMessage(0x213), 0, true, false, 0, "Message", 280, 120, 0); this->m_nameEdit->SetText(""); return 0; } char name[24] = {}; strcpy(name, this->m_nameEdit->Text()); memcpy(this->m_name, name, sizeof(this->m_name)); memcpy_s(&g_charInfo, sizeof(g_charInfo), this->unknown_0210, sizeof(g_charInfo)); if (strstr(g_charInfo.name, "\xB1\xD7\xB6\xF3\xBA\xF1\xC6\xBC") != nullptr) { return 0; } _strlwr(name); if (strstr(name, "gravity") != nullptr) { return 0; } if ((name[0] == '[' && name[1] == 'g' && name[2] == 'm') || (name[1] == '[' && name[2] == 'g' && name[3] == 'm') || (name[2] == '[' && name[3] == 'g' && name[4] == 'm')) { return 0; } static_cast(g_charViewMode)->SendMsg(0x2715, 0, 0, 0, 0); g_windowMgr.Schedule(this); } else { if (hasControlCharacter || allowed == 0) { reinterpret_cast(&g_windowMgr)->Confirm(LookupMessage(0x14), 0, true, false, 0, "Message", 280, 120, 0); } if (valid == 0) { reinterpret_cast(&g_windowMgr)->Confirm(LookupMessage(0xBE), 0, true, false, 0, "Message", 280, 120, 0); } if (blank == 1) { reinterpret_cast(&g_windowMgr)->Confirm(LookupMessage(199), 0, true, false, 0, "Message", 280, 120, 0); } } CMode* mode = static_cast(g_charViewMode); mode->SendMsg(0x271F, reinterpret_cast(this->m_nameEdit->Text()), 0, 0, 0); int payload[8]; payload[0] = this->m_stats[0]; payload[1] = this->m_stats[1]; payload[2] = this->m_stats[2]; payload[3] = this->m_stats[3]; payload[4] = this->m_stats[4]; payload[5] = this->m_stats[5]; payload[6] = this->m_headPalette; payload[7] = this->m_head; mode->SendMsg(0x2721, reinterpret_cast(payload), 0, 0, 0); return 0; } reinterpret_cast(&g_windowMgr)->Confirm(LookupMessage(messageId), 0, true, false, 0, "Message", 280, 120, 0); return 0; } case 0xB9: g_windowMgr.Schedule(this); static_cast(g_charViewMode)->SendMsg(0, 0x2714, 0, 0, 0); return 0; case 0xCC: if (g_doramCreationEnabled || sender != this->m_raceViews[1]) { for (int index = 0; index < 2; ++index) { if (sender == this->m_raceViews[index]) { this->m_race = index; this->m_raceViews[index]->SendMsg(this, 13, 1, 0, 0, 0); } else { this->m_raceViews[index]->SendMsg(this, 13, 0, 0, 0, 0); } this->m_raceViews[index]->Invalidate(); } if (sender == this->m_raceViews[this->m_race]) { this->m_head = 1; for (int index = 0; index < 24; ++index) { this->m_hairStyleButtons[index]->SendMsg(this, 13, index == 0, 0, 0, 0); this->m_hairStyleButtons[index]->m_race = this->m_race; this->m_hairStyleButtons[index]->SendMsg(nullptr, 0x28, 0, 0, 0, 0); } if (this->m_race == 0) { this->m_job = 0; } else if (this->m_race == 1) { this->m_job = 0x107A; } this->sub_7DBFD0(); } } return 0; case 0xD7: if (argument2 == 0x1EF) { for (int index = 0; index < 9; ++index) { if (sender == this->m_hairColorButtons[index]) { this->m_hairColorButtons[index]->SendMsg(this, 13, 1, 0, 0, 0); this->m_headPalette = static_cast(index); if (this->m_headPalette < 0) { this->m_headPalette = 8; } this->sub_7DBFD0(); } else { this->m_hairColorButtons[index]->SendMsg(this, 13, 0, 0, 0, 0); } } } return 0; case 0xE2: if (argument2 == 0) { --this->m_action; if (this->m_action < this->unknown_01FC) { this->m_action = this->unknown_01FC + 7; } this->Invalidate(); } return 0; case 0xE3: if (argument2 == 0) { ++this->m_action; if (this->m_action >= this->unknown_01FC + 8) { this->m_action = this->unknown_01FC; } this->Invalidate(); } return 0; case 0x20C: for (int index = 0; index < 24; ++index) { if (sender == this->m_hairStyleButtons[index]) { if (index >= (g_session.IsDoramJob(this->m_job) == true ? 6 : 0x17)) { return 0; } this->m_hairStyleButtons[index]->SendMsg(this, 13, 1, 0, 0, 0); this->m_head = static_cast(index + 1); if (this->m_head < 0) { this->m_head = 0; } this->sub_7DBFD0(); } else { this->m_hairStyleButtons[index]->SendMsg(this, 13, 0, 0, 0, 0); } } return 0; case 0x20D: for (int index = 0; index < 2; ++index) { if (sender == this->m_genderButtons[index]) { if (index == this->m_sex) { return 0; } this->m_sex = static_cast(index); if (index == 1) { this->m_genderButtons[1]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_male_on.bmp", 0, 0); } else if (index == 0) { this->m_genderButtons[0]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_female_on.bmp", 0, 0); } } else if (index == 1) { this->m_genderButtons[index]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_male_off.bmp", 0, 0); } else if (this->m_sex == 0) { this->m_genderButtons[index]->SetBitmap("유저인터페이스\\make_character_ver2\\bt_female_off.bmp", 0, 0); } this->m_genderButtons[index]->Invalidate(); } for (int index = 0; index < 24; ++index) { this->m_hairStyleButtons[index]->m_sex = this->m_sex; this->m_hairStyleButtons[index]->SendMsg(nullptr, 0x28, 0, 0, 0, 0); } this->sub_7DBFD0(); return 0; } return 0; }