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 5b1b942 commit b9ab147
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lokbot/farmer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import functools
import gzip
import json
import math
import random
import threading
Expand Down Expand Up @@ -779,11 +780,12 @@ def on_field_objects(data):
if share_to and share_to.get('chat_channels'):
for chat_channel in share_to.get('chat_channels'):
text = f'Lv.{level}?fo_{code}'
if text in self.shared_objects:
obj_hash = f'{text}_{json.dumps(loc)}'
if obj_hash in self.shared_objects:
# already shared
continue

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

if code == OBJECT_CODE_DRAGON_SOUL_CAVERN:
Expand Down

0 comments on commit b9ab147

Please sign in to comment.