Skip to content

PartyChanged event desync issues when players disconnect and reconnect #261

Description

@valarnin

Description

In a given instance, if a player disconnects and reconnects, the PartyChanged event either doesn't fire or doesn't have the reconnected player's details, causing raidboss trigger data.party.details object no longer knows about them.

Additional information

I use the following helper function for custom triggers:

const getRole = (data, targetId) => {
  const detail = data.party.details.find(d => d.id === targetId);
  const job = Util.jobEnumToJob(detail.job);
  return Util.jobToRole(job);
};

This is being used in the following trigger:

    {
      id: 'Custom - P4S Curtain Call Callouts',
      // Durations could be 12s, 22s, 32s, and 42s
      type: 'GainsEffect',
      netRegex: NetRegexes.gainsEffect({ effectId: 'AF4', capture: true }),
      condition: (data) => data.act === 'curtain' && ['Some Main', 'Some Alt'].includes(data.me),
      delaySeconds: (data, matches) => parseFloat(matches.duration) - (getRole(data, matches.targetId) === 'dps' ? 12 : 7),
      alertText: (_data, matches) => matches.target,
    }

This results in the following error stack when that trigger fires for the given player after they've disconnected and reconnected (trimmed irrelevant lines):

[2022-04-26 23:29:06] Info: cactbot2: BrowserConsole: Error in trigger: Custom - P4S Curtain Call Callouts (C:\Stuff\Games\ACT\Plugins\cactbot-0.23.10\cactbot\user\raidboss\custom-p4s.js) (Source: http://localhost:8080/ui/raidboss/raidboss.bundle.js, Line: 14512)
[2022-04-26 23:29:06] Info: cactbot2: BrowserConsole: TypeError: Cannot read properties of undefined (reading 'job') (Source: http://localhost:8080/ui/raidboss/raidboss.bundle.js, Line: 14519)
[2022-04-26 23:29:06] Info: cactbot2: BrowserConsole:     at getRole (C:\Stuff\Games\ACT\Plugins\cactbot-0.23.10\cactbot\user\raidboss\custom-p4s.js:26:40) (Source: http://localhost:8080/ui/raidboss/raidboss.bundle.js, Line: 14519)

Possibly related to #151.

Relevant Cactbot code segments:

https://github.com/quisquous/cactbot/blob/ed9b3b912a3107f3481cc5d92fa9b81349c68f5a/ui/raidboss/popup-text.ts#L519-L521

https://github.com/quisquous/cactbot/blob/ed9b3b912a3107f3481cc5d92fa9b81349c68f5a/resources/party.ts#L28-L48

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions