Skip to content

Commit

Permalink
Added UseItemRevive
Browse files Browse the repository at this point in the history
  • Loading branch information
carboniris committed Jul 29, 2016
1 parent e4d8dc7 commit 7a1b298
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions pogo/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from POGOProtos.Networking.Requests.Messages import RecycleInventoryItemMessage_pb2
from POGOProtos.Networking.Requests.Messages import NicknamePokemonMessage_pb2
from POGOProtos.Networking.Requests.Messages import UseItemPotionMessage_pb2
from POGOProtos.Networking.Requests.Messages import UseItemReviveMessage_pb2

# Load local
import api
Expand Down Expand Up @@ -415,6 +416,27 @@ def useItemPotion(self, item_id, pokemon):
# Return everything
return self._state.itemPotion

# Use a Revive
def useItemRevive(self, item_id,pokemon):

# Create request
payload = [Request_pb2.Request(
request_type = RequestType_pb2.USEITEMREVIVEMESSAGE,
request_message = UseItemReviveMessage_pb2.UseItemReviveMessage(
item_id = item_id
pokemon_id = pokemon.id
).SerializeToString()
)]

# Send
res = self.wrapAndRequest(payload, defaults=False)

# Parse
self._state.itemRevive.ParseFromString(res.returns[0])

# Return everything
return self._state.itemRevive

# Evolve Pokemon
def evolvePokemon(self, pokemon):

Expand Down
3 changes: 2 additions & 1 deletion pogo/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from Networking.Responses import UseItemCaptureResponse_pb2
from Networking.Responses import NicknamePokemonResponse_pb2
from Networking.Responses import UseItemPotionResponse_pb2

from Networking.Responses import UseItemReviveResponse_pb2

class State(object):
"""Class to wrap the current state of responses"""
Expand All @@ -32,6 +32,7 @@ def __init__(self):
self.catch = CatchPokemonResponse_pb2.CatchPokemonResponse()
self.itemCapture = UseItemCaptureResponse_pb2.UseItemCaptureResponse()
self.itemPotion = UseItemPotionResponse_pb2.UseItemPotionResponse()
self.itemRevive = UseItemReviveResponse_pb2.UseItemReviveResponse()
self.evolve = EvolvePokemonResponse_pb2.EvolvePokemonResponse()
self.release = ReleasePokemonResponse_pb2.ReleasePokemonResponse()
self.recycle = RecycleInventoryItemResponse_pb2.RecycleInventoryItemResponse()
Expand Down

0 comments on commit 7a1b298

Please sign in to comment.