summaryrefslogtreecommitdiff
path: root/storage.py
diff options
context:
space:
mode:
authorMeistache <crie.fernanda@gmail.com>2015-02-22 14:15:36 -0300
committerMeistache <crie.fernanda@gmail.com>2015-02-22 14:15:36 -0300
commitbd6b97110b2e73bcdb3ad83c6b605e10bc75736a (patch)
tree27ddc4a6011b0d8639a3a9a97cc66232408cf372 /storage.py
parent576f092fda4d3b89f9cf6fd3de96e280a0d8b775 (diff)
downloadmanamarket-bd6b97110b2e73bcdb3ad83c6b605e10bc75736a.tar.gz
manamarket-bd6b97110b2e73bcdb3ad83c6b605e10bc75736a.tar.bz2
manamarket-bd6b97110b2e73bcdb3ad83c6b605e10bc75736a.tar.xz
manamarket-bd6b97110b2e73bcdb3ad83c6b605e10bc75736a.zip
Storage finally working - may enter on test
Diffstat (limited to 'storage.py')
-rw-r--r--storage.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/storage.py b/storage.py
index 9ad0841..4de818c 100644
--- a/storage.py
+++ b/storage.py
@@ -22,6 +22,7 @@ class Storage:
def __init__(self):
self.storage = {}
self.timer = 0
+ self.mapserv = 0
self.Open = mutex.mutex()
def reset(self):
@@ -89,27 +90,27 @@ class Storage:
if not item_found:
return "Server and client storage out of sync."
- def storage_send(self, mapserv, index, amount):
+ def storage_send(self, index, amount):
packet = PacketOut(CMSG_MOVE_TO_STORAGE)
packet.write_int16(index + inventory_offset)
packet.write_int32(amount)
- mapserv.sendall(str(packet))
+ self.mapserv.sendall(str(packet))
return 0
- def storage_get(self, mapserv, index, amount):
+ def storage_get(self, index, amount):
packet = PacketOut(CMSG_MOVE_FROM_STORAGE)
packet.write_int16(index + storage_offset)
packet.write_int32(amount)
- mapserv.sendall(str(packet))
+ self.mapserv.sendall(str(packet))
return 0
- def storage_open(self, mapserv):
+ def storage_open(self):
self.timer = time.time()
- mapserv.sendall(chat("@storage"))
+ self.mapserv.sendall(chat("@storage"))
- def storage_close(self, mapserv):
+ def storage_close(self):
self.reset()
- mapserv.sendall(str(PacketOut(CMSG_CLOSE_STORAGE)))
+ self.mapserv.sendall(str(PacketOut(CMSG_CLOSE_STORAGE)))
if __name__ == '__main__':
print "Do not run this file directly. Run main.py"