Beispiel #1
0
 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)
Beispiel #2
0
 def gm_scene_enter(self, pid, mapId):
     p = self._get_player(pid)
     if p:
         p.scene_enter(mapId)
     else:
         PlayerData.update_values(pid, dict(mapId=int(mapId)))
     self.log(u'进入地图成功')
Beispiel #3
0
 def gm_unforbid_chat(self, pid):
     """ 取消禁言 """
     p = self._get_player(pid)
     if p:
         p.unforbid_chat()
     else:
         PlayerData.update_values(pid, dict(fbChat=0))
     self.log(u'取消禁言成功')
Beispiel #4
0
 def gm_unforbid_login(self, pid):
     """ 解禁登录 """
     p = self._get_player(pid)
     if p:
         p.unforbid_login()
     else:
         PlayerData.update_values(pid, dict(fbLogin=0))
     self.log(u'取消禁止登录成功')
Beispiel #5
0
 def gm_set_level(self, pid, level):
     """ 调等级 """
     player = Game.rpc_player_mgr.get_rpc_player(pid)
     if player:
         player.upgrade(level)
     else:
         PlayerData.update_values(pid, dict(level=level))
     self.log(u'更发等级成功')
Beispiel #6
0
 def gm_forbid_login(self, pid, times):
     """ 禁止登录 """
     p = self._get_player(pid)
     if p:
         p.forbid_login(times)
     else:
         PlayerData.update_values(pid,
                                  dict(fbLogin=int(time.time()) + times))
     self.log(u'禁止登录成功')
Beispiel #7
0
 def gm_forbid_chat(self, pid, times):
     """ 禁言到某某时间 """
     p = self._get_player(pid)
     if p:
         p.forbid_chat(times)
     else:
         PlayerData.update_values(pid,
                                  dict(fbChat=int(time.time()) + times))
     self.log(u'禁言成功')
Beispiel #8
0
 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)
Beispiel #9
0
 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'解锁成功')
Beispiel #10
0
 def gm_change_uid(self, pid, uid):
     PlayerData.update_values(pid, dict(uid=uid))
     self.log(u'更发UID成功')
Beispiel #11
0
 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)