def advance(self): # advances to next research age... self.research.advance() if self.websocket != None: self.sendMessage(createMessage('updateResources',data=template('tpl/page_chunks/resourcebar',user=self))) return True else: print 'no websocket connected to user ',self.name
def advance(self): # advances to next research age... self.research.advance() if self.websocket != None: self.sendMessage( createMessage('updateResources', data=template('tpl/page_chunks/resourcebar', user=self))) return True else: print 'no websocket connected to user ', self.name
def payFor(self, bal): # deducts item cost from resources, # returns true if purchase is sucessful # assumes that user can afford item self.resources.applyBalance(bal) if self.websocket is not None: self.sendMessage(createMessage('updateResources', data=str(self.get_resource_balance_dict()))) return True else: print 'no websocket connected to user ', self.name
def payFor(self,bal): # deducts item cost from resources, # returns true if purchase is sucessful # assumes that user can afford item self.resources.applyBalance(bal) if self.websocket != None: self.websocket.send(createMessage('updateResources',data=template('tpl/page_chunks/resourcebar',user=self))) return True else: print 'no websocket connected to user ',self.name
def payFor(self, bal): # deducts item cost from resources, # returns true if purchase is sucessful # assumes that user can afford item self.resources.applyBalance(bal) if self.websocket is not None: self.sendMessage( createMessage('updateResources', data=str(self.get_resource_balance_dict()))) return True else: print 'no websocket connected to user ', self.name
def signOut(self): self.disconnected = True self.sendMessage(createMessage("Signout", "None"))