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 on_field_objects(): add shared_objects
Browse files Browse the repository at this point in the history
Signed-off-by: hldh214 <[email protected]>
  • Loading branch information
hldh214 committed Aug 24, 2023
1 parent f18d4fd commit 5b1b942
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lokbot/farmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def __init__(self, token, captcha_solver_config):
self.zones = []
self.available_dragos = self._get_available_dragos()
self.drago_action_point = self.kingdom_enter.get('kingdom').get('dragoActionPoint', {}).get('value', 0)
self.shared_objects = set()

@staticmethod
def calc_time_diff_in_seconds(expected_ended):
Expand Down Expand Up @@ -777,7 +778,13 @@ def on_field_objects(data):

if share_to and share_to.get('chat_channels'):
for chat_channel in share_to.get('chat_channels'):
self.api.chat_new(chat_channel, CHAT_TYPE_LOC, f'Lv.{level}?fo_{code}', {'loc': loc})
text = f'Lv.{level}?fo_{code}'
if text in self.shared_objects:
# already shared
continue

self.shared_objects.add(text)
self.api.chat_new(chat_channel, CHAT_TYPE_LOC, text, {'loc': loc})

if code == OBJECT_CODE_DRAGON_SOUL_CAVERN:
if self.drago_action_point < 1:
Expand Down

0 comments on commit 5b1b942

Please sign in to comment.