-
Notifications
You must be signed in to change notification settings - Fork 134
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
Ability to modify or remove the 125% trade rule #403
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks!
If you want to take this PR all the way, then address all the comments I left and push to your branch again. It's all little stuff, but let me know if you need help. Also if you don't want to do all this extra stuff, just tell me and I will do it.
Also, there are a couple other places you need to add tradeMatchingPercentage
:
- In
gameAttributes
in tools/lib/generateJSONSchema.mjs, next to all the other settings (keep this one in alphabetical order) - In
defaultSettings
in src/worker/views/newLeague.ts, next to all the other settings (this is already not in alphabetical order, so just add it belowfantasyPoints
)
key: "tradeMatchingPercentage", | ||
name: "Trade Matching Percentage", | ||
godModeRequired: "existingLeagueOnly", | ||
type: "int", |
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.
Switch this to intOrNull
so that blank is disabled, rather than 0. I think that's a little more straightforward.
@@ -101,9 +103,13 @@ const summary = async (teams: TradeTeams): Promise<TradeSummary> => { | |||
} | |||
}), | |||
); | |||
if (g.get("tradeMatchingPercentage") === 0) { |
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.
Since it was changed to intOrNull
, this should compare against null
now.
@@ -101,9 +103,13 @@ const summary = async (teams: TradeTeams): Promise<TradeSummary> => { | |||
} | |||
}), | |||
); | |||
if (g.get("tradeMatchingPercentage") === 0) { |
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.
If you return here, then the hardCapCondition
code below never runs. To fix that, add && !g.get("hardCap")
to this condition.
you to modify this. | ||
</p> | ||
|
||
<p>Set this to 0 to turn off the rule</p> |
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.
Change the text to:
<p>If you have the Hard Cap setting disabled, teams can make trades that increase their payroll beyond the salary cap. To limit the amount they can exceed the salary cap in a trade, their total incoming contracts must be less than X% of their outgoing contracts. By default this value is 125%.</p>
<p>Leave blank to disable this rule and allow any trades over the cap.</p>
import { league } from "src/worker/core"; | ||
league.loadGameAttributes(); |
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.
Delete these lines, they are not necessary and will cause errors in some situations.
|
||
// Time in milliseconds of the start of auto play |
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.
Add this back.
|
||
export type GetCopyType = "noCopyCache"; |
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.
Add this back.
@@ -507,6 +507,7 @@ export type GameAttributesLeague = { | |||
numGames: number; | |||
numGamesDiv: number | null; | |||
numGamesConf: number | null; | |||
tradeMatchingPercentage: number; |
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.
Move this down so it's in alphabetical order.
@@ -554,6 +555,7 @@ export type GameAttributesLeague = { | |||
stopOnInjury: boolean; | |||
stopOnInjuryGames: number; | |||
tiebreakers: (keyof typeof TIEBREAKERS)[]; | |||
|
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.
No need for a new line here.
@@ -994,6 +994,7 @@ export const settings: { | |||
</p> | |||
</> | |||
), | |||
|
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.
No need for a new line here.
(Screenshot rule set as 300)
(Screenshot rule set to 0)
@dumbmatter