mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(skills): save running skill cooldown groups (charxml <skil sc>)
The client reads the cooldowns still running from the charxml on load
(LWOSkillComponent::LoadFromSaveData 0x00c2a9c0): <skil sc="..."> split
on ';' and ':' (the delimiter string at 0x015b1714 is L";:") into a
cooldown group and the seconds left, each put in its cooldown map under
{hasCooldownGroup = 1, group}, the key it checks when the player casts a
skill of that group (0x00c11400). Live wrote <skil/> with nothing running
and e.g. <skil sc="17:15.6958;"/> otherwise (226 live charxmls; groups
8, 17 and 78 seen, the times below the groups' SkillBehavior cooldowns).
The claude-client-re-docs page described sc as "id;time" pairs; the
live saves and the delimiters show "group:time;".
DLU wrote no <skil>, so relogging or changing zones cleared every
cooldown (e.g. the 90 s imagination and faction skills).
- A player's successful cast (CastPlayerSkill) starts its
SkillBehavior.cooldowngroup's cooldown (groups 0 and up, cooldown > 0),
counted down in Update.
- Saved as live wrote it; loaded back when the player's SkillComponent
is created, so a cooldown survives several zone changes. Old saves
without <skil> load with none running.
Check in game: use a skill with a long cooldown (e.g. a faction kit's
special skill, a consumable with a cooldown), change zones or log out and
back in right away: its cooldown is still shown and counts down from
where it was (minus the loading time on the server).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,27 @@ public:
|
||||
*/
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Loads the cooldown groups still running at the last save: <skil sc="group:seconds;group:seconds;"/>
|
||||
*/
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Saves the running cooldown groups the way live did and the client reads them (LWOSkillComponent::LoadFromSaveData
|
||||
* 0x00c2a9c0 splits sc on ';' and ':' into a cooldown group and the seconds left)
|
||||
*/
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Starts the cooldown of a skill's cooldown group (SkillBehavior.cooldowngroup, cooldown) when the player casts it
|
||||
*/
|
||||
void StartCooldown(uint32_t skillID);
|
||||
|
||||
/**
|
||||
* The cooldown groups running and the seconds left on each
|
||||
*/
|
||||
const std::map<int32_t, float>& GetCooldownGroups() const { return m_CooldownGroups; }
|
||||
|
||||
/**
|
||||
* Computes server-side skill updates.
|
||||
*/
|
||||
@@ -223,6 +244,9 @@ private:
|
||||
*/
|
||||
uint32_t m_skillUid;
|
||||
|
||||
// Cooldown group -> seconds left, for the player's save
|
||||
std::map<int32_t, float> m_CooldownGroups;
|
||||
|
||||
/**
|
||||
* Cache for looking up a behavior id via a skill ID
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user