mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-08 16:04:30 +00:00
adds daily challenges, posted to discord via ~~travis~~MALCO (#86)
* sets up travis for daily challenges * separate push from cron * whoops * windows env * i have no idea how to effectively test travis builds * sdgahhetheah * tests * possible fix * we'll get there one day * this is the one * trying something different * why not * sdgsgs * please? * yet another angle * why why hwhy why * oh ok this makes sense tho * i'm silly * aafasfadf * wtf is xvfb fr * screen? * testing something... * ? * idk man * timeout * is it a zip thing * this might be it * oh we're so close * quote? * alternate method to read * for the record i am definitely squashing before this gets merged * more tests * try something new * how bout this one. donk * to be clear i have no idea how bash syntax works * hmmmm * maybe this way * keep tryin * tst * verbosity * one last tiiiiiime, relax have a drink with me * one last tiiiime, and if we get this right * we're gonna teach em how to say goodbye * YOUUUU AND IIIIIIIII * (drum fill) * pick up a pen start writing * i wanna talk about what i have learned * the hard-won wisdom i have earned * i have no idea * lol * is it quotes' fault * stack echange blowing my mind rn * @filename be like * this is the one * should be the final update to daily * fix bash error Co-authored-by: duncathan <dunc@duncathan.com>
This commit is contained in:
parent
9b24429db7
commit
734f772164
23
.travis.yml
Normal file
23
.travis.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
language: bash
|
||||||
|
dist: xenial
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- xvfb
|
||||||
|
|
||||||
|
services:
|
||||||
|
- xvfb
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- sudo add-apt-repository -y ppa:bartbes/love-stable
|
||||||
|
- sudo apt-get -q update
|
||||||
|
- sudo apt-get -y install love
|
||||||
|
|
||||||
|
script:
|
||||||
|
- sudo chmod u+r+x daily.sh
|
||||||
|
- sudo ./daily.sh
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
# travis encrypt WEBHOOK=<url>
|
||||||
|
- secure: "DU2Mq4FPbOidv0Go4b+2r5Vy7v0bbQo40ZZPkiwm/6nAJYkwySwVn2DyZGwh/kV4o6ZG0IgtLxPvHiF8lVZptbtkHJTt/GeokwwvsfpHJntPC9jyvXklFkkln9h2AgWrhTmFf+EYE4Mlm7FAjsr/9ZZHCuGn7wDCOBk3g4Zy7eAyKGqpYMN3296eUiZPXWtOAexmbavFI07pmu4ZyJ8K6HMmjd8YSAQpui3zJn/hMTupQm+o5s/ehZ72QnUyjRWdKvLlJCzORrajJxgYXQqLdjXVMcq4kuR4pDRnLdW9XBlAWiHOvj7wlVOUyBq2ZyhkTTNEYiQp+9UsIua1gG0hdLiOGH2ODtrb6NvQIRUfs5jE6xHmw3hQCfIe9itT+SbVQmuuTovM/MQTS/vH7k+AHtnJCGykMjAD6evNi1EkOG5oxrL7xEGPz7lzyVISoz0O4YmMWGF0qIzb68R11+Eo1URFrEUDxZc7F2kMoeAbnTxfiGABrMXrgIN7ReJhfD1z4ik6KwKBFw9AwJfldyb5w0QgqFAkkihqKGp5VbTMR6LeSN0Tq/Ic3QRvLHYt43+eoRXS4d2lvSo/0Nf7FftQPurbLI6c/r9nckwOZmjFicwYJ0Ulrbd46og74FUQZFSMcrVsiXo1PG2yTwu9bUvTBUHWdWh0o2xPpfAHbA05++c="
|
10
daily.sh
Normal file
10
daily.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
if [ "$TRAVIS_EVENT_TYPE" != "cron" ]; then exit 0; fi
|
||||||
|
P="csrando"
|
||||||
|
mkdir target
|
||||||
|
mkdir target/src
|
||||||
|
cp -r src target
|
||||||
|
cd target/src
|
||||||
|
zip -9 -r "${P}.love" .
|
||||||
|
sudo xvfb-run --server-args="-screen 0 1024x768x24" love "${P}.love" --daily
|
||||||
|
cat daily.txt
|
||||||
|
curl -H "Content-Type: application/json" -X POST -d @daily.txt "$WEBHOOK"
|
10
src/conf.lua
10
src/conf.lua
|
@ -30,11 +30,11 @@ function love.conf(t)
|
||||||
-- This is the name of your game's executable.
|
-- This is the name of your game's executable.
|
||||||
package = 'Cave Story Randomizer',
|
package = 'Cave Story Randomizer',
|
||||||
loveVersion = '11.2',
|
loveVersion = '11.2',
|
||||||
version = nil,
|
version = 'v2.0-RC2',
|
||||||
author = 'shru',
|
author = 'duncathan',
|
||||||
email = nil,
|
email = 'dunc@duncathan.com',
|
||||||
description = nil,
|
description = 'A randomizer for Cave Story',
|
||||||
homepage = 'https://shru.itch.io/cave-story-randomizer',
|
homepage = 'https://github.com/cave-story-randomizer/cave-story-randomizer',
|
||||||
-- MacOS needs this.
|
-- MacOS needs this.
|
||||||
identifier = 'CaveStoryRandomizer',
|
identifier = 'CaveStoryRandomizer',
|
||||||
excludeFileList = {
|
excludeFileList = {
|
||||||
|
|
76
src/main.lua
76
src/main.lua
|
@ -23,8 +23,15 @@ Screen = require 'ui.draw'
|
||||||
|
|
||||||
local csdirectory
|
local csdirectory
|
||||||
|
|
||||||
function love.load()
|
function love.load(args)
|
||||||
Settings:init()
|
Settings:init()
|
||||||
|
|
||||||
|
if _.contains(args, "--daily") then
|
||||||
|
love.window.close()
|
||||||
|
U.writeFile("daily.txt", generateDaily())
|
||||||
|
love.event.quit()
|
||||||
|
return
|
||||||
|
end
|
||||||
Screen:setup()
|
Screen:setup()
|
||||||
|
|
||||||
if Settings.settings.csdirectory == "csdata" then
|
if Settings.settings.csdirectory == "csdata" then
|
||||||
|
@ -94,3 +101,70 @@ end
|
||||||
function love.draw()
|
function love.draw()
|
||||||
Screen:draw()
|
Screen:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function generateDaily()
|
||||||
|
local json = [[{"embeds": [{"title": "**Daily Challenge: %s**","color": 11323851,"fields": [{"name": "Seed","value": "%s","inline": true},{"name": "Version","value": "%s","inline": true},{"name": "Settings","value": "**Objective**: %s\n**Spawn**: %s\n**Puppysanity**: %s\n**Sequence breaks**: %s\n"},{"name": "Title Screen Code","value": "<%s> <%s> <%s> <%s> <%s> (%s/%s/%s/%s/%s)"},{"name": "<:rando:558942498668675072> Sharecode","value": "`%s`"}]}]}]]
|
||||||
|
|
||||||
|
local date = os.date("%B %d, %Y")
|
||||||
|
|
||||||
|
local function pick(t) return t[love.math.random(#t)] end
|
||||||
|
local objective = pick({{name = "Bad Ending", val = "objBadEnd"}, {name = "Normal Ending", val = "objNormalEnd"}, {name = "Best Ending", val = "objBestEnd"}, {name = "All Bosses", val = "objAllBosses"}, {name = "100%", val = "obj100Percent"}})
|
||||||
|
local spawn = pick({"Start Point", "Arthur's House", "Camp"})
|
||||||
|
local puppies = pick({{name = "Enabled", val = true}, {name = "Disabled", val = false}})
|
||||||
|
local sequence = pick({{name = "All", val = true}, {name = "None", val = false}})
|
||||||
|
|
||||||
|
Randomizer.obj = objective.val
|
||||||
|
Randomizer.worldGraph.spawn = spawn
|
||||||
|
Randomizer.puppy = puppies.val
|
||||||
|
Randomizer.worldGraph.seqbreak = sequence.val
|
||||||
|
|
||||||
|
local seed = Randomizer:_seedRngesus()
|
||||||
|
Randomizer:_updateSharecode(seed)
|
||||||
|
Randomizer:_shuffleItems()
|
||||||
|
|
||||||
|
local itemdata = {
|
||||||
|
{emoji = ":arthurkey:685845258843455501", name = "Arthur's Key"},
|
||||||
|
{emoji = ":mapsystem:685848232374567076", name = "Map System"},
|
||||||
|
{emoji = ":santakey:685848232428830790", name = "Santa's Key"},
|
||||||
|
{emoji = ":silverlocket:685848232584413185", name = "Silver Locket"},
|
||||||
|
{emoji = ":beastfang:685848232428830720", name = "Beast Fang"},
|
||||||
|
{emoji = ":lifecapsule:685848233393913946", name = "Life Capsule"},
|
||||||
|
{emoji = ":idcard:685848232295006208", name = "ID Card"},
|
||||||
|
{emoji = ":jellyfishjuice:685848232290680879", name = "Jellyfish Juice"},
|
||||||
|
{emoji = ":rustykey:685848232554791045", name = "Rusty Key"},
|
||||||
|
{emoji = ":gumkey:685848232173240381", name = "Gum Key"},
|
||||||
|
{emoji = ":gumbase:685848232336818195", name = "Gum Base"},
|
||||||
|
{emoji = ":charcoal:685848232987066409", name = "Charcoal"},
|
||||||
|
{emoji = ":explosive:685848232328560712", name = "Explosive"},
|
||||||
|
{emoji = ":puppyitem:685848232554791003", name = "Puppy"},
|
||||||
|
{emoji = ":lifepot:685848231875575868", name = "Life Pot"},
|
||||||
|
{emoji = ":cureall:685848232315715596", name = "Cure-All"},
|
||||||
|
{emoji = ":clinickey:685848232315715589", name = "Clinic Key"},
|
||||||
|
{emoji = ":booster08:685848232332492802", name = "Booster 0.8"},
|
||||||
|
{emoji = ":armsbarrier:685848232252932127", name = "Arms Barrier"},
|
||||||
|
{emoji = ":turbocharge:685848232756248614", name = "Turbocharge"},
|
||||||
|
{emoji = ":airtank:685848232311521353", name = "Curly's Air Tank"},
|
||||||
|
{emoji = ":nikumaru:685848232504590342", name = "Nikumaru Counter"},
|
||||||
|
{emoji = ":booster20:685848232299069511", name = "Booster 2.0"},
|
||||||
|
{emoji = ":mimigamask:685848232592539695", name = "Mimiga Mask"},
|
||||||
|
{emoji = ":teleportkey:685848232655716423", name = "Teleporter Room Key"},
|
||||||
|
{emoji = ":suesletter:685848232554659898", name = "Sue's Letter"},
|
||||||
|
{emoji = ":controller:685848232294613036", name = "Controller"},
|
||||||
|
{emoji = ":brokensprinkler:685848232290680898", name = "Broken Sprinkler"},
|
||||||
|
{emoji = ":sprinkler:685848232588476438", name = "Sprinkler"},
|
||||||
|
{emoji = ":towrope:685848232403927093", name = "Tow Rope"},
|
||||||
|
{emoji = ":clayfiguremedal:685848232160526375", name = "Clay Figure Medal"},
|
||||||
|
{emoji = ":mrlittle:685848232521367630", name = "Mr. Little"},
|
||||||
|
{emoji = ":mushroombadge:685848232445870111", name = "Mushroom Badge"},
|
||||||
|
{emoji = ":mapignon:685848232122777673", name = "Ma Pignon"},
|
||||||
|
{emoji = ":panties:685848232508915752", name = "Curly's Panties"},
|
||||||
|
{emoji = ":alienmedal:685848232076640298", name = "Alien Medal"},
|
||||||
|
{emoji = ":lipstick:685848232370372609", name = "Chaco's Lipstick"},
|
||||||
|
{emoji = ":whimsicalstar:685848232458190853", name = "Whimsical Star"},
|
||||||
|
{emoji = ":ironbond:685848232341143625", name = "Iron Bond"}
|
||||||
|
}
|
||||||
|
local hash = Randomizer:_generateHash()
|
||||||
|
local h = {itemdata[hash[1]], itemdata[hash[2]], itemdata[hash[3]], itemdata[hash[4]], itemdata[hash[5]]}
|
||||||
|
|
||||||
|
return json:format(date, seed, VERSION, objective.name, spawn, puppies.name, sequence.name, h[1].emoji, h[2].emoji, h[3].emoji, h[4].emoji, h[5].emoji, h[1].name, h[2].name, h[3].name, h[4].name, h[5].name, Randomizer.sharecode)
|
||||||
|
end
|
|
@ -218,9 +218,11 @@ function C:_shuffleItems(tscFiles)
|
||||||
self:_fastFillItems(optional, shuffle(self.worldGraph:getEmptyLocations()))
|
self:_fastFillItems(optional, shuffle(self.worldGraph:getEmptyLocations()))
|
||||||
self:_generateHints()
|
self:_generateHints()
|
||||||
|
|
||||||
|
if tscFiles ~= nil then
|
||||||
self.worldGraph:writeItems(tscFiles)
|
self.worldGraph:writeItems(tscFiles)
|
||||||
self.worldGraph:logLocations()
|
self.worldGraph:logLocations()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function C:_fillItems(items, locations)
|
function C:_fillItems(items, locations)
|
||||||
assert(#items > 0, ("No items provided! Trying to fill %s locations."):format(#locations))
|
assert(#items > 0, ("No items provided! Trying to fill %s locations."):format(#locations))
|
||||||
|
@ -291,6 +293,7 @@ function C:_generateHash()
|
||||||
local path = self:_getWritePath() .. '/hash.txt'
|
local path = self:_getWritePath() .. '/hash.txt'
|
||||||
local h = {love.math.random(39), love.math.random(39), love.math.random(39), love.math.random(39), love.math.random(39)}
|
local h = {love.math.random(39), love.math.random(39), love.math.random(39), love.math.random(39), love.math.random(39)}
|
||||||
U.writeFile(path, ("%04d,%04d,%04d,%04d,%04d"):format(h[1], h[2], h[3], h[4], h[5]))
|
U.writeFile(path, ("%04d,%04d,%04d,%04d,%04d"):format(h[1], h[2], h[3], h[4], h[5]))
|
||||||
|
return h
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:_getWritePath()
|
function C:_getWritePath()
|
||||||
|
|
Loading…
Reference in a new issue