1515import tempfile
1616import colorsys
1717import io
18+ from random import randint
1819from time import sleep
1920
2021from pgu import gui
@@ -183,18 +184,18 @@ def update(slider, label):
183184 c = gui .Table (width = 250 )
184185 c .td (gui .Label (lang .w_priority , size = 40 ), colspan = 3 )
185186 c .tr ()
186- H = gui .HSlider (value = 1 , min = 0 , max = 9 , size = 20 , height = 16 , width = 120 )
187- S = gui .HSlider (value = 1 , min = 0 , max = 9 , size = 20 , height = 16 , width = 120 )
187+ H = gui .HSlider (value = 3 , min = 0 , max = 9 , size = 20 , height = 16 , width = 120 )
188+ S = gui .HSlider (value = 2 , min = 0 , max = 9 , size = 20 , height = 16 , width = 120 )
188189 V = gui .HSlider (value = 1 , min = 0 , max = 9 , size = 20 , height = 16 , width = 120 )
189190 c .td (gui .Label (lang .w_hue ))
190191 c .td (H )
191- hl = gui .Label ("1X " )
192+ hl = gui .Label ("3X " )
192193 H .connect (gui .CHANGE , update , H , hl )
193194 c .td (hl )
194195 c .tr ()
195196 c .td (gui .Label (lang .w_saturation ))
196197 c .td (S )
197- sl = gui .Label ("1X " )
198+ sl = gui .Label ("2X " )
198199 S .connect (gui .CHANGE , update , S , sl )
199200 c .td (sl )
200201 c .tr ()
@@ -212,15 +213,15 @@ def update(slider, label):
212213
213214 ###GUI END###
214215
215- self .header = {'spawn' : (w // 2 , h // 2 ), 'groundlevel' : h + 0.4 , 'is_bloodmoon' : 0 ,
216+ self .header = {'spawn' : (w // 2 , h // 2 ), 'groundlevel' : h + 0.0 , 'is_bloodmoon' : 0 ,
216217 'dungeon_xy' : (w , h ), 'worldrect' : (0 , w * 16 , 0 , h * 16 ),
217- 'is_meteor_spawned' : 0 , 'gob_inv_time' : 0 , 'rocklevel' : h + 100.4 ,
218+ 'is_meteor_spawned' : 0 , 'gob_inv_time' : 0 , 'rocklevel' : h + 100.0 ,
218219 'gob_inv_x' : 0.0 , 'is_day' : 1 , 'shadow_orbs_broken' : 0 ,
219220 'width' : w , 'version' : 39 , 'gob_inv_type' : 0 ,
220221 'bosses_slain' : (0 , 0 , 0 ), "npcs_saved" : (0 , 0 , 0 ), "special_slain" : (0 , 0 , 0 ),
221222 'gob_inv_size' : 0 , 'height' : h ,
222- 'ID' : 1394008880 , 'moonphase' : 0 , 'name' : name ,
223- 'is_a_shadow_orb_broken' : 0 , 'time' : 13500 ,
223+ 'ID' : randint ( 10 , 10000000 ) , 'moonphase' : 0 , 'name' : name ,
224+ 'is_a_shadow_orb_broken' : 0 , 'time' : 13500.0 ,
224225 "hardmode" : 0 , "altars_broken" : 0 , }
225226
226227 import time
@@ -229,9 +230,16 @@ def rgb(a, surface, rcolors, weight=None):
229230 w10 = w // 20
230231 total = z = w
231232 cache = {}
233+ tiledata = io .BytesIO ()
234+ set_tile (tiledata , (None , None , 0 , None ))
235+ air = tiledata .getvalue ()
236+
232237 for x in range (w ):
233238 for y in range (h ):
234239 color = surface .get_at ((x , y ))
240+ if color [3 ] == 0 :
241+ a .write (air )
242+ continue
235243 cachecolor = color [:3 ]
236244 if cachecolor in cache :
237245 a .write (cache [cachecolor ])
@@ -267,9 +275,16 @@ def hsv(a, surface, rcolors, weight=(2, 3, 1)):
267275 w10 = w // 20
268276 total = z = w
269277 cache = {}
278+ tiledata = io .BytesIO ()
279+ set_tile (tiledata , (None , None , 0 , None ))
280+ air = tiledata .getvalue ()
281+
270282 for x in range (w ):
271283 for y in range (h ):
272284 color = surface .get_at ((x , y ))
285+ if color [3 ] == 0 :
286+ a .write (air )
287+ continue
273288 cachecolor = color [:3 ]
274289 if cachecolor in cache :
275290 a .write (cache [cachecolor ])
@@ -315,9 +330,10 @@ def hsv(a, surface, rcolors, weight=(2, 3, 1)):
315330 print ("%5f seconds taken, that is %0.10f seconds per pixel" % n )
316331 self .chests = [None ] * 1000
317332 self .signs = [None ] * 1000
318- self .names = db .names
319- self .npcs = [('Guide' , (self .header ["spawn" ][0 ] * 16 , (self .header ["spawn" ][1 ] - 3 ) * 16 ), 1 ,
320- (self .header ["spawn" ][0 ], self .header ["spawn" ][1 ] - 3 ))]
333+ self .names = names
334+ self .npcs = []
335+ print ("Test done" )
336+
321337
322338
323339if __name__ == "__main__" :
0 commit comments