def gm_add_money(self, pid, coin1, coin2=0, coin3=0, is_set=False, vip=False): """ 增加金钱(coin1, coin2=0, coin3=0) """ p = self._get_player(pid) if p: p.add_coin(aCoin1=coin1, aCoin2=coin2, aCoin3=coin3, is_set=is_set, vip=vip, log_type=COIN_ADD_GM) p.pack_msg_data(coin=1, send=1) else: str_coin1, str_coin2, str_coin3 = 'coin1', 'coin2', 'coin3' cols = [str_coin1, str_coin2, str_coin3] val = PlayerData.get_values(pid, cols) coin1 = val[str_coin1] + coin1 coin2 = val[str_coin2] + coin2 coin3 = val[str_coin3] + coin3 PlayerData.update_values( pid, dict(coin1=coin1, coin2=coin2, coin3=coin3)) self.log(u'增加银币成功,角色当前(银币,元宝,绑元宝)数:(%s, %s, %s)', coin1, coin2, coin3)
def gm_del_player(self, pid): """ 删除玩家,不删除数据,只是将数据和user断开联系 """ p = self._get_player(pid) if not p: uid = 'uid' tmp_player = PlayerData.get_values(pid, None) PlayerData.update_values(pid, dict(uid=-abs(tmp_player[uid]))) else: p.data.uid = -abs(p.data.uid) self.log(u'修改角色(%d)成功', pid)
def _node_list(self, op_l): online_pids = self._mgr._game.rpc_player_mgr.get_online_ids(op_l) r_l = [] for pid in op_l: t_dict = PlayerData.get_values(pid, ['rid', 'name', 'level'], self._mgr._game.rpc_store) if not t_dict: continue if pid in online_pids: t_dict['st'] = 1 else: t_dict['st'] = 0 r_l.append(t_dict) return r_l
def gm_player_func(self, pid, index): funcs = 'funcs' tmp_func = PlayerData.get_values(pid, None) tmp_func = tmp_func[funcs] | (1L << index) PlayerData.update_values(pid, dict(funcs=tmp_func)) self.log(u'解锁成功')
def gm_del_offline_player(self, pid): """ 删除角色 """ uid = 'uid' tmp_player = PlayerData.get_values(pid, None) PlayerData.update_values(pid, dict(uid=-tmp_player[uid])) self.log(u'修改角色(%d)成功', pid)