File tree Expand file tree Collapse file tree 1 file changed +34
-38
lines changed
Expand file tree Collapse file tree 1 file changed +34
-38
lines changed Original file line number Diff line number Diff line change 1+ import copy
2+
13from api import Lord
24from api import Ui
35from api import Game
6870
6971back = ui .load_image ("./mods/auto_market/images/back.bmp" )
7072
73+ default_list_of_number_of_goods = {"wood" : - 1 , "stone" : - 1 ,
74+ "hops" : - 1 ,
75+ "iron" : - 1 ,
76+ "pitch" : - 1 ,
77+ "wheat" : - 1 ,
78+ "bread" : - 1 ,
79+ "cheese" : - 1 ,
80+ "meat" : - 1 ,
81+ "fruit" : - 1 ,
82+ "ale" : - 1 ,
83+ "flour" : - 1 ,
84+ "bows" : - 1 ,
85+ "crossbows" : - 1 ,
86+ "spears" : - 1 ,
87+ "pikes" : - 1 ,
88+ "maces" : - 1 ,
89+ "swords" : - 1 ,
90+ "leather_armor" : - 1 ,
91+ "metal_armor" : - 1 }
92+
7193
7294class MenuStatus :
7395 is_market_menu_open = False
7496 is_good_selected = False
7597 selected_good = None
76- list_of_number_of_goods_to_sell = {"wood" : - 1 , "stone" : - 1 ,
77- "hops" : - 1 ,
78- "iron" : - 1 ,
79- "pitch" : - 1 ,
80- "wheat" : - 1 ,
81- "bread" : - 1 ,
82- "cheese" : - 1 ,
83- "meat" : - 1 ,
84- "fruit" : - 1 ,
85- "ale" : - 1 ,
86- "flour" : - 1 ,
87- "bows" : - 1 ,
88- "crossbows" : - 1 ,
89- "spears" : - 1 ,
90- "pikes" : - 1 ,
91- "maces" : - 1 ,
92- "swords" : - 1 ,
93- "leather_armor" : - 1 ,
94- "metal_armor" : - 1 }
95- list_of_number_of_goods_to_buy = {"wood" : - 1 , "stone" : - 1 ,
96- "hops" : - 1 ,
97- "iron" : - 1 ,
98- "pitch" : - 1 ,
99- "wheat" : - 1 ,
100- "bread" : - 1 ,
101- "cheese" : - 1 ,
102- "meat" : - 1 ,
103- "fruit" : - 1 ,
104- "ale" : - 1 ,
105- "flour" : - 1 ,
106- "bows" : - 1 ,
107- "crossbows" : - 1 ,
108- "spears" : - 1 ,
109- "pikes" : - 1 ,
110- "maces" : - 1 ,
111- "swords" : - 1 ,
112- "leather_armor" : - 1 ,
113- "metal_armor" : - 1 }
98+ list_of_number_of_goods_to_sell = copy .copy (default_list_of_number_of_goods )
99+ list_of_number_of_goods_to_buy = copy .copy (default_list_of_number_of_goods )
100+
101+
102+ DefaultMenuStatus = MenuStatus
114103
115104
116105def on_ui_tick_listener ():
@@ -414,5 +403,12 @@ def on_game_tick_listener():
414403 my_lord .buy (24 , 5 )
415404
416405
406+ def on_game_begin ():
407+ # Rest auto market state
408+ MenuStatus .list_of_number_of_goods_to_sell = copy .copy (default_list_of_number_of_goods )
409+ MenuStatus .list_of_number_of_goods_to_buy = copy .copy (default_list_of_number_of_goods )
410+
411+
417412ui .set_on_tick_listener (on_ui_tick_listener )
418413game .set_on_tick_listener (on_game_tick_listener )
414+ game .register_game_begin_listener (on_game_begin )
You can’t perform that action at this time.
0 commit comments