File tree 1 file changed +34
-38
lines changed
1 file changed +34
-38
lines changed Original file line number Diff line number Diff line change
1
+ import copy
2
+
1
3
from api import Lord
2
4
from api import Ui
3
5
from api import Game
68
70
69
71
back = ui .load_image ("./mods/auto_market/images/back.bmp" )
70
72
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
+
71
93
72
94
class MenuStatus :
73
95
is_market_menu_open = False
74
96
is_good_selected = False
75
97
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
114
103
115
104
116
105
def on_ui_tick_listener ():
@@ -414,5 +403,12 @@ def on_game_tick_listener():
414
403
my_lord .buy (24 , 5 )
415
404
416
405
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
+
417
412
ui .set_on_tick_listener (on_ui_tick_listener )
418
413
game .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