def max_plunder_times(self): char = Char(self.char_id) times = VIP_FUNCTION[char.mc.vip].plunder ae = ActivityEntry(self.char_id, 40007) if not ae or not ae.is_ok(): return times if times > 10: return times return 10
def send_prisoners_notify(self): ae = ActivityEntry(self.char_id, 40008) if ae and ae.is_ok(): _add_prob = 80 else: _add_prob = 0 msg = protomsg.PrisonerListNotify() for k, v in self.p.prisoners.iteritems(): p = msg.prisoner.add() self._fill_up_prisoner_msg(p, int(k), v.oid, v.prob + _add_prob, v.active) publish_to_char(self.char_id, pack_msg(msg))
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