Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
feat(farmer): imp _get_optimal_speedups
Browse files Browse the repository at this point in the history
Signed-off-by: hldh214 <[email protected]>
  • Loading branch information
hldh214 committed Oct 6, 2023
1 parent c3cc8bb commit ebb6888
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lokbot/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@
ITEM_CODE_ACTION_POINTS_50 = 10101051
ITEM_CODE_ACTION_POINTS_100 = 10101052

ITEM_CODE_SPEEDUP_1M = 10103001
ITEM_CODE_SPEEDUP_5M = 10103002
ITEM_CODE_SPEEDUP_10M = 10103003
ITEM_CODE_SPEEDUP_30M = 10103004
ITEM_CODE_SPEEDUP_1H = 10103005
ITEM_CODE_SPEEDUP_3H = 10103006
ITEM_CODE_SPEEDUP_8H = 10103007
ITEM_CODE_SPEEDUP_1D = 10103008

ITEM_CODE_SPEEDUP_BUILDING_1M = 10103012
ITEM_CODE_SPEEDUP_BUILDING_5M = 10103013
ITEM_CODE_SPEEDUP_BUILDING_10M = 10103014
Expand Down Expand Up @@ -231,6 +240,16 @@
ITEM_CODE_RECOVER_1D = 10103049

ITEM_CODE_SPEEDUP_MAP = {
'universal': {
ITEM_CODE_SPEEDUP_1M: 60,
ITEM_CODE_SPEEDUP_5M: 300,
ITEM_CODE_SPEEDUP_10M: 600,
ITEM_CODE_SPEEDUP_30M: 1800,
ITEM_CODE_SPEEDUP_1H: 3600,
ITEM_CODE_SPEEDUP_3H: 10800,
ITEM_CODE_SPEEDUP_8H: 28800,
ITEM_CODE_SPEEDUP_1D: 86400,
},
'building': {
# item_code: seconds
ITEM_CODE_SPEEDUP_BUILDING_1M: 60,
Expand Down
1 change: 1 addition & 0 deletions lokbot/farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def _request_callback(self, json_response):

def _get_optimal_speedups(self, need_seconds, speedup_type):
current_map = ITEM_CODE_SPEEDUP_MAP.get(speedup_type)
current_map.update(ITEM_CODE_SPEEDUP_MAP.get('universal'))

assert current_map, f'invalid speedup type: {speedup_type}'

Expand Down

0 comments on commit ebb6888

Please sign in to comment.