﻿mse version: 0.3.8
short name: YGOpro
full name: 导出卡图
position hint: 002
icon: icon.jpg
version: 2014-01-01
installer group: Yugioh/Export/To Image

depends on:
	package: yugioh.mse-game
	version: 2009-08-09

game: yugioh
file type: *.txt|*.txt|*.*|*.*
create directory: true

option field:
	type:boolean
	name:仅导出中间图像
	initial:no
	
option field:
	type: choice
	name: 图片大小
	initial:177x254
	choice:44x64
	choice:177x254
	choice:200x290
	choice:349x508
	choice:原始大小
option field:
	type: choice
	name: 命名方式
	initial:密码
	choice:密码
	choice:卡名
option field:
	type:boolean
	name:去掉密码前面的0
	initial:yes
option field:
	type: choice
	name: 图片格式
	initial:jpg
	choice:png
	choice:jpg
	choice:bmp
script:
	code:={
		to_int(card.gamecode) or else 0 
	}
	fname:={
		if options.命名方式=="密码" 
		then if options.去掉密码前面的0=="yes" then code()+"."+options.图片格式
			 else card.gamecode+"."+options.图片格式
		else card.name+"."+options.图片格式
	}
	w:={
		if options.图片大小=="44x64" then 44
		else if options.图片大小=="177x254" then 177
		else if options.图片大小=="200x290" then 200
		else if options.图片大小=="349x508" then 349
		else card.style.card_type.width
	}
	h:={
		if options.图片大小=="44x64" then 64
		else if options.图片大小=="177x254" then 254
		else if options.图片大小=="200x290" then 290
		else if options.图片大小=="349x508" then 508
		else card.style.card_type.height
	}
	
	write_card := {
		code()+"\n"
	}
	write_images :=
	if options.仅导出中间图像=="yes" then for each card in cards do write_image_file(card.image, file:fname()) 
	else if options.图片大小=="原始大小" then for each card in cards do write_image_file(card, file:fname()) 
	else for each card in cards do write_image_file(card, file:fname(), width: w(), height: h()) 
	
	write_cards := to_text(for each card in sort_list(cards, order_by: {card.number+card.name}) do write_card())
	to_string(write_cards)
