-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Order Flipping (and sorted some tab issues) #82
base: master
Are you sure you want to change the base?
Changes from all commits
4184357
8d10eee
883190f
3fcfcaa
7d9973d
b401490
49139a3
f4685b2
6ec92e1
d0c4f4e
21c67ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,18 +19,14 @@ class OverlayRaw extends React.Component { | |
if (Object.getOwnPropertyNames(this.props.Combatant).length === 0) | ||
return false | ||
|
||
let maxRows = this.props.config.maxCombatants | ||
let dataArray = Object.keys(this.props.Combatant) | ||
let battler = dataArray.slice(0, maxRows) | ||
let combatant | ||
const maxRows = this.props.config.maxCombatants //not sure why let was being used here | ||
const dataArray = this.props.isWebSocket ? Object.keys(this.props.Combatant).reverse() : Object.keys(this.props.Combatant) //const is fine, actws flips order for some reason I don't know why, this is my 'fix' | ||
let discordData = [] | ||
let currentRow = 0 | ||
|
||
for (const ref in battler) { | ||
combatant = this.props.Combatant[battler[ref]] | ||
|
||
// Send to Discord the right name in Settings | ||
if (combatant.name.toUpperCase() === 'YOU') | ||
combatant.name = this.props.config.characterName | ||
//NOTE: instead of wasting time slicing the array up we just break the loop when we need to, it avoids the problem of filtering out the lb only to want to handle it later | ||
for (const battler of dataArray) { | ||
const combatant = this.props.Combatant[battler] //scope means we can just use const here | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thank you for explaining your steps, I know it may look weird in some places but I never refactored since v1 😉 Could you then remove the comments? They won't make sense after the PR is accepted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I will remove the comments I'm busy with savage raids and life at the moment but I'll get round to it as soon as possible |
||
|
||
// Send limit break data separated | ||
if (combatant.name.toLowerCase() === 'limit break') { | ||
|
@@ -40,8 +36,16 @@ class OverlayRaw extends React.Component { | |
10 | ||
) | ||
) | ||
break | ||
continue //break will just break the loop entirely.. if someone is deaing less damage than LB (yikes) they wouldn't end up included | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here too if you can |
||
} | ||
|
||
if(currentRow >= maxRows) continue //sadly because of the above statement we have to loop through the full data set if we want to be sure | ||
|
||
currentRow = currentRow + 1 | ||
|
||
// Send to Discord the right name in Settings | ||
if (combatant.name.toUpperCase() === 'YOU') | ||
combatant.name = this.props.config.characterName | ||
|
||
discordData.push({ | ||
job: combatant.Job, | ||
|
@@ -74,6 +78,7 @@ class OverlayRaw extends React.Component { | |
style={{ zoom: props.config.zoom }} | ||
> | ||
<Combatants | ||
isWebSocket={props.isWebSocket} | ||
data={props.Combatant} | ||
encounterDamage={props.Encounter.damage} | ||
config={props.config} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ let querieSet = undefined | |
const getHost = () => /HOST_PORT=(wss?:\/\/.+)/.exec(window.location.search) | ||
|
||
export default function initActWebSocket() { | ||
if (!getHost()) return | ||
if (!getHost()) return false | ||
var webs | ||
const url = new URLSearchParams(window.location.search) | ||
const wsUri = `${url.get('HOST_PORT')}MiniParse` || undefined | ||
|
@@ -28,6 +28,7 @@ export default function initActWebSocket() { | |
) | ||
} | ||
} | ||
return true | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we returning boolean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to identify if ACTWebSocket is in use to flip the order in a couple places, we don't want to perform regex (easiest way to check that is old chromium compatible) everytime a new render is requested and gone throguh the DPS so we pass it through here as a prop to components that need the information There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I didn't understand 😢 I'm asking why did you change this specific function to return a boolean instead of void (no value or undefined). I understood you need to check if ACTWebSocket is in use but from what I could see it's not from the value of this function, right? Or is it? |
||
class ActWebsocketInterface { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably because I changed it after, I was learning es6 at this time and didn't have a linter on - good catch though :)