[FUNCTION ISLESSERTOT]
FILE.MODE.READFLAG=1
IF (<FILE.OPEN Data/LesserToTs.cfg>)
LOCAL.LINES=<FILE.FILELINES <FILE.FILEPATH>>
	FOR <dLOCAL.LINES>
		IF (!(STRCMPI(<NAME>,<SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.NAME>)))
		FILE.CLOSE
		RETURN 1
		ENDIF
	ENDFOR
FILE.CLOSE
RETURN 0
ENDIF
SERV.LOG File not found!
RETURN

[FUNCTION HASLESSERTOT]
REF1=<UID>
FORCONT <UID>
	IF (<ISLESSERTOT>)
	RETURN 1
	ENDIF
ENDFOR
RETURN 0

[FUNCTION PICKLESSERTOTLIST]
LIST.LesserToTGive_<SRC.UID>.CLEAR
FILE.MODE.READFLAG=1
IF (<FILE.OPEN Data/LesserToTs.cfg>)
LOCAL.LINES=<FILE.FILELINES <FILE.FILEPATH>>
LOCAL.PAGE=2
LOCAL.LASTPAGE=2
	FOR x 1 <dLOCAL.LINES>
		IF (<SRC.FINDID.<FILE.READLINE <dLOCAL.x>>>)
			FOR 1 <SRC.RESCOUNT <FILE.READLINE <dLOCAL.x>>>
			LOCAL.ITEMS ++
			LOCAL.TOTALITEMS ++
				IF (<LOCAL.ITEMS> > 8)
				LOCAL.PAGE ++
				LOCAL.ITEMS=1
				button 360 567 026b0 026b1 0 <dLOCAL.PAGE> 100
				ENDIF
				IF (<LOCAL.PAGE> > <LOCAL.LASTPAGE>)
				PAGE <dLOCAL.PAGE>
				xmfhtmlgumpcolor 180 15 300 25 1071012 0 0 32767
				button 300 567 026b6 026b7 0 <EVAL <LOCAL.PAGE>-1> 100
				LOCAL.LASTPAGE=<LOCAL.PAGE>
				ENDIF
			LIST.LesserToTGive_<SRC.UID>.ADD=<FILE.READLINE <dLOCAL.x>>
				IF (<LOCAL.ITEMS> <= 4)
				buttontileart 10 <EVAL 40+(130*(<LOCAL.ITEMS>-1))> 023f4 023f4 1 0 <EVAL 100+<LOCAL.TOTALITEMS>> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.ID> <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG0.ITEMCOLOR>> 30 40
				checkertrans 10 <EVAL 40+(130*(<LOCAL.ITEMS>-1))> 130 130
				tooltip <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG.LABELNAME>>
				tilepichue 40 <EVAL 80+(130*(<LOCAL.ITEMS>-1))> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.ID> <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG0.ITEMCOLOR>>
				xmfhtmlgumpcolor 150 <EVAL 150+(130*(<LOCAL.ITEMS>-1))> 150 40 <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG.LABELNAME>> 0 0 32767
				ELIF (<LOCAL.ITEMS> <= 8)
				buttontileart 300 <EVAL 40+(130*(<LOCAL.ITEMS>-5))> 023f4 023f4 1 0 <EVAL 100+<LOCAL.TOTALITEMS>> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.ID> <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG0.ITEMCOLOR>> 30 40
				checkertrans 300 <EVAL 40+(130*(<LOCAL.ITEMS>-5))> 130 130
				tooltip <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG.LABELNAME>>
				tilepichue 330 <EVAL 80+(130*(<LOCAL.ITEMS>-5))> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.ID> <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG0.ITEMCOLOR>>
				xmfhtmlgumpcolor 440 <EVAL 150+(130*(<LOCAL.ITEMS>-5))> 150 40 <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL.x>>.TAG.LABELNAME>> 0 0 32767
				ENDIF
			ENDFOR
			IF (<LIST.LesserToTGive_<SRC.UID>.COUNT> > <LOCAL.TOTALITEMS>)
			SERV.LOG Error on LesserToT Listing! <SRC.NAME> (<SRC.UID>)
			LIST.LesserToTGive_<SRC.UID>.CLEAR
			SRC.SYSMESSAGE Error when loading list! Contact staff.
			SRC.TIMERF 1,closealldialogs
			FILE.CLOSE
			RETURN
			ENDIF
		ENDIF
	ENDFOR
FILE.CLOSE
RETURN 0
ENDIF
SERV.LOG File not found!
RETURN

[DEFNAME PIGMENTOFTOKUNOSTUFF]
PIGMENTOFTOKUNO_COLOR_1 0501
PIGMENTOFTOKUNO_COLOR_2 0486
PIGMENTOFTOKUNO_COLOR_3 04F2
PIGMENTOFTOKUNO_COLOR_4 047E
PIGMENTOFTOKUNO_COLOR_5 048F
PIGMENTOFTOKUNO_COLOR_6 0455
PIGMENTOFTOKUNO_COLOR_7 021
PIGMENTOFTOKUNO_COLOR_8 058C
PIGMENTOFTOKUNO_COLOR_9 066C
PIGMENTOFTOKUNO_COLOR_10 054F
PIGMENTOFTOKUNO_LABELNAME_1 1070987
PIGMENTOFTOKUNO_LABELNAME_2 1070988
PIGMENTOFTOKUNO_LABELNAME_3 1070989
PIGMENTOFTOKUNO_LABELNAME_4 1070990
PIGMENTOFTOKUNO_LABELNAME_5 1070991
PIGMENTOFTOKUNO_LABELNAME_6 1070992
PIGMENTOFTOKUNO_LABELNAME_7 1070993
PIGMENTOFTOKUNO_LABELNAME_8 1070994
PIGMENTOFTOKUNO_LABELNAME_9 1070995
PIGMENTOFTOKUNO_LABELNAME_10 1070996

[FUNCTION PICKPIGMENTLIST]
FOR 1 10
	IF (<LOCAL._FOR> <= 5)
	buttontileart 10 <EVAL 40+(130*(<LOCAL._FOR>-1))> 023f4 023f4 1 0 <dLOCAL._FOR> 3623 <dDEF.PIGMENTOFTOKUNO_COLOR_<dLOCAL._FOR>> 30 40
	checkertrans 10 <EVAL 40+(130*(<LOCAL._FOR>-1))> 130 130
	tilepichue 40 <EVAL 80+(130*(<LOCAL._FOR>-1))> 3623 <dDEF.PIGMENTOFTOKUNO_COLOR_<dLOCAL._FOR>>
	xmfhtmlgumpcolor 150 <EVAL 150+(130*(<LOCAL._FOR>-1))> 150 30 <dDEF.PIGMENTOFTOKUNO_LABELNAME_<dLOCAL._FOR>> 0 0 32767
	ELSE
	buttontileart 300 <EVAL 40+(130*(<LOCAL._FOR>-6))> 023f4 023f4 1 0 <dLOCAL._FOR> 3623 <dDEF.PIGMENTOFTOKUNO_COLOR_<dLOCAL._FOR>> 30 40
	checkertrans 300 <EVAL 40+(130*(<LOCAL._FOR>-6))> 130 130
	tilepichue 330 <EVAL 80+(130*(<LOCAL._FOR>-6))> 3623 <dDEF.PIGMENTOFTOKUNO_COLOR_<dLOCAL._FOR>>
	xmfhtmlgumpcolor 440 <EVAL 150+(130*(<LOCAL._FOR>-6))> 150 30 <dDEF.PIGMENTOFTOKUNO_LABELNAME_<dLOCAL._FOR>> 0 0 32767
	ENDIF
ENDFOR

[FUNCTION PICKGREATERTOTLIST]
FILE.MODE.READFLAG=1
IF (<FILE.OPEN Data/GreaterToTs.cfg>)
LOCAL.LINES=<FILE.FILELINES <FILE.FILEPATH>>
	FOR 1 <dLOCAL.LINES>
		IF (<LOCAL._FOR> <= 4)
		buttontileart 10 <EVAL 40+(130*(<LOCAL._FOR>-1))> 023f4 023f4 1 0 <dLOCAL._FOR> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.ID> <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG0.ITEMCOLOR>> 30 40
		checkertrans 10 <EVAL 40+(130*(<LOCAL._FOR>-1))> 130 130
		tooltip <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG.LABELNAME>>
		tilepichue 40 <EVAL 80+(130*(<LOCAL._FOR>-1))> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.ID> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG0.ITEMCOLOR>>
		xmfhtmlgumpcolor 150 <EVAL 150+(130*(<LOCAL._FOR>-1))> 150 30 <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG.LABELNAME>> 0 0 32767
		ELSE
		buttontileart 300 <EVAL 40+(130*(<LOCAL._FOR>-5))> 023f4 023f4 1 0 <dLOCAL._FOR> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.ID> <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG0.ITEMCOLOR>> 30 40
		checkertrans 300 <EVAL 40+(130*(<LOCAL._FOR>-5))> 130 130
		tooltip <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG.LABELNAME>>
		tilepichue 330 <EVAL 80+(130*(<LOCAL._FOR>-5))> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.ID> <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG0.ITEMCOLOR>>
		xmfhtmlgumpcolor 440 <EVAL 150+(130*(<LOCAL._FOR>-5))> 150 30 <EVAL <SERV.ITEMDEF.<FILE.READLINE <dLOCAL._FOR>>.TAG.LABELNAME>> 0 0 32767
		ENDIF
	ENDFOR
FILE.CLOSE
RETURN 0
ENDIF
SERV.LOG File not found!
RETURN

[DIALOG D_TOT_REDEEM]
30,20
src.closealldialogs

PAGE 0
resizepic 0 0 5054 600 600
gumppictiled 10 10 580 580 2624
checkertrans 10 10 580 580

PAGE 1 //greater tots
xmfhtmlgumpcolor 225 15 200 25 1070985 0 0 32767
CALL PICKGREATERTOTLIST

PAGE 2 //lesser tots
xmfhtmlgumpcolor 180 15 300 25 1071012 0 0 32767
CALL PICKLESSERTOTLIST

[DIALOG D_TOT_REDEEM BUTTON]
ON=0
LIST.LesserToTGive_<SRC.UID>.CLEAR

ON=1 8
FILE.MODE.READFLAG=1
IF (<FILE.OPEN Data/GreaterToTs.cfg>)
LOCAL.OLDNEW=<NEW>
SERV.NEWITEM=<FILE.READLINE <ARGN1>>
NEW.BOUNCE
	IF (<FILE.READLINE <ARGN1>> == i_pigments_tokuno)
	NEW.DIALOG D_SET_PIGMENTOFTOKUNO_COLOR
	ENDIF
SAY @,,2 1070984,<NEW.NAME>
SRC.TAG.TOTSGIVEN=
NEW=<LOCAL.OLDNEW>
FILE.CLOSE
RETURN
ENDIF
SERV.LOG File not found! GreaterToTs.cfg
RETURN

ON=101 10000
SRC.CONSUME <LIST.LesserToTGive_<SRC.UID>.<EVAL <ARGN1>-101>>
LIST.LesserToTGive_<SRC.UID>.CLEAR
SRC.TAG0.TOTSGIVEN ++
IF (<SRC.HASLESSERTOT>) && (<SRC.TAG0.TOTSGIVEN> < 10)
SAY @,,2 1070981,<SRC.dTAG0.TOTSGIVEN>,<EVAL 10-<SRC.dTAG0.TOTSGIVEN>>
DIALOG D_TOT_REDEEM 2
ELIF (<SRC.TAG0.TOTSGIVEN> >= 10)
SAY @,,2 1070980
SAY @,,2 1070982
ELSE
SAY @,,2 1071013
ENDIF

[DIALOG D_SET_PIGMENTOFTOKUNO_COLOR]
30,20
src.closealldialogs

PAGE 0
resizepic 0 0 5054 600 700
gumppictiled 10 10 580 680 2624
checkertrans 10 10 580 680

xmfhtmlgumpcolor 225 15 200 25 1070986 0 0 32767
CALL PICKPIGMENTLIST

[DIALOG D_SET_PIGMENTOFTOKUNO_COLOR BUTTON]
ON=1 10
COLOR=<DEF.PIGMENTOFTOKUNO_COLOR_<ARGN1>>

[EOF]