mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(character): keep and save the tooltip flags (SetTooltipFlag, char@ttip)
The client sends SetTooltipFlag (469: bFlag, then the tooltip, 2 live packets, both tooltip 24) when a tooltip has been shown, and follows it with SetFlag for the same ID. DLU dropped it and never wrote char@ttip, so the client's tooltip bits reset on every load. - SetTooltipFlag message struct and handler: the bit is set or cleared on the CharacterComponent exactly as the client does it (LWOCharacterComponent::SendMessage 0x00d34330): tooltips above 127 are ignored, set = 1 << tooltip, clear = mask ~1 << tooltip (which also clears the lower bits), shifts of 64 or more give 0. - Saved as char@ttip, a 64-bit value (the client reads it with GetLongLongValue in LoadFromSaveData 0x00ca4910). Live wrote it on every character (226 live charxmls: "0" or "16777216" = tooltip 24). Old saves without it load with 0. Check in game: on a new character, trigger a first-time tooltip (e.g. the one about an item or a new area), change zones and log out and back in: the character loads normally and the same tooltip does not come back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -290,6 +290,9 @@ void CharacterComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
|
||||
character->QueryInt64Attribute("ls", &m_Uscore);
|
||||
|
||||
m_TooltipFlags = 0;
|
||||
character->QueryUnsigned64Attribute("ttip", &m_TooltipFlags);
|
||||
|
||||
// Load the statistics
|
||||
const auto* statisticsAttribute = character->FindAttribute("stt");
|
||||
if (statisticsAttribute) {
|
||||
@@ -420,6 +423,8 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
if (m_ClaimCodes[3] != 0) character->SetAttribute("co3", m_ClaimCodes[3]);
|
||||
|
||||
character->SetAttribute("ls", m_Uscore);
|
||||
// Live wrote ttip on every character, 0 when no tooltip was flagged
|
||||
character->SetAttribute("ttip", m_TooltipFlags);
|
||||
// Custom attribute to keep track of reputation.
|
||||
character->SetAttribute("rpt", GetReputation());
|
||||
character->SetAttribute("stt", StatisticsToString().c_str());
|
||||
@@ -471,6 +476,15 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
m_LastUpdateTimestamp = newUpdateTimestamp;
|
||||
}
|
||||
|
||||
void CharacterComponent::SetTooltipFlag(const int32_t tooltip, const bool flag) {
|
||||
if (tooltip > 127) return;
|
||||
// x86 64-bit shifts (__allshl) by 64 or more give 0; the shift count is the tooltip's low byte
|
||||
const auto shift = static_cast<uint8_t>(tooltip);
|
||||
const auto shifted = [shift](const uint64_t value) { return shift < 64 ? value << shift : 0; };
|
||||
if (flag) m_TooltipFlags |= shifted(1);
|
||||
else m_TooltipFlags &= shifted(~uint64_t{ 1 });
|
||||
}
|
||||
|
||||
void CharacterComponent::SetLastRocketConfig(std::u16string config) {
|
||||
m_IsLanding = !config.empty();
|
||||
m_LastRocketConfig = config;
|
||||
|
||||
@@ -327,6 +327,14 @@ public:
|
||||
|
||||
const std::u16string& GetLastRocketConfig() const { return m_LastRocketConfig; };
|
||||
|
||||
/**
|
||||
* Sets or clears a tooltip's "seen" bit as the client's SetTooltipFlag does (LWOCharacterComponent::SendMessage
|
||||
* 0x00d34330): tooltips above 127 are ignored; setting shifts 1 left by the tooltip (nothing at 64 or more);
|
||||
* clearing masks with ~1 shifted left by the tooltip, which also clears every lower bit. Saved as char@ttip.
|
||||
*/
|
||||
void SetTooltipFlag(int32_t tooltip, bool flag);
|
||||
uint64_t GetTooltipFlags() const { return m_TooltipFlags; }
|
||||
|
||||
uint64_t GetTotalTimePlayed() const { return m_TotalTimePlayed; };
|
||||
|
||||
/**
|
||||
@@ -364,6 +372,9 @@ private:
|
||||
*/
|
||||
int64_t m_Uscore;
|
||||
|
||||
// The tooltips the player has seen, one bit each (char@ttip)
|
||||
uint64_t m_TooltipFlags{};
|
||||
|
||||
/**
|
||||
* The lifetime reputation earned by the entity
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user