本文整理匯總了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)