def _get_prisoner(): prison = 0 heros = [hid for hid in hero_original_ids if hid] while heros: hid = random.choice(heros) heros.remove(hid) if hid in PRISONER_POOL: prison = hid break ac = ActivityEntry(self.char_id, 30005) """@type: core.activity.Activity30005""" if not ac: _prob = PLUNDER_GET_PRISONER_PROB else: _prob = ac.get_prisoner_prob() ae = ActivityEntry(self.char_id, 50005) if ae and ae.is_valid(): _vip = ae.get_current_value(self.char_id) if _vip == 6: _prob = 50 elif _vip >= 7: _prob = 100 if random.randint(1, 100) <= _prob: return prison return 0
def _get(): got = False prob = self.p.prisoners[str_id].prob + treasures_prob ae = ActivityEntry(self.char_id, 40008) if ae and ae.is_ok(): prob += 80 ae = ActivityEntry(self.char_id, 50005) if ae and ae.is_valid(): _vip = ae.get_current_value(self.char_id) if _vip == 4: prob += 30 elif _vip == 5: prob += 50 elif _vip == 6: prob += 60 elif _vip >= 7: prob += 100 if prob >= random.randint(1, 100): # got it save_hero(self.char_id, self.p.prisoners[str_id].oid) got = True self.p.prisoners.pop(str_id) msg = protomsg.RemovePrisonerNotify() msg.ids.append(_id) publish_to_char(self.char_id, pack_msg(msg)) else: self.p.prisoners[str_id].active = False msg = protomsg.UpdatePrisonerNotify() p = msg.prisoner.add() p_obj = self.p.prisoners[str_id] self._fill_up_prisoner_msg(p, _id, p_obj.oid, p_obj.prob, p_obj.active) publish_to_char(self.char_id, pack_msg(msg)) self.p.save() return got
def login_notify(char_id): message_clean(char_id) function_open = FunctionOpen(char_id) function_open.send_notify() hero_objs = char_heros_obj(char_id) Char(char_id).send_notify() VIP(char_id).send_notify() hero_notify(char_id, hero_objs) Item(char_id).send_notify() f = Formation(char_id) f.send_socket_notify() f.send_formation_notify() Plunder(char_id).send_notify() p = Prison(char_id) p.send_prisoners_notify() a = Arena(char_id) a.send_notify() a.login_process() f = Friend(char_id) f.send_friends_notify() f.send_friends_amount_notify() CheckIn(char_id).send_notify() stage = Stage(char_id) stage.send_already_stage_notify() stage.send_new_stage_notify() stage_elite = EliteStage(char_id) stage_elite.send_notify() stage_elite.send_times_notify() stage_activity = ActivityStage(char_id) stage_activity.check(send_notify=False) stage_activity.send_notify() stage_activity.send_remained_times_notify() HeroPanel(char_id).send_notify() Task(char_id).send_notify() Achievement(char_id).send_notify() HeroSoul(char_id).send_notify() Levy(char_id).send_notify() Attachment(char_id).send_notify() BasePurchaseAction(char_id).send_notify() SystemBroadcast(char_id).send_global_broadcast() ChatMessagePublish(char_id).send_notify() affairs = Affairs(char_id) affairs.send_city_notify() affairs.send_hang_notify() HorseFreeTimesManager(char_id).send_notify() Horse(char_id).send_notify() union.send_notify(char_id) ae = ActivityEntry(char_id, 50006) if ae and ae.is_valid(): ae.enable(ae.get_current_value(char_id)) ActivityStatic(char_id).send_notify() # mail notify 要放在最后,因为 其他功能初始化时可能会产生登录邮件 Mail(char_id).send_notify()