Skip to content

Commit

Permalink
raffles: add keymunity tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
GGonryun committed Oct 5, 2024
1 parent accee29 commit 7a70be1
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"INDIEFOLD",
"itchio",
"Jeeble",
"Keymunity",
"Kunoichi",
"Larian",
"lastmod",
Expand Down
29 changes: 26 additions & 3 deletions apps/charity/pages/api/cron/spawn-raffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ const prizes = {
numWinners: [5, 7, 10],
imageUrl: undefined,
},
'102': {
itemId: '102',
premium: false,
numWinners: [1, 2, 3],
imageUrl: undefined,
},
'103': {
itemId: '103',
premium: false,
numWinners: [1, 1, 1, 2, 3],
imageUrl: undefined,
},
'1000': {
itemId: '1000',
premium: false,
Expand Down Expand Up @@ -104,7 +116,18 @@ const generateRaffle = (): Prisma.RaffleUncheckedCreateInput => {

const maxEntries = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];

const dropChance: PrizeId[] = ['5', '8', '1000', '4', '4', '4', '4'];
const dropChance: PrizeId[] = [
'5',
'8',
'1000',
'102',
'103',
'4',
'4',
'4',
'4',
'4',
];

const prizeId = randomArrayElement(dropChance);
const prize = prizes[prizeId];
Expand Down Expand Up @@ -156,14 +179,14 @@ const selectActions = (
]
);

if (isLucky(0.25)) {
if (isLucky(0.75)) {
actions.push({
order: 5,
reward: randomArrayElement([1, 2, 3, 4, 5]),
taskId: randomArrayElement(primarySocial),
});
}
if (isLucky(0.25)) {
if (isLucky(0.75)) {
actions.push({
order: 6,
reward: randomArrayElement([1, 2, 3, 4, 5]),
Expand Down
47 changes: 47 additions & 0 deletions libs/data/tasks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,22 @@ export const TASKS: Prisma.TaskUncheckedCreateInput[] = [
label: 'Visit Water.org',
},
},
{
version: 1,
id: 'INSTAGRAM_VISIT_KEYMUNITY_ONCE',
type: TaskType.VISIT_INSTAGRAM,
category: TaskCategory.TASK,
frequency: TaskFrequency.ONCE,
requiredRepetitions: 1,
maxRepetitions: 1,
name: 'Visit Keymunity on Instagram',
description:
'View an account on Instagram. Stay up to date on the latest news and updates.',
data: {
url: 'https://www.instagram.com/keymunityofficial',
label: 'Visit Keymunity',
},
},
// visit facebook
{
version: 2,
Expand All @@ -414,6 +430,22 @@ export const TASKS: Prisma.TaskUncheckedCreateInput[] = [
label: 'Visit Charity Games',
},
},
{
version: 1,
id: 'FACEBOOK_VISIT_KEYMUNITY_ONCE',
type: TaskType.VISIT_FACEBOOK,
category: TaskCategory.TASK,
frequency: TaskFrequency.ONCE,
requiredRepetitions: 1,
maxRepetitions: 1,
name: 'Visit Keymunity on Facebook',
description:
'View an account on Facebook. Stay up to date on the latest news and updates.',
data: {
url: 'https://www.facebook.com/share/1WAaj2zugnW45Qu2/',
label: 'Visit Keymunity',
},
},
// visit tiktok
{
version: 1,
Expand All @@ -432,6 +464,21 @@ export const TASKS: Prisma.TaskUncheckedCreateInput[] = [
},
},
// follow twitter
{
version: 1,
id: 'FOLLOW_KEYMUNITY_TWITTER_ONCE',
type: TaskType.FOLLOW_TWITTER,
category: TaskCategory.TASK,
frequency: TaskFrequency.ONCE,
requiredRepetitions: 1,
maxRepetitions: 1,
name: 'Follow Keymunity',
description:
'Follow Keymunity on Twitter. Stay up to date on the latest news and updates.',
data: {
handle: 'TheKeymunity',
},
},
{
version: 1,
id: 'FOLLOW_CHARITY_GAMES_TWITTER_ONCE',
Expand Down

0 comments on commit 7a70be1

Please sign in to comment.