def at_after_move(self, source_location): super(Character, self).at_after_move(source_location) if self.location.key == (u"Сычевальня"): bugurts = [u"ПОЧЕМУ У МЕНЯ НЕТ ТЯН... РАЗВЕ Я ТАК МНОГО ПРОШУ...", u"ТРИЖДЫБЛЯДСКАЯ ЯРОСТЬ"] self.execute_cmd("сказать " + random.choice(bugurts)) #выходит в окно если под веществами if self.location.key == (u"Сычевальня"): if self.db.effects: if len(self.db.effects) > 0: out = self.search("Преддворая территория",global_search=True,quiet=True) if out: dest = out[0] self.move_to(dest,quiet=True) self.msg("Ты был под веществами. Ты перепутал ковер с окном и вашел в него.") self.at_die() else: self.msg("Ты был под веществами. Ты тебе привидилась Леночка и вы вкрылись.") self.at_die() #получаем от мамаки ежедневные карманные деньги. your_mom = self.search(True, location=self.location, attribute_name = 'is_mom', quiet=True) if your_mom: mom = your_mom[0] if (gametime.gametime() - mom.db.last_payout) >= (24*60)*60: self.db.money = self.db.money + self.poket_money_amount self.msg("Мамка дала тебе %s денег." % self.poket_money_amount) mom.db.last_payout = gametime.gametime()
def at_after_move(self, source_location): super(Character, self).at_after_move(source_location) if self.location.key == (u"Сычевальня"): bugurts = [u"ПОЧЕМУ У МЕНЯ НЕТ ТЯН... РАЗВЕ Я ТАК МНОГО ПРОШУ...", u"ТРИЖДЫБЛЯДСКАЯ ЯРОСТЬ"] self.execute_cmd("сказать " + random.choice(bugurts)) #выходит в окно если под веществами if self.location.key == (u"Сычевальня"): if self.db.effects: if len(self.db.effects) > 0: out = self.search("Преддворая территория",global_search=True,quiet=True) if out: dest = out[0] self.move_to(dest,quiet=True) self.msg("Ты был под веществами. Ты перепутал окно с ковром и вышел в него.") self.at_die() else: self.msg("Ты был под веществами. Тебе привиделась Алиска и вы вскрылись.") self.at_die() #получаем от мамаки ежедневные карманные деньги. your_mom = self.search(True, location=self.location, attribute_name = 'is_mom', quiet=True) if your_mom: mom = your_mom[0] if (gametime.gametime() - mom.db.last_payout) >= (24*60)*60: self.db.money = self.db.money + self.poket_money_amount self.msg("Мамка дала тебе %s денег." % self.poket_money_amount) mom.db.last_payout = gametime.gametime()
def get_time_and_season(self): """ Calculate the current time and season ids. """ # get the current time as parts of year and parts of day # returns a tuple (years,months,weeks,days,hours,minutes,sec) time = gametime.gametime(format=True) month, hour = time[1], time[4] season = float(month) / MONTHS_PER_YEAR timeslot = float(hour) / HOURS_PER_DAY # figure out which slots these represent if SEASONAL_BOUNDARIES[0] <= season < SEASONAL_BOUNDARIES[1]: curr_season = "spring" elif SEASONAL_BOUNDARIES[1] <= season < SEASONAL_BOUNDARIES[2]: curr_season = "summer" elif SEASONAL_BOUNDARIES[2] <= season < 1.0 + SEASONAL_BOUNDARIES[0]: curr_season = "autumn" else: curr_season = "winter" if DAY_BOUNDARIES[0] <= timeslot < DAY_BOUNDARIES[1]: curr_timeslot = "night" elif DAY_BOUNDARIES[1] <= timeslot < DAY_BOUNDARIES[2]: curr_timeslot = "morning" elif DAY_BOUNDARIES[2] <= timeslot < DAY_BOUNDARIES[3]: curr_timeslot = "afternoon" else: curr_timeslot = "evening" return curr_season, curr_timeslot
def get_time_and_season(self): """ Calculate the current time and season ids. """ # get the current time as parts of year and parts of day. # we assume a standard calendar here and use 24h format. timestamp = gametime.gametime(absolute=True) # note that fromtimestamp includes the effects of server time zone! datestamp = datetime.datetime.fromtimestamp(timestamp) season = float(datestamp.month) / MONTHS_PER_YEAR timeslot = float(datestamp.hour) / HOURS_PER_DAY # figure out which slots these represent if SEASONAL_BOUNDARIES[0] <= season < SEASONAL_BOUNDARIES[1]: curr_season = "spring" elif SEASONAL_BOUNDARIES[1] <= season < SEASONAL_BOUNDARIES[2]: curr_season = "summer" elif SEASONAL_BOUNDARIES[2] <= season < 1.0 + SEASONAL_BOUNDARIES[0]: curr_season = "autumn" else: curr_season = "winter" if DAY_BOUNDARIES[0] <= timeslot < DAY_BOUNDARIES[1]: curr_timeslot = "night" elif DAY_BOUNDARIES[1] <= timeslot < DAY_BOUNDARIES[2]: curr_timeslot = "morning" elif DAY_BOUNDARIES[2] <= timeslot < DAY_BOUNDARIES[3]: curr_timeslot = "afternoon" else: curr_timeslot = "evening" return curr_season, curr_timeslot
def at_object_creation(self): self.cmdset.add(CmdSetTest) self.locks.add("call:false()") self.db.npc = True self.db.desc = random.choice(self.descriptions) self.db.last_payout = gametime.gametime() - (24*60)*60 self.db.is_mom = True