Pārlūkot izejas kodu

General update

master
Noëlle pirms 4 gadiem
vecāks
revīzija
144cf10099
12 mainītis faili ar 21 papildinājumiem un 14 dzēšanām
  1. 5
    0
      .gitignore
  2. 16
    14
      metroidgen.py
  3. Binārs
      sprites/bombs.png
  4. Binārs
      sprites/energytank.png
  5. Binārs
      sprites/hijump.png
  6. Binārs
      sprites/icebeam.png
  7. Binārs
      sprites/longbeam.png
  8. Binārs
      sprites/marumari.png
  9. Binārs
      sprites/missiletank.png
  10. Binārs
      sprites/screwattack.png
  11. Binārs
      sprites/varia.png
  12. Binārs
      sprites/wavebeam.png

+ 5
- 0
.gitignore Parādīt failu

@@ -5,3 +5,8 @@ __pycache__/metroidgen.cpython-37.pyc
metroidgen.log
met-config.cfg
met-config.cfg
met-config.cfg
sprites/1774.png
sprites/1776.png
sprites/1777.png
sprites/122214.png

+ 16
- 14
metroidgen.py Parādīt failu

@@ -824,6 +824,20 @@ class MetroidState:
if i%64 == 63:
print()

def createImage(self):
pwd_chunks = self.password.split(" ") # This is safe because we'll never generate a password with a space in it
pwd_lines = []
pwd_lines.append(" ".join([pwd_chunks[0], pwd_chunks[1]]))
pwd_lines.append(" ".join([pwd_chunks[2], pwd_chunks[3]]))
newpwd = "\n".join(pwd_lines)
fnt = ImageFont.truetype('narpasfw.ttf', size=18)
img = Image.new('RGB', (300, 100))
draw = ImageDraw.Draw(img)
draw.text((50, 35), newpwd, font=fnt, fill=(190, 210, 255))
filename = 'images/{}.png'.format("".join(pwd_chunks))
img.save(filename)
return filename

class MetroidPoster(PineappleBot):

@hourly(minute=30)
@@ -834,24 +848,12 @@ class MetroidPoster(PineappleBot):
gs.createBitfield()
gs.generatePassword()
post_text = gs.toString()
img = self.createImage(gs.password)
img = gs.createImage()
media_id = self.mastodon.media_post(img, description=gs.password)
self.mastodon.status_post(post_text, visibility = "unlisted", spoiler_text = "Metroid password: {}".format(gs.password), media_ids = [media_id])
print("Metroidgen scheduled: posted {}".format(gs.password))

def createImage(self, pwd):
pwd_chunks = pwd.split(" ") # This is safe because we'll never generate a password with a space in it
pwd_lines = []
pwd_lines.append(" ".join([pwd_chunks[0], pwd_chunks[1]]))
pwd_lines.append(" ".join([pwd_chunks[2], pwd_chunks[3]]))
newpwd = "\n".join(pwd_lines)
fnt = ImageFont.truetype('narpasfw.ttf', size=18)
img = Image.new('RGB', (300, 100))
draw = ImageDraw.Draw(img)
draw.text((50, 35), newpwd, font=fnt, fill=(190, 210, 255))
filename = 'images/{}.png'.format("".join(pwd_chunks))
img.save(filename)
return filename



def main():

Binārs
sprites/bombs.png Parādīt failu


Binārs
sprites/energytank.png Parādīt failu


Binārs
sprites/hijump.png Parādīt failu


Binārs
sprites/icebeam.png Parādīt failu


Binārs
sprites/longbeam.png Parādīt failu


Binārs
sprites/marumari.png Parādīt failu


Binārs
sprites/missiletank.png Parādīt failu


Binārs
sprites/screwattack.png Parādīt failu


Binārs
sprites/varia.png Parādīt failu


Binārs
sprites/wavebeam.png Parādīt failu


Notiek ielāde…
Atcelt
Saglabāt