瀏覽代碼

General update

master
Noëlle 4 年之前
父節點
當前提交
144cf10099
共有 12 個檔案被更改,包括 21 行新增14 行删除
  1. 5
    0
      .gitignore
  2. 16
    14
      metroidgen.py
  3. 二進制
      sprites/bombs.png
  4. 二進制
      sprites/energytank.png
  5. 二進制
      sprites/hijump.png
  6. 二進制
      sprites/icebeam.png
  7. 二進制
      sprites/longbeam.png
  8. 二進制
      sprites/marumari.png
  9. 二進制
      sprites/missiletank.png
  10. 二進制
      sprites/screwattack.png
  11. 二進制
      sprites/varia.png
  12. 二進制
      sprites/wavebeam.png

+ 5
- 0
.gitignore 查看文件

@@ -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 查看文件

@@ -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():

二進制
sprites/bombs.png 查看文件


二進制
sprites/energytank.png 查看文件


二進制
sprites/hijump.png 查看文件


二進制
sprites/icebeam.png 查看文件


二進制
sprites/longbeam.png 查看文件


二進制
sprites/marumari.png 查看文件


二進制
sprites/missiletank.png 查看文件


二進制
sprites/screwattack.png 查看文件


二進制
sprites/varia.png 查看文件


二進制
sprites/wavebeam.png 查看文件


Loading…
取消
儲存