Ejemplo n.º 1
0
 def bank(self):
     """Return a list of stack which represent the bank ! this is only for display purpose, modifying stacks here don't affect the player bank"""
     bank = []
     for bank_data in self._bank:
         stack = Stack.from_dict(bank_data)
         bank.append(stack)
     return bank
Ejemplo n.º 2
0
 def inventory(self):
     """Return a dict of stack which represent the inventory ! this is only for display purpose, modifying stacks here don't affect the player inventory
     Exemple : {0:Stack,1:None,2:Stack} (None ==> empty stack)
     """
     inv = {}
     for idx in range(self.inventory_size):
         dict_data = self._inventory.get(str(idx), None)
         stack = Stack.from_dict(dict_data) if dict_data else None
         inv[idx] = stack
     return inv
Ejemplo n.º 3
0
 def equipment(self):
     """
     0 - weapon
     1 - shield
     2 - book_1
     3 - book_2
     4 - book_3
     5 - helmet 
     6 - chestplate
     7 - gloves 
     8 - boots
     9 - ring_1
     10 - ring_2
     11 - neckless
     12 - tool
     """
     equ = {}
     for idx in range(13):
         dict_data = self._equipment.get(str(idx), None)
         stack = Stack.from_dict(dict_data) if dict_data else None
         equ[idx] = stack
     return equ
Ejemplo n.º 4
0
 def get_bank_stack(self, index):
     return Stack.from_dict(self._bank[index])
Ejemplo n.º 5
0
 def remove_bank_stack(self, index):
     """Remove and return a stack from the bank by it index"""
     return Stack.from_dict(self._bank.pop(index))