Ejemplo n.º 1
0
from team_sprite_entry import *
site = login('me', 'lol')  # Set wiki
summary = 'Update team sprite according to high-use pages'  # Set summary

IMAGE_DIR = 'Test Images/'
SPRITE_NAME = 'Team'
IMAGE_WIDTH = 60
IMAGE_HEIGHT = 25
IMAGES_ACROSS = 15
IMAGE_GAP = 2
SPRITE_FILE_NAME = SPRITE_NAME + 'Sprite'
SPRITE_FILE_NAME_FULL = SPRITE_FILE_NAME + '.png'
SPRITE_DATA_PAGE = site.pages['Module:%sSprite' % SPRITE_NAME]
HIGH_USE_PAGE_LIST = site.pages['Maintenance:High-Use Pages'].text().split(',')

spritesheet = sprite_creator.Sprite(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGES_ACROSS,
                                    IMAGE_GAP, SPRITE_FILE_NAME)
spritesheet.open_from_image(
    open_image_from_filename(site, SPRITE_FILE_NAME_FULL))

spritesheet.save()

split_text = '\tids = {\n'
end_text = '\n\t},\n}'

sprite_file_text = SPRITE_DATA_PAGE.text()
sprite_file_table = sprite_file_text.split(split_text)
sprite_text = sprite_file_table[1].replace(end_text, '').strip()
#print(sprite_file_table)
sprite_data = SpriteSheet(sprite_text)

limit = -1
Ejemplo n.º 2
0
import sprite_creator

SUFFIX = ''
SPRITE_NAME = 'Item'
IMAGE_DIR = SPRITE_NAME + ' Images'
DATA_FILE_LOCATION = SPRITE_NAME + 'Sprite' + SUFFIX + '.txt'
IMAGE_WIDTH = 30
IMAGE_HEIGHT = 30
IMAGE_GAP = 2
IMAGES_ACROSS = 20

OLD_FILE = 'ItemSprite Old'
SPRITE_FILE_NAME = SPRITE_NAME + 'Sprite' + SUFFIX

sprite = sprite_creator.Sprite(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGES_ACROSS,
                               IMAGE_GAP, SPRITE_FILE_NAME)
sprite.create_new()

sprite_old = sprite_creator.Sprite(64, 64, 20, 2, OLD_FILE)
sprite_old.open_from_file(OLD_FILE)

for i in range(1, 500):
    img = sprite_old.get_slice(i)
    sprite.add_next_image(img)
    print(sprite.current_location)
    print('{} {}'.format(sprite_old.current_row, sprite_old.current_col))

sprite.save()