def level_down(self): if self.level == TIER.LOWEST: # Can't level down any more. self.make_ruin() self.log.debug("%s: Destroyed by lack of happiness", self) if self.owner.is_local_player: # check_duplicate: only trigger once for different settlers of a neighborhood self.session.ingame_gui.message_widget.add(point=self.position.center, string_id='SETTLERS_MOVED_OUT', check_duplicate=True) else: self.level -= 1 self._update_level_data() # reset happiness value for new level new_happiness = self.__get_data("happiness_init_value") - self.happiness self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness) self.log.debug("%s: Level down to %s", self, self.level) self._changed() # update the level of our inhabitants so graphics can change if self.has_component(CollectingComponent): for collector in self.get_component(CollectingComponent).get_local_collectors(): collector.level_upgrade(self.level) # Notify the world about the level down SettlerUpdate.broadcast(self, self.level, -1)
def level_down(self): if self.level == TIER.LOWEST: # Can't level down any more. self.make_ruin() self.log.debug("%s: Destroyed by lack of happiness", self) if self.owner.is_local_player: # check_duplicate: only trigger once for different settlers of a neighborhood self.session.ingame_gui.message_widget.add(point=self.position.center, string_id='SETTLERS_MOVED_OUT', check_duplicate=True) else: self.level -= 1 self._update_level_data() # reset happiness value for new level new_happiness = self.__get_data("happiness_init_value") - self.happiness self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness) self.log.debug("%s: Level down to %s", self, self.level) self._changed() # update the level of our inhabitants so graphics can change if self.has_component(CollectingComponent): for collector in self.get_component(CollectingComponent).get_local_collectors(): collector.level_upgrade(self.level) # Notify the world about the level down SettlerUpdate.broadcast(self, self.level, -1)
def level_down(self): if self.level == 0: # can't level down any more # replace this building with a ruin command = Build(BUILDINGS.SETTLER_RUIN, self.position.origin.x, \ self.position.origin.y, island=self.island, settlement=self.settlement) Scheduler().add_new_object( Callback.ChainedCallbacks(self.remove, Callback(command, self.owner)), # remove, then build new self, run_in=0) self.log.debug("%s: Destroyed by lack of happiness", self) if self.owner.is_local_player: # check_duplicate: only trigger once for different settlers of a neighborhood self.session.ingame_gui.message_widget.add(self.position.center().x, self.position.center().y, \ 'SETTLERS_MOVED_OUT', check_duplicate=True) else: self.level -= 1 self._update_level_data() # reset happiness value for new level self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, self.__get_data("happiness_init_value") - self.happiness) self.log.debug("%s: Level down to %s", self, self.level) self._changed() # Notify the world about the level down SettlerUpdate.broadcast(self, self.level, -1)
def load(self, db, worldid): super(Settler, self).load(db, worldid) self.inhabitants, last_tax_payed = \ db("SELECT inhabitants, last_tax_payed FROM settler WHERE rowid=?", worldid)[0] remaining_ticks = \ db("SELECT ticks FROM remaining_ticks_of_month WHERE rowid=?", worldid)[0][0] self.__init(loading=True, last_tax_payed=last_tax_payed) self._load_upgrade_data(db) SettlerUpdate.broadcast(self, self.level, self.level) self.run(remaining_ticks)
def load(self, db, worldid): super(Settler, self).load(db, worldid) self.inhabitants, last_tax_payed = \ db("SELECT inhabitants, last_tax_payed FROM settler WHERE rowid=?", worldid)[0] remaining_ticks = \ db("SELECT ticks FROM remaining_ticks_of_month WHERE rowid=?", worldid)[0][0] self.__init(loading=True, last_tax_payed=last_tax_payed) self._load_upgrade_data(db) SettlerUpdate.broadcast(self, self.level, self.level) self.run(remaining_ticks)
def _do_level_up(): self.level += 1 self.log.debug("%s: Levelling up to %s", self, self.level) self._update_level_data() # Notify the world about the level up SettlerUpdate.broadcast(self, self.level, 1) # reset happiness value for new level self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, self.__get_data("happiness_init_value") - self.happiness) self._changed()
def _do_level_up(): # NOTE: production is unused, but gets passed by the production code self.level += 1 self.log.debug("%s: Levelling up to %s", self, self.level) self._update_level_data() # Notify the world about the level up SettlerUpdate.broadcast(self, self.level) # reset happiness value for new level self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS_ID, self.__get_data("happiness_init_value") - self.happiness) self._changed()
def _do_level_up(): self.level += 1 self.log.debug("%s: Levelling up to %s", self, self.level) self._update_level_data() # Notify the world about the level up SettlerUpdate.broadcast(self, self.level, 1) # reset happiness value for new level new_happiness = self.__get_data("happiness_init_value") - self.happiness self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness) self._changed()
def _do_level_up(): self.level += 1 self.log.debug("%s: Levelling up to %s", self, self.level) self._update_level_data() # update the level of our inhabitants so graphics can change if self.has_component(CollectingComponent): for collector in self.get_component(CollectingComponent).get_local_collectors(): collector.level_upgrade(self.level) # Notify the world about the level up SettlerUpdate.broadcast(self, self.level, 1) # reset happiness value for new level new_happiness = self.__get_data("happiness_init_value") - self.happiness self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness) self._changed()
def _do_level_up(): self.level += 1 self.log.debug("%s: Levelling up to %s", self, self.level) self._update_level_data() # update the level of our inhabitants so graphics can change if self.has_component(CollectingComponent): for collector in self.get_component(CollectingComponent).get_local_collectors(): collector.level_upgrade(self.level) # Notify the world about the level up SettlerUpdate.broadcast(self, self.level, 1) # reset happiness value for new level new_happiness = self.__get_data("happiness_init_value") - self.happiness self.get_component(StorageComponent).inventory.alter(RES.HAPPINESS, new_happiness) self._changed()
def level_down(self): if self.level == 0: # can't level down any more self.make_ruin() self.log.debug("%s: Destroyed by lack of happiness", self) if self.owner.is_local_player: # check_duplicate: only trigger once for different settlers of a neighborhood self.session.ingame_gui.message_widget.add( point=self.position.center(), string_id="SETTLERS_MOVED_OUT", check_duplicate=True ) else: self.level -= 1 self._update_level_data() # reset happiness value for new level self.get_component(StorageComponent).inventory.alter( RES.HAPPINESS, self.__get_data("happiness_init_value") - self.happiness ) self.log.debug("%s: Level down to %s", self, self.level) self._changed() # Notify the world about the level down SettlerUpdate.broadcast(self, self.level, -1)
def change_tier(session, tier): """ Changes the tier of the settlements. """ for settlement in session.world.settlements: if settlement.owner == session.world.player: # Settler levels are zero-based! SettlerUpdate.broadcast(settlement.warehouse, tier - 1, tier - 1)
def change_tier(session, tier): """ Changes the tier of the settlements. """ for settlement in session.world.settlements: if settlement.owner == session.world.player: # Settler levels are zero-based! SettlerUpdate.broadcast(settlement.warehouse, tier - 1, tier - 1)
def change_increment(session, increment): """ Changes the increment of the settlements. """ for settlement in session.world.settlements: if settlement.owner == session.world.player: # Settler levels are zero-based! SettlerUpdate.broadcast(settlement.warehouse, increment - 1, increment - 1)