本文整理汇总了Python中app.scense.core.PlayersManager.PlayersManager.getDynamicId方法的典型用法代码示例。如果您正苦于以下问题:Python PlayersManager.getDynamicId方法的具体用法?Python PlayersManager.getDynamicId怎么用?Python PlayersManager.getDynamicId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.scense.core.PlayersManager.PlayersManager
的用法示例。
在下文中一共展示了PlayersManager.getDynamicId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addPlayerFriend
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def addPlayerFriend(dynamicId,characterId,friendName,friendType,isSheildedMail=0):
'''添加好友
@param dynamicId: int 客户端的动态id
@param characterId: int 角色的id
@param friendName: string 对方的昵称
@param friendType: int(1,2) 好友的类型 1:好友 2:黑名单
@param isSheildedMail: 是否屏蔽邮件
'''
player = PlayersManager().getPlayerByID(characterId)
if not player:
return {'result':False,'message':Lg().g(18)}
friendId = dbaccess.getCharacterIdByNickName(friendName)#返回好友角色id [id]
if not friendId:
msg =Lg().g(75)
pushObjectNetInterface.pushOtherMessage(905,msg, [player.getDynamicId()])
return {'result':False,'message':Lg().g(68)}
pyid=-1 #关系好友动态id -1表示角色没有在线 其他表示角色动态id
py1=PlayersManager().getPlayerByID(friendId[0])
if py1 and py1.friend.getTypeByid(characterId)==0:#如果好友在线
pyid=py1.getDynamicId()
result = player.friend.addFriend(characterId,friendId[0],friendType,pyid)
if result:
pushObjectNetInterface.pushOtherMessage(905, result['message'], [player.getDynamicId()])
return {'result':True,'message':Lg().g(69)}
return {'result':False,'message':Lg().g(70)}
示例2: guyongpet
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def guyongpet(pid, petid, typeid):
"""雇用宠物
@param pid: int 角色id
@param petid: int 宠物模板id
@param typeid: int #1表示金币兑换的宠物 2表示幸运值兑换
"""
from app.scense.utils.dbopera import dbCharacterPet
player = PlayersManager().getPlayerByID(pid)
if not player:
return {"result": False, "message": Lg().g(18)}
alls = dbCharacterPet.PET_TEMPLATE
if alls.has_key(petid):
pet = alls.get(petid)
coin = pet["coin"]
xy = pet["xy"]
if typeid == 1: # 扣除金币
pcoin = player.finance.getCoin()
if pcoin >= coin:
petlevel = 1 # 宠物等级
for i in player.petShop.shop1: # i[宠物模板id,宠物等级]
if i[0]["id"] == petid:
petlevel = i[1]
flg = player.pet.addPet(petid, level=petlevel) # 添加宠物并返回
if flg == -1:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(167), [player.getDynamicId()])
return {"result": True, "message": Lg().g(167)}
elif flg == -2:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(168), [player.getDynamicId()])
return {"result": True, "message": Lg().g(168)}
player.finance.updateCoin(pcoin - coin)
player.quest.specialTaskHandle(115) # 特殊任务处理
player.schedule.noticeSchedule(16, goal=1)
return {"result": True, "message": Lg().g(166)}
else:
return {"result": False, "message": Lg().g(88)}
else: # 扣除幸运值
pxy = player.petShop.xy
if pxy < xy:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(169), [player.getDynamicId()])
return {"result": True, "message": Lg().g(169)}
if pxy >= xy:
flg = player.pet.addPet(petid)
if flg == -1:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(167), [player.getDynamicId()])
return {"result": False, "message": Lg().g(167)}
elif flg == -2:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(168), [player.getDynamicId()])
return {"result": True, "message": Lg().g(168)}
player.petShop.xy = pxy - xy
player.quest.specialTaskHandle(115) # 特殊任务处理
player.schedule.noticeSchedule(16, goal=1)
return {"result": True, "message": Lg().g(166)}
else:
return {"result": False, "message": Lg().g(169)}
else:
return {"result": False, "message": Lg().g(170)}
示例3: updateSpirit
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def updateSpirit(pid, contxt):
"""修改角色心情
@param pid: int 角色id
@param context: str 心情
"""
player = PlayersManager().getPlayerByID(pid)
if player.baseInfo.updateSpirit(contxt):
pushObjectNetInterface.pushOtherMessage(905, Lg().g(175), [player.getDynamicId()])
else:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(176), [player.getDynamicId()])
return {"result": True, "message": u""}
示例4: runingQd
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def runingQd(self, pid, gold):
"""祈祷逻辑
@param gold: int 钻石数量
"""
from app.scense.serverconfig.chatnode import chatnoderemote
from app.scense.core.PlayersManager import PlayersManager
v = {1: Lg().g(564), 2: Lg().g(499), 3: Lg().g(565), 4: Lg().g(566), 0: Lg().g(564)}
player = PlayersManager().getPlayerByID(pid)
mygold = player.finance.getGold()
if mygold < gold:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(567), [player.getDynamicId()])
return False
result = configure.qd(gold)
lx = result[0] # 奖励类型 1金币奖励 2经验奖励 3声望奖励 4活力
sl = result[1] # 奖励数量
bs = result[2] # 奖励倍数
if lx == 1:
player.finance.addCoin(sl)
ss = Lg().g(568) % (v.get(lx), sl)
elif lx == 2:
player.level.addExp(sl)
ss = Lg().g(568) % (v.get(lx), sl)
elif lx == 3:
player.finance.addPrestige(sl)
ss = Lg().g(568) % (v.get(lx), sl)
elif lx == 4:
player.attribute.addEnergy(sl)
ss = Lg().g(568) % (v.get(lx), sl)
else:
player.finance.addCoin(sl)
if bs > 1:
ss += Lg().g(569) % bs
pushObjectNetInterface.pushOtherMessage(905, ss, [player.getDynamicId()])
# player.finance.updateGold(mygold-gold)
player.finance.consGold(gold, 1)
bbs = 1 # 大于这个倍数的才会广播
sj = time.strftime("%w%H")
sj = int(sj)
if sj >= 310 and sj <= 314:
bbs = 2
if bs > bbs:
pname = player.baseInfo.getName()
tm = time.strftime("%Y-%m-%d %X")
mg = Lg().g(570) % (pname, bs, v.get(lx), sl)
chatnoderemote.callRemote("pushSystemToInfo", mg)
if len(self.getGG()) == 4:
del self.gg[0]
self.gg.append([tm, mg])
self.uploadGG(self.gg)
return True
示例5: ObtainReward
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def ObtainReward(pid,did):
'''领取单个保卫奖励
@param pid: int 角色id
@param did: int 保卫奖励表主键id
'''
msg=u""
flg=True
player=PlayersManager().getPlayerByID(pid)#获得角色id
info=dbDefenceBonus.getByid(did) #根据奖励主键id获得奖励信息
if not info:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(61), [player.getDynamicId()])
return False,Lg().g(61)
reward=info['reward']
player.finance.updatePrestige(player.finance.getPrestige()+reward)
if not dbDefenceBonus.delByid(info['id']) :
msg+=Lg().g(62)
flg=False
# item=Item(itemTemplateId=20030061)
# item.pack.setStack(info['reward']) #物品的数量
# rs1=player.pack._package.canPutItem(item,info['reward']) #判断背包中是否可以放入这些数量的物品
# if rs1: #如果可以放进去
# player.pack.putNewItemsInPackage(20030061,info['reward'])
# del item
# if not dbDefenceBonus.delByid(info['id']) :
# msg+=Lg().g(62)
# flg=False
# else: #如果一个奖励所获得物品不能放入背包
# del item
# pushObjectNetInterface.pushOtherMessage(905, Lg().g(16), [player.getDynamicId()])
# return False,Lg().g(16)
return flg,msg
示例6: tiaozhuan
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def tiaozhuan(dynamicId,characterid,csz):
'''场景间的跳转或者进入副本
'''
player = PlayersManager().getPlayerByID(characterid)
if not player:
return {'result':False,'message':Lg().g(18)}
doorinfo = dbMap.ALL_DOOR_INFO.get(csz)#获取传送门的信息
lastscene = MapManager().getMapId(player.baseInfo.getTown())
if doorinfo.get('functionType')==1:#跳转场景
placeId = doorinfo.get('nextmap')
position = (doorinfo.get('init_x'),doorinfo.get('init_y'))
player.baseInfo.setTown( placeId)
player.baseInfo.setState(0)
PlayersManager().addPlayer(player)
defencelog_app.isReward(player.baseInfo.id, player.getDynamicId())
scene = MapManager().getMapId(placeId)
scenename = scene.getSceneName()
chatnoderemote.callRemote('JoinRoom',characterid,placeId,scenename)
scene.addPlayer(characterid)
player.quest.setNpcList(scene._npclist)
player.baseInfo.initPosition(position)
scene.pushEnterPlace([dynamicId])
result = {'result':True}
else:
instanceId = doorinfo.get('famID')
result = instance_app.enterInstance1(player,dynamicId, characterid, instanceId,0)
if result.get('result'):
lastscene.dropPlayer(characterid)
示例7: isHaveQH
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def isHaveQH(characterid,itemid):
'''判断是否能够强化
@param characterid: int 角色id
@param itemid: int 物品1(item)表主键id
'''
item1=None#物品实例1
player=PlayersManager().getPlayerByID(characterid)
if itemid>0:#如果物品1存在
if player.pack._package._PropsPagePack.getPositionByItemId(itemid)!=-1:#背包中没有此物品
item1=player.pack._package._PropsPagePack.getItemInfoByItemid(itemid)#获取物品实例
else:
item1=player.pack._equipmentSlot.getItemInfoByItemid(itemid)
if not item1:
return {'result':False,'message':Lg().g(189),'data':None}
wqtype=item1.getWQtype()#武器类型 #装备类型id #0=衣服#1=裤子 #2=头盔#3=手套#4=靴子#5=护肩#6=项链#7=戒指#8=主武器#9=副武器#10=双手
if wqtype<0 or wqtype>10: #装备类型id
pushObjectNetInterface.pushOtherMessage(905, Lg().g(196), [player.getDynamicId()])
return {'result':False,'message':Lg().g(197),'data':None}
baseQuality=item1.baseInfo.getItemTemplateInfo().get("baseQuality",0)#基础品质 1灰 2白 3绿 4蓝 5紫 6橙 7红
itemlevel=item1.baseInfo.getItemTemplateInfo().get("levelRequire",0) #装备等级
qlevel=item1.attribute.getStrengthen() #物品当前的强化等级
jinbi= coinCount(qlevel,baseQuality,wqtype,itemlevel)
return qq(player, itemid,wqtype,baseQuality,jinbi,item1)
示例8: CorpsInviteReply
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def CorpsInviteReply(dynamicId,characterId,union_id,is_ok):
'''邀请加入行会的反馈信息
@param dynamicId: int 客户端的动态id
@param characterId: int 角色的id
@param union_id: int 行会的id(邀请者的ID)
@param is_ok: int 是否同意 0否 1是
'''
player = PlayersManager().getPlayerByID(characterId)
fplayer = PlayersManager().getPlayerByID(union_id)
if not player or not player.CheckClient(dynamicId):
return {'result':False,'message':Lg().g(18)}
nowguildId = player.guild.getID()
toguildId = dbGuild.getCharacterGuildId(union_id)
if fplayer and not is_ok:
msg = "%s拒绝了你的邀请"%player.baseInfo.getName()
pushOtherMessage(905, msg, [fplayer.getDynamicId()])
return {'result':True}
if nowguildId:
return {'result':False,'message':Lg().g(94)}
guild = GuildManager().getGuildById(toguildId)
if not guild:
return {'result':False,'message':Lg().g(95)}
surplushours = player.guild.getCanJoinTime()
if surplushours:
return {'result':False,'message':Lg().g(647)%surplushours}
result = guild.JointGuild(characterId)
if result.get('result',False):
msg = u'成功加入%s'%guild.getGuildName()
pushOtherMessage(905, msg, [dynamicId])
else:
nmsg = result.get('message','')
pushOtherMessage(905, nmsg, [dynamicId])
return result
示例9: CorpsInviteOther
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def CorpsInviteOther(dynamicId,characterId,otherid,otername):
'''邀请加入行会
@param dynamicId: int 客户端的动态id
@param characterId: int 角色的id
@param otherid: int 对方的Id
@param otername: 对方的名称
'''
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)}
toplayer = PlayersManager().getPlayerByID(otherid)
if not toplayer:
return {'result':False,'message':Lg().g(91)}
if toplayer.level.getLevel()<LEVELREQUIRED:
return {'result':False,'message':Lg().g(86)}
guild = GuildManager().getGuildById(guildId)
if guild.guildinfo.get('curMenberNum',50)>=guild.guildinfo.get('memberCount',50):
return {'result':False,'message':Lg().g(83)}
sendList = [toplayer.getDynamicId()]
pushInviteOtherJoinGuild(characterId, guildId, player.baseInfo.getName(),\
guild.getGuildName(), sendList)
msg = Lg().g(92)
pushOtherMessage(905, msg, [dynamicId])
return {'result':True}
示例10: getSxzy
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def getSxzy(characterid,item1,item2):
'''获取属性转移后的效果及其花费信息
@param item1: int 物品id (转移后强化等级变成0的那个物品的id)
@param item: int 物品id
'''
if item1==item2:
pushObjectNetInterface.pushOtherMessageByCharacterId(Lg().g(206), [characterid])
return {'result':False,'message':Lg().g(206),'data':None}
player=PlayersManager().getPlayerByID(characterid) #角色实例
if not player:
return {'result':False,'message':Lg().g(199),'data':None}
if player.level.getLevel()<30:
return {'result':False,'message':Lg().g(205),'data':None}
items1=getItemByplayer(player, item1)
if not items1:
return {'result':False,'message':Lg().g(189),'data':None}
items2=getItemByplayer(player, item2)
if not items2:
return {'result':False,'message':Lg().g(189),'data':None}
if items1.getWQtype()!=items2.getWQtype():
return {'qh':None,'coin':0}
level=Sxzy(items1, items2)
zyyh=level+items2.attribute.getStrengthen()#转移以后装备的强化等级
if player.level.getLevel()<zyyh:
pushObjectNetInterface.pushOtherMessage(905, Lg().g(207)%zyyh, [player.getDynamicId()])
Zcion=getSxzyCoin(items1, items2)#转移花费金币
return {'qh':level,'coin':Zcion}
示例11: ObtainItem_2408
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def ObtainItem_2408(dynamicId, request_proto):
'''放到自己背包中'''
argument=ObtainItem2408_pb2.ObtainItemRequest()
argument.ParseFromString(request_proto)
response=ObtainItem2408_pb2.ObtainItemResponse()
id=argument.id #角色id
type=argument.type #0获取所有 1获取单个
pos=argument.pos # 单个在背包的位置
player=PlayersManager().getPlayerByID(id) #角色实例
if type==0:
data=player.instance.putAllItemsInPack()
if not data:
response.result=False
response.message=Lg().g(16)
pushObjectNetInterface.pushOtherMessage(905, Lg().g(16), [player.getDynamicId()])
return response.SerializeToString()
else:
data=player.instance.getOneItemInPackByPosition(pos)
if not data:
response.result=False
response.message=Lg().g(16)
return response.SerializeToString()
response.result=True
response.message=u''
return response.SerializeToString()
示例12: StartUpGuaJi
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def StartUpGuaJi(dynamicId,characterId):
'''角色开始挂机
@param characterId: int 角色的ID
'''
from app.scense.core.campaign.FortressManager import FortressManager
player = PlayersManager().getPlayerByID(characterId)
if not player or not player.CheckClient(dynamicId):
return {'result':False,'message':Lg().g(18)}
#判断是否有冥想加成
if player.baseInfo.getState()==1: #如果角色在副本
state = 0
else:
guildId = player.guild.getID()
sceneId = player.baseInfo.getTown()
fortress= FortressManager().getFortressBySceneId(sceneId)
if not fortress.isOccupied:
state = 0
else:
if fortress.kimori==guildId and guildId!=0:
state=1
else:
state = 0
result = player.afk.startMeditation(state=state)
if not result.get('result'):
msg = result.get('message')
sendId = player.getDynamicId()
pushOtherMessage(905, msg, [sendId])
return result
示例13: pushSceneInfo
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def pushSceneInfo(self,rate):
'''给每一个在场景中的玩家推送场景信息
@param rate: int 移动的频率
'''
if not self._canRec:
return
self.updateAllPlayerLocation(rate)
if self._monsters:
self.updateAllMonsterLocation()
groupState = configure.isteamInstanceTime(20)#组队副本时间判断
guildFightState = fortress.IsWarTime()#国战时间判断
for room in self.rooms:
sendlist = []
sceneInfo = pushSceneMessage_pb2.pushSceneMessage()
for playerId in room:
player = PlayersManager().getPlayerByID(playerId)
if not player:
continue
player.icon.groupIconManager(groupState)#组队战图标管理
player.icon.guildFightManager(guildFightState)#国战图标管理
PlayerPosition = sceneInfo.PlayerPosition.add()
PlayerPosition.id = player.baseInfo.id
PlayerPosition.name = player.baseInfo.getNickName()
PlayerPosition.profession = player.profession.getProfessionName()
PlayerPosition.headicon = player.profession.getFigure()
GuildInfo = player.guild.getGuildInfo()
if GuildInfo:
PlayerPosition.guildname = GuildInfo.get('name','')
PlayerPosition.figure = player.profession.getSceneFigure()
position = player.baseInfo.getDestination()
PlayerPosition.x = int(position[0])
PlayerPosition.y = int(position[1])
PlayerPosition.level = player.level.getLevel()
PlayerPosition.viptype = player.baseInfo.getType()
PlayerPosition.gemlevel = player.pack._equipmentSlot.getGemLevel()
sendlist.append(player.getDynamicId())
###############角色展示宠物的处理################
petremove = player.pet.popLastRemove()
for petId in petremove:
self.dropPet(petId)
for petId in player.matrix._matrixSetting.values():
if petId<=0:
continue
pet = player.pet.getPet(petId)
figure = pet.templateInfo['resourceid']
position = pet.getPosition()
PetPosition = sceneInfo.petInfo.add()
PetPosition.id = petId
PetPosition.name = pet.baseInfo.getName()
PetPosition.profession = pet.baseInfo.getName()
PetPosition.headicon = figure
PetPosition.figure = figure
PetPosition.x = int(position[0])
PetPosition.y = int(position[1])
PetPosition.masterId = playerId
sceneInfo.sceneId = self._id
msg = sceneInfo.SerializeToString()
pushApplyMessage(602,msg, sendlist)
示例14: getSendList
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def getSendList(self,room):
'''获取接受场景消息的角色的客户端ID'''
sendlist = []
for playerId in room:
player = PlayersManager().getPlayerByID(playerId)
if playerId in self._canRec and player and player.baseInfo.getStatus()!=4:
sendlist.append(player.getDynamicId())
return sendlist
示例15: packageArrange
# 需要导入模块: from app.scense.core.PlayersManager import PlayersManager [as 别名]
# 或者: from app.scense.core.PlayersManager.PlayersManager import getDynamicId [as 别名]
def packageArrange(dynamicId,characterId,packageType):
'''包裹整理'''
player = PlayersManager().getPlayerByID(characterId)
if not player or not player.CheckClient(dynamicId):
return {'result':False,'message':Lg().g(18)}
player.pack.packageArrange(packageType)
pushPromptedMessage(Lg().g(158),[player.getDynamicId()])
return {'result':True,'message':Lg().g(158)}