# 飛船 ``` import pygame import random import os FPS = 60 WIDTH = 500 HEIGHT = 600 BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) YELLOW = (255, 255, 0) # 遊戲初始化 and 創建視窗 pygame.init() pygame.mixer.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("那可玹玹的遊戲") clock = pygame.time.Clock() # 載入圖片 background_img = pygame.image.load(os.path.join("img", "background1.jpg")).convert() player_img = pygame.image.load(os.path.join("img", "player.png")).convert() player_mini_img = pygame.transform.scale(player_img, (25, 19)) player_mini_img.set_colorkey(BLACK) pygame.display.set_icon(player_mini_img) bullet_img = pygame.image.load(os.path.join("img", "bullet.png")).convert() rock_imgs = [] for i in range(7): rock_imgs.append(pygame.image.load(os.path.join("img", f"rock{i}.png")).convert()) expl_anim = {} expl_anim['lg'] = [] expl_anim['sm'] = [] expl_anim['player'] = [] for i in range(9): expl_img = pygame.image.load(os.path.join("img", f"expl{i}.png")).convert() expl_img.set_colorkey(BLACK) expl_anim['lg'].append(pygame.transform.scale(expl_img, (75, 75))) expl_anim['sm'].append(pygame.transform.scale(expl_img, (30, 30))) player_expl_img = pygame.image.load(os.path.join("img", f"player_expl{i}.png")).convert() player_expl_img.set_colorkey(BLACK) expl_anim['player'].append(player_expl_img) power_imgs = {} power_imgs['shield'] = pygame.image.load(os.path.join("img", "shield.png")).convert() power_imgs['gun'] = pygame.image.load(os.path.join("img", "gun.png")).convert() font_name = os.path.join("font.ttf") def draw_text(surf, text, size, x, y): font = pygame.font.Font(font_name, size) text_surface = font.render(text, True, WHITE) text_rect = text_surface.get_rect() text_rect.centerx = x text_rect.top = y surf.blit(text_surface, text_rect) def new_rock(): r = Rock() all_sprites.add(r) rocks.add(r) def draw_health(surf, hp, x, y): if hp < 0: hp = 0 BAR_LENGTH = 100 BAR_HEIGHT = 10 fill = (hp/100)*BAR_LENGTH outline_rect = pygame.Rect(x, y, BAR_LENGTH, BAR_HEIGHT) fill_rect = pygame.Rect(x, y, fill, BAR_HEIGHT) pygame.draw.rect(surf, GREEN, fill_rect) pygame.draw.rect(surf, WHITE, outline_rect, 2) def draw_lives(surf, lives, img, x, y): for i in range(lives): img_rect = img.get_rect() img_rect.x = x + 32*i img_rect.y = y surf.blit(img, img_rect) def draw_init(): screen.blit(background_img, (0,0)) draw_text(screen, '小行星體驗', 64, WIDTH/2, HEIGHT/4) draw_text(screen, '左右移動飛船,然後發射不出子彈~', 22, WIDTH/2, HEIGHT/2) draw_text(screen, '左右鍵開始遊戲', 18, WIDTH/2, HEIGHT*3/4) pygame.display.update() waiting = True while waiting: clock.tick(FPS) # 取得輸入 for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() return True elif event.type == pygame.KEYDOWN: waiting = False return False class Player(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.image = pygame.transform.scale(player_img, (50, 38)) self.image.set_colorkey(BLACK) self.rect = self.image.get_rect() self.radius = 20 # pygame.draw.circle(self.image, RED, self.rect.center, self.radius) self.rect.centerx = WIDTH / 2 self.rect.bottom = HEIGHT - 10 self.speedx = 8 self.health = 100 self.lives = 3 self.hidden = False self.hide_time = 0 self.gun = 1 self.gun_time = 0 def update(self): now = pygame.time.get_ticks() if self.gun > 1 and now - self.gun_time > 5000: self.gun -= 1 self.gun_time = now if self.hidden and now - self.hide_time > 1000: self.hidden = False self.rect.centerx = WIDTH / 2 self.rect.bottom = HEIGHT - 10 key_pressed = pygame.key.get_pressed() if key_pressed[pygame.K_RIGHT]: self.rect.x += self.speedx if key_pressed[pygame.K_LEFT]: self.rect.x -= self.speedx if self.rect.right > WIDTH: self.rect.right = WIDTH if self.rect.left < 0: self.rect.left = 0 def shoot(self): if not(self.hidden): if self.gun == 1: bullet = Bullet(self.rect.centerx, self.rect.top) all_sprites.add(bullet) bullets.add(bullet) elif self.gun >=2: bullet1 = Bullet(self.rect.left, self.rect.centery) bullet2 = Bullet(self.rect.right, self.rect.centery) all_sprites.add(bullet1) all_sprites.add(bullet2) bullets.add(bullet1) bullets.add(bullet2) def hide(self): self.hidden = True self.hide_time = pygame.time.get_ticks() self.rect.center = (WIDTH/2, HEIGHT+500) def gunup(self): self.gun += 1 self.gun_time = pygame.time.get_ticks() class Rock(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.image_ori = random.choice(rock_imgs) self.image_ori.set_colorkey(BLACK) self.image = self.image_ori.copy() self.rect = self.image.get_rect() self.radius = int(self.rect.width * 0.85 / 2) # pygame.draw.circle(self.image, RED, self.rect.center, self.radius) self.rect.x = random.randrange(0, WIDTH - self.rect.width) self.rect.y = random.randrange(-180, -100) self.speedy = random.randrange(2, 5) self.speedx = random.randrange(-3, 3) self.total_degree = 0 self.rot_degree = random.randrange(-3, 3) def rotate(self): self.total_degree += self.rot_degree self.total_degree = self.total_degree % 360 self.image = pygame.transform.rotate(self.image_ori, self.total_degree) center = self.rect.center self.rect = self.image.get_rect() self.rect.center = center def update(self): self.rotate() self.rect.y += self.speedy self.rect.x += self.speedx if self.rect.top > HEIGHT or self.rect.left > WIDTH or self.rect.right < 0: self.rect.x = random.randrange(0, WIDTH - self.rect.width) self.rect.y = random.randrange(-100, -40) self.speedy = random.randrange(2, 10) self.speedx = random.randrange(-3, 3) class Bullet(pygame.sprite.Sprite): def __init__(self, x, y): pygame.sprite.Sprite.__init__(self) self.image = bullet_img self.image.set_colorkey(BLACK) self.rect = self.image.get_rect() self.rect.centerx = x self.rect.bottom = y self.speedy = -10 def update(self): self.rect.y += self.speedy if self.rect.bottom < 0: self.kill() class Explosion(pygame.sprite.Sprite): def __init__(self, center, size): pygame.sprite.Sprite.__init__(self) self.size = size self.image = expl_anim[self.size][0] self.rect = self.image.get_rect() self.rect.center = center self.frame = 0 self.last_update = pygame.time.get_ticks() self.frame_rate = 50 def update(self): now = pygame.time.get_ticks() if now - self.last_update > self.frame_rate: self.last_update = now self.frame += 1 if self.frame == len(expl_anim[self.size]): self.kill() else: self.image = expl_anim[self.size][self.frame] center = self.rect.center self.rect = self.image.get_rect() self.rect.center = center class Power(pygame.sprite.Sprite): def __init__(self, center): pygame.sprite.Sprite.__init__(self) self.type = random.choice(['shield', 'gun']) self.image = power_imgs[self.type] self.image.set_colorkey(BLACK) self.rect = self.image.get_rect() self.rect.center = center self.speedy = 3 def update(self): self.rect.y += self.speedy if self.rect.top > HEIGHT: self.kill() # 遊戲迴圈 show_init = True running = True while running: if show_init: close = draw_init() if close: break show_init = False all_sprites = pygame.sprite.Group() rocks = pygame.sprite.Group() bullets = pygame.sprite.Group() powers = pygame.sprite.Group() player = Player() all_sprites.add(player) for i in range(8): new_rock() score = 0 clock.tick(FPS) # 取得輸入 for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: player.shoot() # 更新遊戲 all_sprites.update() # 判斷石頭 子彈相撞 hits = pygame.sprite.groupcollide(rocks, bullets, True, True) for hit in hits: score += hit.radius expl = Explosion(hit.rect.center, 'lg') all_sprites.add(expl) if random.random() > 0.9: pow = Power(hit.rect.center) all_sprites.add(pow) powers.add(pow) new_rock() # 判斷石頭 飛船相撞 hits = pygame.sprite.spritecollide(player, rocks, True, pygame.sprite.collide_circle) for hit in hits: new_rock() player.health -= hit.radius * 2 expl = Explosion(hit.rect.center, 'sm') all_sprites.add(expl) if player.health <= 0: death_expl = Explosion(player.rect.center, 'player') all_sprites.add(death_expl) player.lives -= 1 player.health = 100 player.hide() # 判斷寶物 飛船相撞 hits = pygame.sprite.spritecollide(player, powers, True) for hit in hits: if hit.type == 'shield': player.health += 20 if player.health > 100: player.health = 100 elif hit.type == 'gun': player.gunup() if player.lives == 0 and not(death_expl.alive()): show_init = True # 畫面顯示 screen.fill(BLACK) screen.blit(background_img, (0,0)) all_sprites.draw(screen) draw_text(screen, str(score), 18, WIDTH/2, 10) draw_health(screen, player.health, 5, 15) draw_lives(screen, player.lives, player_mini_img, WIDTH - 100, 15) pygame.display.update() pygame.quit() ``` # starsong ``` # import import pyautogui import time import pyperclip import datetime import random # list chinese = ["國文課好無聊", "國文課真的好無聊", " 想睡覺", "想睡", "窩討厭國文課", "你在幹嘛呀~~", "國文課窩好累~"]## 不用語助詞 english = ["窩不想上英文", "真的好無聊", " 想睡覺", "窩討厭英文課", "你在幹嘛呀~~", "英文課窩好累~"]## 不用語助詞 painting = ["好想睡覺", "畫畫好難....", "我好無聊", "你在幹嘛"] pe = ["體育課不想動", "窩不想打球球", "擬在幹嘛", "想你了"] music = ["又是一節自習課", "你有沒有認真讀書", "你在幹嘛"] goodmorning = ["早安", "早安安", "古摸擬", "早安", "早安安", "早安早安",] goodafternoon = ["午安", "午安安", "午安", "午安安", "午安午安",] endings = ["阿~", "呀~", "啊~", "阿~~", "呀~~", "啊~~"] afternoon_sleeping_endings = ["囉~", "囉~~", "了~", "了~~"] name = ["1020256", "oilio", "牽牛花", "迷迷", "那可玹玹"] account = ["yoyo222rocketmail", "kevin327mail200", "yayamikimo", "johokimo", "linshixuan0621"] password = ["1234abcd", "kevin19910903", "123abc", "123abc", "902536441shane"] guild1_purchase = [1100, 850, 600, 850, 1100, 600] guild2_purchase = [400, 530, 650, 650, 650, 400] guild3_purchase = [1100, 850, 600] guild4_purchase = [400, 530, 400] fate1 = [650, 650, 650, 650, 650, 1219] fate2 = [600, 660, 660, 730, 710, 291] # function ## action of Instagram ### 預處理 def proceeding(): pyautogui.press('win')# 開啟Windows開始選單 ts(0.5) take(1547, 1027) ts(0.5) pyautogui.write('Microsoft Edge')# 輸入Edge的程式名稱 ts(0.5) pyautogui.press('enter') ts(5)# 等待Edge程式開啟 take(805, 798)# 點IG ts(3) take(1547, 1027) ts(10) ### 複製訊息到對話框 def push_back(): pyautogui.hotkey('ctrl', 'v') ts(1) ### 傳送訊息 def send_the_message(): take(1560, 975) ts(3) ### 關閉Micosof Edge def left(): take(1662, 9) ts(1) take(1547, 1027) ts(3) ### 點擊對話框 def table_box(): take(627, 973) ts(3) take(1547, 1027) ### 訊息愛心 def message_love(): for i in range(2): take(577, 901) ## 表情符號 def open_emoji(): take(510, 970) ts(3) def crying_smile(): take(535, 671) ts(3) def smile_love(): take(662, 720) ts(3) def crying(): take(750, 716) ts(3) def fire(): take(742, 666) ts(3) def regret(): take(665, 674) ts(3) def fire_work(): take(788, 672) ts(3) def smile_regert(): take(753, 798) ts(3) def love(): take(1560, 975) ts(3) ## 星曲fundemental def take(n, m): ### 滑鼠移動至 pyautogui.click(x = n, y = m) ts(0.125) def ts(n): time.sleep(n) def double_click(): ### 打開應用程式 for i in range(2): take(800, 150) time.sleep(20) now = time.localtime() print("「打開星曲」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) def put_my_account(): ### 輸入帳號、密碼 take(977, 634) ts(3) take(1025, 626) ts(3) take(1542, 1030) ts(3) pyautogui.write(account[tmp]) ts(3) take(943, 675) ts(3) pyautogui.write(password[tmp]) ts(3) take(1142, 651) ts(5) pyautogui.moveTo(900, 664) ts(1) pyautogui.mouseDown() ts(1) pyautogui.moveTo(1121, 649) ts(1) pyautogui.mouseUp() time.sleep(20) take(1148, 475) ts(6) take(1542, 1030) ts(6) take(1287, 195) ts(80) now = time.localtime() print("「輸入帳號密碼」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 命運輪盤 def fate(): take(1175, 966) ts(10) take(650, 450) ts(10) for i in range(3): take(1030, 486) ts(5) take(965, 444) ts(10) take(fate1[2*i], fate2[2*i]) ts(5) take(fate1[2*i+1], fate2[2*i+1]) ts(5) now = time.localtime() print("「命運轉盤」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 地下迷宮 def open_maze(): take(400, 500) ts(4) now = time.localtime() print("「魔法酒館」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) def underground_maze_first(): take(960, 600) ts(5) take(1000, 700) ts(5) take(1000, 600) ts(5) now = time.localtime() print("「地下迷宮掃蕩」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) def underground_maze_second(): take(950, 700) ts(1) take(100, 300) ts(200) take(975, 390) now = time.localtime() print("「地下迷宮闖關」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 深淵迷宮 def abyss_maze_first(): take(500, 500) ts(4) take(960, 600) ts(4) take(1000, 700) ts(4) take(1000, 600) ts(4) now = time.localtime() print("「深淵迷宮掃蕩」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) def abyss_maze_second(): take(500, 500) ts(4) take(1080, 670) ts(4) take(750, 550) ts(4) take(1160, 315) ts(4) now = time.localtime() print("「深淵迷宮重置」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 時光寶箱 def time_treasure(): take(325, 150) ts(4) take(800, 500) ts(4) take(810, 610) ts(4) take(1035, 380) ts(4) now = time.localtime() print("「時光寶箱」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 前往農場 def go_to_farm(): take(1141, 316) ts(5) take(1074, 672) ts(5) now = time.localtime() print("「前往農場」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 抓蟲、除草 def you_root(): for i in range(4): #### 回到我的農場、進入牧場 if(i == 2): take(1100, 750) ts(3) take(720, 320) ts(3) #### 回到第一頁 if(i == 2): take(1050, 655) for j in range(11): #### 換人、一鍵收成 take(1124, 340+27*j) time.sleep(3) take(1141, 695) take(1172, 655) now = time.localtime() print("「幫助別人種植」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 種植 def my_root(): take(1142, 755) ts(2) take(1141, 719) ts(2) take(596, 741) ts(2) take(1225, 401) ts(2) #### 18棵植物 take(591, 488) ts(2) take(530, 532) ts(2) take(462, 560) ts(2) take(555, 601) ts(2) take(584, 567) ts(2) take(646, 513) ts(2) take(713, 562) ts(2) take(664, 606) ts(2) take(606, 639) ts(2) take(679, 665) ts(2) take(735, 636) ts(2) take(792, 598) ts(2) take(861, 636) ts(2) take(801, 665) ts(2) take(747, 697) ts(2) take(817, 741) ts(2) take(871, 702) ts(2) take(936, 669) ts(2) now = time.localtime() print("「種植物」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 離開農場 def leave_farm(): take(1247, 254) ts(3) take(1224, 263) now = time.localtime() print("「離開農場」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 簽到 def check_in(): #### 結束掃蕩、關頁面 take(1000, 600) take(1115, 275) take(50, 235) ts(2) take(800, 500) ts(2) take(1115, 275) ts(2) now = time.localtime() print("「簽到」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 經驗找回 def experience_recovery(): take(59, 396) ts(5) take(1020, 529) ts(2) now = time.localtime() print("「經驗找回」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 遠征獎勵 def expedition_reward(): take(900, 60) ts(10) take(820, 550) ts(5) now = time.localtime() print("「遠征獎勵」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 登陸獎勵 def login_bonus(): take(1200, 50) ts(5) take(985, 400 + current_day * 50) ts(3) take(1030, 315) ts(3) now = time.localtime() print("「登陸獎勵」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 防BUG def defense_bug(): take(1165, 250) take(1270, 230) take(842, 585) take(1065, 340) take(1214, 288) take(1195, 295) take(820, 550) now = time.localtime() print("「防BUG」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 魔法酒館 def magic_tavern(): take(650, 550) ts(5) take(1100, 750) ts(5) for i in range(5): take(400, 300+100*i) ts(5) for _ in range(2): take(700, 430) ts(3) take(600, 700) ts(3) take(1250, 750) ts(3) take(1300, 250) ts(3) take(1225, 240) now = time.localtime() print("「魔法酒館」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 戰役 def challenging(): take(1650, 875) ts(5) take(1100, 500) ts(5) take(1000, 580) ts(2) take(1020, 447) ts(2) take(1542, 1030) ts(2) pyautogui.write("10") take(1542, 1030) ts(2) take(970, 625) ts(5) now = time.localtime() print("「戰役」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 英靈競技獎勵 def Heroes_reward(): if current_day == 0: take(900, 60) ts(5) take(842, 585) now = time.localtime() print("「英靈獎勵」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) else: now = time.localtime() print("跳過「英靈獎勵」,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 公會商城 def rich_donate(): take(1100, 600) ts(20) for i in range(len(guild2_purchase)): if(i == 0 or i == 5): take(886, 703) ts(1) take(guild1_purchase[i], guild2_purchase[i]) ts(5) take(841, 547) ts(2) take(1540, 1037) pyautogui.write("100") ts(2) take(1540, 1037) take(827, 627) ts(2) take(1157, 257) def poor_donate(): take(1100, 600) ts(20) for i in range(len(guild3_purchase)): if(i == 0 or i == 2): take(886, 703) ts(3) take(guild3_purchase[i], guild4_purchase[i]) ts(5) take(841, 547) ts(2) take(1540, 1037) pyautogui.write("100") ts(2) take(1540, 1037) take(827, 627) ts(2) take(1157, 257) ### 公會 def guild(): #### 點開 take(1607, 974) ts(10) ##### 公會玩法 if(tmp == 5): take(950, 280) else: take(825, 280) ts(2) #### 公會寶箱 take(1200, 700) ts(2) take(1081, 472) ts(2) take(550, 495) ts(2) for _ in range(2): take(1081, 472) ts(2) take(549, 542) for _ in range(2): take(1081, 472) ts(2) take(1191, 294) ts(2) ##### 公會建築 if(tmp == 5): take(825, 280) else: take(700, 276) ts(1) take(1154, 384) ts(1) for _ in range(2): take(1100, 399) ts(1) take(1200, 300) ts(1) #### 公會商城 poor_donate() #### 公會捐款 if(tmp != 3 and tmp != 4): take(456, 284) ts(1) take(512, 740) ts(1) take(1002, 549) ts(1) take(1540, 1037) ts(1) pyautogui.write("4000000") ts(1) take(1540, 1037) ts(1) take(1107, 553) ts(1) take(1172, 321) ts(1) #### 關閉 take(1310, 237) ts(1) now = time.localtime() print("「公會」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 地圖 def maps(): take(1569, 521) ts(3) now = time.localtime() print("「點開地圖」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 英靈競技 def Heroes(): take(875, 385) ts(80) take(771, 604) ts(10) take(825, 700) ts(180) now = time.localtime() print("「英靈競技」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 內城/天空之城 def change_scene(): take(1586, 62) ts(10) now = time.localtime() print("「切換場景」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 徵收 def recruitment(): take(465, 224) ts(5) for _ in range(5): take(1074, 564) take(1140, 420) now = time.localtime() print("「徵收」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 種樹 def rooting(): go_to_farm() ts(5) take(1100, 700) ts(5) you_root() leave_farm() now = time.localtime() print("「種樹」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 英靈遠征 def Heroes_Crusade(): take(892, 373) ####地圖上的座標 ts(5) take(800, 600) ts(2) take(1100, 700) ts(3) take(800, 700) ts(3) take(800, 700) ts(3) take(950, 550) ts(2) now = time.localtime() print("「英靈遠征」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 關閉 def ending(): take(1650, 20) ts(5) now = time.localtime() print("「關閉」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ### 星曲關閉 def starsong_close(): take(1660, 5) ts(3) take(800, 680) take(800, 670) take(800, 660) take(800, 650) take(800, 640) take(800, 630) take(800, 620) take(800, 610) take(800, 600) take(800, 590) take(800, 580) now = time.localtime() print("「星曲關閉」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) ## Instagram exceeding def send_good_morning_message(): ### 預處理 random_goodmorning = random.randint(0, len(goodmorning)-1) message = goodmorning[random_goodmorning] endings_number = random.randint(0, len(endings)-1) ### 進入、點擊對話框、處理主文字 table_box() pyperclip.copy(message) push_back() ### 處理語助詞 message = endings[endings_number] pyperclip.copy(message) push_back() ### 傳送、愛心、離開 send_the_message() love() left() def send_good_afternoon_message(): ### 預處理 random_goodafternoon = random.randint(0, len(goodafternoon)-1) message = goodafternoon[random_goodafternoon] endings_number = random.randint(0, len(endings)-1) ### 進入、點擊對話框、處理主文字 table_box() pyperclip.copy(message) push_back() ### 處理語助詞 message = endings[endings_number] pyperclip.copy(message) push_back() ### 傳送、愛心、離開 send_the_message() love() message_love() left() def send_good_night_message(): message = "晚安~~" ### 進入、點擊對話框、處理主文字 table_box() pyperclip.copy(message) push_back() ### 傳送、愛心、離開 send_the_message() love() left() def send_chinese_bored_message(): ###預處理 random_chinese = random.randint(0, len(chinese)-1) message = chinese[random_chinese] endings_number = random.randint(0, len(endings)-1) ### 進入、點擊對話框、處理主文字 proceeding() table_box() pyperclip.copy(message) push_back() ### 傳送訊息、離開 send_the_message() left() ts(180) def send_painting_interesting_message(): ###預處理 random_painting = random.randint(0, len(painting)-1) message = painting[random_painting] endings_number = random.randint(0, len(endings)-1) ### 進入、點擊對話框、處理主文字 proceeding() table_box() pyperclip.copy(message) push_back() ### 處理語助詞 if(random_painting != 1): message = endings[endings_number] pyperclip.copy(message) push_back() ### 傳送訊息、離開 send_the_message() love() left() ts(180) def send_pe_message(): ###預處理 random_pe = random.randint(0, len(pe)-1) message = painting[random_pe] endings_number = random.randint(0, len(endings)-1) ### 進入、點擊對話框、處理主文字 proceeding() table_box() pyperclip.copy(message) push_back() ### 處理語助詞 message = endings[endings_number] pyperclip.copy(message) push_back() ### 傳送訊息、離開 send_the_message() left() def send_afternoon_sleeping_message(): ### 預處理 message = "我要午休" endings_number = random.randint(0, len(afternoon_sleeping_endings)-1) ### 進入、點擊對話框、處理主文字 proceeding() table_box() pyperclip.copy(message) push_back() ### 處理語助詞 message = endings[endings_number] pyperclip.copy(message) push_back() ### 表情符號 open_emoji() smile_love() ### 傳送訊息、愛心、離開 send_the_message() leve() left() def execute(): # 簽到 check_in() # 經驗找回 experience_recovery() # 遠征獎勵 expedition_reward() # 防BUG defense_bug() # 英靈獎勵 Heroes_reward() # 防BUG if current_day == 0: defense_bug() # 登陸獎勵 login_bonus() # 命運轉盤 fate() # 地圖 maps() # 英靈競技 Heroes() # 切換場景 change_scene() # 徵收 recruitment() # 魔法酒館 magic_tavern() # 種樹 rooting() # 切換場景 change_scene() # 地圖 maps() # 英靈遠征 Heroes_Crusade() # 關閉 starsong_close() #main ## 設定參數 print("請記得切換成中文輸入法") rhm = 7 rha = 12 rhg = 23 rmm = random.randint(17, 59) rma = random.randint(17, 59) rmg = random.randint(19, 59) print(rhm, ":", rmm, "傳送早安訊息") print(rha, ":", rma, "傳送午安訊息") print(rhg, ":", rmg, "傳送晚安訊息") tmp = 0 random_monday_painting_min = random.randint(19, 35) random_tuesday_chinese_min = random.randint(18, 37) random_tuesday_pe_min = random.randint(21, 48) random_afternoon_sleeping_min = random.randint(27, 32) print("random_monday_painting_min == ", random_monday_painting_min) print("random_tuesday_chinese_min == ", random_tuesday_chinese_min) print("random_tuesday_pe_min == ", random_tuesday_pe_min) print("random_afternoon_sleeping_min == ", random_afternoon_sleeping_min) while True: now = time.localtime() current_day = datetime.datetime.now().weekday() # 早安訊息 if now.tm_hour == rhm and now.tm_min == rmm: proceeding() send_good_morning_message() ts((60-rmm)*60) print("「早安訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 午安訊息 if now.tm_hour == rha and now.tm_min == rma: proceeding() send_good_afternoon_message() ts((60-rma)*60) print("「午安訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 晚安訊息 if now.tm_hour == rhg and now.tm_min == rmg: proceeding() send_good_night_message() ts((60-rmg)*60) print("「晚安訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 二國文 if now.tm_hour == 8 and now.tm_min == random_tuesday_chinese_min and current_day + 1 == 2: proceeding() send_chinese_bored_message() print("「國文訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 一美術 if now.tm_hour == 8 and now.tm_min == random_monday_painting_min and current_day + 1 == 1: proceeding() send_painting_interesting_message() print("「美術訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 二體育 if now.tm_hour == 15 and now.tm_min == random_tuesday_pe_min and current_day + 1 == 2: proceeding() send_pe_message() print("「體育訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 午休前訊息 if now.tm_hour == 12 and now.tm_min == random_afternoon_sleeping_min: proceeding() send_afternoon_sleeping_message() print("「午休訊息」已完成,目前時間為 ", now.tm_hour, ":", now.tm_min) # 星曲 if now.tm_hour == 22 and now.tm_min == 1: for i in range(10): ## 執行第一次 if(i == 0): for j in range(5): print("現在是", name[tmp]) double_click() put_my_account() execute() tmp += 1 ## 非第一次 else: for j in range(5): tmp = j print("現在是", name[tmp]) double_click() put_my_account() ### 結束掃蕩 take(1000, 600) ### 補齊計畫 if(i == 1 and tmp == 0): #### 公會寶箱幫助列表 take(1607, 974) ts(5) take(825, 280) ts(2) take(1200, 700) ts(1) take(550, 550) ts(2) take(1100, 480) ts(1) take(1200, 300) ts(1) take(1300, 235) ### 主要執行 maps() Heroes() ### 自我種植、地下迷宮 if(i == 1): change_scene() go_to_farm() my_root() leave_farm() open_maze() underground_maze_first() ### 深淵迷宮 if(i == 2): open_maze() underground_maze_second() open_maze() abyss_maze_first() ### 戰役 if(i == 3): open_maze() abyss_maze_second() challenging() starsong_close() ``` # url https://codeforces.com/blog/entry/127018 https://www.youtube.com/watch?v=rze17VqyMGU&list=PLTIakIxRr2QupvMN7M7of-IHGiEayHVjD https://docs.google.com/spreadsheets/d/1vc8jznRk1LOc2ksLs3xvhtngfv4tB4XKsMmL-kpM5lA/edit#gid=0 https://hackmd.io/@L39Ai4MITOCY2Aioz54q2g/hhsh_pre