修复只读 ESP 名称显示

This commit is contained in:
kedou 2026-08-08 13:50:05 +08:00
parent 9d09d6e3dc
commit 9503d22b62
5 changed files with 46 additions and 11 deletions

View File

@ -31,7 +31,7 @@ bool CContainer::Update()
} }
if (m_CName.empty()) if (m_CName.empty())
m_CName = "Container"; m_CName = "容器";
return true; return true;
} }

View File

@ -56,11 +56,11 @@ const char* GetExfilStatusText(const uint8_t status) noexcept
{ {
switch (status) switch (status)
{ {
case static_cast<uint8_t>(CLOSE): return "Closed"; case static_cast<uint8_t>(CLOSE): return "已关闭";
case static_cast<uint8_t>(NOTREADY): return "Not ready"; case static_cast<uint8_t>(NOTREADY): return "等待中";
case static_cast<uint8_t>(OPEN): return "Open"; case static_cast<uint8_t>(OPEN): return "开启";
case static_cast<uint8_t>(READY): return "Ready"; case static_cast<uint8_t>(READY): return "已准备";
default: return "Unknown"; default: return "未知";
} }
} }

View File

@ -190,7 +190,7 @@ bool CItem::Update()
// Keep a stable label even when a partially initialized loot object has no template metadata. // Keep a stable label even when a partially initialized loot object has no template metadata.
if (m_CName.empty()) if (m_CName.empty())
m_CName = "Item"; m_CName = "物品";
// Keep the legacy corpse check, but validate the chain through ReadChain's read-only checks. // Keep the legacy corpse check, but validate the chain through ReadChain's read-only checks.
const uintptr_t nameAddr = m.ReadChain(address, { 0x0, 0x0, 0x48 }); const uintptr_t nameAddr = m.ReadChain(address, { 0x0, 0x0, 0x48 });

View File

@ -213,7 +213,7 @@ void CFramework::UpdateStaticList()
exfil.m_pExfilName = exfil.GetName(); exfil.m_pExfilName = exfil.GetName();
if (exfil.m_pExfilName.empty()) if (exfil.m_pExfilName.empty())
exfil.m_pExfilName = "Exfil"; exfil.m_pExfilName = "撤离点";
staticSnapshot->exfils.push_back(std::move(exfil)); staticSnapshot->exfils.push_back(std::move(exfil));
} }
} }

View File

@ -46,6 +46,41 @@ namespace
} }
} }
bool HasRuntimeDisplayName(const std::string& value, const char* fallback,
const char* legacyFallback)
{
return !value.empty() && value != fallback && value != legacyFallback;
}
std::string GetChineseItemDisplayName(const CItem& item)
{
if (item.m_bIsCorpse)
return "尸体";
if (HasRuntimeDisplayName(item.m_CName, "物品", "Item"))
return item.m_CName;
if (item.m_bIsQuestItem)
return "任务物品";
switch (item.m_iRarity)
{
case 2: return "稀有物品";
case 3: return "超稀有物品";
default: return "物品";
}
}
std::string GetChineseContainerDisplayName(const CContainer& container)
{
return HasRuntimeDisplayName(container.m_CName, "容器", "Container") ?
container.m_CName : "容器";
}
std::string GetChineseExfilDisplayName(const CExfil& exfil)
{
return HasRuntimeDisplayName(exfil.m_pExfilName, "撤离点", "Exfil") ?
exfil.m_pExfilName : "撤离点";
}
ImColor GetExfilDisplayColor(const ExfilDisplayCategory category, ImColor GetExfilDisplayColor(const ExfilDisplayCategory category,
const ImColor& closedColor, const ImColor& openColor, const ImColor& closedColor, const ImColor& openColor,
const ImColor& pendingColor, const ImColor& unknownColor) const ImColor& pendingColor, const ImColor& unknownColor)
@ -313,7 +348,7 @@ void CFramework::RenderESP()
if (!WorldToScreen(viewMatrix, gameSize, item.m_vecOrigin, screen) || !InScreen(screen)) if (!WorldToScreen(viewMatrix, gameSize, item.m_vecOrigin, screen) || !InScreen(screen))
continue; continue;
std::string text = item.m_bIsCorpse ? "Corpse" : item.m_CName; std::string text = GetChineseItemDisplayName(item);
text += " [" + std::to_string((int)distance) + "m]"; text += " [" + std::to_string((int)distance) + "m]";
const ImColor itemColor = GetItemDisplayColor(item, Col_ESP_ItemQuest, Col_ESP_ItemCommon, const ImColor itemColor = GetItemDisplayColor(item, Col_ESP_ItemQuest, Col_ESP_ItemCommon,
Col_ESP_ItemRare, Col_ESP_ItemSuperRare, Col_ESP_Corpse); Col_ESP_ItemRare, Col_ESP_ItemSuperRare, Col_ESP_Corpse);
@ -334,7 +369,7 @@ void CFramework::RenderESP()
if (!WorldToScreen(viewMatrix, gameSize, container.m_vecOrigin, screen) || !InScreen(screen)) if (!WorldToScreen(viewMatrix, gameSize, container.m_vecOrigin, screen) || !InScreen(screen))
continue; continue;
const std::string text = container.m_CName + " [" + std::to_string((int)distance) + "m]"; const std::string text = GetChineseContainerDisplayName(container) + " [" + std::to_string((int)distance) + "m]";
ImGui::GetBackgroundDrawList()->AddCircleFilled(ImVec2(screen.x, screen.y - 2.f), 2.f, Col_ESP_Container, 0); ImGui::GetBackgroundDrawList()->AddCircleFilled(ImVec2(screen.x, screen.y - 2.f), 2.f, Col_ESP_Container, 0);
String(ImVec2(screen.x - (ImGui::CalcTextSize(text.c_str()).x / 2.f), screen.y), Col_ESP_Container, text.c_str()); String(ImVec2(screen.x - (ImGui::CalcTextSize(text.c_str()).x / 2.f), screen.y), Col_ESP_Container, text.c_str());
} }
@ -352,7 +387,7 @@ void CFramework::RenderESP()
const ImColor exfilColor = GetExfilDisplayColor(category, Col_ESP_ExfilClose, const ImColor exfilColor = GetExfilDisplayColor(category, Col_ESP_ExfilClose,
Col_ESP_ExfilOpen, Col_ESP_ExfilPending, Col_ESP_ExfilUnknown); Col_ESP_ExfilOpen, Col_ESP_ExfilPending, Col_ESP_ExfilUnknown);
const float distance = GetDistance(localPlayer.m_vecOrigin, exfil.m_pVecLocation); const float distance = GetDistance(localPlayer.m_vecOrigin, exfil.m_pVecLocation);
const std::string text = exfil.m_pExfilName + " [" + GetExfilStatusText(exfil.m_pExfilStatus) + "] [" + const std::string text = GetChineseExfilDisplayName(exfil) + " [" + GetExfilStatusText(exfil.m_pExfilStatus) + "] [" +
std::to_string((int)distance) + "m]"; std::to_string((int)distance) + "m]";
ImGui::GetBackgroundDrawList()->AddCircleFilled(ImVec2(screen.x, screen.y - 2.f), 2.f, exfilColor, 0); ImGui::GetBackgroundDrawList()->AddCircleFilled(ImVec2(screen.x, screen.y - 2.f), 2.f, exfilColor, 0);
String(ImVec2(screen.x - (ImGui::CalcTextSize(text.c_str()).x / 2.f), screen.y), exfilColor, text.c_str()); String(ImVec2(screen.x - (ImGui::CalcTextSize(text.c_str()).x / 2.f), screen.y), exfilColor, text.c_str());