本文整理汇总了Python中app.scense.core.PlayersManager.PlayersManager.updatePlayerInfo方法的典型用法代码示例。如果您正苦于以下问题:Python PlayersManager.updatePlayerInfo方法的具体用法?Python PlayersManager.updatePlayerInfo怎么用?Python PlayersManager.updatePlayerInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.scense.core.PlayersManager.PlayersManager
的用法示例。
在下文中一共展示了PlayersManager.updatePlayerInfo方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addexp
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def addexp(characterId,argument):
'''升级'''
if len(argument)<1:
return
player = PlayersManager().getPlayerByID(characterId)
player.level.addExp(int(argument[0]))
player.updatePlayerInfo()
示例2: cleancd
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def cleancd(characterId,argument):
'''清除竞技场CD'''
player = PlayersManager().getPlayerByID(characterId)
if not player:
return
player.arena.clearCD()
player.updatePlayerInfo()
示例3: LevelUpEmblem
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def LevelUpEmblem(dynamicId,characterId):
'''升级军徽
@param dynamicId: int 客户端的动态id
@param characterId: int 角色的id
'''
player = PlayersManager().getPlayerByID(characterId)
if not player or not player.CheckClient(dynamicId):
return {'result':False,'message':Lg().g(18)}
guildId = player.guild.getID()
if not guildId:
return {'result':False,'message':Lg().g(79)}
guild = GuildManager().getGuildById(guildId)
emblemlevel = guild.guildinfo.get('emblemLevel',0)
goldRequired = {1:100,2:200,3:500,4:1000,5:2000,6:5000,7:10000,8:20000,9:50000,10:10000}
goldcons = goldRequired.get(emblemlevel,100)
if goldcons > player.finance.getGold():
msg = Lg().g(190)
pushOtherMessage(905, msg, [dynamicId])
return {'result':False,'message':msg}
data = guild.LevelUpEmblem(characterId)
if data.get('result',False):
player.finance.consGold(goldcons,6)#升级军徽消耗钻
player.guild.addContribution(int(goldcons*1.5))
player.updatePlayerInfo()
else:
pushOtherMessage(905, data.get('message',''), [dynamicId])
return data
示例4: addCoin
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def addCoin(characterId,argument):
'''添加金币'''
if len(argument)<1:
return
player = PlayersManager().getPlayerByID(characterId)
if not player:
return
player.finance.addCoin(int(argument[0]))
player.updatePlayerInfo()
示例5: vipup
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def vipup(characterId,argument):
'''修改vip等级'''
if len(argument)<1:
return
player = PlayersManager().getPlayerByID(characterId)
if not player:
return
player.baseInfo.updateType(int(argument[0]))
player.updatePlayerInfo()
示例6: addhp
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def addhp(characterId,argument):
'''添加兵力
'''
if len(argument)<1:
return
player = PlayersManager().getPlayerByID(characterId)
if not player:
return
player.attribute.addHp(int(argument[0]))
player.updatePlayerInfo()
示例7: addxingyun
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def addxingyun(characterId,argument):
'''添加幸运值
'''
if len(argument)<1:
return
player = PlayersManager().getPlayerByID(characterId)
if not player:
return
player.petShop.addXy(int(argument[0]))
player.updatePlayerInfo()
示例8: acceptGuildApply
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def acceptGuildApply(self,operator,characterId):
'''同意角色的入会申请
@param operator: 操作者的id
@param characterId: int 申请人的id
'''
president = self.get('president')
veteranList = eval('['+self.guildinfo['veterans']+']')
staffList = eval('['+self.guildinfo['staffOfficers']+']')
senatorsList = eval('['+self.guildinfo['senators']+']')
#获取操作者的权限
if operator==president:
operatorpost =Lg().g(520)
elif operator in veteranList:
operatorpost = Lg().g(519)
elif operator in staffList:
operatorpost = Lg().g(518)
elif operator in senatorsList:
operatorpost = Lg().g(517)
managementGroup = veteranList + staffList + senatorsList
if not dbGuild.checkHasApply(self.id, characterId):
return -4
if operator!=self.president and operator not in managementGroup:
return -1#权限不够
if dbGuild.checkCharacterHasGuild(characterId):
return -2#已经加入了行会
curMenberNum = dbGuild.countGuildMenberNum(self.id)
info = self.guildinfo
maxMemberCount = 20 + ((info['emblemLevel']-1)*30)
if curMenberNum>=maxMemberCount:
return -3#成员数量达到上限
result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
dbGuild.delCharacterAllApply(characterId)
if result:
player = PlayersManager().getPlayerByID(operator)
content = Lg().g(532)\
%(self.guildinfo.get('name',''),operatorpost,\
player.baseInfo.getNickName(),self.guildinfo.get('name',''))
title = Lg().g(526)
m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
sender = Lg().g(128),content=content)
m.mailIntoDB()
player = PlayersManager().getPlayerByID(characterId)
if player:
player.guild.updateID(self.id)
chatnoderemote.callRemote('updateGuild',characterId,self.id,1)#同步聊天角色中的行会
player.updatePlayerInfo()
return 1#同意申请成功
return 0#同意申请失败
示例9: quitFight
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def quitFight(dynamicId,characterId):
'''退出战斗
@param dynamicId: int 客户端的动态id
@param characterId: int 角色的id
'''
player = PlayersManager().getPlayerByID(characterId)
if not player or not player.CheckClient(dynamicId):
return {'result':False,'message':Lg().g(18)}
player.baseInfo.setStatus(1) #离开战斗状态
player.msgbox.AfterFightMsgHandle()#战后消息处理
player.updatePlayerInfo()
player.effect.doEffectHot()
player.attribute.PromptHP()
data = {'placeId':player.baseInfo.getLocation()}
return {'result':True,'message':Lg().g(65),'data':data}
示例10: JointGuild
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def JointGuild(self,characterId):
'''将角色加入国'''
curMenberNum = dbGuild.countGuildMenberNum(self.id)
info = self.guildinfo
maxMemberCount = 20 + ((info['emblemLevel']-1)*30)
if curMenberNum>=maxMemberCount:
return {'result':False,'message':Lg().g(83)}
result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
dbGuild.delCharacterAllApply(characterId)
if result:
player = PlayersManager().getPlayerByID(characterId)
if player:
player.quest.specialTaskHandle(ADDGUILDTASKTYPE)
player.guild.updateID(self.id)
chatnoderemote.callRemote('updateGuild',characterId,self.id,1)#同步聊天角色中的行会
player.updatePlayerInfo()
return {'result':True,'message':Lg().g(530)}#同意申请成功
return {'result':True,'message':Lg().g(531)}#同意申请失败
示例11: TransferCorps
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def TransferCorps(self,operator,memberId):
'''移交国长
@param operator: int 操作者的id
@param memberId: int 被任命的角色的id
'''
managementGroup = eval("["+self.guildinfo['veterans']+"]")\
+eval("["+self.guildinfo['staffOfficers']+"]")\
+eval("["+self.guildinfo['senators']+"]")
if memberId not in managementGroup:
return {'result':False,'message':Lg().g(534)}
if operator!=self.president:
return {'result':False,'message':Lg().g(515)}
if not dbGuild.checkCharacterInGuild(memberId, self.id):
return {'result':False,'message':Lg().g(524)}
result = dbGuild.TransferCorps(self.id, operator, memberId)
if result:
self.president = memberId
player = PlayersManager().getPlayerByID(operator)
player.updatePlayerInfo()
member = PlayersManager().getPlayerByID(memberId)
if member:
member.updatePlayerInfo()
dbGuild.updateCharacterGuildInfo(memberId, {'post':4})
membername = dbGuild.getCharacterNameByID(memberId)
content = Lg().g(535)%\
(self.guildinfo.get('nickname',''),membername,self.guildinfo.get('name',''),)
title = Lg().g(526)
for characterId in dbGuild.getAllGuildCharacterId(self.id):
m = Mail( title=title,type =0, senderId =-1, receiverId=characterId[0],\
sender = Lg().g(128),content=content)
m.mailIntoDB()
postdict = dbGuild.updateGuildPost(self.id)
self.veterans=postdict.veterans
self.staffOfficers=postdict.staffOfficers
self.senators=postdict.senators
# self.SynchGuildInfo()
return {'result':True,'message':Lg().g(85)}
return {'result':False,'message':Lg().g(536)}
示例12: leaveGuild
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def leaveGuild(self,operator):
'''离开行会'''
from app.scense.core.instance.ColonizeManage import ColonizeManage
if self.getPresident() == operator:
newPresident = self.findNewPresident()
if not newPresident:
return {'result':False,'message':Lg().g(550)}
else:
dbGuild.updateCharacterGuildInfo(newPresident, {'post':4})
self.president=newPresident
# if operator in eval("["+self.guildinfo['veterans']+"]"):
# newstaffOfficers = str(eval("["+self.guildinfo['veterans']+"]").remove(operator))[1:-1]
# self.update('veterans', newstaffOfficers)
# if operator in eval("["+self.guildinfo['staffOfficers']+"]"):
# newveterans = str(eval("["+self.guildinfo['staffOfficers']+"]").remove(operator))[1:-1]
# self.update('staffOfficers', newveterans)
# if operator in eval("["+self.guildinfo['senators']+"]"):
# newsenators = str(eval("["+self.guildinfo['senators']+"]").remove(operator))[1:-1]
# self.update('senators', newsenators)
result = dbGuild.deleteCharacterGuildRelation(operator)
if result:
postdict = dbGuild.updateGuildPost(self.id)
self.veterans=postdict.veterans
self.staffOfficers=postdict.staffOfficers
self.senators=postdict.senators
player = PlayersManager().getPlayerByID(operator)
player.updatePlayerInfo()
playerList = dbGuild.getGuildCharacterIdList(self.id)
msg = Lg().g(551)%player.baseInfo.getName()
sendList = [PlayersManager().getPlayerByID(p[0]).getDynamicId()\
for p in playerList \
if PlayersManager().getPlayerByID(p[0]) and \
PlayersManager().getPlayerByID(p[0]).getDynamicId()]
pushPromptedMessage(msg, sendList)
ColonizeManage().updateGuild(operator, 0, Lg().g(143))
return {'result':True,'message':Lg().g(552)}#开除成功
return {'result':False,'message':Lg().g(553)}#开除失败
示例13: fireMember
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def fireMember(self,operator,memberId):
'''开除行会成员
@param operator: 操作者的id
@param memberID: int 成员的id 角色id
'''
from app.scense.core.instance.ColonizeManage import ColonizeManage
president = self.getPresident()
veteranList = eval('['+self.guildinfo['veterans']+']')
staffList = eval('['+self.guildinfo['staffOfficers']+']')
senatorsList = eval('['+self.guildinfo['senators']+']')
#获取操作者的权限
if operator==president:
operatorpost =4
elif operator in veteranList:
operatorpost = 3
elif operator in staffList:
operatorpost = 2
elif operator in senatorsList:
operatorpost = 1
else:
operatorpost = 0
#获取被操作者的权限
if memberId==president:
memberpost =4
elif memberId in veteranList:
memberpost = 3
elif memberId in staffList:
memberpost = 2
elif memberId in senatorsList:
memberpost = 1
else:
memberpost = 0
if operator ==memberId:
return {'result':False,'message':Lg().g(523)}#权限不够
if operatorpost<= memberpost:
return {'result':False,'message':Lg().g(515)}#权限不够
if not dbGuild.checkCharacterInGuild(memberId, self.id):
return {'result':False,'message':Lg().g(524)}
result = dbGuild.deleteCharacterGuildRelation(memberId)
if result:
postdict = dbGuild.updateGuildPost(self.id)
self.veterans=postdict.veterans
self.staffOfficers=postdict.staffOfficers
self.senators=postdict.senators
content = Lg().g(525)%(self.guildinfo.get('nickname',''),\
self.guildinfo.get('name',''))
title = Lg().g(526)
m = Mail( title=title,type =0, senderId =-1, receiverId=memberId,\
sender = Lg().g(128),content=content)
m.mailIntoDB()
player = PlayersManager().getPlayerByID(memberId)
if player:
player.guild.updateID(0)
chatnoderemote.callRemote('updateGuild',memberId,self.id,0)#同步聊天角色中的行会
playerList = dbGuild.getGuildCharacterIdList(self.id)
msg = Lg().g(527)%(player.baseInfo.getName(),self.getGuildName())
sendList = [PlayersManager().getPlayerByID(p[0]).getDynamicId()\
for p in playerList \
if PlayersManager().getPlayerByID(p[0]) and \
PlayersManager().getPlayerByID(p[0]).getDynamicId()]
pushPromptedMessage(msg, sendList)
player.updatePlayerInfo()
ColonizeManage().updateGuild(memberId, 0, u'')
return {'result':True,'message':Lg().g(528)}#开除成功
return {'result':False,'message':Lg().g(529)}#开除失败
示例14: geSettlement
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import updatePlayerInfo [as 别名]
def geSettlement(self):
'''获取战斗结算数据'''
if self.battleResult==2:
return
exGoal = 20000
coinGoal = 0
goldGoal = 0
itemGoal = []
defenders = [defende for defende in self.battlefield if defende['camp']==2]
if self.fightType== 1:#打怪
for defender in defenders:
exGoal = exGoal + defender['expBonus']
coinGoal = coinGoal +defender['coinBonus']
goldGoal = goldGoal+ defender['goldBonus']
itemGoal.append(defender['dropItemId'])
self.winners = [self.battlefield[winner] for winner in self.winners if self.battlefield[winner]['CharacterType']==1]
for winner in self.winners:
settlementData = {}
attackLostGoal = 0
if winner['attackNum']!=0:
attackLostGoal = float(winner['beDodgeNum'])/float(winner['attackNum'])*100
defenseGoal = float(winner['hp'])/float(winner['maxHp'])*100
defenseGetGoal = 0
if winner['defenseNum']!=0:
defenseGetGoal = float(winner['dodgeNum'])/float(winner['defenseNum'])*100
settlementData['id'] = winner['id']
settlementData['expBonus'] = exGoal/len(self.winners)
settlementData['coinBonus'] = coinGoal/len(winner)
settlementData['goldBonus'] = goldGoal/len(winner)
settlementData['attackGoal'] = int(100-attackLostGoal)
settlementData['defenseGoal'] = int(defenseGoal + defenseGetGoal)
if settlementData['defenseGoal']>100:
settlementData['defenseGoal']=100
settlementData['slayGoal'] = winner['criNum']+winner['bogeyNum']+winner['cri_bogeyNum']*3
if settlementData['slayGoal']>100:
settlementData['slayGoal']=100
settlementData['popularity'] = 5
settlementData['itemsBonus'] = None #奖励的物品
player = PlayersManager().getPlayerByID(winner['id'])
if self.fightType ==1:
itemDropConfig = random.choice(itemGoal)
if itemDropConfig:
dropItem = None
dropItem = player.dropping.getItemByDropping(itemDropConfig) #根据掉落配置得到物品
if dropItem:
#print dropItem
player.pack.putNewItemInPackage(dropItem)
settlementData['itemsBonus']=dropItem#.formatItemInfo()
# player.attribute.updateHp(int(winner['hp']))
# player.attribute.updateMp(int(winner['mp']))
if winner['died']:
player.status.updateLifeStatus(0)
player.level.updateExp(player.level.getExp()+settlementData['expBonus'],status = 0)
player.finance.updateCoin(player.finance.getCoin()+settlementData['coinBonus'])
player.finance.updateGold(player.finance.getGold()+settlementData['goldBonus'])
player.updatePlayerInfo(statu=0)
self.settlementData.append(settlementData)