Skip to content

Instantly share code, notes, and snippets.

@brian6932
Last active October 21, 2023 18:55
Show Gist options
  • Save brian6932/baa06bb8a6ee63bc8fc3f7204d291230 to your computer and use it in GitHub Desktop.
Save brian6932/baa06bb8a6ee63bc8fc3f7204d291230 to your computer and use it in GitHub Desktop.
const
fmt = num => {
if (num >= 11 && num <= 13)
return num += `th`
switch (num % 10) {
case 1:
return num += `st`
case 2:
return num += `nd`
case 3:
return num += `rd`
default:
return num += `th`
}
},
fishes = Uint16Array.of(1, 15, 21, 22, 23, 34, 41, 1406, 1443),
failEmotes = [
`PoroSad`,
`peepoSad`,
`SadLain`,
`Sadeg`,
`Sadge`,
`SadgeCry`,
`SadCat`,
`FeelsBadMan`,
`RAGEY`,
`docnotL`,
`ReallyMad`,
`PunOko`,
`SirMad`,
`SirSad`,
`KannaCry`,
`RemCry`,
`catCry`,
`PepeHands`,
`Madge`,
`reeferSad`,
`sadE`,
`NotLikeThis`,
`NLT`,
`FailFish`,
`SAJ`,
`SAJI`
],
successEmotes = [
`SUGOI`,
`LETSGO`,
`PagMan`,
`PAGLADA`,
`PAGGING`,
`PagBounce`,
`PagChomp`,
`PogU`,
`Pog`,
`PogChamp`,
`WakuWaku`,
`sheCrazy`,
`heCrazy`,
`WICKED`,
`FeelsStrongMan`,
`MUGA`,
`Wowee`,
`PogBones`,
`peepoPog`,
`peepoPag`,
`Shockisu`
],
fishing = async () => {
customData.set(`fish_total`, ~~customData.get(`fish_total`) + 1)
const dist = Math.random() * 75 | 0
if (dist) {
const unlucky = ~~customData.get(`fish_unlucky`) + 1
customData.set(`fish_unlucky`, unlucky)
if (unlucky > ~~customData.get(`fish_unlucky_record`))
customData.set(`fish_unlucky_record`, unlucky)
return `No luck... (${dist}cm away) ` + await utils.getEmote(
failEmotes.sort(() => Math.random() - .5),
``,
{ caseSensitivity: false }
)
}
let out = fishes[Math.random() * fishes.length | 0]
const len = Math.random() * out | 0 || 1
let record
if (len > ~~customData.get(`fish_len`)) {
customData.set(`fish_len`, len % fishes.at(-1))
record = `! This is a new record!`
}
else
record = `.`
let caught = customData.get(`fish`) ?? []
if (!Array.isArray(caught))
switch (typeof caught) {
case `string`:
const emojis = []
for (let emoji of caught.trim())
if (fishes.includes((emoji = emoji.codePointAt(0)) - 128010))
emojis.push(emoji)
caught = emojis
break
case `object`:
try {
caught = new Uint32Array(caught)
.filter(emoji => fishes.includes(emoji - 128010))
}
catch {
caught = []
}
break
default:
caught = [].concat(caught)
}
out += 128010
caught.push(out)
caught = caught.reduce((emojis, emoji) => {
if (!emojis.includes(emoji))
emojis.push(emoji)
return emojis
}, [])
if (caught.length > fishes.length)
return `Either a previous import failed, or I detect some cheating \u{1f4bf} Clap Let @brian6932 know`
customData.set(`fish`, caught)
const streak = ` This is the ${fmt(~~customData.get(`fish_unlucky`) + 1)} attempt since your last catch`
customData.set(`fish_unlucky`, 0)
let count = ~~customData.get(`fish_count`)
customData.set(`fish_count`, ++count)
return `You caught a ${String.fromCodePoint(out)}! This is your ${fmt(count)} fish! It is ${len}cm in length${record + streak} ` + await utils.getEmote(
successEmotes.sort(() => Math.random() - .5),
``,
{ caseSensitivity: false }
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment