Maintenance: [forced, user-approved] Family D2: remove fabricated ItemNaming / ItemNamingContext reference structs; their methods are

Batch #10201 by ragnarok-clanker: forced by an admin (14 lower score(s), 95 changed function(s)); checked with 256 compiled unit(s), including every includer of Source/Contents/Items/ItemInfo.h, Source/Contents/Items/ItemNaming.h, Source/UI/Shortcuts/ShortcutTooltip.h, Source/UI/Shortcuts/ShortcutUse.h, Source/UI/Text/ItemLinkDisplay.h, Source/UI/Text/UITextViewer.h, Source/UI/UIBasicCtrl.h.
This commit is contained in:
ragnarok-clanker 2026-11-02 22:03:09 +00:00
commit ae35da0248
40 changed files with 244 additions and 544 deletions

View file

@ -1091,11 +1091,7 @@ void CGameMode::ReceivePartyItemPickup(const unsigned char* data) {
item.unknown_0060 = packet->refine;
item.unknown_0088 = packet->grade;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::string name = naming.DisplayName(item, 0);
std::string name = item.DisplayName(0);
g_windowMgr.SendNotice(1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1276), member.name.c_str(), name.c_str()).c_str()), 0xFFFF00, 9, 0, 0);
}
}
@ -1496,54 +1492,49 @@ void CGameMode::ReceiveItemEffectResult(const unsigned char* data) {
item.identified = 1;
std::string text;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
switch (packet->type) {
case 0:
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(154, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(431), naming.DisplayName(item, 0).c_str()));
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(431), item.DisplayName(0).c_str()));
break;
case 1:
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(155, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(430), naming.DisplayName(item, 0).c_str()));
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(430), item.DisplayName(0).c_str()));
break;
case 2:
if (static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->state.Attachments().HasId(305)) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->SendMsg(nullptr, 109, 0, 305, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(305, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = FormatOwnedString(LookupMessage(431), naming.DisplayName(item, 0).c_str()).c_str();
text = FormatOwnedString(LookupMessage(431), item.DisplayName(0).c_str()).c_str();
break;
case 3:
if (static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->state.Attachments().HasId(306)) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->SendMsg(nullptr, 109, 0, 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(306, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = FormatOwnedString(LookupMessage(430), naming.DisplayName(item, 0).c_str()).c_str();
text = FormatOwnedString(LookupMessage(430), item.DisplayName(0).c_str()).c_str();
break;
case 4:
if (static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->state.Attachments().HasId(1015)) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->SendMsg(nullptr, 109, 0, 1015, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(1015, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = FormatOwnedString(LookupMessage(431), naming.DisplayName(item, 0).c_str()).c_str();
text = FormatOwnedString(LookupMessage(431), item.DisplayName(0).c_str()).c_str();
break;
case 5:
if (static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->state.Attachments().HasId(1016)) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->SendMsg(nullptr, 109, 0, 1016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(1016, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = FormatOwnedString(LookupMessage(430), naming.DisplayName(item, 0).c_str()).c_str();
text = FormatOwnedString(LookupMessage(430), item.DisplayName(0).c_str()).c_str();
break;
case 6: {
if (static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->state.Attachments().HasId(1017)) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->SendMsg(nullptr, 109, 0, 1017, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(1017, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = FormatOwnedString(LookupMessage(430), naming.DisplayName(item, 0).c_str()).c_str();
text = FormatOwnedString(LookupMessage(430), item.DisplayName(0).c_str()).c_str();
UIWindow* window = g_windowMgr.LookupWindow(344);
if (window) {
window->SendMsg(nullptr, 6, 415, 0, 0, 0);
@ -1555,7 +1546,7 @@ void CGameMode::ReceiveItemEffectResult(const unsigned char* data) {
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->SendMsg(nullptr, 109, 0, 1018, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->player->LaunchEffect(1018, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
text = FormatOwnedString(LookupMessage(430), naming.DisplayName(item, 0).c_str()).c_str();
text = FormatOwnedString(LookupMessage(430), item.DisplayName(0).c_str()).c_str();
UIWindow* window = g_windowMgr.LookupWindow(344);
if (window) {
window->SendMsg(nullptr, 6, 415, 0, 0, 0);
@ -5200,11 +5191,7 @@ void CGameMode::ReceiveRefineStatus(const char* playerName, int itemId, unsigned
item.SetItemId(itemId);
item.identified = 1;
{
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
itemName = naming.DisplayName(item, 0);
itemName = item.DisplayName(0);
}
std::string text = FormatOwnedString(LookupMessage(!success + 3271), name.c_str(), refine, itemName.c_str());
@ -5227,11 +5214,7 @@ void CGameMode::ReceiveGradeEnchantBroadcast(const unsigned char* data) {
item.SetItemId(packet->itemId);
item.identified = 1;
{
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
itemName = naming.DisplayName(item, 0);
itemName = item.DisplayName(0);
}
std::string grade;

View file

@ -1135,12 +1135,8 @@ void CGameMode::ReceiveRandomUpgradeSimulation(const unsigned char* packet) {
result.SetItemId(record->resultItemId);
result.identified = 1;
result.unknown_0000[0] = 0x15;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::fprintf(file, "\t\t%s\t%s\t%d\t\t%.5f%%\n", ToUtf8(naming.DisplayName(item, 0), g_textCodePage).c_str(),
ToUtf8(naming.DisplayName(result, 0), g_textCodePage).c_str(), record->count, static_cast<float>(record->rate) / 1000.0f);
std::fprintf(file, "\t\t%s\t%s\t%d\t\t%.5f%%\n", ToUtf8(item.DisplayName(0), g_textCodePage).c_str(),
ToUtf8(result.DisplayName(0), g_textCodePage).c_str(), record->count, static_cast<float>(record->rate) / 1000.0f);
total += record->count;
++record;
}
@ -1174,11 +1170,7 @@ void CGameMode::ReceiveEnchantSimulation(const unsigned char* packet) {
item.SetItemId(record->itemId);
item.identified = 1;
item.unknown_0000[0] = 6;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::fprintf(file, "\t\t%s\t%d\t%.5f%%\n", ToUtf8(naming.DisplayName(item, 0), g_textCodePage).c_str(), record->count,
std::fprintf(file, "\t\t%s\t%d\t%.5f%%\n", ToUtf8(item.DisplayName(0), g_textCodePage).c_str(), record->count,
static_cast<float>(record->rate) / 1000.0f);
total += record->count;
++record;
@ -1230,11 +1222,7 @@ void CGameMode::ReceivePackageSimulation(const unsigned char* packet) {
if (package->refine != 0 || package->unknown_0006 != 0) {
item.unknown_0000[0] = 0x15;
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::fprintf(file, "\t%-24s\t\t\t\t\t\t\t%d\t(%d)\t%d/%d\t%s\n", ToUtf8(naming.DisplayName(item, 0), g_textCodePage).c_str(), package->count,
std::fprintf(file, "\t%-24s\t\t\t\t\t\t\t%d\t(%d)\t%d/%d\t%s\n", ToUtf8(item.DisplayName(0), g_textCodePage).c_str(), package->count,
package->unknown_000A, package->unknown_0026, package->unknown_002A, ToUtf8(std::string(package->text), g_textCodePage).c_str());
unpacked += package->count;
}
@ -1911,12 +1899,8 @@ void __stdcall sub_D08110(int field8, int itemIdWord, int quantityWord, int fiel
window->SendMsg(nullptr, 0x17, reinterpret_cast<std::intptr_t>(&item), field18, field8, 0);
reinterpret_cast<ClientItemLists*>(&g_session)->RemoveItem1758(item);
g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(0xE7), naming.DisplayName(item, 0).c_str(), quantity).c_str()), 0xFFFF64, 0, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(0xE7), item.DisplayName(0).c_str(), quantity).c_str()), 0xFFFF64, 0, 0, 0
);
if (g_vendingOpenWindow != nullptr) {
g_vendingOpenWindow->SendMsg(nullptr, 0x17, 0, 0, 0, 0);
@ -6912,13 +6896,9 @@ void CGameMode::ReceiveItemSellResult(const unsigned char* packet) {
const int count = *reinterpret_cast<const std::int16_t*>(packet + 4);
const int price = *reinterpret_cast<const int*>(packet + 6);
ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, *reinterpret_cast<const std::int16_t*>(packet + 2));
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
g_windowMgr.SendNotice(
1,
reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1746), naming.DisplayName(item, 0).c_str(), count, price * count).c_str()),
reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1746), item.DisplayName(0).c_str(), count, price * count).c_str()),
0xFFFF64, 0, 0, 0
);
reinterpret_cast<ClientItemLists*>(&g_session)->RemoveItem1710(
@ -7069,29 +7049,25 @@ void CGameMode::ReceiveItemObtainNotice(const unsigned char* packet) {
item.SetItemId(*reinterpret_cast<const int*>(packet + 6));
item.unknown_0060 = 0;
item.identified = 1;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
switch (*reinterpret_cast<const int*>(packet + 2)) {
case 0:
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(911), naming.DisplayName(item, 0).c_str()).c_str()), 0xFFFF00, 0, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(911), item.DisplayName(0).c_str()).c_str()), 0xFFFF00, 0, 0, 0
);
break;
case 1:
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(912), naming.DisplayName(item, 0).c_str()).c_str()), 0xCDCD00, 0, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(912), item.DisplayName(0).c_str()).c_str()), 0xCDCD00, 0, 0, 0
);
break;
case 2:
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(913), naming.DisplayName(item, 0).c_str()).c_str()), 0xC8C8FF, 0, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(913), item.DisplayName(0).c_str()).c_str()), 0xC8C8FF, 0, 0, 0
);
break;
case 3:
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(914), naming.DisplayName(item, 0).c_str()).c_str()), 0xC8C8FF, 0, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(914), item.DisplayName(0).c_str()).c_str()), 0xC8C8FF, 0, 0, 0
);
break;
}
@ -7109,13 +7085,9 @@ void CGameMode::ReceiveTakeOffEquipItemResult(const unsigned char* packet) {
} else {
g_session.UnequipItem61B8(item);
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const char* suffix = LookupMessage(3144);
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString("%s%s", naming.DisplayName(item, 0).c_str(), suffix).c_str()), 0xC8FF00, 7, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString("%s%s", item.DisplayName(0).c_str(), suffix).c_str()), 0xC8FF00, 7, 0, 0
);
break;
}
@ -7141,12 +7113,8 @@ void CGameMode::ReceiveBuyingStoreSellResult(const unsigned char* packet) {
case 6: {
g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0);
ITEM_INFO item = LookupClientItem(g_session.m_inventoryItems, *reinterpret_cast<const int*>(packet + 4), 0);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1747), naming.DisplayName(item, 0).c_str()).c_str()), 0xFF, 0, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1747), item.DisplayName(0).c_str()).c_str()), 0xFF, 0, 0, 0
);
break;
}
@ -7266,12 +7234,8 @@ void CGameMode::ReceivePartyItemPickupNotice(const unsigned char* packet) {
item.unknown_005D = packet[0x0B];
item.unknown_0060 = packet[0x0C];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1276), member.name.c_str(), naming.DisplayName(item, 0).c_str()).c_str()),
1, reinterpret_cast<std::intptr_t>(FormatOwnedString(LookupMessage(1276), member.name.c_str(), item.DisplayName(0).c_str()).c_str()),
0xFFFF00, 9, 0, 0
);
}
@ -9439,11 +9403,7 @@ void CGameMode::ReceiveSkillFailure(const unsigned char* data) {
case 71: {
ITEM_INFO item;
item.SetItemId(packet->itemId);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const std::string message = FormatOwnedString(LookupMessage(0x600), naming.DisplayName(item, 0).c_str(), packet->value);
const std::string message = FormatOwnedString(LookupMessage(0x600), item.DisplayName(0).c_str(), packet->value);
g_windowMgr.SendNotice(1, reinterpret_cast<std::intptr_t>(message.c_str()), 0xFF, 0xB, 0, 0);
return;
}
@ -9451,11 +9411,7 @@ void CGameMode::ReceiveSkillFailure(const unsigned char* data) {
ITEM_INFO item;
item.SetItemId(packet->itemId);
item.identified = 1;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const std::string message = FormatOwnedString(LookupMessage(0x602), naming.DisplayName(item, 0).c_str());
const std::string message = FormatOwnedString(LookupMessage(0x602), item.DisplayName(0).c_str());
g_windowMgr.SendNotice(1, reinterpret_cast<std::intptr_t>(message.c_str()), 0xFF, 0xB, 0, 0);
return;
}
@ -11775,13 +11731,9 @@ void CGameMode::ReceiveEquipItemResult(const unsigned char* packet) {
g_session.EquipItem61B8(item);
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const char* suffix = LookupMessage(3143);
g_windowMgr.SendNotice(
1, reinterpret_cast<std::intptr_t>(FormatOwnedString("%s%s", naming.DisplayName(item, 0).c_str(), suffix).c_str()), 0xC8FF00, 7, 0, 0
1, reinterpret_cast<std::intptr_t>(FormatOwnedString("%s%s", item.DisplayName(0).c_str(), suffix).c_str()), 0xC8FF00, 7, 0, 0
);
}

View file

@ -258,11 +258,7 @@ void CSession::UnequipItem61B8(const ITEM_INFO& item) {
ITEM_INFO equipped = g_session.FindItemByIdentity(item.unknown_0000[1], location);
if (equipped.unknown_0000[1] != 0) {
const char* message = LookupMessage(0xAB);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const std::string name = naming.DisplayName(equipped, 0);
const std::string name = equipped.DisplayName(0);
const std::string text = FormatOwnedString("%s%s", name.c_str(), message);
g_windowMgr.SendNotice(1, reinterpret_cast<std::intptr_t>(text.c_str()), 0xFF, 7, 0, 0);
}

View file

@ -167,10 +167,7 @@ void CItem::SendMsg(CGameObject* sender, int message, int a, int b, int c, int d
item.itemId = itemName;
item.identified = entry->identified;
item.unknown_0060 = 0;
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->name = static_cast<const std::string&>(FormatOwnedString(LookupMessage(183), naming.DisplayName(item, 0).c_str(), entry->count));
this->name = static_cast<const std::string&>(FormatOwnedString(LookupMessage(183), item.DisplayName(0).c_str(), entry->count));
this->GetActRes();
this->render.unknown_008C = timeGetTime();

View file

@ -71,6 +71,15 @@ struct alignas(8) ITEM_INFO {
bool operator<(const ITEM_INFO& other) const;
bool SetName(const char* name);
std::string DisplayName(unsigned char detailed) const;
bool HasCards() const;
int Grade(char* output, int& capacity, unsigned char consume) const;
int Creator(char* output, int& capacity, unsigned char consume) const;
int Prefixes(char* output, int& capacity, unsigned char consume) const;
int Suffixes(char* output, int& capacity, unsigned char consume) const;
int Slots(char* output, int& capacity, unsigned char consume) const;
int Element(char* output, int& capacity, unsigned char consume) const;
int Star(char* output, int& capacity, unsigned char consume) const;
int Apprentice(char* output, int& capacity, unsigned char consume) const;
void SetItemId(int value);
void SetOption(ItemOption option, const int& index);
void SetCard(const int& card, const int& index);

View file

@ -1,6 +1,7 @@
#include "Client/Replay.h"
#include "Contents/Items/ItemInfo.h"
#include "Contents/Items/ItemNaming.h"
#include "Contents/Configuration/ServiceConfiguration.h"
#include "Utility/Text/FormatString.h"
#include "Contents/MessageTable.h"
#include "Contents/PlayerNameDictionary.h"
@ -54,30 +55,25 @@ namespace {
}
}
// INLINED
const char* ItemNaming::Message(int id) const {
return LookupMessage(id);
}
// OFFSET: 0x006D77E0
// FUNCTION: fn_06595
bool ItemNaming::HasCards(const ITEM_INFO& item) const {
bool ITEM_INFO::HasCards() const {
int ids[4];
CardIds(item, ids);
const bool first = this->cards.contains(ids[0]);
const unsigned id = static_cast<unsigned>(std::atoi(item.itemId.c_str()));
CardIds(*this, ids);
const bool first = g_itemCardNames.contains(ids[0]);
const unsigned id = static_cast<unsigned>(std::atoi(this->itemId.c_str()));
if (id - 9001u <= 498 || id - 10000u <= 999 || ids[0] == 254 || ids[0] == 255 || !Equipment(item)) {
if (id - 9001u <= 498 || id - 10000u <= 999 || ids[0] == 254 || ids[0] == 255 || !Equipment(*this)) {
return first;
}
return first || this->cards.contains(ids[1]) || this->cards.contains(ids[2]) || this->cards.contains(ids[3]);
return first || g_itemCardNames.contains(ids[1]) || g_itemCardNames.contains(ids[2]) || g_itemCardNames.contains(ids[3]);
}
// OFFSET: 0x006D5780
// FUNCTION: fn_06577
int ItemNaming::Grade(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const {
const char grade[2] = {item.unknown_0088 >= 1 && item.unknown_0088 <= 4 ? "DCBA"[item.unknown_0088 - 1] : '\0', '\0'};
int ITEM_INFO::Grade(char* output, int& capacity, unsigned char consume) const {
const char grade[2] = {this->unknown_0088 >= 1 && this->unknown_0088 <= 4 ? "DCBA"[this->unknown_0088 - 1] : '\0', '\0'};
const int bytes = _snprintf_s(output, capacity, _TRUNCATE, "[%s] ", grade);
if (bytes <= 0) {
return 0;
@ -92,13 +88,13 @@ int ItemNaming::Grade(const ITEM_INFO& item, char* output, int& capacity, unsign
// OFFSET: 0x006D6C10
// FUNCTION: fn_06585
int ItemNaming::Creator(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) {
int ITEM_INFO::Creator(char* output, int& capacity, unsigned char consume) const {
int ids[4];
CardIds(item, ids);
std::string name = this->players.Lookup(static_cast<unsigned>(ids[2]) + (static_cast<unsigned>(ids[3]) << 16));
CardIds(*this, ids);
std::string name = g_playerNameDictionary->Lookup(static_cast<unsigned>(ids[2]) + (static_cast<unsigned>(ids[3]) << 16));
if (name.empty()) {
name = this->Message(581);
name = LookupMessage(581);
}
const int bytes = Copy(output, capacity, name.c_str());
@ -111,9 +107,9 @@ int ItemNaming::Creator(const ITEM_INFO& item, char* output, int& capacity, unsi
// OFFSET: 0x006D6F50
// FUNCTION: fn_06588
int ItemNaming::Prefixes(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const {
int ITEM_INFO::Prefixes(char* output, int& capacity, unsigned char consume) const {
int ids[4];
CardIds(item, ids);
CardIds(*this, ids);
int remaining = capacity;
char* cursor = output;
@ -122,8 +118,8 @@ int ItemNaming::Prefixes(const ITEM_INFO& item, char* output, int& capacity, uns
continue;
}
const auto card = this->cards.find(ids[index]);
if (card == this->cards.end() || !card->second.prefix || !*card->second.prefix) {
const auto card = g_itemCardNames.find(ids[index]);
if (card == g_itemCardNames.end() || !card->second.prefix || !*card->second.prefix) {
continue;
}
@ -137,7 +133,7 @@ int ItemNaming::Prefixes(const ITEM_INFO& item, char* output, int& capacity, uns
}
if (count >= 2) {
const int bytes = _snprintf_s(cursor, remaining, _TRUNCATE, "%s ", this->Message(444 + count));
const int bytes = _snprintf_s(cursor, remaining, _TRUNCATE, "%s ", LookupMessage(444 + count));
if (bytes > 0) {
cursor += bytes;
remaining -= bytes;
@ -161,9 +157,9 @@ int ItemNaming::Prefixes(const ITEM_INFO& item, char* output, int& capacity, uns
// OFFSET: 0x006D6DB0
// FUNCTION: fn_06587
int ItemNaming::Suffixes(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const {
int ITEM_INFO::Suffixes(char* output, int& capacity, unsigned char consume) const {
int ids[4];
CardIds(item, ids);
CardIds(*this, ids);
int remaining = capacity;
char* cursor = output;
@ -172,8 +168,8 @@ int ItemNaming::Suffixes(const ITEM_INFO& item, char* output, int& capacity, uns
continue;
}
const auto card = this->cards.find(ids[index]);
if (card == this->cards.end() || !card->second.suffix || !*card->second.suffix) {
const auto card = g_itemCardNames.find(ids[index]);
if (card == g_itemCardNames.end() || !card->second.suffix || !*card->second.suffix) {
continue;
}
@ -193,7 +189,7 @@ int ItemNaming::Suffixes(const ITEM_INFO& item, char* output, int& capacity, uns
}
if (count >= 2) {
bytes = _snprintf_s(cursor, remaining, _TRUNCATE, " %s", this->Message(444 + count));
bytes = _snprintf_s(cursor, remaining, _TRUNCATE, " %s", LookupMessage(444 + count));
if (bytes > 0) {
cursor += bytes;
remaining -= bytes;
@ -211,8 +207,8 @@ int ItemNaming::Suffixes(const ITEM_INFO& item, char* output, int& capacity, uns
// OFFSET: 0x006D76E0
// FUNCTION: fn_06593
int ItemNaming::Slots(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) {
const int slots = this->descriptions.Find(std::atoi(item.itemId.c_str())).slots;
int ITEM_INFO::Slots(char* output, int& capacity, unsigned char consume) const {
const int slots = ItemDescriptions{g_itemDescriptions}.Find(std::atoi(this->itemId.c_str())).slots;
if (slots == 0) {
return 0;
}
@ -231,7 +227,7 @@ int ItemNaming::Slots(const ITEM_INFO& item, char* output, int& capacity, unsign
// OFFSET: 0x006D59A0
// FUNCTION: fn_06581
std::string ItemNaming::DisplayName(const ITEM_INFO& item, unsigned char detailed) {
std::string ITEM_INFO::DisplayName(unsigned char detailed) const {
char text[128] = {};
int capacity = 128;
std::string result;
@ -241,35 +237,35 @@ std::string ItemNaming::DisplayName(const ITEM_INFO& item, unsigned char detaile
result += text;
}
};
const int id = std::atoi(item.itemId.c_str());
ITEM_DESC& descriptor = this->descriptions.Find(id);
const int id = std::atoi(this->itemId.c_str());
ITEM_DESC& descriptor = ItemDescriptions{g_itemDescriptions}.Find(id);
if (item.identified != 1) {
if (this->identified != 1) {
append(Copy(text, capacity, descriptor.unidentifiedName));
return result;
}
int cards[4];
CardIds(item, cards);
CardIds(*this, cards);
if ((static_cast<unsigned>(id) - 9001u <= 498 || static_cast<unsigned>(id) - 10000u <= 999) && cards[3] == 1) {
append(Copy(text, capacity, this->Message(756)));
append(Copy(text, capacity, LookupMessage(756)));
append(Copy(text, capacity, descriptor.identifiedName));
return result;
}
const auto refine = [&]() {
const int value = item.unknown_0060;
const int value = this->unknown_0060;
if (value > 0) {
append(_snprintf_s(text, sizeof(text), _TRUNCATE, "+%d ", value));
}
if (item.unknown_0088 > 0) {
append(this->Grade(item, text, capacity, 0));
if (this->unknown_0088 > 0) {
append(this->Grade(text, capacity, 0));
}
};
const auto name = [&]() { append(Copy(text, capacity, descriptor.identifiedName)); };
const auto element = [&]() {
const unsigned value = item.unknown_001C[4];
const unsigned value = this->unknown_001C[4];
int message = 0;
switch (value) {
@ -291,13 +287,13 @@ std::string ItemNaming::DisplayName(const ITEM_INFO& item, unsigned char detaile
}
if (message) {
append(Copy(text, capacity, this->Message(message)));
append(Copy(text, capacity, LookupMessage(message)));
}
};
const auto star = [&]() {
int message = 0;
switch (item.unknown_001C[5]) {
switch (this->unknown_001C[5]) {
case 5:
message = 459;
break;
@ -310,59 +306,59 @@ std::string ItemNaming::DisplayName(const ITEM_INFO& item, unsigned char detaile
}
if (message) {
append(Copy(text, capacity, this->Message(message)));
append(Copy(text, capacity, LookupMessage(message)));
}
};
if (cards[0] == 254 && cards[1] == 0) {
refine();
if (this->service != 12 && this->service != 14) {
append(this->Creator(item, text, capacity, 0));
if (g_serviceType != 12 && g_serviceType != 14) {
append(this->Creator(text, capacity, 0));
element();
name();
} else {
name();
element();
append(this->Creator(item, text, capacity, 0));
append(this->Creator(text, capacity, 0));
}
return result;
}
if (!Equipment(item) && detailed == 0) {
if (!Equipment(*this) && detailed == 0) {
name();
return result;
}
refine();
if (this->HasCards(item)) {
append(this->Prefixes(item, text, capacity, 0));
if (this->HasCards()) {
append(this->Prefixes(text, capacity, 0));
name();
append(this->Suffixes(item, text, capacity, 0));
append(this->Slots(item, text, capacity, 0));
append(this->Suffixes(text, capacity, 0));
append(this->Slots(text, capacity, 0));
return result;
}
if (cards[0] != 254 && cards[0] != 255) {
name();
append(this->Slots(item, text, capacity, 0));
append(this->Slots(text, capacity, 0));
return result;
}
if (this->service == 12) {
if (g_serviceType == 12) {
name();
element();
star();
append(this->Creator(item, text, capacity, 0));
} else if (this->service == 14) {
append(this->Creator(text, capacity, 0));
} else if (g_serviceType == 14) {
star();
name();
element();
append(this->Creator(item, text, capacity, 0));
append(this->Creator(text, capacity, 0));
} else {
star();
append(this->Creator(item, text, capacity, 0));
append(this->Creator(text, capacity, 0));
element();
name();
}
@ -396,11 +392,7 @@ std::string ItemDisplayName(int id) {
ITEM_INFO item;
item.SetItemId(id);
item.identified = 1;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
return naming.DisplayName(item, 0);
return item.DisplayName(0);
}
// OFFSET: 0x006D69C0
@ -462,7 +454,7 @@ bool IsItemCard(int id) {
// FUNCTION: fn_06591
const char* ItemResourcePath(const ITEM_INFO& item) {
int id = std::atoi(item.itemId.c_str());
ITEM_DESC& desc = FindItemDescription(id);
ITEM_DESC& desc = ItemDescriptions{g_itemDescriptions}.Find(id);
return item.identified == 1 ? desc.identifiedResource : desc.unidentifiedResource;
}
@ -470,14 +462,14 @@ const char* ItemResourcePath(const ITEM_INFO& item) {
// FUNCTION: fn_06592
int ItemSlotsCount(const ITEM_INFO& item) {
int id = std::atoi(item.itemId.c_str());
return FindItemDescription(id).slots;
return ItemDescriptions{g_itemDescriptions}.Find(id).slots;
}
// OFFSET: 0x006D7760
// FUNCTION: fn_06594
int ItemUnidentifiedName(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) {
int id = std::atoi(item.itemId.c_str());
int written = Copy(output, capacity, FindItemDescription(id).unidentifiedName);
int written = Copy(output, capacity, ItemDescriptions{g_itemDescriptions}.Find(id).unidentifiedName);
if (written > 0 && consume) {
capacity -= written;
}
@ -830,7 +822,7 @@ std::uint32_t __fastcall ItemCardColor(const ITEM_INFO* item) {
}
const std::uint32_t colors[5] = {0, 0x00ADFF2F, 0x0000BFFF, 0x00FFA500, 0x009400D3};
const int slots = FindItemDescription(std::atoi(item->itemId.c_str())).slots;
const int slots = ItemDescriptions{g_itemDescriptions}.Find(std::atoi(item->itemId.c_str())).slots;
int count = 0;
for (int index = 0; index < 4; ++index) {
if (index >= slots && IsItemCard(ids[index])) {
@ -842,10 +834,10 @@ std::uint32_t __fastcall ItemCardColor(const ITEM_INFO* item) {
// OFFSET: 0x006D6AA0
// FUNCTION: fn_06583
int ItemNamingContext::Element(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const {
const unsigned value = item.unknown_001C[4];
int ITEM_INFO::Element(char* output, int& capacity, unsigned char consume) const {
const unsigned value = this->unknown_001C[4];
int message = 0;
int id = std::atoi(item.itemId.c_str());
int id = std::atoi(this->itemId.c_str());
switch (value) {
case 0:
@ -866,7 +858,7 @@ int ItemNamingContext::Element(const ITEM_INFO& item, char* output, int& capacit
}
if (message) {
const char* text = this->Message(message);
const char* text = LookupMessage(message);
const int error = strncpy_s(output, capacity, text ? text : " ", _TRUNCATE);
int written = (error == 0 || error == 80) && output ? static_cast<int>(strnlen(output, capacity)) : 0;
if (written > 0 && consume) {
@ -879,9 +871,9 @@ int ItemNamingContext::Element(const ITEM_INFO& item, char* output, int& capacit
// OFFSET: 0x006D6B90
// FUNCTION: fn_06584
int ItemNamingContext::Star(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const {
int ITEM_INFO::Star(char* output, int& capacity, unsigned char consume) const {
int message = 0;
switch (item.unknown_001C[5]) {
switch (this->unknown_001C[5]) {
case 5:
message = 459;
break;
@ -894,7 +886,7 @@ int ItemNamingContext::Star(const ITEM_INFO& item, char* output, int& capacity,
}
if (message) {
const char* text = this->Message(message);
const char* text = LookupMessage(message);
const int error = strncpy_s(output, capacity, text ? text : " ", _TRUNCATE);
int written = (error == 0 || error == 80) && output ? static_cast<int>(strnlen(output, capacity)) : 0;
if (written > 0 && consume) {
@ -907,8 +899,8 @@ int ItemNamingContext::Star(const ITEM_INFO& item, char* output, int& capacity,
// OFFSET: 0x006D6D50
// FUNCTION: fn_06586
int ItemNamingContext::Apprentice(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const {
const char* text = this->Message(756);
int ITEM_INFO::Apprentice(char* output, int& capacity, unsigned char consume) const {
const char* text = LookupMessage(756);
const int error = strncpy_s(output, capacity, text ? text : " ", _TRUNCATE);
int written = (error == 0 || error == 80) && output ? static_cast<int>(strnlen(output, capacity)) : 0;
if (written > 0 && consume) {

View file

@ -8,7 +8,6 @@
#include <string>
#include <windows.h>
class CPlayerNameDictionary;
struct ITEM_INFO;
struct ItemCardName {
@ -29,30 +28,6 @@ struct ItemMoveInfo {
/* 000B */ bool guildStorage;
};
struct ItemNaming {
ItemDescriptions& descriptions;
const std::map<int, ItemCardName>& cards;
CPlayerNameDictionary& players;
const bool& languagePrefix;
const int& service;
const WORD& language;
std::string DisplayName(const ITEM_INFO& item, unsigned char detailed);
bool HasCards(const ITEM_INFO& item) const;
int Grade(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const;
int Creator(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume);
int Prefixes(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const;
int Suffixes(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const;
int Slots(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume);
const char* Message(int id) const;
};
struct ItemNamingContext : public ItemNaming {
int Element(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const;
int Star(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const;
int Apprentice(const ITEM_INFO& item, char* output, int& capacity, unsigned char consume) const;
};
extern std::map<int, ItemCardName> g_itemCardNames;
extern std::map<int, ItemMoveInfo> g_itemMoveInfo;

View file

@ -2012,11 +2012,7 @@ void UIItemCollectionWnd::Slot28(int x, int y) {
color = ItemCardColor(&this->m_item);
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
tooltip->Show(naming.DisplayName(card, 0).c_str(), slotX, slotY, color, 0, 1);
tooltip->Show(card.DisplayName(0).c_str(), slotX, slotY, color, 0, 1);
}
// OFFSET: 0x008F46C0
@ -2379,12 +2375,7 @@ void UINpcTextEditDialogWnd::InsertItemTag(const ITEM_INFO& item) {
}
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (!this->m_tagCtrl->CanInsertTag(naming.DisplayName(item, 0), this->edit->geometry.width)) {
if (!this->m_tagCtrl->CanInsertTag(item.DisplayName(0), this->edit->geometry.width)) {
return;
}
@ -2392,7 +2383,7 @@ void UINpcTextEditDialogWnd::InsertItemTag(const ITEM_INFO& item) {
std::string text = this->edit->Text();
this->m_tagCtrl->taggedText = text;
}
this->edit->SetText(this->m_tagCtrl->AppendTag(naming.DisplayName(item, 0)).c_str());
this->edit->SetText(this->m_tagCtrl->AppendTag(item.DisplayName(0)).c_str());
this->edit->MoveCursorToEnd();
this->m_tagCtrl->sub_89CFE0(item, 0x12B8A4);
}
@ -9557,9 +9548,6 @@ int UIFrameWnd::BuildItemName(
int& capacity = reinterpret_cast<int&>(*remaining);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNamingContext naming{{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language}};
const auto unknownCreator = [&]() {
this->m_context->registration.Add(this);
@ -9597,7 +9585,7 @@ int UIFrameWnd::BuildItemName(
int cards[4];
std::memcpy(cards, item->unknown_001C, sizeof(cards));
if (item->unknown_0000[0] == 4 && item->IsApprenticeItem() == true && cards[3] == 1) {
*cursor += naming.Apprentice(*item, *cursor, capacity, 1);
*cursor += item->Apprentice(*cursor, capacity, 1);
breaks->push_back(*cursor);
}
@ -9607,16 +9595,16 @@ int UIFrameWnd::BuildItemName(
breaks->push_back(*cursor);
}
if (item->unknown_0088 > 0) {
*cursor += naming.Grade(*item, *cursor, capacity, 1);
*cursor += item->Grade(*cursor, capacity, 1);
breaks->push_back(*cursor);
}
if (g_serviceType == 12 || g_serviceType == 14) {
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += naming.Element(*item, *cursor, capacity, 1);
*cursor += item->Element(*cursor, capacity, 1);
breaks->push_back(*cursor);
const int bytes = naming.Creator(*item, *cursor, capacity, 1);
const int bytes = item->Creator(*cursor, capacity, 1);
if (bytes) {
*creator = *cursor;
*cursor += bytes;
@ -9629,7 +9617,7 @@ int UIFrameWnd::BuildItemName(
return 1;
}
const int bytes = naming.Creator(*item, *cursor, capacity, 1);
const int bytes = item->Creator(*cursor, capacity, 1);
if (bytes) {
*creator = *cursor;
*cursor += bytes;
@ -9643,7 +9631,7 @@ int UIFrameWnd::BuildItemName(
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
if (withSlots == 1) {
*cursor += naming.Slots(*item, *cursor, capacity, 1);
*cursor += item->Slots(*cursor, capacity, 1);
breaks->push_back(*cursor);
}
return 1;
@ -9654,19 +9642,19 @@ int UIFrameWnd::BuildItemName(
breaks->push_back(*cursor);
}
if (item->unknown_0088 > 0) {
*cursor += naming.Grade(*item, *cursor, capacity, 1);
*cursor += item->Grade(*cursor, capacity, 1);
breaks->push_back(*cursor);
}
if (naming.HasCards(*item)) {
*cursor += naming.Prefixes(*item, *cursor, capacity, 1);
if (item->HasCards()) {
*cursor += item->Prefixes(*cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += naming.Suffixes(*item, *cursor, capacity, 1);
*cursor += item->Suffixes(*cursor, capacity, 1);
breaks->push_back(*cursor);
if (withSlots == 1) {
*cursor += naming.Slots(*item, *cursor, capacity, 1);
*cursor += item->Slots(*cursor, capacity, 1);
breaks->push_back(*cursor);
}
return 1;
@ -9676,7 +9664,7 @@ int UIFrameWnd::BuildItemName(
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
if (withSlots == 1) {
*cursor += naming.Slots(*item, *cursor, capacity, 1);
*cursor += item->Slots(*cursor, capacity, 1);
breaks->push_back(*cursor);
}
return 1;
@ -9686,19 +9674,19 @@ int UIFrameWnd::BuildItemName(
if (g_serviceType == 12) {
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += naming.Element(*item, *cursor, capacity, 1);
*cursor += item->Element(*cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += naming.Star(*item, *cursor, capacity, 1);
*cursor += item->Star(*cursor, capacity, 1);
} else {
*cursor += naming.Star(*item, *cursor, capacity, 1);
*cursor += item->Star(*cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += naming.Element(*item, *cursor, capacity, 1);
*cursor += item->Element(*cursor, capacity, 1);
}
breaks->push_back(*cursor);
*creator = *cursor;
const int bytes = naming.Creator(*item, *cursor, capacity, 1);
const int bytes = item->Creator(*cursor, capacity, 1);
if (bytes) {
*creator = *cursor;
*cursor += bytes;
@ -9714,10 +9702,10 @@ int UIFrameWnd::BuildItemName(
return 1;
}
*cursor += naming.Star(*item, *cursor, capacity, 1);
*cursor += item->Star(*cursor, capacity, 1);
breaks->push_back(*cursor);
*creator = *cursor;
const int bytes = naming.Creator(*item, *cursor, capacity, 1);
const int bytes = item->Creator(*cursor, capacity, 1);
if (bytes) {
*creator = *cursor;
*cursor += bytes;
@ -9727,7 +9715,7 @@ int UIFrameWnd::BuildItemName(
}
breaks->push_back(*cursor);
if (!splitCreator) {
*cursor += naming.Element(*item, *cursor, capacity, 1);
*cursor += item->Element(*cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);
@ -9736,7 +9724,7 @@ int UIFrameWnd::BuildItemName(
}
breaks->push_back(*cursor);
*cursor += naming.Element(*item, *cursor, capacity, 1);
*cursor += item->Element(*cursor, capacity, 1);
breaks->push_back(*cursor);
*cursor += descriptions.Name(*item, *cursor, capacity, 1);
breaks->push_back(*cursor);

View file

@ -511,11 +511,11 @@ void UIBasicItemCtrl::Slot28(int, int) {
if (std::atoi(this->m_item.itemId.c_str()) < 1) {
text = this->m_tooltip;
} else if (this->m_item.unknown_0000[1] == 0) {
text = this->m_naming->DisplayName(this->m_item, 0);
text = this->m_item.DisplayName(0);
} else if (this->m_item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2551), this->m_naming->DisplayName(this->m_item, 0).c_str(), this->m_item.unknown_0098, this->m_item.quantity);
text = FormatOwnedString(LookupMessage(2551), this->m_item.DisplayName(0).c_str(), this->m_item.unknown_0098, this->m_item.quantity);
} else {
text = FormatOwnedString(LookupMessage(183), this->m_naming->DisplayName(this->m_item, 0).c_str(), this->m_item.quantity);
text = FormatOwnedString(LookupMessage(183), this->m_item.DisplayName(0).c_str(), this->m_item.quantity);
}
int screenX = 0, screenY = 0;

View file

@ -1840,12 +1840,8 @@ void UIItemWnd::Slot26(int x, int y) {
break;
case 18:
if (*reinterpret_cast<const int*>(&g_session.unknown_16F4[4]) >= 0) {
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (reinterpret_cast<WindowDialogs*>(&g_windowMgr)
->Confirm(FormatOwnedString(LookupMessage(1226), naming.DisplayName(item, 0).c_str()).c_str(), 2, false, false, 0, "Message", 280, 120, 0) == 187) {
->Confirm(FormatOwnedString(LookupMessage(1226), item.DisplayName(0).c_str()).c_str(), 2, false, false, 0, "Message", 280, 120, 0) == 187) {
mode->SendMsg(27, static_cast<int>(item.unknown_0000[1]), 0, 0, 0);
}
}
@ -2662,11 +2658,7 @@ bool ItemTypeNameLess::operator()(const ITEM_INFO& left, const ITEM_INFO& right)
return leftRank < rightRank;
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
return naming.DisplayName(left, 0) < naming.DisplayName(right, 0);
return left.DisplayName(0) < right.DisplayName(0);
}
extern "C" void sub_96E320(void* head, size_t size, ...);
@ -5825,15 +5817,11 @@ void UIItemPurchaseWnd::Slot28(int x, int y) {
}
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.unknown_0014[0] != item.unknown_0014[1]) {
text = FormatOwnedString("%s %d %s %d -> %s %s", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
text = FormatOwnedString("%s %d %s %d -> %s %s", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
} else {
text = FormatOwnedString("%s %d %s %s %s", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588),
text = FormatOwnedString("%s %d %s %s %s", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
}
@ -5852,15 +5840,11 @@ void UIItemSellWnd2::Slot28(int x, int y) {
std::string text;
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.unknown_0014[0] != item.unknown_0014[1]) {
text = FormatOwnedString("%s %d %s %d -> %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
text = FormatOwnedString("%s %d %s %d -> %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
} else {
text = FormatOwnedString("%s %d %s %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588),
text = FormatOwnedString("%s %d %s %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
}
@ -5882,24 +5866,20 @@ void UIItemSellWnd::Slot28(int x, int y) {
std::string text;
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.unknown_0014[0] != item.unknown_0014[1]) {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2758), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
text = FormatOwnedString(LookupMessage(2758), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
item.unknown_0014[0], FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), "Zeny");
} else {
text = FormatOwnedString("%s %d %s %d -> %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
text = FormatOwnedString("%s %d %s %d -> %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
}
} else {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2759), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
text = FormatOwnedString(LookupMessage(2759), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), "Zeny");
} else {
text = FormatOwnedString("%s %d %s %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588),
text = FormatOwnedString("%s %d %s %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
}
}
@ -5921,23 +5901,19 @@ void UIItemShopWnd2::Slot28(int x, int y) {
std::string text;
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (this->unknown_00F8 == 0) {
if (item.unknown_0014[0] == item.unknown_0014[1]) {
text = FormatOwnedString("%s %s Zeny", naming.DisplayName(item, 0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
text = FormatOwnedString("%s %s Zeny", item.DisplayName(0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
} else {
text = FormatOwnedString("%s %d -> %s Zeny", naming.DisplayName(item, 0).c_str(), item.unknown_0014[0],
text = FormatOwnedString("%s %d -> %s Zeny", item.DisplayName(0).c_str(), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
}
} else {
if (item.unknown_0014[0] == item.unknown_0014[1]) {
text = FormatOwnedString("%s %d %s %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588),
text = FormatOwnedString("%s %d %s %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
} else {
text = FormatOwnedString("%s %d %s %d -> %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
text = FormatOwnedString("%s %d %s %d -> %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
}
}
@ -5972,43 +5948,39 @@ void UIItemShopWnd::Slot28(int x, int y) {
}
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (this->unknown_00F8) {
if (item.unknown_0014[0] != item.unknown_0014[1]) {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2758), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
text = FormatOwnedString(LookupMessage(2758), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
item.unknown_0014[0], FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
} else {
text = FormatOwnedString("%s %d %s %d -> %s %s", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
text = FormatOwnedString("%s %d %s %d -> %s %s", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
}
} else {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2759), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
text = FormatOwnedString(LookupMessage(2759), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
} else {
text = FormatOwnedString("%s %d %s %s %s", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588),
text = FormatOwnedString("%s %d %s %s %s", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
}
}
} else {
if (item.unknown_0014[0] != item.unknown_0014[1]) {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2760), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.unknown_0014[0],
text = FormatOwnedString(LookupMessage(2760), item.DisplayName(0).c_str(), item.unknown_0098, item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
} else {
text = FormatOwnedString("%s %d -> %s %s", naming.DisplayName(item, 0).c_str(), item.unknown_0014[0],
text = FormatOwnedString("%s %d -> %s %s", item.DisplayName(0).c_str(), item.unknown_0014[0],
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
}
} else {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2761), naming.DisplayName(item, 0).c_str(), item.unknown_0098,
text = FormatOwnedString(LookupMessage(2761), item.DisplayName(0).c_str(), item.unknown_0098,
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64), currency);
} else {
text = FormatOwnedString("%s %s %s", naming.DisplayName(item, 0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64),
text = FormatOwnedString("%s %s %s", item.DisplayName(0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64),
currency);
}
}
@ -6027,16 +5999,12 @@ void UIItemStoreFindWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
}
}
}
@ -6050,16 +6018,12 @@ void UIItemStoreSubWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
}
}
}
@ -6073,16 +6037,12 @@ void UIItemStoreWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
}
}
}
@ -6096,17 +6056,13 @@ void UIItemWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2551), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2551), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(183), naming.DisplayName(item, 0).c_str(), item.quantity).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(183), item.DisplayName(0).c_str(), item.quantity).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
}
}
@ -6123,19 +6079,15 @@ void UIMerchantItemMyShopWnd::Slot28(int x, int y) {
std::string text;
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (this->unknown_0100 == 0) {
if (item.identified == 1 && item.unknown_0098 != 0) {
text = FormatOwnedString(LookupMessage(2757), naming.DisplayName(item, 0).c_str(), item.unknown_0098,
text = FormatOwnedString(LookupMessage(2757), item.DisplayName(0).c_str(), item.unknown_0098,
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
} else {
text = FormatOwnedString("%s %s Zeny", naming.DisplayName(item, 0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
text = FormatOwnedString("%s %s Zeny", item.DisplayName(0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64));
}
} else {
text = FormatOwnedString(LookupMessage(1736), naming.DisplayName(item, 0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64),
text = FormatOwnedString(LookupMessage(1736), item.DisplayName(0).c_str(), FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64),
item.quantity);
}
@ -6153,12 +6105,8 @@ void UIMerchantItemPurchaseWnd::Slot28(int x, int y) {
this->ToScreen(tooltipX, tooltipY);
char price[64];
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString("%s %d %s %s Zeny", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588),
->Show(FormatOwnedString("%s %d %s %s Zeny", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588),
FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, 64))
.c_str(),
tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
@ -6169,10 +6117,6 @@ void UIMerchantItemPurchaseWnd::Slot28(int x, int y) {
// FUNCTION: fn_13382
void UIMerchantItemShopWnd::Slot28(int x, int y) {
ITEM_INFO item = this->GetItemAt(x, y);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.unknown_0000[1] > 0) {
int tooltipX = (x - 40) / 32 * 32 + 40;
int tooltipY = (y - 17) / 32 * 32 + 1;
@ -6180,10 +6124,10 @@ void UIMerchantItemShopWnd::Slot28(int x, int y) {
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
}
return;
}
@ -6199,10 +6143,10 @@ void UIMerchantItemShopWnd::Slot28(int x, int y) {
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX - 2, tooltipY + 24,
->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX - 2, tooltipY + 24,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(naming.DisplayName(item, 0).c_str(), tooltipX - 2, tooltipY + 24, g_session.GetItemNameColor(item), 0, 1);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(item.DisplayName(0).c_str(), tooltipX - 2, tooltipY + 24, g_session.GetItemNameColor(item), 0, 1);
}
}
@ -6215,17 +6159,13 @@ void UIMerchantItemWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2551), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2551), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString("%s %d %s", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588)).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString("%s %d %s", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588)).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
}
}
@ -6240,17 +6180,13 @@ void UIMerchantMirrorItemWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2756), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2756), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString("%s %d %s", naming.DisplayName(item, 0).c_str(), item.quantity, LookupMessage(588)).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString("%s %d %s", item.DisplayName(0).c_str(), item.quantity, LookupMessage(588)).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
}
}
@ -6878,16 +6814,12 @@ void UIChatEditCtrl::InsertItemLink(const ITEM_INFO& item) {
}
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (!this->unknown_0144->CanInsertTag(naming.DisplayName(item, 0), this->geometry.width)) {
if (!this->unknown_0144->CanInsertTag(item.DisplayName(0), this->geometry.width)) {
return;
}
this->unknown_0144->taggedText = this->text;
const std::string name = naming.DisplayName(item, 0);
const std::string name = item.DisplayName(0);
const std::string tag = this->unknown_0144->AppendTag(name);
g_serverLanguage->ResetInput();
g_serverLanguage->Insert(tag.c_str());
@ -8522,27 +8454,24 @@ void UIMerchantShopMakeWnd::PrintSellList() {
char* cursor = name;
int capacity = 256;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNamingContext naming{{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language}};
if (item.unknown_0060 != 0) {
cursor += item.Refine(cursor, capacity, 1);
}
if (naming.HasCards(item)) {
cursor += naming.Prefixes(item, cursor, capacity, 1);
if (item.HasCards()) {
cursor += item.Prefixes(cursor, capacity, 1);
cursor += descriptions.Name(item, cursor, capacity, 1);
cursor += naming.Suffixes(item, cursor, capacity, 1);
naming.Slots(item, cursor, capacity, 1);
cursor += item.Suffixes(cursor, capacity, 1);
item.Slots(cursor, capacity, 1);
} else if (item.HasSpecialCard()) {
cursor += naming.Star(item, cursor, capacity, 1);
cursor += naming.Creator(item, cursor, capacity, 1);
cursor += naming.Element(item, cursor, capacity, 1);
cursor += item.Star(cursor, capacity, 1);
cursor += item.Creator(cursor, capacity, 1);
cursor += item.Element(cursor, capacity, 1);
descriptions.Name(item, cursor, capacity, 1);
} else {
cursor += descriptions.Name(item, cursor, capacity, 1);
naming.Slots(item, cursor, capacity, 1);
item.Slots(cursor, capacity, 1);
}
std::sprintf(text, "%s ", this->priceEdits[index]->Text());

View file

@ -168,17 +168,13 @@ void UIMerchantItemLogWnd::Slot28(int x, int y) {
int tooltipY = (y - 17) / 32 * 32 + 1;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.identified == 1 && item.unknown_0098 != 0) {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(2551), naming.DisplayName(item, 0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(2551), item.DisplayName(0).c_str(), item.unknown_0098, item.quantity).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)
->Show(FormatOwnedString(LookupMessage(183), naming.DisplayName(item, 0).c_str(), item.quantity).c_str(), tooltipX, tooltipY,
->Show(FormatOwnedString(LookupMessage(183), item.DisplayName(0).c_str(), item.quantity).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
}
}
@ -248,11 +244,7 @@ int UIMerchantItemLogWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a
lcData data;
data.name = LookupPlayerName(b);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
data.unknown_001C = naming.DisplayName(item, 0);
data.unknown_001C = item.DisplayName(0);
data.time = c;
data.characterId = b;
this->logs.push_back(data);

View file

@ -189,16 +189,12 @@ void UIParaResultWnd::Slot28(int x, int y) {
std::string text;
char price[64];
std::memset(price, 0, sizeof(price));
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.unknown_0014[0] == item.unknown_0014[1]) {
const char* amount = FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, sizeof(price));
text = FormatOwnedString("%s %s Zeny", naming.DisplayName(item, 0).c_str(), amount);
text = FormatOwnedString("%s %s Zeny", item.DisplayName(0).c_str(), amount);
} else {
const char* amount = FormatGroupedInteger(static_cast<int>(item.unknown_0014[1]), price, sizeof(price));
text = FormatOwnedString("%s %d -> %s Zeny", naming.DisplayName(item, 0).c_str(), item.unknown_0014[0], amount);
text = FormatOwnedString("%s %d -> %s Zeny", item.DisplayName(0).c_str(), item.unknown_0014[0], amount);
}
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(text.c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);

View file

@ -197,11 +197,7 @@ void CMergeItemWnd::Slot28(int x, int y) {
ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, id);
if (item.unknown_0000[1] != 0) {
this->ToScreen(screenX, screenY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::string text = FormatOwnedString(LookupMessage(183), naming.DisplayName(item, 0).c_str(), item.quantity);
std::string text = FormatOwnedString(LookupMessage(183), item.DisplayName(0).c_str(), item.quantity);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(text.c_str(), screenX, screenY, g_session.GetItemNameColor(item), 0, 1);
}
}

View file

@ -133,11 +133,7 @@ void CUIGameItem::SetItem(const ITEM_INFO& item) {
}
this->itemInfo = item;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->name = naming.DisplayName(this->itemInfo, 0);
this->name = this->itemInfo.DisplayName(0);
std::string path;
if (this->mode == 0) {

View file

@ -242,11 +242,7 @@ int UIItemRepairWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std
item.SetItemId(entry.itemId);
item.unknown_0060 = 0;
item.identified = 1;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->m_list->AddLine(naming.DisplayName(item, 0).c_str());
this->m_list->AddLine(item.DisplayName(0).c_str());
return 0;
}

View file

@ -115,11 +115,7 @@ int UIMakeTargetListWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a,
item.SetItemId(itemId);
item.unknown_0060 = 0;
item.identified = 1;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->m_list->AddLine(naming.DisplayName(item, 0).c_str());
this->m_list->AddLine(item.DisplayName(0).c_str());
return 0;
}

View file

@ -439,20 +439,16 @@ void UISwapEquipmentWnd::Slot28(int x, int y) {
this->ToScreen(tooltipX, tooltipY);
std::string text;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (item.quantity > 1) {
if (item.unknown_0098 != 0) {
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(0x9F7), naming.DisplayName(item, 0)));
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(0x9F7), item.DisplayName(0)));
} else {
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(0xB7), naming.DisplayName(item, 0).c_str(), item.quantity));
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(0xB7), item.DisplayName(0).c_str(), item.quantity));
}
} else if (item.unknown_0098 != 0) {
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(0xA28), naming.DisplayName(item, 0).c_str(), item.unknown_0098));
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(0xA28), item.DisplayName(0).c_str(), item.unknown_0098));
} else {
text = naming.DisplayName(item, 0);
text = item.DisplayName(0);
}
reinterpret_cast<ModeTooltip*>(g_modeMgr.GetGameMode())->Show(text.c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);

View file

@ -102,11 +102,7 @@ int UIWeaponRefineWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s
item.SetItemId(itemId);
item.unknown_0060 = 0;
item.identified = 1;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->m_list->AddLine(naming.DisplayName(item, 0).c_str());
this->m_list->AddLine(item.DisplayName(0).c_str());
return 0;
}

View file

@ -21,11 +21,7 @@
std::string UIChatHisBox::ResolvePlayerTags(const char* name) {
std::string result = "";
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ItemLinkDisplay display{*this->geometry.surface, g_fontCache, this->m_context->locale, naming, this->geometry.width};
ItemLinkDisplay display{*this->geometry.surface, g_fontCache, this->m_context->locale, this->geometry.width};
for (std::vector<UIItemTagButton*>& row : this->ItemTags()) {
const int count = static_cast<int>(row.size());
@ -38,7 +34,7 @@ std::string UIChatHisBox::ResolvePlayerTags(const char* name) {
const std::string label = tag->label;
if (label.find(LookupMessage(581)) == std::string::npos) {
const std::string bracket = display.BracketName(naming.DisplayName(reinterpret_cast<const ITEM_INFO&>(tag->unknown_00F8), 0));
const std::string bracket = display.BracketName(reinterpret_cast<const ITEM_INFO&>(tag->unknown_00F8).DisplayName(0));
const std::string tail = result.substr(position);
const std::size_t found = tail.find(bracket);
const std::string head = result.substr(0, position + found);
@ -58,7 +54,7 @@ std::string UIChatHisBox::ResolvePlayerTags(const char* name) {
position += start + std::strlen(opening.c_str()) + 1;
tag->column = this->TextWidth(head.c_str(), 0, 0, 12, 0, 0) - this->horizontalOffset;
const std::string bracket = display.BracketName(naming.DisplayName(reinterpret_cast<const ITEM_INFO&>(tag->unknown_00F8), 0));
const std::string bracket = display.BracketName(reinterpret_cast<const ITEM_INFO&>(tag->unknown_00F8).DisplayName(0));
tag->SetTooltip(bracket.c_str());
const std::string text = bracket.c_str();
tag->label = text;

View file

@ -1821,10 +1821,7 @@ std::string UIChatHisBox::RenderItemLinks(const char* lineText, std::string& sou
unsigned position = 0;
unsigned previous = 0;
ItemDescriptions descriptions{g_itemDescriptions};
const bool languagePrefix = false;
const WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ItemLinkDisplay display{*this->geometry.surface, g_fontCache, this->m_context->locale, naming, this->geometry.width};
ItemLinkDisplay display{*this->geometry.surface, g_fontCache, this->m_context->locale, this->geometry.width};
for (;;) {
std::string encoded;
@ -1862,7 +1859,7 @@ std::string UIChatHisBox::RenderItemLinks(const char* lineText, std::string& sou
DecodeItemLinkFields(encoded, fields);
ITEM_INFO item;
if (ItemFromLinkFields(fields, item, descriptions)) {
const std::string label = display.BracketName(naming.DisplayName(item, 0));
const std::string label = display.BracketName(item.DisplayName(0));
if (result.size() + label.size() > std::strlen(lineText)) {
previous += static_cast<unsigned>(prefix.size());
break;
@ -1872,7 +1869,7 @@ std::string UIChatHisBox::RenderItemLinks(const char* lineText, std::string& sou
if (button) {
std::memcpy(button->unknown_00F8, &item, sizeof(item));
button->Configure(label.c_str(), 0x82F2E1, 0, 12, 0, 0);
button->SetTooltip(naming.DisplayName(item, 0).c_str());
button->SetTooltip(item.DisplayName(0).c_str());
button->m_hoverColor = 0x82F2E1;
button->SetId(0x1D0);
button->ResizeToTextClipped(
@ -2072,11 +2069,7 @@ void UIChatHisBox::sub_89DC30(const char* text, int& color, int& mode) {
}
std::vector<std::string> wrapped;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ItemLinkDisplay display{*this->geometry.surface, g_fontCache, this->m_context->locale, naming, this->geometry.width};
ItemLinkDisplay display{*this->geometry.surface, g_fontCache, this->m_context->locale, this->geometry.width};
const std::string converted = display.Convert(text);
this->sub_8932D0(&mode, &wrapped, converted);
this->RewrapLinkLines(wrapped, mode);

View file

@ -289,11 +289,7 @@ void CUIRewards::OnBindItem(CUIRewardItem* item, const CRewardItemData& data) {
info.identified = 1;
item->gameItem->SetItem(info);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::string name = naming.DisplayName(info, 0);
std::string name = info.DisplayName(0);
item->nameText->SetText(name.c_str(), name.size());
std::string count = FormatOwnedString(LookupMessage(0xB6), data.count);
item->countText->SetText(count.c_str(), count.size());

View file

@ -97,19 +97,14 @@ void UIRodexComposeWnd::sub_7FF710(const ITEM_INFO& item) {
}
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::string name = naming.DisplayName(item, 0);
std::string name = item.DisplayName(0);
auto* tagCtrl = static_cast<UIItemTagOnMail*>(this->unknown_0100);
if (!tagCtrl->CanInsertTag(name, this->m_contents->geometry.width)) {
return;
}
tagCtrl->taggedText = this->m_contents->Text();
std::string appendResult = tagCtrl->AppendTag(naming.DisplayName(item, 0));
std::string appendResult = tagCtrl->AppendTag(item.DisplayName(0));
this->m_contents->SetText(appendResult.c_str());
this->m_contents->sub_855150();
tagCtrl->sub_89CFE0(item, 0xd630a9);
@ -209,19 +204,15 @@ void UIRodexComposeWnd::Slot28(int x, int y) {
int tooltipX = this->m_itemIndex * 34 + 30;
int tooltipY = 290;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (item.identified == 1 && item.unknown_0098 != 0) {
std::uint32_t color = g_session.GetItemNameColor(item);
tooltip->Show(
FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY, color, 0, 1
FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY, color, 0, 1
);
} else {
std::uint32_t color = g_session.GetItemNameColor(item);
tooltip->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, color, 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, color, 0, 1);
}
}
}

View file

@ -1225,11 +1225,7 @@ void UIRuneSetReWard::Slot28(int, int) {
ITEM_INFO item;
item.SetItemId(this->m_itemId);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (std::string("Unknown Item") == naming.DisplayName(item, 0)) {
if (std::string("Unknown Item") == item.DisplayName(0)) {
return;
}
@ -1239,7 +1235,7 @@ void UIRuneSetReWard::Slot28(int, int) {
this->ToScreen(x, y);
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (tooltip) {
tooltip->Show(naming.DisplayName(item, 0).c_str(), x, y - 10, 0xFFFFFF, 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), x, y - 10, 0xFFFFFF, 0, 1);
}
}
@ -1268,11 +1264,7 @@ void UIRuneSystem_ActiveWnd::Slot28(int x, int y) {
this->ToScreen(tipX, tipY);
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (tooltip) {
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
tooltip->Show(naming.DisplayName(item, 0).c_str(), tipX, tipY, 0xFFFFFF, 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), tipX, tipY, 0xFFFFFF, 0, 1);
}
}
@ -1296,11 +1288,7 @@ void UIRune_Decom::Slot28(int x, int y) {
this->ToScreen(tipX, tipY);
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (tooltip) {
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
tooltip->Show(naming.DisplayName(item, 0).c_str(), tipX, tipY, 0xFFFFFF, 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), tipX, tipY, 0xFFFFFF, 0, 1);
}
}
@ -1673,11 +1661,7 @@ void UIRune_Decom::SetItem(int itemId) {
item.identified = 1;
if (this->m_itemId != itemId) {
this->m_itemId = itemId;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->unknown_007C = naming.DisplayName(item, 0);
this->unknown_007C = item.DisplayName(0);
std::string resource;
if (IsItemCard(std::atoi(item.itemId.c_str()))) {

View file

@ -738,11 +738,7 @@ void CUISelectPackageItemBox::BindItem(SelectPackageItemBox::CUIItemInfo* item,
item->image->SetImage(image);
item->gameItem->SetItem(data);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const std::string name = naming.DisplayName(data, 0);
const std::string name = data.DisplayName(0);
item->nameText->SetText(name.c_str(), name.size());
}

View file

@ -1,5 +1,6 @@
#include "Client/Session.h"
#include "Contents/Hotkeys/HotkeyInfo.h"
#include "Contents/MessageTable.h"
#include "UI/Shortcuts/ShortcutTooltip.h"
#include "UI/Buttons/UIButton.h"
#include "UI/Window/UIWindow.h"
@ -51,9 +52,9 @@ void ShortcutTooltip::Hover(UIWindow& window, ShortcutGrid& grid, int x, int y,
return;
}
const std::string name = this->naming.DisplayName(item, 0);
const std::string name = item.DisplayName(0);
char text[4096];
_snprintf_s(text, sizeof(text), _TRUNCATE, this->naming.Message(183), name.c_str(), item.unknown_0000[1]);
_snprintf_s(text, sizeof(text), _TRUNCATE, LookupMessage(183), name.c_str(), item.unknown_0000[1]);
ToScreen(window, tooltipX, tooltipY);
if (this->services) {
@ -101,9 +102,9 @@ void ShortcutTooltip::Hover(UIWindow& window, ShortcutGrid& grid, int x, int y,
if (item.unknown_0000[1] == 0) {
text = shortcut;
} else {
const std::string name = this->naming.DisplayName(item, 0);
const std::string name = item.DisplayName(0);
char formatted[4096];
_snprintf_s(formatted, sizeof(formatted), _TRUNCATE, this->naming.Message(184), shortcut.c_str(), name.c_str(), item.unknown_0000[1]);
_snprintf_s(formatted, sizeof(formatted), _TRUNCATE, LookupMessage(184), shortcut.c_str(), name.c_str(), item.unknown_0000[1]);
text = formatted;
}
}

View file

@ -3,7 +3,6 @@
#include "Contents/Skills/ClientSkills.h"
#include "Contents/Items/ItemInfo.h"
#include "Contents/Items/ItemNaming.h"
#include "Contents/UserData/NormalItemSlots.h"
#include "UI/Shortcuts/ShortcutGrid.h"
@ -14,7 +13,6 @@ class ButtonServices;
struct ShortcutTooltip {
ClientSkills& skills;
const std::list<ITEM_INFO>& inventory;
ItemNaming& naming;
LuaScript& script;
ButtonServices* services;
const bool& itemSlotActive;

View file

@ -3,7 +3,6 @@
#include "Contents/Skills/ClientSkills.h"
#include "Contents/Items/ItemInfo.h"
#include "Contents/Items/ItemNaming.h"
#include "Contents/UserData/NormalItemSlots.h"
class ModeEvents;
@ -12,7 +11,6 @@ class ButtonServices;
struct ShortcutUse {
ClientSkills& skills;
const std::list<ITEM_INFO>& inventory;
ItemNaming& naming;
ModeEvents*& mode;
ButtonServices& dialogs;
const int& itemConfirmationState;

View file

@ -113,10 +113,7 @@ void UIQuickSlotWnd::Slot28(int x, int y) {
}
} else {
ITEM_INFO item = LookupClientItem(painting.inventory, static_cast<int>(id), 1);
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{painting.descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(183), naming.DisplayName(item, 0).c_str(), item.quantity));
text = static_cast<const std::string&>(FormatOwnedString(LookupMessage(183), item.DisplayName(0).c_str(), item.quantity));
}
if (!text.empty()) {
@ -286,10 +283,7 @@ int UIQuickSlotWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argumen
break;
case 18:
if (*reinterpret_cast<int*>(&g_session.unknown_16F4[4]) >= 0) {
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{this->m_painting->descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
const std::string text = FormatOwnedString(LookupMessage(0x4CA), naming.DisplayName(item, 0).c_str());
const std::string text = FormatOwnedString(LookupMessage(0x4CA), item.DisplayName(0).c_str());
if (reinterpret_cast<WindowDialogs*>(&g_windowMgr)->Confirm(text.c_str(), 2, false, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) {
mode->SendMsg(0x1B, item.unknown_0000[1], 0, 0, 0);
}

View file

@ -370,7 +370,7 @@ inline void ShortcutUse::Use(const NormalItemSlot& slot) {
case 0:
case 1:
case 2:
if (item.GetItemId() != 12802 || this->dialogs.Confirm(this->naming.Message(2373), 2, 0, 0, "Message", 280, 120) != 188) {
if (item.GetItemId() != 12802 || this->dialogs.Confirm(LookupMessage(2373), 2, 0, 0, "Message", 280, 120) != 188) {
use();
}
@ -388,10 +388,10 @@ inline void ShortcutUse::Use(const NormalItemSlot& slot) {
case 18:
if (this->itemConfirmationState >= 0) {
const std::string name = this->naming.DisplayName(item, 0);
const std::string name = item.DisplayName(0);
char text[4096];
_snprintf_s(text, sizeof(text), _TRUNCATE, this->naming.Message(1226), name.c_str());
_snprintf_s(text, sizeof(text), _TRUNCATE, LookupMessage(1226), name.c_str());
if (this->dialogs.Confirm(text, 2, 0, 0, "Message", 280, 120) == 187) {
use();

View file

@ -30,8 +30,9 @@ bool ItemLinkDisplay::Name(const std::string& encoded, std::string& output) {
DecodeItemLinkFields(encoded, fields);
ITEM_INFO item;
if (ItemFromLinkFields(fields, item, this->items.descriptions)) {
output = this->items.DisplayName(item, 0);
ItemDescriptions descriptions{g_itemDescriptions};
if (ItemFromLinkFields(fields, item, descriptions)) {
output = item.DisplayName(0);
return true;
}

View file

@ -6,13 +6,11 @@
class CDC;
class FontCache;
struct TextLocale;
struct ItemNaming;
struct ItemLinkDisplay {
CDC& surface;
FontCache& fonts;
const TextLocale& locale;
ItemNaming& items;
const int& width;
bool Name(const std::string& encoded, std::string& output);

View file

@ -1673,11 +1673,7 @@ void UIItemImage::Slot28(int, int) {
if (g_charViewMode) {
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_charViewMode);
const std::uint32_t color = g_session.GetItemNameColor(item);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
tooltip->Show(naming.DisplayName(item, 0).c_str(), x, y, color, 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), x, y, color, 0, 1);
}
}

View file

@ -6,7 +6,6 @@
#include <windows.h>
class UITextButton;
struct ItemNaming;
struct ItemLinkDisplay;
class TextViewerActions {
@ -21,7 +20,6 @@ protected:
};
struct UITextViewerContext {
ItemNaming& items;
TextViewerActions& actions;
HWND& applicationWindow;

View file

@ -153,9 +153,8 @@ void UITextViewer::AppendText(char* text, int width, bool carriageReturns, bool
const int scrollWidth = carriageReturns ? this->verticalBar->geometry.width + 2 : 0;
this->WrapPixelText(display.c_str(), wrapped, this->geometry.width - scrollWidth - 4);
} else {
WrapRichText(
display.c_str(), wrapped, width == 0 ? 35 : width, carriageReturns, this->m_text->items.descriptions
);
ItemDescriptions descriptions{g_itemDescriptions};
WrapRichText(display.c_str(), wrapped, width == 0 ? 35 : width, carriageReturns, descriptions);
}
for (const auto& line : wrapped) {

View file

@ -2,9 +2,8 @@
// OFFSET: 0x0086C410
// FUNCTION: fn_11026
UIBasicItemCtrl::UIBasicItemCtrl(UIWindowContext& windows, ItemNaming& naming, WindowManagerWindows& windowList)
: UIWindow(windows, 0), m_itemType(-1), m_itemMask(-1), m_identified(0), m_tooltip(""), m_item(0), m_naming(&naming),
m_windows(&windowList) {
UIBasicItemCtrl::UIBasicItemCtrl(UIWindowContext& windows, WindowManagerWindows& windowList)
: UIWindow(windows, 0), m_itemType(-1), m_itemMask(-1), m_identified(0), m_tooltip(""), m_item(0), m_windows(&windowList) {
}
// OFFSET: 0x0086C4C0

View file

@ -6,13 +6,12 @@
#include <string>
struct ItemNaming;
struct ClientSkills;
#include "UI/Window/WindowManagerWindows.h"
class UIBasicItemCtrl : public UIWindow {
public:
UIBasicItemCtrl(UIWindowContext& windows, ItemNaming& naming, WindowManagerWindows& windowList);
UIBasicItemCtrl(UIWindowContext& windows, WindowManagerWindows& windowList);
void Slot10(int argument1, int argument2, std::intptr_t argument3) override;
void Paint() override;
void Slot26(int x, int y) override;
@ -26,7 +25,7 @@ protected:
/* 0084 */ unsigned char m_identified;
/* 0088 */ std::string m_tooltip;
/* 00A0 */ ITEM_INFO m_item;
ItemNaming* m_naming;
void* unknown_naming;
void* unknown_controls;
WindowManagerWindows* m_windows;
};

View file

@ -605,10 +605,7 @@ void UIChangeMaterialWnd_List::Paint() {
UIWindowContext& context = *this->m_context;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::string name = naming.DisplayName(item, 0);
std::string name = item.DisplayName(0);
if (this->TextWidth(name.c_str(), 0, 0, 12, 0, 0) > 100) {
name = this->FitDisplayText(100, name.c_str(), 0, 12, 0);
}

View file

@ -152,15 +152,11 @@ void UIItemReformWnd_List::Slot15(int width, int height) {
void UIItemReformWnd::Paint() {
this->DrawBitmap(0, 0, &static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\ItemReform\\bg_reform.bmp")))->image, true);
UIWindowContext& context = *this->m_context;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
if (std::atoi(this->reformItem.itemId.c_str()) > 0) {
this->DrawTitleBar(false, naming.DisplayName(this->reformItem, 0).c_str(), 0);
this->DrawTitleBar(false, this->reformItem.DisplayName(0).c_str(), 0);
}
if (std::atoi(this->resultItem.itemId.c_str()) != 0) {
this->DrawCenteredText(6, 104, this->FitDisplayText(200, naming.DisplayName(this->resultItem, 0).c_str(), 0, 14, 1).c_str(), 209, 0, 14, 0, 1);
this->DrawCenteredText(6, 104, this->FitDisplayText(200, this->resultItem.DisplayName(0).c_str(), 0, 14, 1).c_str(), 209, 0, 14, 0, 1);
}
for (unsigned int index = 0; index < this->materials.size(); ++index) {
const unsigned int half = this->TextWidth("/", 0, 0, 12, 0, 0) * 0.5;
@ -227,10 +223,7 @@ void UIItemReformWnd_List::Paint() {
const ITEM_INFO& item = this->items[this->scrollPosition + row];
ItemDescriptions descriptions{g_itemDescriptions};
DrawItemIcon(*this, ResourceMgr::Instance(), descriptions, 15, this->itemHeight * row + 4, item, 1);
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
this->DrawTextAt(42, this->itemHeight * row + 10, this->FitDisplayText(160, naming.DisplayName(item, 0).c_str(), 0, 12, 0).c_str(), 0, 0,
this->DrawTextAt(42, this->itemHeight * row + 10, this->FitDisplayText(160, item.DisplayName(0).c_str(), 0, 12, 0).c_str(), 0, 0,
12, 0, 0, 0
);
}
@ -268,11 +261,7 @@ void UIItemReformWnd_Item::Slot28(int x, int y) {
this->ToScreen(screenX, screenY);
const int tipX = screenX + 5;
const int tipY = screenY - 5;
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(naming.DisplayName(*this->item, 0).c_str(), tipX, tipY, 0xFFFFFFFFu, 0, 1);
reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode)->Show(this->item->DisplayName(0).c_str(), tipX, tipY, 0xFFFFFFFFu, 0, 1);
}
}

View file

@ -212,16 +212,12 @@ void UIRodexContentsWnd::Slot28(int x, int y) {
int tooltipX = this->m_itemIndex * 34 + 30;
int tooltipY = 290;
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (item.identified == 1 && item.unknown_0098 != 0) {
tooltip->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
tooltip->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
tooltip->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
}
}
}

View file

@ -257,16 +257,12 @@ void UIRoulletteWnd::Slot28(int x, int y) {
if (item.quantity != 0) {
this->ToScreen(tooltipX, tooltipY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (item.identified == 1 && item.unknown_0098 != 0) {
tooltip->Show(FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
tooltip->Show(FormatOwnedString(LookupMessage(2600), item.DisplayName(0).c_str(), item.unknown_0098).c_str(), tooltipX, tooltipY,
g_session.GetItemNameColor(item), 0, 1);
} else {
tooltip->Show(naming.DisplayName(item, 0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
tooltip->Show(item.DisplayName(0).c_str(), tooltipX, tooltipY, g_session.GetItemNameColor(item), 0, 1);
}
}
}