Skip to content

Commit 4bea3fb

Browse files
authored
Merge pull request #746 from Pseudo-Corp/link-accounts
link accounts
2 parents aa22c88 + 4541179 commit 4bea3fb

10 files changed

Lines changed: 153 additions & 373 deletions

File tree

Synergism.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5204,6 +5204,37 @@ form input:hover {
52045204
margin-top: 5px;
52055205
}
52065206

5207+
/* Event Bonuses Dropdown Styles */
5208+
.event-bonuses-header {
5209+
display: inline-flex;
5210+
align-items: center;
5211+
gap: 6px;
5212+
margin-top: 10px;
5213+
user-select: none;
5214+
vertical-align: middle;
5215+
}
5216+
5217+
.event-bonuses-header:hover {
5218+
opacity: 0.8;
5219+
}
5220+
5221+
.event-bonuses-header .chevron {
5222+
display: inline-flex;
5223+
align-items: center;
5224+
justify-content: center;
5225+
transition: transform 0.3s ease;
5226+
font-size: 12px;
5227+
line-height: 1;
5228+
width: 14px;
5229+
height: 14px;
5230+
vertical-align: middle;
5231+
}
5232+
5233+
.event-bonuses-content {
5234+
display: block;
5235+
margin-left: 24px;
5236+
}
5237+
52075238
.pseudoUpgradeContainer {
52085239
display: grid;
52095240
grid-template-columns: repeat(4, 1fr);

src/Login.ts

Lines changed: 105 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ interface SynergismUserAPIResponse<T extends keyof AccountMetadata> {
257257
bonus: BonusTypes
258258
error?: unknown
259259
subscription: SubscriptionMetadata
260+
linkedAccounts: string[]
260261
}
261262

262263
const isDiscordAccount = (
@@ -290,15 +291,16 @@ export async function handleLogin () {
290291
personalBonus: 0,
291292
accountType: 'none',
292293
bonus: { quarks: 0 },
293-
subscription: null
294+
subscription: null,
295+
linkedAccounts: []
294296
} satisfies SynergismUserAPIResponse<'none'>
295297
),
296298
{ status: 401 }
297299
)
298300
)
299301

300302
const account = await response.json() as SynergismUserAPIResponse<keyof AccountMetadata>
301-
const { personalBonus, subscription: sub } = account
303+
const { personalBonus, subscription: sub, linkedAccounts } = account
302304

303305
setPersonalQuarkBonus(personalBonus)
304306
player.worlds = new QuarkHandler(Number(player.worlds))
@@ -354,60 +356,136 @@ export async function handleLogin () {
354356

355357
subtabElement.innerHTML = `
356358
${user ? `Hello, ${user}` : 'Hello'}!\n
357-
Your personal Quark bonus is ${format(personalBonus, 2, true)}%, computed by the following:
358-
Donator Bonuses (Multiplicative with other bonuses):
359-
<span style="color: orchid">Transcended Baller</span> [+2%] - ${hasTier1 ? checkMark(2) : exMark}
360-
<span style="color: green">Reincarnated Baller</span> [+3%] - ${hasTier2 ? checkMark(3) : exMark}
361-
<span style="color: orange">ASCENDED Baller</span> [+4%] - ${hasTier3 ? checkMark(4) : exMark}
359+
Your personal Quark bonus is ${format(personalBonus, 2, true)}%, from the following sources:
360+
361+
Subscription Bonuses:
362+
<span style="color: orchid">Transcended Baller (or higher)</span> [+2%] - ${hasTier1 ? checkMark(2) : exMark}
363+
<span style="color: green">Reincarnated Baller (or higher)</span> [+3%] - ${hasTier2 ? checkMark(3) : exMark}
364+
<span style="color: orange">ASCENDED Baller (or higher)</span> [+4%] - ${hasTier3 ? checkMark(4) : exMark}
362365
<span style="color: lightgoldenrodyellow">OMEGA Baller</span> [+5%] - ${hasTier4 ? checkMark(5) : exMark}
363366
<span style="color: #f47fff">Discord Server Booster</span> [+1%] - ${boosted ? checkMark(1) : exMark}
364367
365-
Event Bonuses:
366-
<span style="color: #ffcc00">Thanksgiving 2023</span> [+0.2%] - ${
368+
<div class="event-bonuses-header" id="eventBonusesHeader">
369+
<span class="chevron" id="eventBonusesChevron">▼</span>
370+
<span>${i18next.t('account.eventBonuses')}:</span>
371+
</div>
372+
<div class="event-bonuses-content" id="eventBonusesContent">
373+
${i18next.t('account.eventBonusMulti')}
374+
<span style="color: #ffcc00">Thanksgiving 2023</span> [+0.2%] - ${
367375
discord && account.member.roles?.includes(THANKSGIVING_2023) ? checkMark(0.2) : exMark
368376
}
369-
<span style="color: #ffcc00">Thanksgiving 2024</span> [+0.3%] - ${
377+
<span style="color: #ffcc00">Thanksgiving 2024</span> [+0.3%] - ${
370378
discord && account.member.roles?.includes(THANKSGIVING_2024) ? checkMark(0.3) : exMark
371379
}
372-
<span style="color: #ffcc00">Conductor 2023</span> [+0.3%] - ${
380+
<span style="color: #ffcc00">Conductor 2023</span> [+0.3%] - ${
373381
discord && account.member.roles?.includes(CONDUCTOR_2023) ? checkMark(0.3) : exMark
374382
}
375-
<span style="color: #ffcc00">Conductor 2024</span> [+0.4%] - ${
383+
<span style="color: #ffcc00">Conductor 2024</span> [+0.4%] - ${
376384
discord && account.member.roles?.includes(CONDUCTOR_2024) ? checkMark(0.4) : exMark
377385
}
378-
<span style="color: #ffcc00">Eight Leaf</span> [+0.3%] - ${
386+
<span style="color: #ffcc00">Eight Leaf</span> [+0.3%] - ${
379387
discord && account.member.roles?.includes(EIGHT_LEAF) ? checkMark(0.3) : exMark
380388
}
381-
<span style="color: #ffcc00">Ten Leaf</span> [+0.4%] - ${
389+
<span style="color: #ffcc00">Ten Leaf</span> [+0.4%] - ${
382390
discord && account.member.roles?.includes(TEN_LEAF) ? checkMark(0.4) : exMark
383391
}
384-
<span style="color: #ffcc00">Smith Incarnate</span> [+0.6%] - ${
392+
<span style="color: #ffcc00">Smith Incarnate</span> [+0.6%] - ${
385393
discord && account.member.roles?.includes(SMITH_INCARNATE) ? checkMark(0.6) : exMark
386394
}
387-
<span style="color: #ffcc00">Smith God</span> [+0.7%] - ${
395+
<span style="color: #ffcc00">Smith God</span> [+0.7%] - ${
388396
discord && account.member.roles?.includes(SMITH_GOD) ? checkMark(0.7) : exMark
389397
}
390-
<span style="color: #ffcc00">Golden Smith God</span> [+0.8%] - ${
398+
<span style="color: #ffcc00">Golden Smith God</span> [+0.8%] - ${
391399
discord && account.member.roles?.includes(GOLDEN_SMITH_GOD) ? checkMark(0.8) : exMark
392400
}
393-
<span style="color: #ffcc00">Diamond Smith Messiah</span> [+1%] - ${
394-
discord && account.member.roles?.includes(DIAMOND_SMITH_MESSIAH) ? checkMark(1.2) : exMark
401+
<span style="color: #ffcc00">Diamond Smith Messiah</span> [+1%] - ${
402+
discord && account.member.roles?.includes(DIAMOND_SMITH_MESSIAH) ? checkMark(1) : exMark
395403
}
404+
</div>
396405
397406
And Finally...
398407
<span style="color: lime"> Being <span style="color: lightgoldenrodyellow"> YOURSELF! </span></span> [+1%] - ${
399408
checkMark(1)
400409
}
410+
`.trim()
401411

402-
The current maximum is 16%, by being a Discord server booster and an OMEGA Baller!
412+
const allPlatforms = ['discord', 'patreon']
413+
const unlinkedPlatforms = allPlatforms.filter((platform) => !linkedAccounts.includes(platform))
414+
415+
if (unlinkedPlatforms.length > 0) {
416+
const linkAccountsSection = document.createElement('div')
417+
418+
const buttonContainer = document.createElement('div')
419+
buttonContainer.style.display = 'flex'
420+
buttonContainer.style.flexWrap = 'wrap'
421+
buttonContainer.style.gap = '10px'
422+
buttonContainer.style.marginTop = '10px'
423+
buttonContainer.style.justifyContent = 'center'
424+
425+
const platformConfig = {
426+
discord: {
427+
label: 'Link Discord',
428+
color: '#5865F2',
429+
logo:
430+
`<svg width="20" height="20" viewBox="0 0 71 55" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle; margin-right: 8px;">
431+
<path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z" fill="white"/>
432+
</svg>`
433+
},
434+
patreon: {
435+
label: 'Link Patreon',
436+
color: '#FF424D',
437+
logo:
438+
`<svg width="20" height="20" viewBox="0 0 436 476" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle; margin-right: 8px;">
439+
<path d="M436 143.371C436 64.203 373.797 2 294.629 2C215.461 2 153.258 64.203 153.258 143.371C153.258 222.539 215.461 284.742 294.629 284.742C373.797 284.742 436 222.539 436 143.371ZM0 474H74.8139V2H0V474Z" fill="white"/>
440+
</svg>`
441+
}
442+
}
403443

404-
More will be incorporated both for general accounts and supporters of the game shortly.
405-
Become a supporter of development via the link below, and get special bonuses,
406-
while also improving the Global Bonus for all to enjoy!
407-
<a href="https://www.patreon.com/synergism" target="_blank" rel="noopener noreferrer nofollow">
408-
<span style="color: lightgoldenrodyellow">--> PATREON <--</span>
409-
</a>
410-
`.trim()
444+
for (const platform of unlinkedPlatforms) {
445+
const config = platformConfig[platform as keyof typeof platformConfig]
446+
const button = document.createElement('button')
447+
button.innerHTML = `${config.logo}${config.label}`
448+
button.style.padding = '10px 20px'
449+
button.style.cursor = 'pointer'
450+
button.style.backgroundColor = config.color
451+
button.style.color = 'white'
452+
button.style.border = 'none'
453+
button.style.borderRadius = '5px'
454+
button.style.fontSize = '14px'
455+
button.style.fontWeight = 'bold'
456+
button.style.display = 'flex'
457+
button.style.alignItems = 'center'
458+
button.style.transition = 'opacity 0.2s'
459+
button.addEventListener('mouseenter', () => {
460+
button.style.opacity = '0.85'
461+
})
462+
button.addEventListener('mouseleave', () => {
463+
button.style.opacity = '1'
464+
})
465+
button.addEventListener('click', () => {
466+
window.open(`https://synergism.cc/login?with=${platform}&link=true`, '_blank')
467+
})
468+
buttonContainer.appendChild(button)
469+
}
470+
471+
linkAccountsSection.appendChild(buttonContainer)
472+
subtabElement.appendChild(linkAccountsSection)
473+
}
474+
475+
// Add event listener for event bonuses dropdown toggle
476+
const eventBonusesHeader = DOMCacheGetOrSet('eventBonusesHeader')
477+
const eventBonusesContent = DOMCacheGetOrSet('eventBonusesContent')
478+
const eventBonusesChevron = DOMCacheGetOrSet('eventBonusesChevron')
479+
480+
eventBonusesContent.style.display = 'none'
481+
eventBonusesChevron.style.transform = 'rotate(-90deg)'
482+
483+
eventBonusesHeader.style.cursor = 'pointer'
484+
eventBonusesHeader.addEventListener('click', () => {
485+
const isCollapsed = eventBonusesContent.style.display === 'none'
486+
eventBonusesContent.style.display = isCollapsed ? 'block' : 'none'
487+
eventBonusesChevron.style.transform = isCollapsed ? 'rotate(0deg)' : 'rotate(-90deg)'
488+
})
411489
} else if (!hasAccount(account)) {
412490
// User is not logged in
413491
subtabElement.querySelector('#open-register')?.addEventListener('click', () => {

src/mock/browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,8 @@ export const worker = setupWorker(
14141414
bonus: {
14151415
quarkBonus: 5
14161416
},
1417-
subscription: null
1417+
subscription: null,
1418+
linkedAccounts: ['email']
14181419
})
14191420
}),
14201421
...GETHandlers,

translations/da.json

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -486,58 +486,8 @@
486486
}
487487
},
488488
"ants": {
489-
"upgrades": {
490-
"1": "Promotes romance and unity within the colony. [+12% Ant Speed / level]",
491-
"2": "Sweetens crumbs to increase their value [Each level increases Crumb --> Coin Conversion efficiency, up to ^50,000,000]",
492-
"3": "Swarms the Taxman into submission [Up to -99.5% taxes!]",
493-
"4": "Scares you into running faster [up to x20]",
494-
"5": "Imitates your body through magic shape-shifting powers [up to x40]",
495-
"6": "Tries to please Ant God... but fails [Additional Offerings!]",
496-
"7": "Helps you build a few things here and there [+3% Building Cost Delay / level, Cap 9,999,999%]",
497-
"8": "Knows how to salt and pepper food [Up to 1,000x Rune EXP!]",
498-
"9": "Can make your message to Ant God a little more clear [+1 all Rune Levels / level, Cap 10 Million]",
499-
"10": "Has big brain energy [Additional Obtainium!]",
500-
"11": "A valuable offering to the Ant God [Gain up to 3x Sacrifice Rewards!]",
501-
"12": "Betray Ant God increasing the fragility of your dimension [Unlocks ant talisman, Up to 2x faster timers on most things]"
502-
},
503-
"descriptions": {
504-
"1": "Gain a Worker Ant for your everyday life. Gathers Galactic Crumbs. Essential!",
505-
"2": "Gain a Breeder Ant that produces Worker Ants automatically!",
506-
"3": "Gain a Meta-breeder Ant that produces Breeder Ants automatically!",
507-
"4": "Gain a Mega-breeder Ant that produces Meta-breeder Ants automatically!",
508-
"5": "Gain a Queen Ant that produces Mega-breeder Ants automatically!",
509-
"6": "Gain a Lord Royal Ant that produces Queen Ants automatically!",
510-
"7": "Gain an ALMIGHTY ANT that produces Lord Royal Ants automatically!",
511-
"8": "Gain a DISCIPLE OF ANT GOD that produces ALMIGHTY ANTS automatically!"
512-
},
513-
"generates": {
514-
"1": "Generates {{x}} Crumbs/sec",
515-
"2": "Generates {{x}} Workers/sec",
516-
"3": "Generates {{x}} Breeders/sec",
517-
"4": "Generates {{x}} MetaBreeders/sec",
518-
"5": "Generates {{x}} MegaBreeders/sec",
519-
"6": "Generates {{x}} Queens/sec",
520-
"7": "Generates {{x}} Royals/sec",
521-
"8": "Generates {{x}} ALMIGHTIES/sec"
522-
},
523-
"rewards": {
524-
"1": "CURRENT EFFECT: ALL Ants work at {{x}}x speed.",
525-
"2": "CURRENT EFFECT: Crumb --> Coin exponent is ^{{x}}",
526-
"3": "CURRENT EFFECT: Tax growth is multiplied by {{x}}",
527-
"4": "CURRENT EFFECT: Accelerator Boosts +{{x}}%",
528-
"5": "CURRENT EFFECT: Multipliers +{{x}}%",
529-
"6": "CURRENT EFFECT: Offerings x{{x}}",
530-
"7": "CURRENT EFFECT: Building Costs scale {{x}}% slower!",
531-
"8": "CURRENT EFFECT: Rune EXP is multiplied by {{x}}!",
532-
"9": "CURRENT EFFECT: Each rune has +{{x}} effective levels.",
533-
"10": "CURRENT EFFECT: Obtainium x{{x}}",
534-
"11": "CURRENT EFFECT: Sacrificing is {{x}}x as effective",
535-
"12": "CURRENT EFFECT: Global timer is sped up by a factor of {{x}}"
536-
},
537489
"header": "The ants welcome you to their home.",
538490
"hover": "Hover over the icons for description. Click icons to buy!",
539-
"youHaveGalacticCrumbs": "You have {{x}} Galactic Crumbs [{{y}}/s], providing a {{z}} Coin Multiplier",
540-
"owned": "Owned: {{x}} [+{{y}}]",
541491
"costGalacticCrumbs": "Cost: {{x}} Galactic Crumbs",
542492
"costParticles": "Cost: {{x}} Particles",
543493
"autoSacrificeOn": "Auto Sacrifice: ON",
@@ -548,10 +498,8 @@
548498
"yourAntELO": "<<plum|Your Ant ELO is>> <<gold|{{x}}>> [{{y}} effective]",
549499
"upgradeMultiplier": "Upgrade Multiplier: <<gold|{{x}}x>>",
550500
"timeMultiplier": "Time Multiplier: <<var(--lightseagreen-text-color);|{{x}}x>>",
551-
"resetAnthill": "Reset Anthill features for:",
552501
"antSacMultiplier": "Ant Sacrifice Multiplier: {{y}}x --> <<limegreen|x{{x}}>>",
553-
"autoReset": "This resets your Crumbs, Ants and Ant Upgrades in exchange for some multiplier and resources. Continue?",
554-
"elo": "+{{x}} [>{{y}} ELO]"
502+
"autoReset": "This resets your Crumbs, Ants and Ant Upgrades in exchange for some multiplier and resources. Continue?"
555503
},
556504
"challenges": {
557505
"1": {
@@ -2396,7 +2344,6 @@
23962344
"confirm": "Confirm",
23972345
"intro": "The most rewarding ventures are those few would dare to embark.",
23982346
"traitInfo": "Select the trait levels you wish to run with. Choose wisely! <<var(--red-text-color)|Don't bite off more than you can chew...>>",
2399-
"antExponent": "This Ascension's climate raises Ant production to the power of <<var(--darkorchid-text-color)|{{exponent}}>>.",
24002347
"spiritBonus": "However, it also multiplies Rune Spirit Effects by <<wheat|{{multiplier}}>>.",
24012348
"corruptionBank": "You have <<var(--crimson-text-color)|{{number}}>> Wow! Cubes in the Ascension bank. Gain more by finishing Challenges! Ascend to redeem them.",
24022349
"corruptionScore": "Your Ascension Score is <<goldenrod|{{ascScore}}>></span> (base) * <<var(--crimson-text-color)|{{corrMult}}>> (Corruption mult) * <<var(--orchid-text-color)|{{bonusMult}}>> (Bonus mult) = <<var(--darkorchid-text-color)|{{totalScore}}>>",

translations/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7377,7 +7377,9 @@
73777377
"noSaveFound": "No save found with that ID. Try reloading the page.",
73787378
"downloadComplete": "Download complete",
73797379
"deletedSave": "\"{{name}}\" was deleted",
7380-
"notDeleted": "Your save wasn't deleted. Check the console for more information."
7380+
"notDeleted": "Your save wasn't deleted. Check the console for more information.",
7381+
"eventBonuses": "Event Bonuses",
7382+
"eventBonusMulti": "<<cyan|♔>> Your total Event Bonus is <<gold|multiplicative>> to your total Subscription Bonus."
73817383
},
73827384
"pseudoCoins": {
73837385
"coinCount": "You have <<gold|{{amount}} PseudoCoins>>!",

0 commit comments

Comments
 (0)