Add a job to find enchanted golden apples

This commit is contained in:
2020-09-25 00:03:22 -06:00
parent b723143299
commit 25ce916b43
10 changed files with 163 additions and 11 deletions
+30 -3
View File
@@ -249,6 +249,11 @@ class Game:
source, text = message
reply = None
if source == 'SYSTEM':
print('unlocking command...')
self.g.command_lock = False
return
match = re.match(r'<(\w+)> (.*)', text)
if match:
sender, text = match.groups()
@@ -267,6 +272,7 @@ class Game:
data = text.split(' ', 1)[1]
else:
command = text
data = None
if command == 'ping':
reply = 'pong'
@@ -370,6 +376,12 @@ class Game:
if command == 'loaded':
reply = str(self.g.chunks.get_loaded_area())
if command == 'gapple':
self.g.job.state = self.g.job.find_gapple
if data:
self.g.job.find_gapple_states.count = int(data)
reply = 'ok'
if reply:
print(reply)
self.g.chat.send(reply)
@@ -513,13 +525,28 @@ class Game:
self.g.connection.write_packet(packet2)
def handle_spawn_object(self, packet):
return
if packet.type_id != 37: return
print(packet)
def handle_entity_metadata(self, packet):
return
if packet.metadata and packet.metadata[0].index != 7: return
print(packet)
if not packet.metadata:
return
if not self.g.job:
return
current_chest = self.g.job.find_gapple_states.current_chest
if not current_chest:
return
for entry in packet.metadata:
if entry.type != 6:
continue
if entry.value.item_id in items.GAPPLE_ID:
self.g.chat.send('gapple found: ' + str(current_chest)[1:-1])
def handle_spawn_living(self, packet):
return