129 【战斗】战斗系统-服务端(主线掉落战利品、装备;主线击杀怪物获得经验、升级;主线装备穿戴、分解;)
| | |
| | | list AttrValue; //属性值
|
| | | };
|
| | |
|
| | | //装备品质表
|
| | |
|
| | | struct EquipColor
|
| | | {
|
| | | BYTE _ItemColor; //装备品质
|
| | | DWORD MoneyBase; //分解货币
|
| | | DWORD AtkStep; //攻击步长
|
| | | DWORD DefStep; //防御步长
|
| | | DWORD HPStep; //生命步长
|
| | | list AttrLibCntList; //库属性条数列表
|
| | | list AttrRange; //通用属性范围,下限|上限
|
| | | dict AttrRangeDict; //指定属性范围字典,{指定属性ID:[范围下限, 上限], ...}
|
| | | };
|
| | |
|
| | | //装备部位表
|
| | |
|
| | | struct EquipPlace
|
| | | {
|
| | | BYTE _EquipPlace; //装备部位
|
| | | float BaseAttrProportion; //基础属性占比
|
| | | list AttrLib1; //随机属性ID库1,[属性ID, ...]
|
| | | list AttrLib2; //随机属性ID库2,[属性ID, ...]
|
| | | list AttrLib3; //随机属性ID库3,[属性ID, ...]
|
| | | };
|
| | |
|
| | | //定制属性表
|
| | |
|
| | | struct AppointItem
|
| | | {
|
| | | DWORD _ID; //定制ID
|
| | | BYTE CancelUseLimit; //穿戴限制(除职业)
|
| | | WORD ItemLV; //物品等级
|
| | | list BaseAttrID; //基础属性ID
|
| | | list BaseAttrValue; //基础属性值
|
| | | list LegendAttrID; //传奇属性ID
|
| | | list LegendAttrValue; //传奇属性值
|
| | | };
|
| | |
|
| | | //装备传奇属性条数表
|
| | |
|
| | | struct tagEquipLegendAttrCount
|
| | |
| | | struct tagPlayerLV
|
| | | {
|
| | | WORD _LV; //玩家等级
|
| | | DWORD ExpPoint; //升级所需经验点,每个经验点代表的经验由项目决定
|
| | | DWORD Exp; //除经验点总经验外升级还需的经验
|
| | | DWORD Exp; //升级所需经验
|
| | | BYTE TalentPoint; //等级获得的天赋点
|
| | | DWORD ReExp; //等级经验效率(second)
|
| | | DWORD ReMaxHP; //生命
|
| | |
| | | dict ItemID; //奖励物品信息
|
| | | WORD Price; //礼包现价
|
| | | WORD OldPrice; //礼包原价
|
| | | };
|
| | |
|
| | | //定制物品表
|
| | |
|
| | | struct tagAppointItem
|
| | | {
|
| | | DWORD _ID; //定制物品ID
|
| | | BYTE CancelUseLimit; //穿戴限制(除职业)
|
| | | list LegendAttrID; //传奇属性ID
|
| | | list LegendAttrValue; //传奇属性值
|
| | | };
|
| | |
|
| | | //拍卖物品表
|
| | |
| | | DWORD LVUPNeedMoney; //升到下一级所需货币数
|
| | | DWORD LVUPNeedTime; //升级下一级所需所需秒
|
| | | list EquipColorRateList; //产出装备品质概率列表,[0品质万分率, 1品质万分率, ...]
|
| | | list ExAwardItemRateList; //每次砍树概率额外产出道具饼图,[[万分率,[物品ID,个数]], ...]
|
| | | };
|
| | |
| | | ;已删除物品rptDeleted//已无用
|
| | | PackCnt00=0
|
| | | ;装备rptEquip//一定要与枚举RoleEquipType的最大值匹配
|
| | | PackCnt01=203
|
| | | PackCnt01=12
|
| | | ;物品rptItem
|
| | | PackCnt02=100
|
| | | ;垃圾桶(回收站)rptRecycle
|
| | |
| | | ;合成背包rptCompose
|
| | | PackCnt07=0
|
| | | ;鉴定背包rptIdentify
|
| | | PackCnt08=0
|
| | | PackCnt08=20
|
| | | ;拆解准备背包rptBreakPrepare
|
| | | PackCnt09=0
|
| | | ;合成结果背包rptResult
|
| | |
| | | ;坐骑装备背包rptHorseEquip
|
| | | PackCnt15=0
|
| | | ;衣服外套背包rptCabinetDressCoat
|
| | | PackCnt16= 0
|
| | | PackCnt16=0
|
| | | ;武器外套背包rptCabinetWeaponCoat
|
| | | PackCnt17=0
|
| | | ;时装坐骑背包rptCabinetHorse
|
| | |
| | | PacketSubCMD_1=0x26
|
| | | PacketCallFunc_1=OnVisitFairyDomain
|
| | |
|
| | | ;主线战斗
|
| | | [GameLogic_MainLevel]
|
| | | ScriptName = GameWorldLogic\FBProcess\GameLogic_MainLevel.py
|
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 1
|
| | |
|
| | | PacketCMD_1=0xB4
|
| | | PacketSubCMD_1=0x15
|
| | | PacketCallFunc_1=OnMainDropItemOP
|
| | |
|
| | | ;回合攻击
|
| | | [TurnAttack]
|
| | | ScriptName = Attack\TurnAttack.py
|
| | |
| | | if GameObj.GetHP(curObjDetel) > 0:
|
| | | return
|
| | |
|
| | | if TurnAttack.SetKilled(curObjDetel):
|
| | | if TurnAttack.SetTurnObjKilled(curObjDetel, atkObj):
|
| | | return
|
| | |
|
| | | #---玩家处理---
|
| | |
| | |
|
| | | #普通NPC
|
| | | if GameObj.GetHP(defender) <= 0:
|
| | | if TurnAttack.SetKilled(defender):
|
| | | if TurnAttack.SetTurnObjKilled(defender, attacker):
|
| | | return
|
| | | if not ChNPC.OnCheckCanDie(attacker, defender, skill, tick):
|
| | | return
|
| | |
| | |
|
| | | #召唤兽死亡
|
| | | if GameObj.GetHP(curTagSummonNPC) <= 0:
|
| | | if TurnAttack.SetKilled(curTagSummonNPC):
|
| | | if TurnAttack.SetTurnObjKilled(curTagSummonNPC, curNormalNPC):
|
| | | return
|
| | | curTagSummonNPCControl = NPCCommon.NPCControl(curTagSummonNPC)
|
| | | #召唤兽死亡
|
| | |
| | | return
|
| | |
|
| | | #---NPC被击杀---
|
| | | if TurnAttack.SetKilled(curTagNPC):
|
| | | if TurnAttack.SetTurnObjKilled(curTagNPC, curSummonNPC):
|
| | | return
|
| | |
|
| | | #玩家击杀NPC副本触发器
|
| | |
| | |
|
| | | #防守方召唤兽死亡
|
| | | if GameObj.GetHP(curTagSummon) <= 0:
|
| | | if TurnAttack.SetKilled(curTagSummon):
|
| | | if TurnAttack.SetTurnObjKilled(curTagSummon, curSummonNPC):
|
| | | return
|
| | | curTagSummonNPCControl = NPCCommon.NPCControl(curTagSummon)
|
| | | #召唤兽死亡
|
| | |
| | | return False
|
| | |
|
| | | DoLogic_AttackResult(attacker, defender, useSkill, tick)
|
| | | |
| | | TurnAttack.OnTurnfightAttackResult(attacker, defender, useSkill)
|
| | | return True
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | |
|
| | | OnHurtTypeTriggerPassiveSkill(attacker, defender, curSkill, tick)
|
| | | DoLogic_AttackResult(attacker, defender, curSkill, tick)
|
| | | |
| | | TurnAttack.OnTurnfightAttackResult(attacker, defender, curSkill)
|
| | | return True
|
| | |
|
| | |
|
| | |
| | | continue
|
| | |
|
| | | DoLogic_AttackResult(attacker, defObj, curSkill, tick)
|
| | |
|
| | |
|
| | | |
| | | TurnAttack.OnTurnfightAttackResult(attacker, defender, curSkill)
|
| | | return
|
| | |
|
| | | ## 执行群攻攻击
|
| | | # @param attacker 攻击者实例
|
| | |
| | | #===========================================================================
|
| | |
|
| | | #----------扣XP点
|
| | | if SkillCommon.isXPSkill(curSkill):
|
| | | GameObj.SetXP(curObj, 0)
|
| | |
|
| | | #if SkillCommon.isXPSkill(curSkill):
|
| | | # GameObj.SetXP(curObj, 0)
|
| | | |
| | | #----------扣HP点
|
| | | lostHPValue = curSkill.GetHP()
|
| | | curPlayerHP = GameObj.GetHP(curObj)
|
| | | |
| | | if curPlayerHP < lostHPValue:
|
| | | GameWorld.ErrLog('释放技能 = %s异常, HP点 = %s不足 = %s' % (
|
| | | curSkill.GetSkillTypeID(), curPlayerHP, lostHPValue))
|
| | | |
| | | if lostHPValue > 0:
|
| | | GameObj.SetHP(curObj, GameObj.GetHP(curObj) - lostHPValue)
|
| | | #lostHPValue = curSkill.GetHP()
|
| | | #curPlayerHP = GameObj.GetHP(curObj)
|
| | | #
|
| | | #if curPlayerHP < lostHPValue:
|
| | | # GameWorld.ErrLog('释放技能 = %s异常, HP点 = %s不足 = %s' % (
|
| | | # curSkill.GetSkillTypeID(), curPlayerHP, lostHPValue))
|
| | | #
|
| | | #if lostHPValue > 0:
|
| | | # GameObj.SetHP(curObj, GameObj.GetHP(curObj) - lostHPValue)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | #通知客户端攻击结果
|
| | | __Sync_AttackResult(curNPC, target, curSkill)
|
| | |
|
| | | TurnAttack.OnTurnfightAttackSuccess(curNPC, target, curSkill)
|
| | | |
| | | #技能使用成功
|
| | | if curSkill:
|
| | | skillTypeID = curSkill.GetSkillTypeID()
|
| | |
| | | if curPlayer != None and GameObj.GetHP(curPlayer) > 0:
|
| | | if curSkill == None or curSkill.GetSkillType() not in ChConfig.Def_NoBattleState_List:
|
| | | AttackCommon.SetPlayerBattleState(curPlayer, tick)
|
| | | |
| | | FBLogic.DoOverNPCAttackSuccess(curNPC, target, tick)
|
| | | |
| | | |
| | | # 灵为玩家的替身需要走此逻辑
|
| | | UseSkillOver(curNPC, target, curSkill, tick)
|
| | | return True
|
| | |
| | | continue
|
| | |
|
| | | DoLogic_AttackResult(attacker, defObj, curSkill, tick)
|
| | |
|
| | | |
| | | TurnAttack.OnTurnfightAttackResult(attacker, None, curSkill)
|
| | | return True
|
| | |
|
| | |
|
| | |
| | | import SkillCommon
|
| | | import SkillShell
|
| | | import AttackCommon
|
| | | import FBLogic
|
| | |
|
| | | import random
|
| | | import time
|
| | |
| | |
|
| | | self.startTime = 0 # 开始时间戳,支持毫秒小数
|
| | | self.costTime = 0 # 单场战斗总耗时,支持毫秒小数
|
| | | |
| | | #玩家武将行动后击杀目标
|
| | | self.playerKillObjIDList = [] # [objID, ...]
|
| | | return
|
| | |
|
| | | def setTurn(self, mapID, funcLineID, turnMax, isNeedReport=False, msgDict={}):
|
| | |
| | | overLineupList = [] # 本回合已经结束行动的阵容列表 [(faction, num), ...], 所有阵容全部结束代表本回合结束
|
| | |
|
| | | turnNum = turnFight.turnNum
|
| | | unXiantaoCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCnt)
|
| | | GameWorld.DebugLog("unXiantaoCnt=%s,turnNum=%s,doMax=%s,actionIndex=%s,%s" % (unXiantaoCnt, turnNum, doMax, turnFight.actionIndex, turnFight.actionSortList))
|
| | | GameWorld.DebugLog("turnNum=%s,doMax=%s,actionIndex=%s,%s" % (turnNum, doMax, turnFight.actionIndex, turnFight.actionSortList))
|
| | | while doCnt < doMax and len(overLineupList) < len(turnFight.actionSortList):
|
| | | doCnt += 1
|
| | | turnNum = turnFight.turnNum
|
| | |
| | | if turnFight.actionIndex >= len(turnFight.actionSortList):
|
| | | turnFight.actionIndex = 0
|
| | |
|
| | | playerHeroAtk = False # 玩家阵容行动标记
|
| | | faction, num = turnFight.actionSortList[turnFight.actionIndex]
|
| | | batFaction = turnFight.getBatFaction(faction)
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | |
| | | continue
|
| | |
|
| | | if faction == Def_FactionA:
|
| | | if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Xiantao, fightPoint, isNotify=False):
|
| | | return
|
| | | playerHeroAtk = True
|
| | | |
| | | break
|
| | |
|
| | | turnFight.actionIndex += 1
|
| | |
| | | if turnFight.checkOverByKilled():
|
| | | break
|
| | |
|
| | | nowUnXiantaoCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCnt)
|
| | | if unXiantaoCnt != nowUnXiantaoCnt:
|
| | | # 玩家有消耗战锤则停止,一段段执行
|
| | | GameWorld.DebugLog("玩家有消耗战锤则停止,nowUnXiantaoCnt=%s" % (nowUnXiantaoCnt))
|
| | | if playerHeroAtk:
|
| | | # 玩家武将有行动则停止,一段段执行
|
| | | GameWorld.DebugLog("玩家武将有行动则停止!")
|
| | | break
|
| | |
|
| | | if turnFight.winFaction:
|
| | |
| | | GameWorld.DebugLog(" 自残: curTD=%s,tagID=%s,skillID=%s,hurtType=%s,hurtValue=%s,lostHP=%s,curHP=%s"
|
| | | % (curID, tagID, skillID, hurtType, hurtValue, lostHP, GameObj.GetHP(curObj)))
|
| | |
|
| | | if lostHP and curID != tagID:
|
| | | AddTurnFightXP(tagObj, __GetAddXP_Defender(tagObj, lostHP), "skillID:%s" % skillID)
|
| | | if lostHP > 0 and curID != tagID:
|
| | | addXP = IpyGameDataPY.GetFuncCfg("AngerXP", 4)
|
| | | AddTurnFightXP(tagObj, addXP, "skillID:%s" % skillID)
|
| | | return
|
| | |
|
| | | def __GetAddXP_Attack(attack, curSkill):
|
| | | ## 攻击方增加的XP值根据主动普攻技能获得
|
| | | if not curSkill:
|
| | | return 0
|
| | | if not SkillCommon.isTurnNormalAtkSkill(curSkill):
|
| | | return 0
|
| | | return IpyGameDataPY.GetFuncCfg("AngerXP", 3)
|
| | |
|
| | | def __GetAddXP_Defender(defender, lostHP):
|
| | | ## 掉血方增加的XP值根据掉血百分比获得
|
| | | if lostHP <= 0:
|
| | | return 0
|
| | | return IpyGameDataPY.GetFuncCfg("AngerXP", 4)
|
| | |
|
| | | def AddTurnFightXP(gameObj, addXP, reason=""):
|
| | | ## 回合战斗增加XP
|
| | |
| | |
|
| | | for useInfo in useSkillList:
|
| | | useSkill = useInfo[-1]
|
| | | skillID = useSkill.GetSkillID()
|
| | | #skillID = useSkill.GetSkillID()
|
| | | atkOK, tagObj = DoNPCUseSkill(curNPC, useSkill, tick)
|
| | | if atkOK:
|
| | | AddTurnFightXP(curNPC, __GetAddXP_Attack(curNPC, useSkill), "skillID:%s" % skillID)
|
| | | break
|
| | |
|
| | | curNPC.SetDict(ChConfig.Def_Obj_Dict_TurnBattleType, 0) # 无论攻击成功与否都重置战斗类型
|
| | |
| | | return tagNPC
|
| | | return
|
| | |
|
| | | def SetKilled(gameObj, killer=None):
|
| | | def SetTurnObjKilled(gameObj, killer=None):
|
| | | if not gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightPosInfo):
|
| | | #GameWorld.DebugLog("非回合战斗主体被击杀: curID=%s" % gameObj.GetID())
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog(" %s 回合战斗主体被击杀: curID=%s" % (GetObjName(gameObj), gameObj.GetID()))
|
| | | GameObj.SetHP(gameObj, 0) # 回合制死亡仅设置为0,实例暂时不回收
|
| | | objID = gameObj.GetID()
|
| | | GameWorld.DebugLog(" %s 回合战斗主体被击杀: curID=%s" % (GetObjName(gameObj), objID))
|
| | | gameObj.SetCurAction(IPY_GameWorld.laNPCDie)
|
| | | if GameObj.GetHP(gameObj) != 0:
|
| | | GameObj.SetHP(gameObj, 0) # 回合制死亡仅设置为0,实例暂时不回收
|
| | | gameObj.SetVisible(False)
|
| | |
|
| | | turnFight = GetTurnFightMgr().getNPCTurnFight(gameObj.GetID())
|
| | | if turnFight:
|
| | | clientPack = ChPyNetSendPack.tagMCTurnFightObjDead()
|
| | | clientPack.ObjID = gameObj.GetID()
|
| | | turnFight.addBatPack(clientPack)
|
| | | turnFight = GetTurnFightMgr().getNPCTurnFight(objID)
|
| | | if not turnFight:
|
| | | return True
|
| | | clientPack = ChPyNetSendPack.tagMCTurnFightObjDead()
|
| | | clientPack.ObjID = objID
|
| | | turnFight.addBatPack(clientPack)
|
| | | |
| | | # 记录主动发起的玩家阵营击杀
|
| | | curPlayer = turnFight.curPlayer
|
| | | if killer and curPlayer and killer.GetDictByKey(ChConfig.Def_Obj_Dict_LineupPlayerID) == curPlayer.GetPlayerID():
|
| | | if objID not in turnFight.playerKillObjIDList:
|
| | | turnFight.playerKillObjIDList.append(objID)
|
| | | GameWorld.DebugLog("玩家单次击杀统计: %s" % turnFight.playerKillObjIDList)
|
| | |
|
| | | return True
|
| | |
|
| | | def OnTurnfightAttackSuccess(curObj, tagObj, curSkill):
|
| | | ## 回合战斗攻击成功额外处理,AttackResult之前,一般处理技能相关
|
| | | if curObj.GetGameObjType() != IPY_GameWorld.gotNPC:
|
| | | return
|
| | | if not curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightPosInfo):
|
| | | return
|
| | | |
| | | objID = curObj.GetID()
|
| | | turnFight = GetTurnFightMgr().getNPCTurnFight(objID)
|
| | | if not turnFight:
|
| | | return
|
| | | |
| | | skillID = curSkill.GetSkillID() if curSkill else 0
|
| | | isXP = SkillCommon.isXPSkill(curSkill)
|
| | | if isXP:
|
| | | GameObj.SetXP(curObj, 0)
|
| | | elif curSkill:
|
| | | if SkillCommon.isTurnNormalAtkSkill(curSkill):
|
| | | addXP = IpyGameDataPY.GetFuncCfg("AngerXP", 3)
|
| | | AddTurnFightXP(curObj, addXP, "skillID:%s" % skillID)
|
| | | |
| | | curPlayer = turnFight.curPlayer
|
| | | # 仅主动发起玩家阵容触发
|
| | | if curPlayer and curObj.GetDictByKey(ChConfig.Def_Obj_Dict_LineupPlayerID) == curPlayer.GetPlayerID():
|
| | | FBLogic.OnPlayerLineupAttackSuccess(curPlayer, curObj, tagObj, curSkill, turnFight.mapID, turnFight.funcLineID)
|
| | | |
| | | return
|
| | |
|
| | | def OnTurnfightAttackResult(curObj, tagObj, curSkill):
|
| | | ## 回合战斗攻击结果额外处理,AttackResult 之后,一般处理击杀结算相关
|
| | | if curObj.GetGameObjType() != IPY_GameWorld.gotNPC:
|
| | | return
|
| | | if not curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightPosInfo):
|
| | | return
|
| | | |
| | | objID = curObj.GetID()
|
| | | turnFight = GetTurnFightMgr().getNPCTurnFight(objID)
|
| | | if not turnFight:
|
| | | return
|
| | | |
| | | curPlayer = turnFight.curPlayer
|
| | | # 仅主动发起玩家阵容触发
|
| | | if curPlayer and curObj.GetDictByKey(ChConfig.Def_Obj_Dict_LineupPlayerID) == curPlayer.GetPlayerID():
|
| | | FBLogic.OnPlayerLineupAttackResult(curPlayer, curObj, tagObj, curSkill, turnFight.mapID, turnFight.funcLineID)
|
| | | |
| | | turnFight.playerKillObjIDList = []
|
| | | return
|
| | |
|
| | | def OnTurnAllOver(guid):
|
| | | ## 所有回合已经全部执行完毕
|
| | | GameWorld.DebugLog("所有回合结束")
|
| | |
| | | Def_ItemType_retTrousers = 106 #6 裤子
|
| | | Def_ItemType_retShoes = 107 #7 鞋子
|
| | | Def_ItemType_retGlove = 108 #8 手套
|
| | | Def_ItemType_retNeck = 109 #9 项链
|
| | | Def_ItemType_retFairyCan = 110 #10 仙器1
|
| | | Def_ItemType_retFairyCan2 = 111 #11 仙器2
|
| | | Def_ItemType_retJade = 112 #12 玉佩
|
| | | Def_ItemType_retShawl = 109 #9 披肩
|
| | | Def_ItemType_retNeck = 110 #10 项链
|
| | | Def_ItemType_retRing = 111 #11 戒指
|
| | | Def_ItemType_retAmulet = 112 #12 玉佩
|
| | | Def_ItemType_retWing = 113 #13 翅膀
|
| | | Def_ItemType_retGuard1 = 114 #14 守护1
|
| | | Def_ItemType_retGuard2 = 115 #15 守护2
|
| | |
| | | ShareDefine.retTrousers:[Def_ItemType_retTrousers],
|
| | | ShareDefine.retShoes:[Def_ItemType_retShoes],
|
| | | ShareDefine.retGlove:[Def_ItemType_retGlove],
|
| | | ShareDefine.retShawl:[Def_ItemType_retShawl],
|
| | | ShareDefine.retNeck:[Def_ItemType_retNeck],
|
| | | ShareDefine.retFairyCan:[Def_ItemType_retFairyCan],
|
| | | ShareDefine.retFairyCan2:[Def_ItemType_retFairyCan2],
|
| | | ShareDefine.retJade:[Def_ItemType_retJade],
|
| | | ShareDefine.retWing:[Def_ItemType_retWing],
|
| | | ShareDefine.retGuard1:[Def_ItemType_retGuard1],
|
| | | ShareDefine.retGuard2:[Def_ItemType_retGuard2],
|
| | | ShareDefine.retRing:[Def_ItemType_retRing],
|
| | | ShareDefine.retAmulet:[Def_ItemType_retAmulet],
|
| | | #ShareDefine.retWing:[Def_ItemType_retWing],
|
| | | #ShareDefine.retGuard1:[Def_ItemType_retGuard1],
|
| | | #ShareDefine.retGuard2:[Def_ItemType_retGuard2],
|
| | | }
|
| | | #---------------------------------------------------------------------
|
| | | #写死的物品效果ID都放这边------请按数值顺序存放
|
| | |
| | | #装备类型
|
| | | Def_EquipItemType = range(Def_ItemType_retWeapon, Def_ItemType_DogzEquipScute + 1)
|
| | |
|
| | | #主线装备类型
|
| | | Def_MainEquipType = range(Def_ItemType_retWeapon, Def_ItemType_retAmulet + 1)
|
| | |
|
| | | #神兽装备类型
|
| | | Def_DogzEquiipType = xrange(Def_ItemType_DogzEquipHorn, Def_ItemType_DogzEquipScute + 1)
|
| | |
|
| | |
| | | IPY_GameWorld.rptItem,
|
| | | #IPY_GameWorld.rptFineSoulSlot,
|
| | | IPY_GameWorld.rptAnyWhere,
|
| | | IPY_GameWorld.rptIdentify, |
| | | #时装背包
|
| | | #IPY_GameWorld.rptCabinetWeaponCoat,
|
| | | #IPY_GameWorld.rptCabinetHorse,
|
| | |
| | |
|
| | | #副本ID转换
|
| | | Def_FB_MapID = {
|
| | | 'MainLevel':[Def_FBMapID_Main, Def_FBMapID_MainBoss], # 主线关卡
|
| | | 'FamilyWar':[Def_FBMapID_FamilyWar], # 仙盟联赛
|
| | | 'FamilyInvade':[Def_FBMapID_FamilyInvade], # 守卫人皇
|
| | | 'FamilyBoss':[Def_FBMapID_FamilyBossMap], # 战盟boss
|
| | |
| | | ShareDefine.retTrousers, #6 裤子
|
| | | ShareDefine.retShoes, #7 鞋子
|
| | | ShareDefine.retGlove, #8 手套
|
| | | ShareDefine.retNeck, #9 项链
|
| | | ShareDefine.retFairyCan, #10 仙器1
|
| | | ShareDefine.retFairyCan2, #11 仙器2
|
| | | ShareDefine.retJade, #12 玉佩
|
| | | ShareDefine.retShawl, #9 披肩
|
| | | ShareDefine.retNeck, #10 项链
|
| | | ShareDefine.retRing, #11 戒指
|
| | | ShareDefine.retAmulet, #12 玉佩
|
| | | ],
|
| | | }
|
| | |
|
| | | ## 装备位 - 基础攻击类
|
| | | EquipPlace_BaseWeapon = [ShareDefine.retWeapon, ShareDefine.retWeapon2, ShareDefine.retBelt, ShareDefine.retGlove]
|
| | | EquipPlace_BaseWeapon = []
|
| | | ## 装备位 - 基础防具类
|
| | | EquipPlace_BaseArmor = [ShareDefine.retHat, ShareDefine.retClothes, ShareDefine.retTrousers, ShareDefine.retShoes]
|
| | | ## 装备位 - 仙器
|
| | | EquipPlace_Relics = [ShareDefine.retFairyCan, ShareDefine.retFairyCan2]
|
| | | ## 装备位 - 特殊
|
| | | EquipPlace_Special = [ShareDefine.retNeck, ShareDefine.retFairyCan, ShareDefine.retFairyCan2, ShareDefine.retJade]
|
| | | EquipPlace_BaseArmor = []
|
| | | ## 装备位 - 所有基础
|
| | | EquipPlace_Base = EquipPlace_BaseWeapon + EquipPlace_BaseArmor
|
| | | ## 装备位 - 灵器
|
| | | EquipPlace_LingQi = [ShareDefine.retWing, ShareDefine.retGuard1, ShareDefine.retPeerlessWeapon, ShareDefine.retPeerlessWeapon2]
|
| | | EquipPlace_LingQi = []
|
| | |
|
| | | #装备物品位置,不需要重刷属性
|
| | | EquipItemNoRefreshState = [
|
| | |
| | | Def_PDict_HeroBook = "HeroBook_%s" # 武将图鉴激活等级,参数(武将ID) cccbbba a-初始激活状态1-英雄激活,2-初始图鉴激活; bbb-存星级图鉴激活等级;ccc-存突破图鉴激活等级
|
| | |
|
| | | #主线
|
| | | Def_PDict_UnXiantaoCnt = "UnXiantaoCnt" # 累计未结算的战锤数
|
| | | Def_PDict_UnXiantaoCntExp = "UnXiantaoCntExp" # 累计未结算经验的战锤数
|
| | | Def_PDict_UnXiantaoCntEquip = "UnXiantaoCntEquip" # 累计未结算掉落的战锤数
|
| | | Def_PDict_BootyDropToday = "BootyDropToday_%s" # 今日已累计掉落战利品数量,参数(itemID)
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | | #可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
|
| | |
| | | ShareDefine.Def_Effect_HatAddPer: [ShareDefine.retHat, [ShareDefine.Def_Effect_MaxHP, ShareDefine.Def_Effect_Def]],
|
| | | ShareDefine.Def_Effect_TrousersAddPer: [ShareDefine.retTrousers, [ShareDefine.Def_Effect_MaxHP, ShareDefine.Def_Effect_Def]],
|
| | | ShareDefine.Def_Effect_ShoesAddPer: [ShareDefine.retShoes, [ShareDefine.Def_Effect_MaxHP, ShareDefine.Def_Effect_Def]],
|
| | | ShareDefine.Def_Effect_FairyCanAddPer: [ShareDefine.retFairyCan, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | ShareDefine.Def_Effect_FairyCan2AddPer: [ShareDefine.retFairyCan2, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | ShareDefine.Def_Effect_ShawlAddPer: [ShareDefine.retShawl, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | ShareDefine.Def_Effect_RingAddPer: [ShareDefine.retRing, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | ShareDefine.Def_Effect_NeckAddPer: [ShareDefine.retNeck, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | ShareDefine.Def_Effect_JadeAddPer: [ShareDefine.retJade, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | ShareDefine.Def_Effect_AmuletAddPer: [ShareDefine.retAmulet, [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MinAtk, ShareDefine.Def_Effect_MaxAtk, ShareDefine.Def_Effect_MaxHP]],
|
| | | }
|
| | |
|
| | | # 指定地图生效的非线性属性配置
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 15 主线掉落物品操作 #tagCSMainDropItemOP
|
| | |
|
| | | class tagCSMainDropItemOP(Structure):
|
| | | Head = tagHead()
|
| | | Count = 0 #(BYTE Count)
|
| | | IndexList = list() #(vector<WORD> IndexList)// 掉落背包中的物品格子索引列表
|
| | | OPType = 0 #(BYTE OPType)// 0 - 拾取非装备物品;1 - 分解;2 - 穿戴/替换;
|
| | | OPValue = 0 #(BYTE OPValue)// 操作额外指令值,由操作类型决定,如穿戴时可发送穿戴后是否自动分解
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB4
|
| | | self.Head.SubCmd = 0x15
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | value,_pos=CommFunc.ReadWORD(_lpData,_pos)
|
| | | self.IndexList.append(value)
|
| | | self.OPType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.OPValue,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB4
|
| | | self.Head.SubCmd = 0x15
|
| | | self.Count = 0
|
| | | self.IndexList = list()
|
| | | self.OPType = 0
|
| | | self.OPValue = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 2 * self.Count
|
| | | length += 1
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteWORD(data, self.IndexList[i])
|
| | | data = CommFunc.WriteBYTE(data, self.OPType)
|
| | | data = CommFunc.WriteBYTE(data, self.OPValue)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | Count:%d,
|
| | | IndexList:%s,
|
| | | OPType:%d,
|
| | | OPValue:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Count,
|
| | | "...",
|
| | | self.OPType,
|
| | | self.OPValue
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCSMainDropItemOP=tagCSMainDropItemOP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSMainDropItemOP.Head.Cmd,m_NAtagCSMainDropItemOP.Head.SubCmd))] = m_NAtagCSMainDropItemOP
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 13 主线战斗请求 #tagCSMainFightReq
|
| | |
|
| | | class tagCSMainFightReq(Structure):
|
| | |
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ReqType", c_ubyte), # 0-停止战斗回城;1-设置消耗倍值;2-挑战小怪;3-挑战boss;4-下一段战报;5-下一队;
|
| | | ("ReqType", c_ubyte), # 0-停止战斗回城;1-设置消耗倍值;2-挑战关卡小怪;3-挑战关卡boss;4-继续战斗;
|
| | | ("ReqValue", c_int), # 请求值,ReqType为1时发送消耗倍值
|
| | | ]
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 23 每日掉落战利品信息 #tagSCDropBootyInfo
|
| | |
|
| | | class tagSCDropBooty(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("ItemID", c_int), # 战利品ID
|
| | | ("TodayDropCnt", c_int), # 今日已掉落数量
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.ItemID = 0
|
| | | self.TodayDropCnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagSCDropBooty)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B1 23 每日掉落战利品信息 //tagSCDropBootyInfo:
|
| | | ItemID:%d,
|
| | | TodayDropCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.ItemID,
|
| | | self.TodayDropCnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCDropBootyInfo(Structure):
|
| | | Head = tagHead()
|
| | | Count = 0 #(WORD Count)
|
| | | DropBootyList = list() #(vector<tagSCDropBooty> DropBootyList)//每日已掉落战利品信息列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x23
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temDropBootyList = tagSCDropBooty()
|
| | | _pos = temDropBootyList.ReadData(_lpData, _pos)
|
| | | self.DropBootyList.append(temDropBootyList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x23
|
| | | self.Count = 0
|
| | | self.DropBootyList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 2
|
| | | for i in range(self.Count):
|
| | | length += self.DropBootyList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteWORD(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.DropBootyList[i].GetLength(), self.DropBootyList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | Count:%d,
|
| | | DropBootyList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCDropBootyInfo=tagSCDropBootyInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCDropBootyInfo.Head.Cmd,m_NAtagSCDropBootyInfo.Head.SubCmd))] = m_NAtagSCDropBootyInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 17 头像信息 #tagMCFaceInfo
|
| | |
|
| | | class tagMCFace(Structure):
|
| | |
| | | import GameWorld
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import GameLogic_MainLevel
|
| | |
|
| | | def OnExec(curPlayer, gmList):
|
| | |
|
| | | if not gmList:
|
| | | GameWorld.DebugAnswer(curPlayer, "重置主线: MainLevel 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置主线: MainLevel 章节 关卡 波")
|
| | | GameWorld.DebugAnswer(curPlayer, "测试掉落: MainLevel d 击杀数")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置战利: MainLevel b 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置战利: MainLevel b 战利品ID 已掉落个数")
|
| | | return
|
| | |
|
| | | value = gmList[0]
|
| | |
|
| | | if value == "d":
|
| | | killCnt = gmList[1] if len(gmList) > 1 else 1
|
| | | GameLogic_MainLevel.GMTestKillDrop(curPlayer, killCnt)
|
| | | return
|
| | | |
| | | if value == "b":
|
| | | itemID = gmList[1] if len(gmList) > 1 else 1
|
| | | dropTotal = gmList[2] if len(gmList) > 2 else 1
|
| | | if not itemID:
|
| | | GameLogic_MainLevel.ResetBootyDropToday(curPlayer)
|
| | | return
|
| | | bootyItemIDList = GameLogic_MainLevel.GetBootyItemIDList()
|
| | | if itemID not in bootyItemIDList:
|
| | | GameWorld.DebugAnswer(curPlayer, "战利品ID(%s) not in %s" % (itemID, bootyItemIDList))
|
| | | return
|
| | | GameLogic_MainLevel.SetBootyDropToday(curPlayer, itemID, dropTotal)
|
| | | GameWorld.DebugAnswer(curPlayer, "设置战利品(%s)今日掉落: %s" % (itemID, dropTotal))
|
| | | return
|
| | | |
| | | if value <= 0:
|
| | | nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, 1, 1, 1)
|
| | | passValue = PlayerControl.SetMainLevelPassInfo(curPlayer, 0, 0, 0)
|
| | |
| | |
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import ShareDefine
|
| | | import GameWorld
|
| | | import ChConfig
|
| | | import ItemCommon
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | |
| | |
|
| | | #输入命令格式错误
|
| | | if len(msgList) < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItemCount ID (个数 拍品组数 全部传奇属性)")
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItemCount ID [个数 定制ID]")
|
| | | return
|
| | |
|
| | | event = [ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]
|
| | | itemID = msgList[0]
|
| | | itemCount = msgList[1] if len(msgList) > 1 else 1
|
| | | auctionGroup = msgList[2] if len(msgList) > 2 else 0
|
| | | isAllAttr = msgList[3] if len(msgList) > 3 else 0
|
| | | appointID = msgList[2] if len(msgList) > 2 else 0
|
| | | auctionGroup = 0
|
| | |
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
|
| | | return
|
| | |
|
| | | playerItemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | setAttrDict = {ShareDefine.Def_CItemKey_AppointID:appointID} if appointID else {}
|
| | |
|
| | | # 拍品
|
| | | if auctionGroup > 0:
|
| | |
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, True, [IPY_GameWorld.rptItem], event=event):
|
| | | GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
|
| | | else:
|
| | | if ItemCommon.GetIsEquip(itemData) or itemData.GetPackCount() <= 1:
|
| | | for _ in xrange(itemCount):
|
| | | __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, 1, False, isAllAttr, event)
|
| | | else:
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, False, [IPY_GameWorld.rptItem], event=event):
|
| | | GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, False, [IPY_GameWorld.rptItem], event=event, setAttrDict=setAttrDict):
|
| | | GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
|
| | | return
|
| | |
|
| | | def __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, count, isAuctionItem, isAllAttr, event):
|
| | | if ItemControler.GetAppointItemRealID(itemID):
|
| | | ItemControler.GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event=event)
|
| | | return
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, count, isAuctionItem, curPlayer=curPlayer, isAllAttr=isAllAttr)
|
| | | if not playerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=event):
|
| | | GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
|
| | | |
| | | return
|
| | |
|
| | | |
| | | |
| | |
|
| | |
| | | openFuncIDList = [openFuncID]
|
| | |
|
| | | if openFuncIDList:
|
| | | needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit(openFuncIDList)
|
| | | needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit(curPlayer, openFuncIDList)
|
| | | if needMagicWeaponIDList:
|
| | | openFuncIDList.append(ShareDefine.GameFuncID_MagicWeapon)
|
| | | if needRealmLV:
|
| | | openFuncIDList.append(ShareDefine.GameFuncID_Official)
|
| | | needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit(openFuncIDList)
|
| | | needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit(curPlayer, openFuncIDList)
|
| | |
|
| | | GameWorld.DebugLog("GM处理等级开启功能: openFuncID=%s,openFuncIDList=%s,needLV=%s" % (openFuncID, openFuncIDList, needLV), curPlayer.GetPlayerID())
|
| | |
|
| | |
| | | GameFuncComm.DoFuncOpenLogic(curPlayer, needMissionIDList)
|
| | | return
|
| | |
|
| | | def __GetOpenFuncLimit(openFuncIDList):
|
| | | maxLV = IpyGameDataPY.GetFuncCfg("PlayerMaxLV")
|
| | | def __GetOpenFuncLimit(curPlayer, openFuncIDList):
|
| | | maxLV = PlayerControl.GetPlayerMaxLV(curPlayer)
|
| | | needLV = 0
|
| | | needRealmLV = 0
|
| | | needMissionIDList = []
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncFirstTouch % keyNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState % keyNum, 0)
|
| | |
|
| | | needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit([])
|
| | | needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit(curPlayer, [])
|
| | | for missionID in needMissionIDList:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_MissionFinish % missionID, 0)
|
| | |
|
| | |
| | |
|
| | | #验证权限失败
|
| | | elif not CheckGMLV(curPlayer , callFunName):
|
| | | GameWorld.DebugAnswer(curPlayer, 'GM等级不足!')
|
| | | return
|
| | |
|
| | | callFunc = GameWorld.GetExecFunc(Commands, "%s.%s"%(callFunName, "OnExec"))
|
| | |
| | | continue
|
| | | inputList[i] = value
|
| | |
|
| | | isSendGameServer = callFunc(curPlayer, inputList)
|
| | | callFunc(curPlayer, inputList)
|
| | | DR_UseGMCMD(curPlayer, inputStr)
|
| | | if isSendGameServer:
|
| | | curPlayer.GameServer_GMCmd(inputStr)
|
| | | return
|
| | |
|
| | | # GameObj 的 Get、Set函数
|
| | |
| | | DR_UseGMCMD(curPlayer, inputStr)
|
| | | return
|
| | |
|
| | | curPlayer.GameServer_GMCmd(inputStr)
|
| | | #没有此命令
|
| | | GameWorld.Log("###使用GM命令 = %s, 没有该命令!" % callFunName, curPlayer.GetPlayerID())
|
| | | GameWorld.DebugAnswer(curPlayer, 'no cmd !!!')
|
| | | except BaseException:
|
| | | GameWorld.DebugAnswer(curPlayer, "执行GM命令错误, 请查看所在地图日志!")
|
| | | errorMsg = str(traceback.format_exc())
|
| | |
| | |
|
| | | return
|
| | |
|
| | | ## NPC攻击成功后FB处理(说明:进入这个函数的时候,怪物已经死亡,掉落经验等都处理过了)
|
| | | # @param curNPC 攻击方
|
| | | # @param target 防守方
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def DoOverNPCAttackSuccess(curNPC, target, tick):
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID())
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "DoOverNPCAttackSuccess"))
|
| | | |
| | | if callFunc:
|
| | | callFunc(curNPC, target, tick)
|
| | | |
| | | return
|
| | |
|
| | | ## 玩家死亡
|
| | | # @param curPlayer:死亡的玩家
|
| | | # @return None
|
| | |
| | |
|
| | | return callFunc(curPlayer, mapID, funcLineID, tagType, tagID, valueList)
|
| | |
|
| | | def OnPlayerLineupAttackSuccess(curPlayer, atkObj, defObj, curSkill, mapID, funcLineID):
|
| | | ## 回合战斗主动发起的玩家阵容释放技能成功
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(mapID)
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnPlayerLineupAttackSuccess"))
|
| | | |
| | | if callFunc:
|
| | | callFunc(curPlayer, atkObj, defObj, curSkill, mapID, funcLineID)
|
| | | |
| | | return
|
| | |
|
| | | def OnPlayerLineupAttackResult(curPlayer, atkObj, defObj, curSkill, mapID, funcLineID):
|
| | | ## 回合战斗主动发起的玩家阵容攻击结果额外处理
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(mapID)
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnPlayerLineupAttackResult"))
|
| | | |
| | | if callFunc:
|
| | | callFunc(curPlayer, atkObj, defObj, curSkill, mapID, funcLineID)
|
| | | |
| | | return
|
| | |
|
| | | def OnTurnFightOver(curPlayer, mapID, funcLineID, tagType, tagID, valueList, fightRet):
|
| | | ## 回合战斗结束
|
| | | # @return: 是否需要同步GameServer, 奖励列表
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package GameWorldLogic.FBProcess.GameLogic_MainLevel
|
| | | #
|
| | | # @todo:主线关卡
|
| | | # @author hxp
|
| | | # @date 2025-07-10
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 主线关卡
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-07-10 17:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import GameWorld
|
| | | import ShareDefine
|
| | | import SkillCommon
|
| | | import IpyGameDataPY
|
| | | import PlayerControl
|
| | | import ChPyNetSendPack
|
| | | import ItemControler
|
| | | import IPY_GameWorld
|
| | | import NetPackCommon
|
| | | import TurnAttack
|
| | | import ItemCommon
|
| | | import NPCCommon
|
| | | import random
|
| | |
|
| | | def OnFBPlayerOnLogin(curPlayer):
|
| | | SyncDropBootyInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def OnFBPlayerOnDay(curPlayer):
|
| | | ResetBootyDropToday(curPlayer)
|
| | | return
|
| | |
|
| | | def ResetBootyDropToday(curPlayer):
|
| | | bootyItemIDList = GetBootyItemIDList()
|
| | | for itemID in bootyItemIDList:
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BootyDropToday % itemID, 0)
|
| | | SyncDropBootyInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def SetBootyDropToday(curPlayer, itemID, updDropToday):
|
| | | updDropToday = min(updDropToday, ChConfig.Def_UpperLimit_DWord)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BootyDropToday % itemID, updDropToday)
|
| | | GameWorld.DebugLog("更新今日掉落战利品数: itemID=%s,updDropToday=%s" % (itemID, updDropToday), curPlayer.GetPlayerID()) |
| | | SyncDropBootyInfo(curPlayer, itemID)
|
| | | return
|
| | |
|
| | | def GetBootyItemIDList():
|
| | | ## 获取所有的战利品ID
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | chapterCount = ipyDataMgr.GetMainChapterCount()
|
| | | if not chapterCount:
|
| | | return []
|
| | | ipyData = ipyDataMgr.GetMainChapterByIndex(chapterCount - 1)
|
| | | return [booty[0] for booty in ipyData.GetDailyBootyUpperList()]
|
| | |
|
| | | def OnPlayerLineupAttackSuccess(curPlayer, atkObj, defObj, curSkill, mapID, funcLineID):
|
| | | ## 回合战斗主动发起的玩家阵容释放技能成功
|
| | | |
| | | if mapID == ChConfig.Def_FBMapID_Main:
|
| | | __doCostZhanchui(curPlayer, atkObj, curSkill)
|
| | | |
| | | return
|
| | |
|
| | | def __doCostZhanchui(curPlayer, atkObj, curSkill):
|
| | | ## 扣除战锤消耗
|
| | | costZhanchui = 0
|
| | | isXP = SkillCommon.isXPSkill(curSkill)
|
| | | turnBattleType = atkObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnBattleType)
|
| | | if isXP:
|
| | | costZhanchui = IpyGameDataPY.GetFuncCfg("ZhanchuiCost", 2)
|
| | | elif turnBattleType == ChConfig.TurnBattleType_Combo:
|
| | | costZhanchui = IpyGameDataPY.GetFuncCfg("ZhanchuiCost", 3)
|
| | | elif turnBattleType == ChConfig.TurnBattleType_AtkBack:
|
| | | costZhanchui = IpyGameDataPY.GetFuncCfg("ZhanchuiCost", 4)
|
| | | elif SkillCommon.isTurnNormalAtkSkill(curSkill):
|
| | | costZhanchui = IpyGameDataPY.GetFuncCfg("ZhanchuiCost", 1)
|
| | | |
| | | if costZhanchui <= 0:
|
| | | return
|
| | | |
| | | fightPoint = max(curPlayer.GetFightPoint(), 1) # 主线战斗消耗倍值,默认1
|
| | | costZhanchuiTotal = costZhanchui * fightPoint
|
| | | if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Xiantao, costZhanchuiTotal, isNotify=False):
|
| | | # 不足时,有多少扣多少
|
| | | nowMoney = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_Xiantao)
|
| | | PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Xiantao, min(nowMoney, costZhanchuiTotal), isNotify=False)
|
| | | |
| | | return
|
| | |
|
| | | def OnPlayerLineupAttackResult(curPlayer, atkObj, defObj, curSkill, mapID, funcLineID):
|
| | | |
| | | if mapID == ChConfig.Def_FBMapID_Main:
|
| | | __doKillAward(curPlayer, atkObj, mapID, funcLineID)
|
| | | |
| | | return
|
| | |
|
| | | def __doKillAward(curPlayer, atkObj, mapID, funcLineID):
|
| | | ## 计算击杀奖励
|
| | | turnFight = TurnAttack.GetTurnFightMgr().getNPCTurnFight(atkObj.GetID())
|
| | | if not turnFight:
|
| | | return
|
| | | |
| | | unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp)
|
| | | if not turnFight.playerKillObjIDList:
|
| | | unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip)
|
| | | GameWorld.DebugLog("没有击杀不需要处理! unXiantaoCntExp=%s,unXiantaoCntEquip=%s" % (unXiantaoCntExp, unXiantaoCntEquip))
|
| | | return
|
| | | killCnt = len(turnFight.playerKillObjIDList)
|
| | | # 直接重置,防止异常时重复结算
|
| | | turnFight.playerKillObjIDList = []
|
| | | |
| | | # 结算经验
|
| | | if unXiantaoCntExp:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntExp, 0)
|
| | | perExp = IpyGameDataPY.GetFuncCfg("Mainline", 1) # 每个战锤增加经验
|
| | | totalExp = unXiantaoCntExp * perExp
|
| | | GameWorld.DebugLog("增加经验: totalExp=%s,unXiantaoCntExp=%s" % (totalExp, unXiantaoCntExp))
|
| | | PlayerControl.PlayerControl(curPlayer).AddExp(totalExp, ShareDefine.Def_ViewExpType_KillNPC)
|
| | | |
| | | __doMainDrop(curPlayer, killCnt)
|
| | | return
|
| | |
|
| | | def __doMainDrop(curPlayer, killCnt):
|
| | | # 装备掉落
|
| | | __doDropEquip(curPlayer)
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | DailyBootyUpperList, BootyWeightList = [], []
|
| | | chapterID = PlayerControl.GetMainLevelNowInfo(curPlayer)[0]
|
| | | chapterIpyData = IpyGameDataPY.GetIpyGameData("MainChapter", chapterID)
|
| | | if chapterIpyData:
|
| | | DailyBootyUpperList = chapterIpyData.GetDailyBootyUpperList()
|
| | | BootyWeightList = chapterIpyData.GetBootyWeightList()
|
| | | |
| | | bootyDropUpperDict = {k:v for k, v in DailyBootyUpperList} |
| | | GameWorld.DebugLog("可掉落战利品上限: chapterID=%s,%s,killCnt=%s" % (chapterID, bootyDropUpperDict, killCnt), playerID)
|
| | | |
| | | # 其他战利品掉落
|
| | | for _ in range(killCnt):
|
| | | dropInfo = GameWorld.GetResultByWeightList(BootyWeightList)
|
| | | if not dropInfo:
|
| | | continue
|
| | | itemID = dropInfo[0]
|
| | | if not itemID:
|
| | | GameWorld.DebugLog("本次不掉落战利品!", playerID)
|
| | | continue
|
| | | if itemID not in bootyDropUpperDict:
|
| | | GameWorld.DebugLog("该战利品未解锁! itemID=%s" % itemID, playerID)
|
| | | continue
|
| | | todyDropCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID)
|
| | | dropUpper = bootyDropUpperDict.get(itemID, 0)
|
| | | if todyDropCnt >= dropUpper:
|
| | | GameWorld.DebugLog("战利品已达今日掉落上限! itemID=%s,todyDropCnt=%s >= %s" % (itemID, todyDropCnt, dropUpper), playerID)
|
| | | continue
|
| | | |
| | | dropMin = dropInfo[1] if len(dropInfo) > 1 else 1
|
| | | dropMax = dropInfo[2] if len(dropInfo) > 2 else 1
|
| | | |
| | | if dropMin == dropMax:
|
| | | dropCnt = dropMin
|
| | | else:
|
| | | dropCnt = random.randint(dropMin, dropMax)
|
| | | dropCnt = min(dropCnt, dropUpper - todyDropCnt)
|
| | | |
| | | GameWorld.DebugLog("掉落战利品! itemID=%s,dropCnt=%s" % (itemID, dropCnt), playerID)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, dropCnt, False, curPlayer=curPlayer)
|
| | | if curItem == None:
|
| | | continue
|
| | | curItem.SetIsBind(1) # 为1时代表是掉落
|
| | | if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
|
| | | continue
|
| | | SetBootyDropToday(curPlayer, itemID, todyDropCnt + dropCnt)
|
| | | |
| | | return
|
| | |
|
| | | def __doDropEquip(curPlayer):
|
| | | ## 主线掉落装备
|
| | | unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip)
|
| | | dropOneNeed = IpyGameDataPY.GetFuncCfg("MainEquipDrop", 1) # 每消耗X个战锤掉落一件装备
|
| | | dropEquipCnt = unXiantaoCntEquip / dropOneNeed
|
| | | if dropEquipCnt <= 0:
|
| | | GameWorld.DebugLog("主线暂不能掉落! unXiantaoCntEquip=%s,dropOneNeed=%s,dropEquipCnt=%s" % (unXiantaoCntEquip, dropOneNeed, dropEquipCnt))
|
| | | return
|
| | | dropEquipCnt = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptIdentify, dropEquipCnt)
|
| | | if not dropEquipCnt:
|
| | | GameWorld.DebugLog("掉落鉴定背包没有空间!")
|
| | | return
|
| | | |
| | | playerID = curPlayer.GetPlayerID() |
| | | treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("TreeLV", treeLV)
|
| | | if not ipyData:
|
| | | return
|
| | | equipColorRateList = ipyData.GetEquipColorRateList()
|
| | | GameWorld.DebugLog("主线掉落装备: unXiantaoCntEquip=%s,dropEquipCnt=%s,treeLV=%s,equipColorRateList=%s" % (unXiantaoCntEquip, dropEquipCnt, treeLV, equipColorRateList), playerID)
|
| | | |
| | | maxRate = 10000
|
| | | totalRate = 0
|
| | | colorRateList = []
|
| | | for equipColor, colorRate in enumerate(equipColorRateList, 1):
|
| | | if not colorRate:
|
| | | continue
|
| | | totalRate += colorRate
|
| | | colorRateList.append([totalRate, equipColor])
|
| | | |
| | | if totalRate != maxRate:
|
| | | GameWorld.SendGameError("GameWarning", "CutTreeTotalRateError:%s!=%s,treeLV=%s" % (totalRate, maxRate, treeLV)) |
| | | if not colorRateList:
|
| | | return
|
| | | GameWorld.DebugLog(" colorRateList=%s,totalRate=%s" % (colorRateList, totalRate), playerID)
|
| | | |
| | | for _ in range(dropEquipCnt):
|
| | | itemColor = GameWorld.GetResultByRandomList(colorRateList)
|
| | | if not itemColor:
|
| | | continue
|
| | | equipIDList = NPCCommon.__GetEquipIDList(0, color=itemColor, findType="MainEquipDrop")
|
| | | if not equipIDList:
|
| | | continue
|
| | | randEquipID = random.choice(equipIDList)
|
| | | |
| | | curItem = ItemControler.GetOutPutItemObj(randEquipID, 1, False, curPlayer=curPlayer)
|
| | | if curItem == None:
|
| | | continue
|
| | | curItem.SetIsBind(1) # 为1时代表是掉落
|
| | | |
| | | #GameWorld.DebugLog("掉落装备: randEquipID=%s,%s" % (randEquipID, curItem.GetGUID()), playerID)
|
| | | if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
|
| | | continue
|
| | | |
| | | unXiantaoCntEquip -= dropOneNeed
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip)
|
| | | |
| | | return
|
| | |
|
| | | def GMTestKillDrop(curPlayer, killCnt):
|
| | | ## GM测试掉落
|
| | | unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip) + killCnt
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip)
|
| | | __doMainDrop(curPlayer, killCnt)
|
| | | |
| | | unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip)
|
| | | GameWorld.DebugAnswer(curPlayer, "剩余未结算装备掉落战锤数:%s" % unXiantaoCntEquip)
|
| | | return
|
| | |
|
| | | #// B4 15 主线掉落物品操作 #tagCSMainDropItemOP
|
| | | #
|
| | | #struct tagCSMainDropItemOP
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE Count;
|
| | | # WORD IndexList[Count]; // 掉落背包中的物品格子索引列表
|
| | | # BYTE OPType; // 0 - 拾取非装备物品;1 - 分解;2 - 穿戴/替换;
|
| | | # BYTE OPValue; // 操作额外指令值,由操作类型决定,如穿戴时可发送穿戴后是否自动分解
|
| | | #};
|
| | | def OnMainDropItemOP(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | itemIndexList = clientData.IndexList
|
| | | opType = clientData.OPType
|
| | | opValue = clientData.OPValue
|
| | | |
| | | if opType == 2:
|
| | | __doEquipMainEquip(curPlayer, itemIndexList, opValue)
|
| | | elif opType == 1:
|
| | | __doDecomposeMainEquip(curPlayer, itemIndexList)
|
| | | else:
|
| | | __doPickupMainItem(curPlayer, itemIndexList)
|
| | | |
| | | return
|
| | |
|
| | | def __doEquipMainEquip(curPlayer, itemIndexList, isAutoDecompose):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("穿戴主线装备: itemIndexList=%s,isAutoDecompose=%s" % (itemIndexList, isAutoDecompose), playerID)
|
| | | IdentifyPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
| | | |
| | | decomposeIndexList = []
|
| | | for itemIndex in itemIndexList:
|
| | | if itemIndex < 0 or itemIndex >= IdentifyPack.GetCount():
|
| | | continue
|
| | | curEquip = IdentifyPack.GetAt(itemIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | GameWorld.DebugLog("物品为空或不可用: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | |
| | | if not ItemCommon.GetIsMainEquip(curEquip):
|
| | | GameWorld.DebugLog("非主线装备: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | |
| | | itemID = curEquip.GetItemTypeID()
|
| | | equipPlace = curEquip.GetEquipPlace()
|
| | | equipPlaceIndex = equipPlace - 1 # 暂固定直接装备位-1
|
| | | |
| | | GameWorld.DebugLog(" itemIndex=%s,itemID=%s,equipPlace=%s,equipPlaceIndex=%s" |
| | | % (itemIndex, itemID, equipPlace, equipPlaceIndex), playerID)
|
| | | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | if equipPlaceIndex < 0 or equipPlaceIndex >= equipPack.GetCount():
|
| | | GameWorld.ErrLog("主线装备对应装备位置索引异常: itemIndex=%s,equipPlace=%s,equipPlaceIndex=%s" |
| | | % (itemIndex, equipPlace, equipPlaceIndex), playerID)
|
| | | continue
|
| | | destEquip = equipPack.GetAt(equipPlaceIndex)
|
| | | canDecomp = ItemCommon.CheckItemCanUse(destEquip)
|
| | | |
| | | curEquip.GetItem().SetIsBind(0) # 穿戴时重置,取源SingleItem修改不通知
|
| | | if not ItemCommon.DoLogicSwitchItem(curPlayer, curEquip, destEquip, IPY_GameWorld.rptEquip):
|
| | | continue
|
| | | |
| | | if isAutoDecompose and canDecomp:
|
| | | decomposeIndexList.append(itemIndex)
|
| | | |
| | | if decomposeIndexList:
|
| | | __doDecomposeMainEquip(curPlayer, decomposeIndexList)
|
| | | |
| | | # 刷属性
|
| | | |
| | | return
|
| | |
|
| | | def __doDecomposeMainEquip(curPlayer, itemIndexList):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("分解主线装备: itemIndexList=%s" % (itemIndexList), playerID)
|
| | | IdentifyPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
| | | |
| | | moneyType = IpyGameDataPY.GetFuncCfg("MainEquipDrop", 2)
|
| | | if not moneyType:
|
| | | return
|
| | | |
| | | moneyTotal = 0
|
| | | |
| | | decomposeIndexList = []
|
| | | for itemIndex in itemIndexList:
|
| | | if itemIndex < 0 or itemIndex >= IdentifyPack.GetCount():
|
| | | continue
|
| | | curEquip = IdentifyPack.GetAt(itemIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | GameWorld.DebugLog("物品为空或不可用: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | |
| | | if not ItemCommon.GetIsMainEquip(curEquip):
|
| | | GameWorld.DebugLog("非主线装备: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | itemColor = curEquip.GetItemColor()
|
| | | |
| | | colorIpyData = IpyGameDataPY.GetIpyGameData("EquipColor", itemColor)
|
| | | if not colorIpyData:
|
| | | return
|
| | | moneyBase = colorIpyData.GetMoneyBase() # 分解货币基础
|
| | | if not moneyBase:
|
| | | return
|
| | | # 可以处理一些加成
|
| | | |
| | | decomposeMoney = moneyBase
|
| | | |
| | | moneyTotal += decomposeMoney
|
| | | GameWorld.DebugLog(" itemIndex=%s,itemColor=%s,moneyBase=%s,decomposeMoney=%s,%s" |
| | | % (itemIndex, itemColor, moneyBase, decomposeMoney, moneyTotal), playerID)
|
| | | |
| | | ItemCommon.DelItem(curPlayer, curEquip, curEquip.GetCount(), True, ChConfig.ItemDel_EquipDecompose)
|
| | | decomposeIndexList.append(itemIndex)
|
| | | |
| | | if not moneyTotal:
|
| | | return
|
| | | |
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyTotal, "DecomposeMainEquip", isSysHint=False)
|
| | | return
|
| | |
|
| | | def __doPickupMainItem(curPlayer, itemIndexList):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("拾取主线掉落战利品! itemIndexList=%s" % itemIndexList, playerID)
|
| | | IdentifyPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
| | | |
| | | itemControl = ItemControler.PlayerItemControler(curPlayer)
|
| | | |
| | | for itemIndex in itemIndexList:
|
| | | if itemIndex < 0 or itemIndex >= IdentifyPack.GetCount():
|
| | | continue
|
| | | curItem = IdentifyPack.GetAt(itemIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | GameWorld.DebugLog("物品为空或不可用: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | |
| | | if ItemCommon.GetIsMainEquip(curItem):
|
| | | GameWorld.DebugLog("主线装备不可拾取: itemIndex=%s" % itemIndex, playerID)
|
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | item = curItem.GetItem()
|
| | | itemCount = ItemControler.GetItemCount(curItem)
|
| | | GameWorld.DebugLog("主线物品拾取: itemIndex=%s,itemID=%s,itemCount=%s" % (itemIndex, itemID, itemCount), playerID)
|
| | | if not itemControl.PutInItem(IPY_GameWorld.rptItem, item):
|
| | | return
|
| | | |
| | | curItem.Wipe()
|
| | | |
| | | return
|
| | |
|
| | | def SyncDropBootyInfo(curPlayer, itemID=0):
|
| | | if not itemID:
|
| | | syncItemIDList = GetBootyItemIDList()
|
| | | else:
|
| | | syncItemIDList = [itemID]
|
| | | clientPack = ChPyNetSendPack.tagSCDropBootyInfo()
|
| | | clientPack.DropBootyList = []
|
| | | for itemID in syncItemIDList:
|
| | | dropBooty = ChPyNetSendPack.tagSCDropBooty()
|
| | | dropBooty.ItemID = itemID
|
| | | dropBooty.TodayDropCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID)
|
| | | clientPack.DropBootyList.append(dropBooty)
|
| | | clientPack.Count = len(clientPack.DropBootyList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
| | | ("list", "AttrValue", 0),
|
| | | ),
|
| | |
|
| | | "EquipColor":(
|
| | | ("BYTE", "ItemColor", 1),
|
| | | ("DWORD", "MoneyBase", 0),
|
| | | ("DWORD", "AtkStep", 0),
|
| | | ("DWORD", "DefStep", 0),
|
| | | ("DWORD", "HPStep", 0),
|
| | | ("list", "AttrLibCntList", 0),
|
| | | ("list", "AttrRange", 0),
|
| | | ("dict", "AttrRangeDict", 0),
|
| | | ),
|
| | |
|
| | | "EquipPlace":(
|
| | | ("BYTE", "EquipPlace", 1),
|
| | | ("float", "BaseAttrProportion", 0),
|
| | | ("list", "AttrLib1", 0),
|
| | | ("list", "AttrLib2", 0),
|
| | | ("list", "AttrLib3", 0),
|
| | | ),
|
| | |
|
| | | "AppointItem":(
|
| | | ("DWORD", "ID", 1),
|
| | | ("BYTE", "CancelUseLimit", 0),
|
| | | ("WORD", "ItemLV", 0),
|
| | | ("list", "BaseAttrID", 0),
|
| | | ("list", "BaseAttrValue", 0),
|
| | | ("list", "LegendAttrID", 0),
|
| | | ("list", "LegendAttrValue", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrCount":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("BYTE", "ItemColor", 1),
|
| | |
| | |
|
| | | "PlayerLV":(
|
| | | ("WORD", "LV", 1),
|
| | | ("DWORD", "ExpPoint", 0),
|
| | | ("DWORD", "Exp", 0),
|
| | | ("BYTE", "TalentPoint", 0),
|
| | | ("DWORD", "ReExp", 0),
|
| | |
| | | ("dict", "ItemID", 0),
|
| | | ("WORD", "Price", 0),
|
| | | ("WORD", "OldPrice", 0),
|
| | | ),
|
| | |
|
| | | "AppointItem":(
|
| | | ("DWORD", "ID", 1),
|
| | | ("BYTE", "CancelUseLimit", 0),
|
| | | ("list", "LegendAttrID", 0),
|
| | | ("list", "LegendAttrValue", 0),
|
| | | ),
|
| | |
|
| | | "AuctionItem":(
|
| | |
| | | ("DWORD", "LVUPNeedMoney", 0),
|
| | | ("DWORD", "LVUPNeedTime", 0),
|
| | | ("list", "EquipColorRateList", 0),
|
| | | ("list", "ExAwardItemRateList", 0),
|
| | | ),
|
| | | }
|
| | |
|
| | |
| | | def GetAttrType(self): return self.attrTuple[1] # 属性类型 list
|
| | | def GetAttrValue(self): return self.attrTuple[2] # 属性值 list |
| | | |
| | | # 装备品质表 |
| | | class IPY_EquipColor(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetItemColor(self): return self.attrTuple[0] # 装备品质 BYTE
|
| | | def GetMoneyBase(self): return self.attrTuple[1] # 分解货币 DWORD
|
| | | def GetAtkStep(self): return self.attrTuple[2] # 攻击步长 DWORD
|
| | | def GetDefStep(self): return self.attrTuple[3] # 防御步长 DWORD
|
| | | def GetHPStep(self): return self.attrTuple[4] # 生命步长 DWORD
|
| | | def GetAttrLibCntList(self): return self.attrTuple[5] # 库属性条数列表 list
|
| | | def GetAttrRange(self): return self.attrTuple[6] # 通用属性范围,下限|上限 list
|
| | | def GetAttrRangeDict(self): return self.attrTuple[7] # 指定属性范围字典,{指定属性ID:[范围下限, 上限], ...} dict |
| | | |
| | | # 装备部位表 |
| | | class IPY_EquipPlace(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetEquipPlace(self): return self.attrTuple[0] # 装备部位 BYTE
|
| | | def GetBaseAttrProportion(self): return self.attrTuple[1] # 基础属性占比 float
|
| | | def GetAttrLib1(self): return self.attrTuple[2] # 随机属性ID库1,[属性ID, ...] list
|
| | | def GetAttrLib2(self): return self.attrTuple[3] # 随机属性ID库2,[属性ID, ...] list
|
| | | def GetAttrLib3(self): return self.attrTuple[4] # 随机属性ID库3,[属性ID, ...] list |
| | | |
| | | # 定制属性表 |
| | | class IPY_AppointItem(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetID(self): return self.attrTuple[0] # 定制ID DWORD
|
| | | def GetCancelUseLimit(self): return self.attrTuple[1] # 穿戴限制(除职业) BYTE
|
| | | def GetItemLV(self): return self.attrTuple[2] # 物品等级 WORD
|
| | | def GetBaseAttrID(self): return self.attrTuple[3] # 基础属性ID list
|
| | | def GetBaseAttrValue(self): return self.attrTuple[4] # 基础属性值 list
|
| | | def GetLegendAttrID(self): return self.attrTuple[5] # 传奇属性ID list
|
| | | def GetLegendAttrValue(self): return self.attrTuple[6] # 传奇属性值 list |
| | | |
| | | # 装备传奇属性条数表 |
| | | class IPY_EquipLegendAttrCount(): |
| | | |
| | |
| | | return |
| | | |
| | | def GetLV(self): return self.attrTuple[0] # 玩家等级 WORD
|
| | | def GetExpPoint(self): return self.attrTuple[1] # 升级所需经验点,每个经验点代表的经验由项目决定 DWORD
|
| | | def GetExp(self): return self.attrTuple[2] # 除经验点总经验外升级还需的经验 DWORD
|
| | | def GetTalentPoint(self): return self.attrTuple[3] # 等级获得的天赋点 BYTE
|
| | | def GetReExp(self): return self.attrTuple[4] # 等级经验效率(second) DWORD
|
| | | def GetReMaxHP(self): return self.attrTuple[5] # 生命 DWORD
|
| | | def GetReAtk(self): return self.attrTuple[6] # 攻击 DWORD
|
| | | def GetReDef(self): return self.attrTuple[7] # 防御 DWORD
|
| | | def GetReHit(self): return self.attrTuple[8] # 命中 DWORD
|
| | | def GetReMiss(self): return self.attrTuple[9] # 闪避 DWORD
|
| | | def GetReAtkSpeed(self): return self.attrTuple[10] # 攻速 DWORD
|
| | | def GetReSkillAtkRate(self): return self.attrTuple[11] # 技能伤害比例 DWORD
|
| | | def GetReDamagePer(self): return self.attrTuple[12] # 增加伤害 DWORD
|
| | | def GetReDamReduce(self): return self.attrTuple[13] # 减少伤害 DWORD
|
| | | def GetReIgnoreDefRate(self): return self.attrTuple[14] # 无视防御比例 DWORD
|
| | | def GetReLuckyHitRate(self): return self.attrTuple[15] # 会心一击率 DWORD
|
| | | def GetReLuckyHit(self): return self.attrTuple[16] # 会心一击伤害 DWORD
|
| | | def GetReBleedDamage(self): return self.attrTuple[17] # 流血伤害增加 DWORD
|
| | | def GetReIceAtk(self): return self.attrTuple[18] # 真实伤害 DWORD
|
| | | def GetReIceDef(self): return self.attrTuple[19] # 真实抵御 DWORD
|
| | | def GetRePetAtk(self): return self.attrTuple[20] # 灵宠攻击 DWORD
|
| | | def GetRePetSkillAtkRate(self): return self.attrTuple[21] # 灵宠技能 DWORD
|
| | | def GetRePetDamPer(self): return self.attrTuple[22] # 灵宠伤害增加 DWORD
|
| | | def GetReFinalHurt(self): return self.attrTuple[23] # 固定伤害增加 DWORD
|
| | | def GetReFinalHurtReduce(self): return self.attrTuple[24] # 固定伤害减少 DWORD
|
| | | def GetRePotionReply(self): return self.attrTuple[25] # 血瓶恢复量 DWORD
|
| | | def GetRePotionCD(self): return self.attrTuple[26] # ѪƿCD DWORD
|
| | | def GetAttackEff(self): return self.attrTuple[27] # 挂机效率 DWORD
|
| | | def GetReFightPower(self): return self.attrTuple[28] # 战斗力 DWORD
|
| | | def GetIceLodeFightPower(self): return self.attrTuple[29] # 冰晶矿脉扫荡战斗力 DWORD |
| | | def GetExp(self): return self.attrTuple[1] # 升级所需经验 DWORD
|
| | | def GetTalentPoint(self): return self.attrTuple[2] # 等级获得的天赋点 BYTE
|
| | | def GetReExp(self): return self.attrTuple[3] # 等级经验效率(second) DWORD
|
| | | def GetReMaxHP(self): return self.attrTuple[4] # 生命 DWORD
|
| | | def GetReAtk(self): return self.attrTuple[5] # 攻击 DWORD
|
| | | def GetReDef(self): return self.attrTuple[6] # 防御 DWORD
|
| | | def GetReHit(self): return self.attrTuple[7] # 命中 DWORD
|
| | | def GetReMiss(self): return self.attrTuple[8] # 闪避 DWORD
|
| | | def GetReAtkSpeed(self): return self.attrTuple[9] # 攻速 DWORD
|
| | | def GetReSkillAtkRate(self): return self.attrTuple[10] # 技能伤害比例 DWORD
|
| | | def GetReDamagePer(self): return self.attrTuple[11] # 增加伤害 DWORD
|
| | | def GetReDamReduce(self): return self.attrTuple[12] # 减少伤害 DWORD
|
| | | def GetReIgnoreDefRate(self): return self.attrTuple[13] # 无视防御比例 DWORD
|
| | | def GetReLuckyHitRate(self): return self.attrTuple[14] # 会心一击率 DWORD
|
| | | def GetReLuckyHit(self): return self.attrTuple[15] # 会心一击伤害 DWORD
|
| | | def GetReBleedDamage(self): return self.attrTuple[16] # 流血伤害增加 DWORD
|
| | | def GetReIceAtk(self): return self.attrTuple[17] # 真实伤害 DWORD
|
| | | def GetReIceDef(self): return self.attrTuple[18] # 真实抵御 DWORD
|
| | | def GetRePetAtk(self): return self.attrTuple[19] # 灵宠攻击 DWORD
|
| | | def GetRePetSkillAtkRate(self): return self.attrTuple[20] # 灵宠技能 DWORD
|
| | | def GetRePetDamPer(self): return self.attrTuple[21] # 灵宠伤害增加 DWORD
|
| | | def GetReFinalHurt(self): return self.attrTuple[22] # 固定伤害增加 DWORD
|
| | | def GetReFinalHurtReduce(self): return self.attrTuple[23] # 固定伤害减少 DWORD
|
| | | def GetRePotionReply(self): return self.attrTuple[24] # 血瓶恢复量 DWORD
|
| | | def GetRePotionCD(self): return self.attrTuple[25] # ѪƿCD DWORD
|
| | | def GetAttackEff(self): return self.attrTuple[26] # 挂机效率 DWORD
|
| | | def GetReFightPower(self): return self.attrTuple[27] # 战斗力 DWORD
|
| | | def GetIceLodeFightPower(self): return self.attrTuple[28] # 冰晶矿脉扫荡战斗力 DWORD |
| | | |
| | | # 特殊地图玩家属性公式表 |
| | | class IPY_SpecMapPlayerAttrFormat(): |
| | |
| | | def GetItemID(self): return self.attrTuple[1] # 奖励物品信息 dict
|
| | | def GetPrice(self): return self.attrTuple[2] # 礼包现价 WORD
|
| | | def GetOldPrice(self): return self.attrTuple[3] # 礼包原价 WORD |
| | | |
| | | # 定制物品表 |
| | | class IPY_AppointItem(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetID(self): return self.attrTuple[0] # 定制物品ID DWORD
|
| | | def GetCancelUseLimit(self): return self.attrTuple[1] # 穿戴限制(除职业) BYTE
|
| | | def GetLegendAttrID(self): return self.attrTuple[2] # 传奇属性ID list
|
| | | def GetLegendAttrValue(self): return self.attrTuple[3] # 传奇属性值 list |
| | | |
| | | # 拍卖物品表 |
| | | class IPY_AuctionItem(): |
| | |
| | | def GetTreeLV(self): return self.attrTuple[0] # 仙树等级 BYTE
|
| | | def GetLVUPNeedMoney(self): return self.attrTuple[1] # 升到下一级所需货币数 DWORD
|
| | | def GetLVUPNeedTime(self): return self.attrTuple[2] # 升级下一级所需所需秒 DWORD
|
| | | def GetEquipColorRateList(self): return self.attrTuple[3] # 产出装备品质概率列表,[0品质万分率, 1品质万分率, ...] list
|
| | | def GetExAwardItemRateList(self): return self.attrTuple[4] # 每次砍树概率额外产出道具饼图,[[万分率,[物品ID,个数]], ...] list |
| | | def GetEquipColorRateList(self): return self.attrTuple[3] # 产出装备品质概率列表,[0品质万分率, 1品质万分率, ...] list |
| | |
|
| | |
|
| | | def Log(msg, playerID=0, par=0):
|
| | |
| | | self.__LoadFileData("ItemPlusMaster", onlyCheck)
|
| | | self.__LoadFileData("ItemPlusMax", onlyCheck)
|
| | | self.__LoadFileData("RoleEquipStars", onlyCheck)
|
| | | self.__LoadFileData("EquipColor", onlyCheck)
|
| | | self.__LoadFileData("EquipPlace", onlyCheck)
|
| | | self.__LoadFileData("AppointItem", onlyCheck)
|
| | | self.__LoadFileData("EquipLegendAttrCount", onlyCheck)
|
| | | self.__LoadFileData("EquipLegendAttrType", onlyCheck)
|
| | | self.__LoadFileData("EquipLegendAttrLib", onlyCheck)
|
| | |
| | | self.__LoadFileData("ContineSignAward", onlyCheck)
|
| | | self.__LoadFileData("SignAward", onlyCheck)
|
| | | self.__LoadFileData("VIPAward", onlyCheck)
|
| | | self.__LoadFileData("AppointItem", onlyCheck)
|
| | | self.__LoadFileData("AuctionItem", onlyCheck)
|
| | | self.__LoadFileData("VipPrivilege", onlyCheck)
|
| | | self.__LoadFileData("Store", onlyCheck)
|
| | |
| | | self.CheckLoadData("RoleEquipStars") |
| | | return self.ipyRoleEquipStarsCache[index]
|
| | | |
| | | def GetEquipColorCount(self): |
| | | self.CheckLoadData("EquipColor") |
| | | return self.ipyEquipColorLen
|
| | | def GetEquipColorByIndex(self, index): |
| | | self.CheckLoadData("EquipColor") |
| | | return self.ipyEquipColorCache[index]
|
| | | |
| | | def GetEquipPlaceCount(self): |
| | | self.CheckLoadData("EquipPlace") |
| | | return self.ipyEquipPlaceLen
|
| | | def GetEquipPlaceByIndex(self, index): |
| | | self.CheckLoadData("EquipPlace") |
| | | return self.ipyEquipPlaceCache[index]
|
| | | |
| | | def GetAppointItemCount(self): |
| | | self.CheckLoadData("AppointItem") |
| | | return self.ipyAppointItemLen
|
| | | def GetAppointItemByIndex(self, index): |
| | | self.CheckLoadData("AppointItem") |
| | | return self.ipyAppointItemCache[index]
|
| | | |
| | | def GetEquipLegendAttrCountCount(self): |
| | | self.CheckLoadData("EquipLegendAttrCount") |
| | | return self.ipyEquipLegendAttrCountLen
|
| | |
| | | def GetVIPAwardByIndex(self, index): |
| | | self.CheckLoadData("VIPAward") |
| | | return self.ipyVIPAwardCache[index]
|
| | | |
| | | def GetAppointItemCount(self): |
| | | self.CheckLoadData("AppointItem") |
| | | return self.ipyAppointItemLen
|
| | | def GetAppointItemByIndex(self, index): |
| | | self.CheckLoadData("AppointItem") |
| | | return self.ipyAppointItemCache[index]
|
| | | |
| | | def GetAuctionItemCount(self): |
| | | self.CheckLoadData("AuctionItem") |
| | |
| | | #===============================================================================
|
| | | def __Func_InitItem(tick):
|
| | | #初始化物品掉落保护
|
| | | MapItemProtectTime = IpyGameDataPY.GetFuncCfg("MapItemProtectTime")
|
| | | MapItemProtectTime = 120000 #IpyGameDataPY.GetFuncCfg("MapItemProtectTime")
|
| | | GameWorld.GetMapItemManager().SetProtectTime(MapItemProtectTime)
|
| | |
|
| | | #===============================================================================================
|
| | |
| | | infoDict[ShareDefine.Def_MapItemInfo_IsSuite] = 1
|
| | |
|
| | | return infoDict
|
| | |
|
| | | # 特别设定:卓越物品必带武器技能增强效果,使用者请特别注意
|
| | | ## 装备动态属性,只用于未设置属性的singleItem,roleItem使用多次发背包刷新包
|
| | | # @param curItem 玩家实例
|
| | | # @param equipData
|
| | | # @return |
| | | def EquipAddAdditionEx(curItem, equipData):
|
| | | # 绑定
|
| | | #if equipData.isBind:
|
| | | # ItemControler.SetItemIsBind(curItem, equipData.isBind)
|
| | | |
| | | if not ItemCommon.CheckItemIsEquip(curItem):
|
| | | return
|
| | | |
| | | #===========================================================================
|
| | | # # 强化等级
|
| | | # if equipData.starLV:
|
| | | # curItem.SetItemStarLV(equipData.starLV)
|
| | | # # 打孔
|
| | | # if 0 < equipData.holeCnt <= curItem.GetMaxHoleCount():
|
| | | # curItem.SetCanPlaceStoneCount(equipData.holeCnt)
|
| | | # |
| | | # # 给镶嵌宝石
|
| | | # for i, stoneID in enumerate(equipData.stoneData):
|
| | | # if i > equipData.holeCnt - 1:
|
| | | # break
|
| | | # |
| | | # if stoneID <= 0:
|
| | | # continue
|
| | | # |
| | | # curItem.SetStone(i, stoneID)
|
| | | #===========================================================================
|
| | | |
| | | # 套装
|
| | | #if equipData.isSuite:
|
| | | # curItem.SetIsSuite(equipData.isSuite)
|
| | | #if equipData.suiteLV:
|
| | | # curItem.SetUserAttr(ShareDefine.Def_IudetSuiteLV, equipData.suiteLV)
|
| | | # 物品来源
|
| | | if equipData.source:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetSource, equipData.source)
|
| | | |
| | | # 传奇属性
|
| | | if equipData.legendAttrIDList and equipData.legendAttrValueList:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | for i in xrange(len(equipData.legendAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, equipData.legendAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, equipData.legendAttrValueList[i])
|
| | | # 传奇属性 - 神
|
| | | if equipData.legendAttrIDListShen and equipData.legendAttrValueListShen:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDShen)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueShen)
|
| | | for i in xrange(len(equipData.legendAttrIDListShen)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDShen, equipData.legendAttrIDListShen[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueShen, equipData.legendAttrValueListShen[i])
|
| | | # 传奇属性 - 仙
|
| | | if equipData.legendAttrIDListXian and equipData.legendAttrValueListXian:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDXian)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueXian)
|
| | | for i in xrange(len(equipData.legendAttrIDListXian)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDXian, equipData.legendAttrIDListXian[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueXian, equipData.legendAttrValueListXian[i])
|
| | | # 传奇属性 - 极
|
| | | if equipData.legendAttrIDListJi and equipData.legendAttrValueListJi:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDJi)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueJi)
|
| | | for i in xrange(len(equipData.legendAttrIDListJi)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDJi, equipData.legendAttrIDListJi[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueJi, equipData.legendAttrValueListJi[i])
|
| | | |
| | | ItemCommon.MakeEquipGS(curItem) |
| | | return
|
| | |
|
| | |
|
| | | ## 判断装备是否是可加强装备
|
| | | # @param curItem 物品实例
|
| | |
| | | #itemColor = curItem.GetItemColor()
|
| | | result = self.SwitchEquip(curItem, equipPackIndex)
|
| | | if result:
|
| | | #穿戴某阶某品质的装备成就
|
| | | PlayerSuccess.DoEquipSuccessLogic(curPlayer, classLV)
|
| | | #换装宝石处理
|
| | | Operate_EquipStone.DoMoveEquipStone(curPlayer, equipPackIndex)
|
| | | dataDict = {'dotype':'EquipItem', 'desItemID':desItemID, 'desUserData':desUserData,'srcItemID':srcItemID,'srcUserData':srcUserData}
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList=None, event=["", False, {}]):
|
| | | def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList=None, event=["", False, {}], setAttrDict=None):
|
| | | '''给玩家物品
|
| | | @param isAuctionItem: 是否拍品
|
| | | '''
|
| | |
| | | #不可放入
|
| | | return False
|
| | |
|
| | | #定制物品
|
| | | if GetAppointItemRealID(itemID):
|
| | | isOK = False
|
| | | for _ in xrange(itemCount):
|
| | | if GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event):
|
| | | isOK = True # 只要有成功的就返回成功,防止异常情况失败可能导致被刷
|
| | | return isOK
|
| | | |
| | | #装备
|
| | | if ItemCommon.GetIsEquip(curItemData):
|
| | | isOK = False
|
| | | for _ in xrange(itemCount):
|
| | | outPutEquip = GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
|
| | | outPutEquip = GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer, setAttrDict=setAttrDict)
|
| | | if not outPutEquip:
|
| | | return isOK
|
| | | if DoLogic_PutItemInPack(curPlayer, outPutEquip, event, packIndexList):
|
| | |
| | | for _ in range(itemCount/65535 + 1):
|
| | | if itemCount <= 0:
|
| | | break
|
| | | giveItem = GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | giveItem = GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer, setAttrDict=setAttrDict)
|
| | | if not giveItem:
|
| | | return isOK
|
| | | giveCount = GetItemCount(giveItem)
|
| | |
| | | giveOKCount += curCount
|
| | |
|
| | | return giveOKCount
|
| | |
|
| | | def GivePlayerAppointItem(curPlayer, appointID, isAuctionItem, event=["", False, {}]):
|
| | | '''给玩家定制物品表物品,定制物品默认个数1
|
| | | @param appointID 定制表ID
|
| | | @param isAuctionItem 是否拍品
|
| | | '''
|
| | | itemDictData = GetAppointItemDictData(appointID, isAuctionItem)
|
| | | if not itemDictData:
|
| | | return False
|
| | | |
| | | return GivePlayerEquip(curPlayer, itemDictData, event=event)
|
| | |
|
| | | def GetAppointItemDictData(appointID, isAuctionItem):
|
| | | '''获取定制表物品数据,定制物品默认个数1
|
| | | @param appointID 定制表ID
|
| | | @param isAuctionItem 是否拍品
|
| | | '''
|
| | | itemID = GetAppointItemRealID(appointID)
|
| | | if not itemID:
|
| | | return {}
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", appointID)
|
| | | if not ipyData:
|
| | | return {}
|
| | | itemDictData = {}
|
| | | |
| | | itemDictData['legendAttrID'] = ipyData.GetLegendAttrID()
|
| | | itemDictData['legendAttrValue'] = ipyData.GetLegendAttrValue()
|
| | | itemDictData['ItemID'] = itemID
|
| | | itemDictData['CancelUseLimit'] = ipyData.GetCancelUseLimit()
|
| | | |
| | | itemDictData['IsAuctionItem'] = isAuctionItem
|
| | | |
| | | return itemDictData
|
| | |
|
| | | def GetAppointItemRealID(itemID):
|
| | | '''获取定制物品对应的真实物品ID'''
|
| | | curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not curItem:
|
| | | return 0
|
| | | curEff = curItem.GetEffectByIndex(0)
|
| | | curEffID = curEff.GetEffectID()
|
| | | if curEffID != ChConfig.Def_Effect_AppointItem:
|
| | | return 0
|
| | | return curEff.GetEffectValue(0)
|
| | |
|
| | | ## 根据物品data字典给玩家装备/翅膀
|
| | | # @param curPlayer:玩家实例
|
| | | # @param itemData:物品数据
|
| | | # @param packType:背包类型
|
| | | # @param defaultPile 默认先判断是否能进行物品堆叠
|
| | | # @return None
|
| | | def GivePlayerEquip(curPlayer, itemData, event=["", False, {}], packType=[IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere],
|
| | | defaultPile=True):
|
| | | equipItem = GetItemByData(itemData)
|
| | | #将物品放入背包
|
| | | return DoLogic_PutItemInPack(curPlayer, equipItem, event, packType, defaultPile)
|
| | |
|
| | |
|
| | | ## 根据物品data字典创建物品
|
| | | # @param itemData:物品数据
|
| | | # @return ItemObj
|
| | | def GetItemByData(itemData):
|
| | | if not itemData:
|
| | | return
|
| | | |
| | | itemID = int(itemData.get('ItemID', 0))
|
| | | isAuctionItem = int(itemData.get('IsAuctionItem', 0))
|
| | | equipItem = ItemCommon.CreateSingleItem(itemID, isAuctionItem=isAuctionItem)
|
| | | if not equipItem:
|
| | | return
|
| | | |
| | | tmpEquipData = SingleEquipTmpData()
|
| | | |
| | | #tmpEquipData.starLV = int(itemData.get('StarLV', '0'))
|
| | | #tmpEquipData.holeCnt = int(itemData.get('HoleCount', '0'))
|
| | | #tmpEquipData.stoneData = eval(itemData.get('StoneData', '[]'))
|
| | | tmpEquipData.isBind = isAuctionItem
|
| | | #tmpEquipData.isSuite = int(itemData.get('IsSuit', '0'))
|
| | | #tmpEquipData.suiteLV = int(itemData.get('SuiteLV', '0'))
|
| | | #if tmpEquipData.suiteLV:
|
| | | # tmpEquipData.isSuite = 1
|
| | | tmpEquipData.source = int(itemData.get('Source', str(ShareDefine.Item_Source_Unkown)))
|
| | | |
| | | tmpEquipData.legendAttrIDList = itemData.get('legendAttrID', [])
|
| | | tmpEquipData.legendAttrValueList = itemData.get('legendAttrValue', [])
|
| | | |
| | | # 装备附加属性
|
| | | ChItem.EquipAddAdditionEx(equipItem, tmpEquipData)
|
| | | |
| | | if "UserData" in itemData:
|
| | | userData = itemData["UserData"]
|
| | | ItemCommon.SetItemUserData(equipItem, userData)
|
| | | |
| | | if "EquipGS" in itemData:
|
| | | equipGS = int(itemData["EquipGS"])
|
| | | ItemCommon.SetEquipGearScore(equipItem, equipGS)
|
| | | |
| | | |
| | | # 取消等级限制
|
| | | if itemData.get('CancelUseLimit', 0):
|
| | | equipItem.SetUserAttr(ShareDefine.Def_IudetCancelUseLimit, 1)
|
| | | |
| | | return equipItem
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 执行物品放入背包逻辑
|
| | |
| | | #---无空位置,替换---
|
| | | return placeList[0]
|
| | |
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, isAllAttr=False):
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, setAttrDict=None):
|
| | | ''' 获取功能产出的物品实例
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | | @param curPlayer: 产出该物品时的玩家,物品某些属性由玩家等级决定,如传奇属性
|
| | | @param isAllAttr: 是否生成该装备所有属性,GM创建物品时用,需验证相关权限
|
| | | @param setAttrDict: 直接设置物品的属性 {key:value, ...} key支持 ShareDefine.Def_IudetXXX字符串 或 自定key
|
| | | '''
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isAuctionItem, expireTime)
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isAuctionItem, expireTime, curPlayer, setAttrDict)
|
| | | if not curItem:
|
| | | GameWorld.ErrLog("产出物品异常,无法创建物品 = %s" % (itemID))
|
| | | return
|
| | | |
| | | # 英雄
|
| | | if curItem.GetType() == ChConfig.Def_ItemType_Hero:
|
| | | return curItem
|
| | | |
| | | # 非装备,无需设置属性
|
| | | if not ItemCommon.CheckItemIsEquip(curItem):
|
| | | return curItem
|
| | | |
| | | # 定制物品
|
| | | if GetAppointItemRealID(itemID):
|
| | | curItem.Clear()
|
| | | #GameWorld.DebugLog("清除给定制物品之前已经创建的物品ID=%s" % itemID)
|
| | | return GetItemByData(GetAppointItemDictData(itemID, isAuctionItem))
|
| | | |
| | | # # 拍品不处理其他属性
|
| | | # if isAuctionItem:
|
| | | # return curItem
|
| | | |
| | | tmpEquipData = SingleEquipTmpData()
|
| | | |
| | | # 传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
| | | if legendAttrInfo:
|
| | | tmpEquipData.legendAttrIDList = legendAttrInfo[0]
|
| | | tmpEquipData.legendAttrValueList = legendAttrInfo[1]
|
| | | tmpEquipData.legendAttrIDListShen = legendAttrInfo[2]
|
| | | tmpEquipData.legendAttrValueListShen = legendAttrInfo[3]
|
| | | tmpEquipData.legendAttrIDListXian = legendAttrInfo[4]
|
| | | tmpEquipData.legendAttrValueListXian = legendAttrInfo[5]
|
| | | tmpEquipData.legendAttrIDListJi = legendAttrInfo[6]
|
| | | tmpEquipData.legendAttrValueListJi = legendAttrInfo[7]
|
| | | |
| | | # 其他装备属性
|
| | | ChItem.EquipAddAdditionEx(curItem, tmpEquipData)
|
| | | return curItem
|
| | |
|
| | | def GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr=False):
|
| | |
| | | mapItem = mapItemManager.GetMapItemByIndex(index)
|
| | | mapItem_List.append(mapItem)
|
| | |
|
| | | disappearTime = IpyGameDataPY.GetFuncCfg("MapItemDisappearTime")
|
| | | disappearTime = 60000 #IpyGameDataPY.GetFuncCfg("MapItemDisappearTime")
|
| | | for curMapItem in mapItem_List:
|
| | | #无此物品
|
| | | if not curMapItem or curMapItem.IsEmpty():
|
| | |
| | | GameWorld.DebugLog("物品过期时间" + timeStr)
|
| | | return GameWorld.ChangeTimeStrToNum(timeStr)
|
| | |
|
| | | def CreateSingleItem(itemID, itemCount=1, isAuctionItem=False, expireTime=0):
|
| | | def CreateSingleItem(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, setAttrDict=None):
|
| | | ''' 创建物品
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | |
| | | # 英雄
|
| | | if curSingleItem.GetType() == ChConfig.Def_ItemType_Hero:
|
| | | PlayerHero.InitHeroItem(curSingleItem)
|
| | | |
| | | elif GetIsEquip(curSingleItem):
|
| | | setAttrDict = GetCreateEquipAttr(curSingleItem, curPlayer, setAttrDict)
|
| | | if setAttrDict == None:
|
| | | curSingleItem.Clear()
|
| | | return
|
| | | AddCreateItemAttr(curSingleItem, setAttrDict)
|
| | | |
| | | #这里返回的是SingleItem , 如果创建了,未使用,会找出C++内存泄露!!!
|
| | | return curSingleItem
|
| | |
|
| | | def AddCreateItemAttr(curItem, setAttrDict):
|
| | | ## 设置生成装备所有属性
|
| | | if not setAttrDict:
|
| | | return
|
| | | for key, value in setAttrDict.items():
|
| | | key = GameWorld.ToIntDef(key, key)
|
| | | # 需支持
|
| | | # 1. UserData格式: {'19': ['1889', '2034', '893', '927'], '50': ['1702622046'], '17': ['39', '33', '34', '9']}
|
| | | # 2. 自定义字典: {"key":value, ...} key支持自定义或与UserData的key,value支持数值或列表,列表元素支持字符串或数值,均默认转为数值
|
| | | # 数值类型的默认为UserData属性 |
| | | if isinstance(key, int):
|
| | | if key % 2 == 0: # 偶数是单数值
|
| | | v = 0
|
| | | if isinstance(value, int):
|
| | | v = value
|
| | | elif (isinstance(value, list) or isinstance(value, tuple)) and value:
|
| | | v = GameWorld.ToIntDef(value[0], 0)
|
| | | curItem.SetUserAttr(key, v)
|
| | | elif isinstance(value, list) or isinstance(value, tuple): # 单数一定是要列表
|
| | | curItem.ClearUserAttr(key)
|
| | | for v in value:
|
| | | v = GameWorld.ToIntDef(v, 0)
|
| | | curItem.AddUserAttr(key, v)
|
| | | # 其他指定字符串类型属性
|
| | | else:
|
| | | GameWorld.Log("###AddCreateItemAttr unknown key:%s, value:%s, itemID=%s" % (key, value, curItem.GetItemTypeID()))
|
| | | |
| | | #MakeEquipGS(curItem)
|
| | | return
|
| | |
|
| | | def GetCreateEquipAttr(curItem, curPlayer=None, setAttrDict=None):
|
| | | '''获取生成装备所有属性
|
| | | @param curPlayer: 可能为None
|
| | | @param setAttrDict: 直接设置物品的属性 {key:value, ...} key支持 ShareDefine.Def_IudetXXX字符串 或 自定key
|
| | | @return: None - 异常情况,物品实例需要clear
|
| | | equipAttrDict - 生成后的最新属性k:v字典,可直接用于 SetCreateEquipAttr
|
| | | '''
|
| | | if setAttrDict == None:
|
| | | setAttrDict = {}
|
| | | equipAttrDict = {}
|
| | | playerID = 0 if not curPlayer else curPlayer.GetPlayerID()
|
| | | itemID = curItem.GetItemTypeID()
|
| | | |
| | | appointID = setAttrDict.get(ShareDefine.Def_CItemKey_AppointID)
|
| | | # 定制属性ID
|
| | | if appointID > 0:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", appointID)
|
| | | if not ipyData:
|
| | | return
|
| | | if ipyData.GetCancelUseLimit():
|
| | | equipAttrDict[str(ShareDefine.Def_IudetCancelUseLimit)] = 1
|
| | | equipAttrDict[str(ShareDefine.Def_IudetItemLV)] = ipyData.GetItemLV()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrID)] = ipyData.GetBaseAttrID()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrValue)] = ipyData.GetBaseAttrValue()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = ipyData.GetLegendAttrID()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = ipyData.GetLegendAttrValue()
|
| | | GameWorld.DebugLog(" 装备定制属性: itemID=%s,appointID=%s,equipAttrDict=%s,setAttrDict=%s" % (itemID, appointID, equipAttrDict, setAttrDict), playerID)
|
| | | return equipAttrDict
|
| | | |
| | | # 主线装备
|
| | | if GetIsMainEquip(curItem):
|
| | | return GetCreateMainEquipAttr(curItem, curPlayer, setAttrDict)
|
| | | |
| | | return equipAttrDict
|
| | | |
| | | def GetCreateMainEquipAttr(curItem, curPlayer, setAttrDict=None):
|
| | | ## 生成主线装备属性
|
| | | |
| | | equipAttrDict = {}
|
| | | itemID = curItem.GetItemTypeID()
|
| | | itemColor = curItem.GetItemColor()
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | |
| | | if not curPlayer:
|
| | | return equipAttrDict
|
| | | |
| | | colorIpyData = IpyGameDataPY.GetIpyGameData("EquipColor", itemColor)
|
| | | placeIpyData = IpyGameDataPY.GetIpyGameData("EquipPlace", equipPlace)
|
| | | if not colorIpyData or not placeIpyData:
|
| | | return equipAttrDict
|
| | | |
| | | playerLV = curPlayer.GetLV()
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | randfloat = random.uniform # 随机一个ab区间的数 [a, b],ab支持小数
|
| | | |
| | | itemLV = setAttrDict.get(str(ShareDefine.Def_IudetItemLV), 0)
|
| | | if not itemLV:
|
| | | # 随机等级
|
| | | lowLV, highLV = IpyGameDataPY.GetFuncEvalCfg("MainEquipDrop", 3)
|
| | | randLVList = range(max(playerLV + lowLV, 1), playerLV + highLV)
|
| | | itemLV = random.choice(randLVList)
|
| | | equipAttrDict[str(ShareDefine.Def_IudetItemLV)] = itemLV
|
| | | |
| | | GameWorld.DebugLog("生成主线装备: itemID=%s,itemLV=%s,itemColor=%s,equipPlace=%s" % (itemID, itemLV, itemColor, equipPlace), playerID)
|
| | | |
| | | # 基础三维
|
| | | baseAttrIDList = setAttrDict.get(str(ShareDefine.Def_IudetBaseAttrID))
|
| | | baseAttrValueList = setAttrDict.get(str(ShareDefine.Def_IudetBaseAttrValue))
|
| | | # 这里注意None为未指定,支持当空列表[]时为不给该属性
|
| | | if baseAttrIDList != None and baseAttrValueList != None and len(baseAttrIDList) == len(baseAttrValueList):
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrID)] = baseAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrValue)] = baseAttrValueList
|
| | | else:
|
| | | attrProportion = placeIpyData.GetBaseAttrProportion()
|
| | | attrInfoList = [
|
| | | [ShareDefine.Def_Effect_Atk, colorIpyData.GetAtkStep()],
|
| | | [ShareDefine.Def_Effect_Def, colorIpyData.GetDefStep()],
|
| | | [ShareDefine.Def_Effect_MaxHP, colorIpyData.GetHPStep()],
|
| | | ]
|
| | | baseAttrIDList, baseAttrValueList = [], []
|
| | | for attrID, attrStep in attrInfoList:
|
| | | attrValue = eval(IpyGameDataPY.GetFuncCompileCfg("MainEquipDrop", 4))
|
| | | # int(itemLV*attrStep*attrProportion*randfloat(0.9,1.1))
|
| | | if not attrValue:
|
| | | continue
|
| | | baseAttrIDList.append(attrID)
|
| | | baseAttrValueList.append(attrValue)
|
| | | |
| | | if baseAttrIDList:
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrID)] = baseAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrValue)] = baseAttrValueList
|
| | | GameWorld.DebugLog(" baseAttrIDList=%s,baseAttrValueList=%s" % (baseAttrIDList, baseAttrValueList), playerID)
|
| | | |
| | | # 战斗属性
|
| | | legendAttrIDList = setAttrDict.get(str(ShareDefine.Def_IudetLegendAttrID))
|
| | | legendAttrValueList = setAttrDict.get(str(ShareDefine.Def_IudetLegendAttrValue))
|
| | | if legendAttrIDList != None and legendAttrValueList != None and len(legendAttrIDList) == len(legendAttrValueList):
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = legendAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = legendAttrValueList
|
| | | else:
|
| | | legendAttrIDList = []
|
| | | legendAttrValueList = []
|
| | | |
| | | attrRangeDefault = colorIpyData.GetAttrRange()
|
| | | attrRangeDict = colorIpyData.GetAttrRangeDict() |
| | | libCntList = colorIpyData.GetAttrLibCntList()
|
| | | GameWorld.DebugLog(" libCntList=%s,attrRangeDict=%s, %s" % (libCntList, attrRangeDict, attrRangeDefault), playerID)
|
| | | for num, attrCnt in enumerate(libCntList, 1):
|
| | | if not hasattr(placeIpyData, "GetAttrLib%s" % num):
|
| | | continue
|
| | | libAttrList = getattr(placeIpyData, "GetAttrLib%s" % num)()
|
| | | if not libAttrList:
|
| | | continue
|
| | | random.shuffle(libAttrList)
|
| | | randAttrList = libAttrList[:attrCnt]
|
| | | for attrID in randAttrList:
|
| | | if attrID in legendAttrIDList:
|
| | | continue
|
| | | attrRange = attrRangeDict.get(attrID, attrRangeDefault)
|
| | | if not attrRange or len(attrRange) != 2:
|
| | | continue
|
| | | attrMin, attrMax = attrRange
|
| | | attrValue = random.randint(attrMin, attrMax)
|
| | | legendAttrIDList.append(attrID)
|
| | | legendAttrValueList.append(attrValue)
|
| | | GameWorld.DebugLog(" libNum=%s,attrID=%s,attrValue=%s(%s~%s)" % (num, attrID, attrValue, attrMin, attrMax), playerID)
|
| | | |
| | | if legendAttrIDList:
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = legendAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = legendAttrValueList
|
| | | GameWorld.DebugLog(" legendAttrIDList=%s,legendAttrValueList=%s" % (legendAttrIDList, legendAttrValueList), playerID)
|
| | | |
| | | GameWorld.DebugLog(" 装备最终属性: equipAttrDict=%s,setAttrDict=%s" % (equipAttrDict, setAttrDict), playerID)
|
| | | return equipAttrDict
|
| | |
|
| | | def SetItemUserData(curItem, dataInfo):
|
| | | if isinstance(dataInfo, dict):
|
| | |
| | | def GetIsEquip(curItem):
|
| | | return curItem.GetType() in ChConfig.Def_EquipItemType
|
| | |
|
| | | def GetIsMainEquip(curItem):
|
| | | ## 是否主线装备
|
| | | return curItem.GetType() in ChConfig.Def_MainEquipType
|
| | |
|
| | | def GetIsDogzEquip(curItem):
|
| | | ## 返回是否神兽装备
|
| | | return curItem.GetType() in ChConfig.Def_DogzEquiipType
|
| | |
| | | continue
|
| | | placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
|
| | | jobList = itemJobList
|
| | | placeList = NPCCommon.GetEquipPlaceByPlaceKey(placeKey)
|
| | | placeList = [] #NPCCommon.GetEquipPlaceByPlaceKey(placeKey)
|
| | | if not placeList:
|
| | | GameWorld.ErrLog("部位集合key不存在!chestsItemID=%s,placeKey=%s" % (chestsItemID, placeKey))
|
| | | continue
|
| | |
| | | @param curGrade: 评级
|
| | | @param isVirtualDrop: 是否给物品虚拟掉落表现
|
| | | '''
|
| | | if not exp_rate:
|
| | | exp_rate = PlayerControl.GetPlayerExpRate(curPlayer)
|
| | | |
| | | npcID = 0
|
| | | totalExp = 0
|
| | | totalMoney = 0
|
| | | itemCountDict = {}
|
| | | auctionItemIDList = []
|
| | | |
| | | if prizeMultiple > 1:
|
| | | hadDropItemKeyList, hadDropItemPlaceList = [], [] # 已经掉落过的物品集合key列表, 已经掉落过的装备部位列表
|
| | | mPrizeItemIDList = IpyGameDataPY.GetFuncEvalCfg("SealDemonDoubleDrop", 1) # 允许多倍奖励的物品ID列表
|
| | | mPrizePlaceList = IpyGameDataPY.GetFuncEvalCfg("SealDemonDoubleDrop", 2) # 允许多倍奖励的装备部位
|
| | | mPrizeItemKeyList = IpyGameDataPY.GetFuncEvalCfg("SealDemonDoubleDrop", 3) # 允许多倍奖励的物品ID集合
|
| | | |
| | | itemKeyDict = IpyGameDataPY.GetFuncEvalCfg("JobItemDropSets") # {物品ID集合key:[职业顺序物品ID列表], ...}
|
| | | itemIDKeyDict = {}
|
| | | for itemKey, itemIDList in itemKeyDict.items():
|
| | | for itemID in itemIDList:
|
| | | itemIDKeyDict[itemID] = itemKey
|
| | | |
| | | for npcID, count in npcCountDict.items():
|
| | | baseExp = GetNPCExp(curPlayer, npcID)
|
| | | addExp = int(baseExp * exp_rate / float(ChConfig.Def_MaxRateValue)) # 基础加成
|
| | | totalCount = count * prizeMultiple
|
| | | totalExp += (addExp * totalCount)
|
| | | |
| | | # 掉落有概率因素,需多次执行
|
| | | for dCount in xrange(1, totalCount + 1):
|
| | | isKillCountDrop = dCount == 1 # 同一只NPC一次处理中多次击杀的情况,只算一次附加装备处理
|
| | | dropInfo = GetNPCDropInfo(curPlayer, mapID, npcID, isKillCountDrop=isKillCountDrop, curGrade=curGrade)
|
| | | if not dropInfo:
|
| | | continue
|
| | | dropIDList, auctionIDList, dropMoneyCnt, moneyValue = dropInfo
|
| | | totalMoney += (dropMoneyCnt * moneyValue)
|
| | | |
| | | for itemID in dropIDList:
|
| | | if prizeMultiple > 1:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | itemPlace = itemData.GetEquipPlace()
|
| | | itemKey = itemIDKeyDict.get(itemID)
|
| | | |
| | | # 超过指定最大只数时,代表多倍奖励,多倍奖励的物品只允许给指定规则内的物品,只对已经掉过的物品有限制
|
| | | if dCount > count:
|
| | | if ItemCommon.GetIsEquip(itemData):
|
| | | if itemPlace in hadDropItemPlaceList and itemPlace not in mPrizePlaceList:
|
| | | GameWorld.DebugLog(" 多倍奖励不能给的物品部位: itemID=%s,itemPlace=%s" % (itemID, itemPlace))
|
| | | continue
|
| | | elif itemKey != None:
|
| | | if itemKey in hadDropItemKeyList and itemKey not in mPrizeItemKeyList:
|
| | | GameWorld.DebugLog(" 多倍奖励不能给的物品ID集合: itemID=%s,itemKey=%s" % (itemID, itemKey))
|
| | | continue
|
| | | else:
|
| | | if itemID in itemCountDict and itemID not in mPrizeItemIDList:
|
| | | GameWorld.DebugLog(" 多倍奖励不能给的物品ID: itemID=%s" % (itemID))
|
| | | continue
|
| | | |
| | | if itemPlace and itemPlace not in hadDropItemPlaceList:
|
| | | hadDropItemPlaceList.append(itemPlace)
|
| | | if itemKey != None and itemKey not in hadDropItemKeyList:
|
| | | hadDropItemKeyList.append(itemKey)
|
| | | |
| | | itemCountDict[itemID] = itemCountDict.get(itemID, 0) + 1
|
| | | if itemID in auctionIDList and itemID not in auctionItemIDList:
|
| | | auctionItemIDList.append(itemID)
|
| | | |
| | | # 固定附加物品
|
| | | for itemID, itemCount, isAuctionItem in extraItemList:
|
| | | itemCountDict[itemID] = itemCountDict.get(itemID, 0) + itemCount * prizeMultiple
|
| | | if isAuctionItem and itemID not in auctionItemIDList:
|
| | | auctionItemIDList.append(itemID)
|
| | | |
| | | needSpace = 0
|
| | | prizeItemList = []
|
| | | jsonItemList = []
|
| | | for itemID, itemCount in itemCountDict.items():
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | |
| | | isAuctionItem = itemID in auctionItemIDList
|
| | | |
| | | if ItemCommon.GetIsEquip(itemData):
|
| | | for _ in xrange(itemCount):
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
|
| | | if curItem:
|
| | | needSpace += 1
|
| | | prizeItemList.append(curItem)
|
| | | jsonItemList.append(ItemCommon.GetJsonItem(curItem))
|
| | | else:
|
| | | needSpace += ItemControler.GetItemNeedPackCount(IPY_GameWorld.rptItem, itemData, itemCount, isAuctionItem)
|
| | | prizeItemList.append([itemID, itemCount, isAuctionItem])
|
| | | jsonItemList.append(ItemCommon.GetJsonItem([itemID, itemCount, isAuctionItem]))
|
| | | #成就
|
| | | if not dropItemMapInfo:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_PickUpItem, itemCount, [itemID])
|
| | | |
| | | ## 直接掉地板上
|
| | | if dropItemMapInfo:
|
| | | dropPosX, dropPosY = dropItemMapInfo[:2]
|
| | | isOnlySelfSee = dropItemMapInfo[2] if len(dropItemMapInfo) > 2 else False # 是否仅自己可见
|
| | | isDropDisperse = dropItemMapInfo[3] if len(dropItemMapInfo) > 3 else False # 堆叠的物品是否散开掉落
|
| | | ## 虚拟掉落表现 |
| | | if isVirtualDrop:
|
| | | DoGiveItemByVirtualDrop(curPlayer, prizeItemList, npcID, dropPosX, dropPosY, isDropDisperse, mailTypeKey)
|
| | | else:
|
| | | DoMapDropPrizeItem(curPlayer, prizeItemList, npcID, dropPosX, dropPosY, isDropDisperse, isOnlySelfSee)
|
| | | |
| | | ## 发邮件 或 背包空间不足
|
| | | elif isMail or needSpace > ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace):
|
| | | mailItemList = []
|
| | | for prizeItem in prizeItemList:
|
| | | if isinstance(prizeItem, list):
|
| | | mailItemList.append(prizeItem)
|
| | | else:
|
| | | mailItemList.append(ItemCommon.GetMailItemDict(prizeItem))
|
| | | prizeItem.Clear() # 发邮件已经创建的物品实例要清空, 不然会导致内存泄露
|
| | | #if totalExp:
|
| | | # expItemID = 0
|
| | | # mailItemList.append([expItemID, totalExp, 1])
|
| | | PlayerControl.SendMailByKey(mailTypeKey, [curPlayer.GetPlayerID()], mailItemList, silver=totalMoney)
|
| | | |
| | | ## 直接放入背包
|
| | | else:
|
| | | event = [ChConfig.ItemGive_NPCDrop, False, {"NPCID":npcID}]
|
| | | for prizeItem in prizeItemList:
|
| | | if isinstance(prizeItem, list):
|
| | | itemID, itemCount, isAuctionItem = prizeItem
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem], |
| | | event=event)
|
| | | else:
|
| | | ItemControler.DoLogic_PutItemInPack(curPlayer, prizeItem, event=event)
|
| | | |
| | | if totalExp:
|
| | | PlayerControl.PlayerControl(curPlayer).AddExp(totalExp)
|
| | | |
| | | if totalMoney:
|
| | | PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, totalMoney)
|
| | | |
| | | #GameWorld.DebugLog("给玩家击杀NPC掉落奖励: mapID=%s,npcCountDict=%s,exp_rate=%s,mailTypeKey=%s,isMail=%s,extraItemList=%s" |
| | | # % (mapID, npcCountDict, exp_rate, mailTypeKey, isMail, extraItemList))
|
| | | #GameWorld.DebugLog(" totalExp=%s,totalMoney=%s,needSpace=%s,jsonItemList=%s" % (totalExp, totalMoney, needSpace, jsonItemList))
|
| | | return jsonItemList, totalExp, totalMoney
|
| | |
|
| | | def DoMapDropPrizeItem(curPlayer, prizeItemList, npcID, dropPosX, dropPosY, isDropDisperse=True, isOnlySelfSee=True):
|
| | | ## 奖励物品真实掉落地图,先拆开分散再掉落
|
| | | |
| | | if isDropDisperse:
|
| | | dropItemList = []
|
| | | for itemInfo in prizeItemList:
|
| | | if isinstance(itemInfo, list):
|
| | | itemID, itemCount, isAuctionItem = itemInfo
|
| | | for _ in xrange(itemCount):
|
| | | dropItemList.append([itemID, 1, isAuctionItem])
|
| | | else:
|
| | | dropItemList.append(itemInfo)
|
| | | else:
|
| | | dropItemList = prizeItemList
|
| | | index = 0
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gameMap = GameWorld.GetMap()
|
| | | sightLevel = PlayerControl.GetMapRealmDifficulty(curPlayer)
|
| | | for posX, posY in ChConfig.Def_DropItemAreaMatrix:
|
| | | resultX = dropPosX + posX
|
| | | resultY = dropPosY + posY
|
| | | |
| | | if not gameMap.CanMove(resultX, resultY):
|
| | | #玩家不可移动这个点
|
| | | continue
|
| | | |
| | | if index > len(dropItemList) - 1:
|
| | | break
|
| | | |
| | | curItem = dropItemList[index]
|
| | | index += 1
|
| | | if isinstance(curItem, list):
|
| | | itemID, itemCount, isAuctionItem = curItem
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | |
| | | if not curItem:
|
| | | continue
|
| | | |
| | | ChItem.AddMapDropItem(resultX, resultY, curItem, ownerInfo=[ChConfig.Def_NPCHurtTypePlayer, playerID], |
| | | dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel)
|
| | | return
|
| | |
|
| | | def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp", extraVirtualItemList=[]):
|
| | | ## 给物品并且做假掉落表现,直接先堆叠给物品,再拆开做虚假掉落表现
|
| | | |
| | | if not giveItemList:
|
| | | return
|
| | | |
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if not mapID:
|
| | | mapID = GameWorld.GetGameWorld().GetMapID()
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | giveItemObjList = []
|
| | | virtualItemDropList = []
|
| | | itemControl = ItemControler.PlayerItemControler(curPlayer)
|
| | | for itemInfo in giveItemList:
|
| | | if isinstance(itemInfo, list) or isinstance(itemInfo, tuple):
|
| | | itemID, itemCount, isAuctionItem = itemInfo
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | | elif hasattr(itemInfo, "GetItemTypeID"):
|
| | | curItem = itemInfo
|
| | | itemID = curItem.GetItemTypeID()
|
| | | itemCount = curItem.GetCount()
|
| | | isAuctionItem = ItemControler.GetIsAuctionItem(curItem)
|
| | | else:
|
| | | continue
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | giveItemObjList.append(curItem)
|
| | | |
| | | # 散开掉落
|
| | | if isDropDisperse:
|
| | | for _ in xrange(itemCount):
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | else:
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | |
| | | # 先通知掉落,再给物品,因为前端表现弹框需要这个顺序需求
|
| | | if extraVirtualItemList: #只显示假掉落
|
| | | for itemInfo in extraVirtualItemList:
|
| | | itemID, itemCount, isAuctionItem = itemInfo
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | # 散开掉落
|
| | | if isDropDisperse:
|
| | | for _ in xrange(itemCount):
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | else:
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | curItem.Clear()
|
| | | |
| | | gameMap = GameWorld.GetMap()
|
| | | index = 0
|
| | | for posX, posY in ChConfig.Def_DropItemAreaMatrix:
|
| | | if dropPosX or dropPosY:
|
| | | resultX = dropPosX + posX
|
| | | resultY = dropPosY + posY
|
| | | if not gameMap.CanMove(resultX, resultY):
|
| | | #玩家不可移动这个点
|
| | | continue
|
| | | else:
|
| | | resultX, resultY = 0, 0
|
| | | if index > len(virtualItemDropList) - 1:
|
| | | break
|
| | | itemID, dropItemDataStr = virtualItemDropList[index]
|
| | | index += 1
|
| | | SendVirtualItemDrop(curPlayer, itemID, resultX, resultY, dropItemDataStr)
|
| | | |
| | | # 再给物品
|
| | | mailItemList = []
|
| | | for itemObj in giveItemObjList:
|
| | | itemID = itemObj.GetItemTypeID()
|
| | | mailItem = ItemCommon.GetMailItemDict(itemObj)
|
| | | equipInfo = [itemObj.GetEquipPlace(), ItemCommon.GetItemClassLV(itemObj), itemObj.GetItemColor(), |
| | | itemObj.GetSuiteID(), itemObj.GetUserData()]
|
| | | packIndex = ChConfig.GetItemPackType(itemObj)
|
| | | if not itemControl.PutInItem(packIndex, itemObj, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
|
| | | mailItemList.append(mailItem)
|
| | | |
| | | if npcID:
|
| | | SendGameServerGoodItemRecord(curPlayer, mapID, lineID, npcID, itemID, equipInfo)
|
| | | |
| | | # 放不下的发邮件 |
| | | if mailItemList:
|
| | | PlayerControl.SendMailByKey(mailTypeKey, [playerID], mailItemList, [mapID])
|
| | | return
|
| | |
|
| | | ################################### NPC掉落 ###################################
|
| | | Def_NPCMaxDropRate = 1000000 # NPC掉落相关的最大概率, 数值设定
|
| | |
|
| | | def GetNPCDropIpyData(npcID):
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("NPCDropItem", npcID)
|
| | | if not ipyDataList:
|
| | | GameWorld.DebugLog("该NPC没配置掉落!npcID=%s" % npcID)
|
| | | return
|
| | | ipyDrop = None
|
| | | maxWorldLV = 0
|
| | | curWorldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | if len(ipyDataList) == 1:
|
| | | ipyDrop = ipyDataList[0]
|
| | | maxWorldLV = ipyDrop.GetMaxWorldLV()
|
| | | if maxWorldLV and curWorldLV > maxWorldLV:
|
| | | GameWorld.DebugLog("该NPC当前世界等级无法掉落物品!npcID=%s,curWorldLV(%s) > maxWorldLV(%s)" % (npcID, curWorldLV, maxWorldLV))
|
| | | return
|
| | | else:
|
| | | for ipyData in ipyDataList:
|
| | | maxWorldLV = ipyData.GetMaxWorldLV()
|
| | | if curWorldLV <= maxWorldLV:
|
| | | ipyDrop = ipyData
|
| | | break
|
| | | if not ipyDrop:
|
| | | GameWorld.DebugLog("该NPC当前世界等级无法掉落物品!npcID=%s,curWorldLV=%s,maxWorldLV=%s" % (npcID, curWorldLV, maxWorldLV))
|
| | | return
|
| | | return ipyDrop
|
| | |
|
| | | def GetNPCDropInfo(dropPlayer, mapID, npcID, ownerPlayerList=[], ipyDrop=None, isSingle=True, isKillCountDrop=True, curGrade=0):
|
| | | '''获取NPC掉落信息, 击杀及扫荡通用,调用该函数获得掉落信息,然后再看掉落地板上还是直接放入背包
|
| | | @param dropPlayer: 用于判断调用相关用的玩家示例,该玩家并不一定是击杀者,只是按一定规则设定的掉落判断依据的玩家
|
| | | 如队伍,取等级最大的玩家,该玩家并不一定是击杀者
|
| | | @param mapID: 掉落物品所属地图,注意此地图并不一定是当前地图,如扫荡时需使用目标副本地图
|
| | | @param npcID: 掉落物品的NPCID
|
| | | @param ownerPlayerList: 有归属的玩家列表
|
| | | @param isSingle: 是否只处理单独玩家掉落逻辑,一般都默认True,目前只有场景杀怪掉落需要考虑摸怪的情况下才为False(外层特殊处理)
|
| | | @return: dropIDList, auctionIDList, dropMoneyCnt, moneyValue
|
| | | None-没有掉落
|
| | | ---------------
|
| | | dropIDList - 掉落的物品ID列表, 同个itemID可能在列表中有多个 [itemID, itemID, ...]
|
| | | auctionIDList - 掉落的拍品物品ID列表, [itemID, itemID, ...]
|
| | | dropMoneyCnt - 掉落金币位置数
|
| | | moneyValue - 每个位置的金币数量
|
| | | '''
|
| | | if not ipyDrop:
|
| | | ipyDrop = GetNPCDropIpyData(npcID)
|
| | | if not ipyDrop:
|
| | | return
|
| | | |
| | | if not ownerPlayerList:
|
| | | ownerPlayerList = [dropPlayer]
|
| | | |
| | | playerID = dropPlayer.GetPlayerID()
|
| | | playerLV = dropPlayer.GetLV()
|
| | | maxDropLV = ipyDrop.GetMaxDropLV()
|
| | | |
| | | realmNPCIpyData = None
|
| | | realmMapIDList = IpyGameDataPY.GetFuncEvalCfg("RealmDifficulty", 1)
|
| | | realmDifficulty = PlayerControl.GetRealmDifficulty(dropPlayer)
|
| | | if mapID in realmMapIDList and realmDifficulty:
|
| | | realmLV = PlayerControl.GetDifficultyRealmLV(realmDifficulty)
|
| | | realmNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCRealmStrengthen", npcID, realmLV)
|
| | | if realmNPCIpyData:
|
| | | maxDropLV = realmNPCIpyData.GetMaxDrapLV()
|
| | | |
| | | if maxDropLV and playerLV > maxDropLV:
|
| | | GameWorld.DebugLog("超过最大可掉落等级,不掉落物品!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV))
|
| | | return
|
| | | |
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
|
| | | if not npcData:
|
| | | GameWorld.ErrLog("获取NPC掉落配置错误!表不存在该NPCID=%s" % npcID, playerID)
|
| | | return
|
| | | |
| | | tianxuanState = False # 是否有天玄额外掉落状态
|
| | | tianxuanBuff = SkillCommon.FindBuffByID(dropPlayer, ChConfig.Def_SkillID_TianxuanBuff)[0]
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | |
| | | dropIDList = [] # 掉落的ID列表
|
| | | auctionIDList = []
|
| | | dropMoneyCnt, moneyValue = 0, 0
|
| | | itemJobList = [dropPlayer.GetJob()] if ipyDrop.GetIsDropJobSelf() else IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1) # 掉落装备职业列表
|
| | | |
| | | # 通用掉率相关
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | doCountAdd = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_DropDoCountAdd)
|
| | | doCountRate = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_DropDoCountRate) # 直接覆盖基值, 无值时取默认值
|
| | | if not doCountRate:
|
| | | doCountRate = ChConfig.Def_MaxRateValue
|
| | | |
| | | # 归属者相关信息
|
| | | tagJob = 0
|
| | | dropEquipKillCountPub = 0 # 装备附加掉落综合击杀次数,取次数最大的那个,至少第一次
|
| | | dropItemIDKillCountPub = 0 # 物品ID附加掉落综合击杀次数,取次数最大的那个,至少第一次
|
| | | equipDropRatePlus = 0 # 装备掉落概率提升
|
| | | equipDropDoCountPlus = 0 # 装备掉落执行次数提升
|
| | | for ownerPlayer in ownerPlayerList:
|
| | | killCountValue = ownerPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCKillCount % npcID)
|
| | | equipPubKillCount = killCountValue % 100 + 1
|
| | | itemIDPubKillCount = killCountValue % 10000 / 100 + 1
|
| | | |
| | | if dropEquipKillCountPub < equipPubKillCount:
|
| | | dropEquipKillCountPub = equipPubKillCount
|
| | | tagJob = ownerPlayer.GetJob()
|
| | | |
| | | if dropItemIDKillCountPub < itemIDPubKillCount:
|
| | | dropItemIDKillCountPub = itemIDPubKillCount
|
| | | |
| | | equipDropRatePlus = max(equipDropRatePlus, PlayerControl.GetDropEquipPer(ownerPlayer))
|
| | | equipDropDoCountPlus = max(equipDropDoCountPlus, PlayerControl.GetDropEquipDoCount(ownerPlayer))
|
| | | |
| | | dropRatePlusValue = ipyDrop.GetCanDropRatePlus()
|
| | | if not dropRatePlusValue & pow(2, 0):
|
| | | equipDropRatePlus = 0
|
| | | |
| | | if not dropRatePlusValue & pow(2, 1):
|
| | | equipDropDoCountPlus = 0
|
| | | |
| | | #GameWorld.DebugLog("NPC掉落: npcID=%s,itemJobList=%s,dropRatePlusValue=%s,equipDropRatePlus=%s,equipDropDoCountPlus=%s,doCountRate=%s,doCountAdd=%s" |
| | | # % (npcID, itemJobList, dropRatePlusValue, equipDropRatePlus, equipDropDoCountPlus, doCountRate, doCountAdd), playerID)
|
| | | |
| | | dropEquipInfoList = [] # [(阶,颜色), ...]
|
| | | # 1. 装备库 - 饼图概率
|
| | | pieRateDoCnt = ipyDrop.GetPieRateDoCnt()
|
| | | if pieRateDoCnt:
|
| | | pieRateDoCnt = __GetNPCDropDoCountChange(pieRateDoCnt, doCountRate + equipDropDoCountPlus, doCountAdd)
|
| | | dropEquipInfoList += __GetNPCPieRateEquipDrop(ipyDrop, pieRateDoCnt, equipDropRatePlus)
|
| | | |
| | | # 2. 装备库 - 独立概率
|
| | | indepRateDoCnt = ipyDrop.GetIndepRateDoCnt()
|
| | | if indepRateDoCnt:
|
| | | indepRateDoCnt = __GetNPCDropDoCountChange(indepRateDoCnt, doCountRate + equipDropDoCountPlus, doCountAdd)
|
| | | dropEquipInfoList += __GetNPCIndepRateEquipDrop(mapID, ipyDrop, indepRateDoCnt, equipDropRatePlus, curGrade) |
| | | #GameWorld.DebugLog("阶,颜色 key,dropEquipInfoList=%s" % (dropEquipInfoList))
|
| | | |
| | | # 天玄丹 |
| | | tianxuanEquipRateList = ipyDrop.GetTianxuanEquipRateList()
|
| | | if tianxuanBuff and tianxuanEquipRateList:
|
| | | tianxuanState = True
|
| | | dropInfo = GameWorld.GetResultByRandomList(tianxuanEquipRateList)
|
| | | if dropInfo:
|
| | | dropEquipInfoList.append(dropInfo)
|
| | | |
| | | # 3. 第x次击杀, 归属者公共附加掉落,所有归属者都增加击杀次数; |
| | | tagClassLV, tagColor, tagIsSuit, tagPlaceKey = 0, 0, 0, 0
|
| | | killCountDropEquipPub = ipyDrop.GetKillCountDropEquipPub() # 第x次击杀附加必掉装备 {次数:[阶,颜色,是否套装,部位集合key], ...}
|
| | | killCountDropItemPub = ipyDrop.GetKillCountDropPub() # 击杀次数必掉(公共){击杀次数:[[物品ID, ...], [随机物品ID, ...]], ...}
|
| | | maxRecordDropEquipKillCountPub = 0 if not killCountDropEquipPub else max(killCountDropEquipPub) # 需要记录的最大击杀次数, 超过此击杀次数后暂时不累加记录
|
| | | maxRecordDropItemIDKillCountPub = 0 if not killCountDropItemPub else max(killCountDropItemPub)
|
| | | #GameWorld.DebugLog("maxRecordDropEquipKillCountPub=%s,maxRecordDropItemIDKillCountPub=%s" % (maxRecordDropEquipKillCountPub, maxRecordDropItemIDKillCountPub))
|
| | | #GameWorld.DebugLog("dropEquipKillCountPub=%s,dropItemIDKillCountPub=%s" % (dropEquipKillCountPub, dropItemIDKillCountPub))
|
| | | if isKillCountDrop and killCountDropEquipPub and dropEquipKillCountPub in killCountDropEquipPub:
|
| | | tagClassLV, tagColor, tagIsSuit, tagPlaceKey = killCountDropEquipPub[dropEquipKillCountPub]
|
| | | if (tagClassLV, tagColor) not in dropEquipInfoList:
|
| | | dropEquipInfoList.insert(0, (tagClassLV, tagColor, tagIsSuit, tagPlaceKey, tagJob))
|
| | | else:
|
| | | tagIndex = dropEquipInfoList.index((tagClassLV, tagColor))
|
| | | dropEquipInfoList[tagIndex] = (tagClassLV, tagColor, tagIsSuit, tagPlaceKey, tagJob)
|
| | | GameWorld.DebugLog("第%s次击杀掉落指定目标装备信息: npcID=%s,tagClassLV=%s,tagColor=%s,tagIsSuit=%s,tagPlaceKey=%s,tagJob=%s,dropEquipInfoList=%s" |
| | | % (dropEquipKillCountPub, npcID, tagClassLV, tagColor, tagIsSuit, tagPlaceKey, tagJob, dropEquipInfoList), playerID)
|
| | | elif isKillCountDrop and killCountDropItemPub and dropItemIDKillCountPub in killCountDropItemPub:
|
| | | killCountItemIDList, killCountRandItemIDList = killCountDropItemPub[dropItemIDKillCountPub]
|
| | | if killCountItemIDList:
|
| | | dropIDList += killCountItemIDList
|
| | | if killCountRandItemIDList:
|
| | | klllCountRandItemID = random.choice(killCountRandItemIDList)
|
| | | dropIDList.append(klllCountRandItemID)
|
| | | GameWorld.DebugLog("第%s次击杀掉落指定目标物品信息: npcID=%s,killCountItemIDList=%s,killCountRandItemIDList=%s,dropIDList=%s" |
| | | % (dropItemIDKillCountPub, npcID, killCountItemIDList, killCountRandItemIDList, dropIDList), playerID)
|
| | | |
| | | for ownerPlayer in ownerPlayerList:
|
| | | # 增加击杀次数
|
| | | killCountValue = ownerPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCKillCount % npcID)
|
| | | equipPubKillCount = killCountValue % 100
|
| | | itemIDPubKillCount = killCountValue % 10000 / 100
|
| | | isUpd = False
|
| | | if equipPubKillCount < maxRecordDropEquipKillCountPub:
|
| | | equipPubKillCount += 1
|
| | | isUpd = True
|
| | | if itemIDPubKillCount < maxRecordDropItemIDKillCountPub:
|
| | | itemIDPubKillCount += 1
|
| | | isUpd = True
|
| | | |
| | | if isUpd:
|
| | | itemIDPriKillCount = killCountValue / 10000
|
| | | updKillCountValue = itemIDPriKillCount * 10000 + itemIDPubKillCount * 100 + equipPubKillCount
|
| | | PlayerControl.NomalDictSetProperty(ownerPlayer, ChConfig.Def_PDict_NPCKillCount % npcID, updKillCountValue)
|
| | | GameWorld.DebugLog("更新玩家击杀次数值: npcID=%s,killCountValue=%s,updKillCountValue=%s" % (npcID, killCountValue, updKillCountValue), ownerPlayer.GetPlayerID())
|
| | | |
| | | gradeColorSuitRateDict = {}
|
| | | fbGradeColorSuitRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 2) # 评级影响颜色套装概率 {npcID:{颜色:[D级影响概率, ..., S级影响概率], ...}, ...}
|
| | | if npcID in fbGradeColorSuitRateDict:
|
| | | gradeColorSuitRateDict = fbGradeColorSuitRateDict[npcID]
|
| | | |
| | | equipColorDropLimitDay = IpyGameDataPY.GetFuncEvalCfg("ItemDropCountLimit", 1, {}) # 每日个人掉落装备个数限制 {品质:每日掉落个数, ...}
|
| | | colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | colorMaxDropCntDict = ipyDrop.GetEquipColorMaxDropCount() # {颜色:上限数量,...}
|
| | | colorSuitRateDict = ipyDrop.GetEquipColorSuitInfo() # 装备颜色对应套装概率 {颜色:套装概率, ...}
|
| | | colorSuitPlaceKeyInfoDict = ipyDrop.GetEquipPartKeyRateInfo() # 装备部位集合信息 {(颜色,是否套装):部位集合key, ...}
|
| | | colorSuitPartOptimization = ipyDrop.GetColorSuitPartOptimization() # 部位颜色套评分优选掉落,十位代表颜色,个位代表套装
|
| | | optColor, optIsSuit = colorSuitPartOptimization / 10, colorSuitPartOptimization % 10
|
| | | optPlace = None # 优选部位
|
| | | |
| | | for dropEquipInfo in dropEquipInfoList:
|
| | | classLV, color = dropEquipInfo[:2]
|
| | | if realmNPCIpyData:
|
| | | classLV = realmNPCIpyData.GetEquipClassLV()
|
| | | GameWorld.DebugLog("掉落对应难度境界装备: classLV=%s" % classLV, playerID)
|
| | | |
| | | colorCountToday = 0
|
| | | if color in equipColorDropLimitDay:
|
| | | colorCountMax = equipColorDropLimitDay[color]
|
| | | colorCountToday = dropPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DropColorToday % color)
|
| | | if colorCountToday >= colorCountMax:
|
| | | GameWorld.DebugLog("已超过该颜色装备今日最大掉落数,不掉!color=%s,colorCountMax=%s" % (color, colorCountMax), playerID)
|
| | | continue
|
| | | |
| | | if color in colorMaxDropCntDict:
|
| | | maxCount = colorMaxDropCntDict[color]
|
| | | dropCount = colorDropCntDict.get(color, 0)
|
| | | if dropCount >= maxCount:
|
| | | GameWorld.DebugLog("已超过该颜色装备最大掉落数,不掉!color=%s,maxCount=%s" % (color, maxCount), playerID)
|
| | | continue
|
| | | |
| | | if len(dropEquipInfo) == 5:
|
| | | isSuit, placeKey, tagJob = dropEquipInfo[2:]
|
| | | jobList = [tagJob]
|
| | | else:
|
| | | isSuit = 0
|
| | | if color in colorSuitRateDict:
|
| | | suitRate = colorSuitRateDict[color]
|
| | | # 评级对套装率的影响
|
| | | if color in gradeColorSuitRateDict:
|
| | | suitRateEffList = gradeColorSuitRateDict[color]
|
| | | suitRateEff = 10000 if (curGrade <= 0 or curGrade > len(suitRateEffList)) else suitRateEffList[curGrade - 1]
|
| | | suitRate = int(suitRate * suitRateEff / 10000.0)
|
| | | isSuit = GameWorld.CanHappen(suitRate, maxRate=Def_NPCMaxDropRate)
|
| | | colorSuitKey = (color, isSuit)
|
| | | if colorSuitKey not in colorSuitPlaceKeyInfoDict:
|
| | | GameWorld.ErrLog("未配置颜色是否套装对应部位集合key! npcID=%s,color=%s,isSuit=%s" % (npcID, color, isSuit))
|
| | | continue
|
| | | placeKey = colorSuitPlaceKeyInfoDict[colorSuitKey]
|
| | | # 掉落优选部位处理
|
| | | if color == optColor and isSuit == optIsSuit and optPlace == None:
|
| | | allEquipPlaceList = GetAllEquipPlaceByPlaceKey(placeKey)
|
| | | #GameWorld.DebugLog(" 所有可优选部位: %s" % allEquipPlaceList)
|
| | | if allEquipPlaceList:
|
| | | optPlace = __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, allEquipPlaceList)
|
| | | jobList = itemJobList
|
| | | if optPlace > 0:
|
| | | GameWorld.DebugLog(" 最终优选部位: %s" % optPlace)
|
| | | placeList = [optPlace]
|
| | | jobList = [dropPlayer.GetJob()]
|
| | | optPlace = 0 # 只有一次性的,置为0
|
| | | else:
|
| | | placeList = GetEquipPlaceByPlaceKey(placeKey)
|
| | | if not placeList:
|
| | | GameWorld.ErrLog("部位集合key不存在!npcID=%s,placeKey=%s" % (npcID, placeKey))
|
| | | continue
|
| | | randEquipIDList = __GetEquipIDList(npcID, classLV, color, isSuit, placeList, jobList)
|
| | | if not randEquipIDList:
|
| | | continue
|
| | | if color in equipColorDropLimitDay:
|
| | | colorCountToday += 1
|
| | | PlayerControl.NomalDictSetProperty(dropPlayer, ChConfig.Def_PDict_DropColorToday % color, colorCountToday)
|
| | | if color in colorMaxDropCntDict:
|
| | | colorDropCntDict[color] = dropCount + 1
|
| | | if isSuit and len(jobList) > 1:
|
| | | randItemID = __GetRandDropSuitEquipID(dropPlayer, randEquipIDList)
|
| | | else:
|
| | | randItemID = random.choice(randEquipIDList)
|
| | | dropIDList.append(randItemID)
|
| | | GameWorld.DebugLog("掉落装备: npcID=%s,itemID=%s,classLV=%s,color=%s,isSuit=%s,placeKey=%s,jobList=%s,randEquipIDList=%s" |
| | | % (npcID, randItemID, classLV, color, isSuit, placeKey, jobList, randEquipIDList), playerID)
|
| | | if colorCountToday:
|
| | | GameWorld.DebugLog(" 更新掉落特殊品质装备今日次数: color=%s,colorCountToday=%s" % (color, colorCountToday), playerID)
|
| | | |
| | | # 4. 指定物品ID库
|
| | | dropIDList += __GetAppointDropItemIDList(dropPlayer, npcID, ipyDrop, doCountRate, doCountAdd, tianxuanBuff)
|
| | | if tianxuanBuff and (ipyDrop.GetTianxuanItemKeyRate() or ipyDrop.GetTianxuanItemIDRate()):
|
| | | tianxuanState = True
|
| | | |
| | | # 5. 私有掉落
|
| | | if isSingle:
|
| | | # 击杀次数掉落
|
| | | killCountDropInfo = ipyDrop.GetKillCountDropPri()
|
| | | if killCountDropInfo:
|
| | | needKillCount, killDropItemList = killCountDropInfo[:2]
|
| | | killCountDropIDList = GetKillCountDropItemList(dropPlayer, npcID, needKillCount, killDropItemList)
|
| | | for kDropItemID in killCountDropIDList:
|
| | | dropIDList.append(kDropItemID) # 单独玩家掉落处理的,直接加到掉落列表里,不考虑是否放入背包或掉落的情况,由使用的功能自行处理
|
| | | #GameWorld.DebugLog("击杀次数掉落: kDropItemID=%s,needKillCount=%s" % (kDropItemID, needKillCount))
|
| | | |
| | | # 固定产出,所有掉落归属者每人一份,默认绑定,不区分职业
|
| | | fbGradePriItemIDDropDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 3)
|
| | | if npcID in fbGradePriItemIDDropDict:
|
| | | gradePriItemIDDropDict = fbGradePriItemIDDropDict[npcID]
|
| | | priDropInfoList = gradePriItemIDDropDict.get(curGrade, [])
|
| | | priDropIDList = []
|
| | | for priItemID, priItemCount in priDropInfoList:
|
| | | priDropIDList += [priItemID] * priItemCount
|
| | | else:
|
| | | priDropIDList = ipyDrop.GetPriItemIDDrop()
|
| | | for priDropID in priDropIDList:
|
| | | dropIDList.append(priDropID)
|
| | | #GameWorld.DebugLog("私有物品掉落: priDropID=%s" % priDropID)
|
| | | |
| | | # 6. 地图评级额外掉落
|
| | | fbGradeDropItemExDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate2", 2) # 地图评级额外物品掉落 {"mapID":{"评级":[[物品ID,个数], ...], ...}}
|
| | | if curGrade and str(mapID) in fbGradeDropItemExDict:
|
| | | gradeItemExDict = fbGradeDropItemExDict[str(mapID)]
|
| | | gradeItemExList = gradeItemExDict.get(str(curGrade), [])
|
| | | #GameWorld.DebugLog("评级额外掉落物品: curGrade=%s,gradeItemExList=%s" % (curGrade, gradeItemExList))
|
| | | for gItemExID, gItemExCount in gradeItemExList:
|
| | | dropIDList += [gItemExID] * gItemExCount
|
| | | |
| | | # 7.相关活动掉落
|
| | | feastWishDropIDList = PlayerFeastWish.GetFeastWishDropItemIDList(dropPlayer, npcData)
|
| | | if feastWishDropIDList:
|
| | | dropIDList.extend(feastWishDropIDList)
|
| | | |
| | | #bossƾ֤
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
| | | if mapID == ChConfig.Def_FBMapID_PersonalBoss:
|
| | | limitIndex = ChConfig.Def_FBMapID_PersonalBoss
|
| | | else:
|
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
| | | if limitIndex != None:
|
| | | bossTrialDrop = PlayerActBossTrial.GetBossTrialDropItemIDList(dropPlayer, limitIndex)
|
| | | if bossTrialDrop:
|
| | | bossTrialItemID, bossTrialItemCount = bossTrialDrop
|
| | | GameWorld.DebugLog("掉落boss凭证: bossTrialItemID=%s, bossTrialItemCount=%s" % (bossTrialItemID, bossTrialItemCount))
|
| | | dropIDList += [bossTrialItemID] * bossTrialItemCount
|
| | | |
| | | # 检查掉落互斥ID组
|
| | | dropIDList = __RemoveMutexDropID(dropIDList, IpyGameDataPY.GetFuncCfg("MutexDrop", 1))
|
| | | |
| | | # 掉落金币
|
| | | dropMoneyDoCnt = ipyDrop.GetDropMoneyDoCnt()
|
| | | dropMoneyRate = ipyDrop.GetDropMoneyRate()
|
| | | if dropMoneyRate == ChConfig.Def_NPCMapDropRate:
|
| | | dropMoneyCnt = dropMoneyDoCnt
|
| | | else:
|
| | | dropMoneyCnt = 0
|
| | | for _ in xrange(dropMoneyDoCnt):
|
| | | if GameWorld.CanHappen(dropMoneyRate, ChConfig.Def_NPCMapDropRate):
|
| | | dropMoneyCnt += 1
|
| | | |
| | | #GameWorld.DebugLog("NPCID=%s,金币掉率: %s, 执行次数=%s, 掉落金币数=%s" % (npcID, dropMoneyRate, dropMoneyDoCnt, dropMoneyCnt))
|
| | | if dropMoneyCnt:
|
| | | moneyValue = __GetDropMoneyValue(dropPlayer, ipyDrop, realmNPCIpyData)
|
| | | #GameWorld.DebugLog(" 掉落金币value=%s" % (moneyValue))
|
| | | |
| | | if dropIDList:
|
| | | if ipyDrop.GetAucionItemCanSell():
|
| | | for dropID in dropIDList:
|
| | | if IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", dropID):
|
| | | auctionIDList.append(dropID)
|
| | | GameWorld.DebugLog("最终掉落物品: npcID=%s,dropIDList=%s" % (npcID, dropIDList), playerID)
|
| | | GameWorld.DebugLog(" auctionIDList=%s" % (auctionIDList), playerID)
|
| | | elif ChConfig.IsGameBoss(npcData):
|
| | | GameWorld.ErrLog("Boss没有掉落物品,NPCID=%s" % (npcID), dropPlayer.GetPlayerID())
|
| | | |
| | | if tianxuanBuff and tianxuanState:
|
| | | GameWorld.DebugLog(" 去除天玄丹buff: Layer=%s" % tianxuanBuff.GetLayer(), playerID)
|
| | | BuffSkill.SetBuffLayer(dropPlayer, tianxuanBuff, max(tianxuanBuff.GetLayer() - 1, 0), True, ChConfig.Def_SkillID_TianxuanBuff, isSync=True)
|
| | | |
| | | return dropIDList, auctionIDList, dropMoneyCnt, moneyValue
|
| | |
|
| | | def __GetRandDropSuitEquipID(curPlayer, randEquipIDList):
|
| | | ## 获取随机掉落的套装ID,为了玩家掉落体验, 当非本职业套装时可至多重新随机X次
|
| | | randItemID = 0
|
| | | suitRandCountEx = IpyGameDataPY.GetFuncCfg("EquipSuitDrop", 1) + 1
|
| | | for _ in xrange(suitRandCountEx):
|
| | | randItemID = random.choice(randEquipIDList)
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(randItemID)
|
| | | if not itemData:
|
| | | continue
|
| | | if ItemCommon.CheckJob(curPlayer, itemData):
|
| | | break
|
| | | return randItemID
|
| | |
|
| | | def GetAllEquipPlaceByPlaceKey(placeKey):
|
| | | placeKeyRateListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 2, {}) # {集合数字key1:[[概率1,部位1],...],...}
|
| | | if placeKey in placeKeyRateListDict:
|
| | | return [rateInfo[1] for rateInfo in placeKeyRateListDict[placeKey]]
|
| | | placeKeyListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 1, {}) # {集合数字key1:[部位1,部位2,...],...}
|
| | | if placeKey in placeKeyListDict:
|
| | | return placeKeyListDict[placeKey]
|
| | | return []
|
| | |
|
| | | def GetEquipPlaceByPlaceKey(placeKey):
|
| | | ## 获取装备位集合对应的部位信息,集合ID重复时,优先饼图
|
| | | placeList = []
|
| | | placeKeyRateListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 2, {}) # {集合数字key1:[[概率1,部位1],...],...}
|
| | | if placeKey in placeKeyRateListDict:
|
| | | placeRateList = placeKeyRateListDict[placeKey]
|
| | | place = GameWorld.GetResultByRandomList(placeRateList)
|
| | | if place:
|
| | | placeList = [place]
|
| | | #GameWorld.DebugLog(" 掉落部位概率集合: placeKey=%s,placeRateList=%s,place=%s,placeList=%s" % (placeKey, placeRateList, place, placeList))
|
| | | |
| | | if not placeList:
|
| | | placeKeyListDict = IpyGameDataPY.GetFuncEvalCfg("EquipDropPartSets", 1, {}) # {集合数字key1:[部位1,部位2,...],...}
|
| | | if placeKey in placeKeyListDict:
|
| | | placeList = placeKeyListDict[placeKey]
|
| | | #GameWorld.DebugLog(" 掉落部位均衡集合: placeKey=%s,placeList=%s" % (placeKey, placeList))
|
| | | |
| | | return placeList
|
| | |
|
| | | def __GetOptimizationEquipPlace(dropPlayer, classLV, optColor, optIsSuit, optPlaceList):
|
| | | ''' 获取掉落优选部位
|
| | | 几个默认规则
|
| | | 1. 颜色大于指定优选颜色的,无论是否套装都不计算在内
|
| | | 2. 颜色小于指定优选颜色的,无论是否套装都计算在内
|
| | | '''
|
| | | #GameWorld.DebugLog("处理优选部位掉落: classLV=%s,optColor=%s,optIsSuit=%s,optPlaceList=%s" % (classLV, optColor, optIsSuit, optPlaceList))
|
| | | minGSPlace = None
|
| | | minGS = None
|
| | | equipPack = dropPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for optPlace in optPlaceList:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, optPlace)
|
| | | if not ipyData:
|
| | | continue
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | curEquip = equipPack.GetAt(equipIndex)
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | #GameWorld.DebugLog(" 没穿装备,直接默认返回该部位: optPlace=%s" % optPlace)
|
| | | return optPlace
|
| | | curColor = curEquip.GetItemColor()
|
| | | curIsSuit = 1 if curEquip.GetSuiteID() else 0
|
| | | if curColor > optColor:
|
| | | # 超过优选指定颜色的不算,无论是否有套装
|
| | | #GameWorld.DebugLog(" 颜色超过优选颜色,不算该部位: optPlace=%s,curColor=%s,curIsSuit=%s" % (optPlace, curColor, curIsSuit))
|
| | | continue
|
| | | if curColor == optColor and curIsSuit >= optIsSuit:
|
| | | # 与优选指定颜色相同,且满足是否套装的不算
|
| | | #GameWorld.DebugLog(" 颜色套装满足优选,不算该部位: optPlace=%s,curColor=%s,curIsSuit=%s" % (optPlace, curColor, curIsSuit))
|
| | | continue
|
| | | curGS = ItemCommon.GetEquipGearScore(curEquip)
|
| | | if minGS == None or curGS < minGS:
|
| | | minGS = curGS
|
| | | minGSPlace = optPlace
|
| | | |
| | | return minGSPlace
|
| | |
|
| | | def __GetNPCDropDoCountChange(doCount, doCountRate, doCountAdd):
|
| | | ## 获取掉落执行次数变更结果,可能增加 或 减少
|
| | | if doCountRate != ChConfig.Def_MaxRateValue:
|
| | | doCount = max(1, int(doCount * doCountRate / 10000.0))
|
| | | if doCountAdd:
|
| | | doCount = max(1, doCount + doCountAdd) # 支持正负,保底1,负值待扩展
|
| | | return doCount
|
| | |
|
| | | def __RemoveMutexDropID(dropIDList, mutexDropInfo):
|
| | | ## 移除互斥的掉落物品,每组互斥的ID最多只能掉落一个,列表顺序为掉落优先级 [[互斥组1ID, ID, ...], [互斥组2ID, ID, ...], ...]
|
| | | for mutexDropList in mutexDropInfo:
|
| | | isMutex = False
|
| | | for mutexID in mutexDropList:
|
| | | if mutexID not in dropIDList:
|
| | | continue
|
| | | if not isMutex:
|
| | | isMutex = True
|
| | | curDropIDCnt = dropIDList.count(mutexID)
|
| | | # 如果超过1个,则移除多余的,只保留一个
|
| | | if curDropIDCnt > 1:
|
| | | for _ in xrange(curDropIDCnt - 1):
|
| | | dropIDList.remove(mutexID)
|
| | | continue
|
| | | |
| | | # 已经是互斥的了,该ID不可掉落,全部移除
|
| | | while mutexID in dropIDList:
|
| | | dropIDList.remove(mutexID)
|
| | | |
| | | return dropIDList
|
| | |
|
| | | def __GetAppointDropItemIDList(curPlayer, npcID, ipyDrop, doCountRate, doCountAdd, tianxuanBuff):
|
| | | ## 指定物品ID掉落
|
| | | |
| | | dropItemIDList = []
|
| | | |
| | | itemDropLimitDayInfo = IpyGameDataPY.GetFuncEvalCfg("ItemDropCountLimit", 2, {}) # 每日个人掉落物品个数限制 {物品ID:每日掉落上限, ...}
|
| | | # 1. 职业物品ID集合
|
| | | job = curPlayer.GetJob()
|
| | | JobItemDropSets = IpyGameDataPY.GetFuncCfg("JobItemDropSets", 1) # {物品ID集合key:[职业顺序物品ID列表], ...}
|
| | | itemDropSets = IpyGameDataPY.GetFuncCfg("JobItemDropSets", 2) # {物品ID集合key:[随机物品ID列表], ...}
|
| | | itemDropRateSets = IpyGameDataPY.GetFuncCfg("JobItemDropSets", 3) # {物品ID集合key:[随机物品ID饼图列表], ...}
|
| | | ItemKeyMaxDropCountDict = ipyDrop.GetItemKeyMaxDropCount() # {物品ID集合key:随机次数,...}
|
| | | |
| | | # 1.1 只掉本职业的
|
| | | ItemKeyDropRateJobDict = ipyDrop.GetItemKeyDropRateJob() # {物品ID集合key:概率, ...}, 只掉本职业的,优先级高
|
| | | if ItemKeyDropRateJobDict:
|
| | | for jobItemKey, dropRate in ItemKeyDropRateJobDict.items():
|
| | | if jobItemKey not in JobItemDropSets:
|
| | | continue
|
| | | jobItemList = JobItemDropSets[jobItemKey]
|
| | | if len(jobItemList) < job:
|
| | | GameWorld.ErrLog("职业物品集合key没有配置对应职业ID: npcID=%s,jobItemKey=%s,job=%s" % (npcID, jobItemKey, job))
|
| | | continue
|
| | | mustDropCount = dropRate / Def_NPCMaxDropRate
|
| | | dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
|
| | | canDropCount = mustDropCount
|
| | | doCnt = ItemKeyMaxDropCountDict.get(jobItemKey, 1) # 默认1个
|
| | | doCnt = __GetNPCDropDoCountChange(doCnt, doCountRate, doCountAdd)
|
| | | for _ in xrange(doCnt):
|
| | | if not GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
|
| | | continue
|
| | | canDropCount += 1
|
| | | |
| | | jobItemID = jobItemList[job - 1]
|
| | | for _ in xrange(canDropCount):
|
| | | dropItemIDList.append(jobItemID)
|
| | | #GameWorld.DebugLog("掉落自身职业指定物品ID: jobItemKey=%s,jobItemID=%s" % (jobItemKey, jobItemID))
|
| | | |
| | | # 1.2 随机掉落一个
|
| | | ItemKeyDropRateDict = ipyDrop.GetItemKeyDropRate() # {物品ID集合key:概率, ...}, 随机掉一个,优先级低
|
| | | tianxuanItemKeyRateDict = ipyDrop.GetTianxuanItemKeyRate() # 天玄丹指定ID集合Key概率{物品ID集合key:概率, ...}
|
| | | if tianxuanBuff and tianxuanItemKeyRateDict:
|
| | | ItemKeyDropRateDict = copy.deepcopy(ItemKeyDropRateDict)
|
| | | ItemKeyDropRateDict.update(tianxuanItemKeyRateDict)
|
| | | |
| | | if ItemKeyDropRateDict:
|
| | | GameWorld.DebugLog("ItemKeyDropRateDict:%s" % ItemKeyDropRateDict)
|
| | | for itemKey, dropRate in ItemKeyDropRateDict.items():
|
| | | # 在只掉本职业里的不处理
|
| | | if itemKey in ItemKeyDropRateJobDict:
|
| | | continue
|
| | | mustDropCount = dropRate / Def_NPCMaxDropRate
|
| | | dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
|
| | | canDropCount = mustDropCount
|
| | | doCnt = ItemKeyMaxDropCountDict.get(itemKey, 1) # 默认1个
|
| | | doCnt = __GetNPCDropDoCountChange(doCnt, doCountRate, doCountAdd)
|
| | | for _ in xrange(doCnt):
|
| | | if not GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
|
| | | continue
|
| | | canDropCount += 1
|
| | | |
| | | for _ in xrange(canDropCount):
|
| | | if itemKey in itemDropRateSets:
|
| | | randItemRateList = itemDropRateSets[itemKey]
|
| | | randItemID = GameWorld.GetResultByRandomList(randItemRateList)
|
| | | #GameWorld.DebugLog("掉落饼图物品ID: itemKey=%s,randItemRateList=%s,randItemID=%s" % (itemKey, randItemRateList, randItemID))
|
| | | elif itemKey in itemDropSets:
|
| | | randItemList = itemDropSets[itemKey]
|
| | | randItemID = random.choice(randItemList)
|
| | | #GameWorld.DebugLog("掉落随机物品ID: itemKey=%s,randItemList=%s,randItemID=%s" % (itemKey, randItemList, randItemID))
|
| | | else:
|
| | | continue
|
| | | if not randItemID:
|
| | | continue
|
| | | if __dropIDCountLimitToday(curPlayer, randItemID, itemDropLimitDayInfo):
|
| | | continue
|
| | | dropItemIDList.append(randItemID)
|
| | | #GameWorld.DebugLog("掉落随机指定物品ID: itemKey=%s,randItemID=%s" % (itemKey, randItemID))
|
| | | |
| | | # 2. 指定掉落ID处理, 受全局设定影响
|
| | | itemIDDropRateDict = ipyDrop.GetItemIDDropRate() # {物品ID:概率, ...}
|
| | | itemIDDropMaxCntDict = ipyDrop.GetItemIDMaxDropCount() # {物品ID:最大掉落个数,...}
|
| | | tianxuanItemIDRate = ipyDrop.GetTianxuanItemIDRate() # 天玄丹指定ID概率 {物品ID:概率, ...}
|
| | | if tianxuanBuff and tianxuanItemIDRate:
|
| | | itemIDDropRateDict = copy.deepcopy(itemIDDropRateDict)
|
| | | itemIDDropRateDict.update(tianxuanItemIDRate)
|
| | | |
| | | # 全局材料掉落控制
|
| | | globalDropCDDict = IpyGameDataPY.GetFuncCfg("GlobalDropCD", 1) # {物品ID:分钟, ...}
|
| | | globalDropRateDict = IpyGameDataPY.GetFuncCfg("NPCGlobalDropRate", 1) # {物品ID:[[npcID列表], "概率公式"], ...}
|
| | | gw = GameWorld.GetGameWorld()
|
| | | |
| | | if itemIDDropRateDict:
|
| | | GameWorld.DebugLog("itemIDDropRateDict=%s" % itemIDDropRateDict)
|
| | | |
| | | for itemID, dropRate in itemIDDropRateDict.items():
|
| | | |
| | | if not dropRate:
|
| | | continue
|
| | | |
| | | # 根据击杀次数来的另外计算,不在此判断
|
| | | if itemID in globalDropRateDict:
|
| | | continue
|
| | | |
| | | doCnt = itemIDDropMaxCntDict.get(itemID, 1) # 默认1个
|
| | | |
| | | # 判断是否全局掉落CD中
|
| | | if itemID in globalDropCDDict:
|
| | | curTime = int(time.time())
|
| | | lastDropTime = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_LastDropTime % itemID)
|
| | | cdTime = globalDropCDDict[itemID] * 60
|
| | | remainTime = cdTime - (curTime - lastDropTime)
|
| | | if remainTime > 0:
|
| | | GameWorld.DebugLog("该物品全局掉落CD中,不掉落!itemID=%s,cdTime=%s,curTime=%s,lastDrop=%s,remainTime=%s" |
| | | % (itemID, cdTime, curTime, lastDropTime, remainTime))
|
| | | continue
|
| | | else:
|
| | | doCnt = __GetNPCDropDoCountChange(doCnt, doCountRate, doCountAdd)
|
| | | |
| | | #GameWorld.DebugLog(" 指定判断: itemID=%s, dropRate=%s, doCnt=%s" % (itemID, dropRate, doCnt))
|
| | | for _ in xrange(doCnt):
|
| | | if not GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
|
| | | continue
|
| | | |
| | | if __dropIDCountLimitToday(curPlayer, itemID, itemDropLimitDayInfo):
|
| | | continue
|
| | | |
| | | dropItemIDList.append(itemID)
|
| | | if itemID in globalDropCDDict:
|
| | | # 通知GameServer记录
|
| | | msgInfo = str([itemID, curTime])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalDropCD", msgInfo, len(msgInfo))
|
| | | DataRecordPack.DR_GlobalDropCD(curPlayer, npcID, itemID)
|
| | | break
|
| | | |
| | | # 3. 指定击杀次数全局掉率
|
| | | for itemID, dropInfo in globalDropRateDict.items():
|
| | | npcIDList, rateFormat = dropInfo
|
| | | if npcID not in npcIDList:
|
| | | continue
|
| | | |
| | | killedCnt = gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DropNPCKilledCnt % itemID)
|
| | | dropRate = eval(FormulaControl.GetCompileFormula("KilledCntDropRate_%s" % itemID, rateFormat))
|
| | | isDrop = GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate)
|
| | | if isDrop:
|
| | | dropItemIDList.append(itemID)
|
| | | DataRecordPack.DR_GlobalDropRate(curPlayer, npcID, itemID, killedCnt, dropRate)
|
| | | |
| | | # 通知GameServer记录
|
| | | updKilledCnt = 0 if isDrop else (killedCnt + 1)
|
| | | msgInfo = str([itemID, updKilledCnt])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalDropRate", msgInfo, len(msgInfo))
|
| | | |
| | | # 4. 指定全服击杀次数必掉,算额外掉落
|
| | | globalKillDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2) # {NPCID:{击杀次数:[是否本职业, {物品ID:个数, ...}, [[随机物品ID,个数], ...]]}, ...}
|
| | | if npcID in globalKillDropDict:
|
| | | killCountDropDict = globalKillDropDict[npcID]
|
| | | updNPCKilledCount = min(gw.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID) + 1, ShareDefine.Def_UpperLimit_DWord)
|
| | | GameWorld.Log("更新全服击杀次数:npcID=%s, %s" % (npcID, updNPCKilledCount))
|
| | | # 通知GameServer记录
|
| | | msgInfo = str([npcID, updNPCKilledCount])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "GlobalKillCount", msgInfo, len(msgInfo))
|
| | | if updNPCKilledCount in killCountDropDict:
|
| | | isJobLimit, itemIDCountDict, randItemIDCountList = killCountDropDict[updNPCKilledCount]
|
| | | for itemID, itemCount in itemIDCountDict.items():
|
| | | if isJobLimit:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | itemJob = itemData.GetJobLimit()
|
| | | if itemJob and itemJob != curPlayer.GetJob():
|
| | | # 非本职业可用,不掉落
|
| | | GameWorld.DebugLog("全服击杀次数必掉,非本职业可用,不掉落! itemID=%s" % itemID)
|
| | | continue
|
| | | dropItemIDList += [itemID] * itemCount
|
| | | GameWorld.Log("全服击杀次数必掉物品: itemID=%s,itemCount=%s" % (itemID, itemCount))
|
| | | if randItemIDCountList:
|
| | | if isJobLimit:
|
| | | randJobItemList = []
|
| | | for rItemID, rItemCount in randItemIDCountList:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(rItemID)
|
| | | if not itemData:
|
| | | continue
|
| | | itemJob = itemData.GetJobLimit()
|
| | | if itemJob and itemJob != curPlayer.GetJob():
|
| | | # 非本职业可用,不掉落
|
| | | GameWorld.DebugLog("全服击杀次数必掉随机,非本职业可用,不掉落! rItemID=%s" % rItemID)
|
| | | continue
|
| | | randJobItemList.append([rItemID, rItemCount])
|
| | | randItemID, randItemCount = random.choice(randJobItemList)
|
| | | else:
|
| | | randItemID, randItemCount = random.choice(randItemIDCountList)
|
| | | dropItemIDList += [randItemID] * randItemCount
|
| | | GameWorld.Log("全服击杀次数必掉随机物品: randItemID=%s,randItemCount=%s" % (randItemID, randItemCount))
|
| | | |
| | | return dropItemIDList
|
| | |
|
| | | def __dropIDCountLimitToday(curPlayer, itemID, itemDropLimitDayInfo):
|
| | | ## 处理今日掉落物品ID个数限制
|
| | | # @return: 是否限制
|
| | | if itemID not in itemDropLimitDayInfo:
|
| | | return False
|
| | | dropCountTodayMax = itemDropLimitDayInfo[itemID]
|
| | | if not dropCountTodayMax:
|
| | | return False
|
| | | dropCountToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DropCountToday % itemID)
|
| | | if dropCountToday >= dropCountTodayMax:
|
| | | GameWorld.DebugLog(" 物品ID今日掉落次数已达上限: itemID=%s,dropCountToday=%s" % (itemID, dropCountToday), curPlayer.GetPlayerID())
|
| | | return True
|
| | | dropCountToday += 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DropCountToday % itemID, dropCountToday)
|
| | | GameWorld.DebugLog(" 更新物品ID今日掉落次数: itemID=%s,dropCountToday=%s" % (itemID, dropCountToday), curPlayer.GetPlayerID())
|
| | | return False
|
| | |
|
| | | def __GetEquipIDList(findID, classLV, color, isSuit, placeList, itemJobList, findType="NPC"):
|
| | | def __GetEquipIDList(findID, classLV=None, color=None, isSuit=None, placeList=None, itemJobList=None, findType="NPC"):
|
| | | #存一个满足要求的所有的物品的列表 然后从当中随机选一个
|
| | | #注: 阶、颜色、套装ID、职业、部位,这5个条件可确认唯一一件装备
|
| | |
|
| | |
| | | if not itemData.GetCanNPCDrop():
|
| | | continue
|
| | |
|
| | | if ItemCommon.GetItemClassLV(itemData) != classLV:
|
| | | if classLV != None and ItemCommon.GetItemClassLV(itemData) != classLV:
|
| | | continue
|
| | | if itemData.GetItemColor() != color:
|
| | | if color != None and itemData.GetItemColor() != color:
|
| | | continue
|
| | | suiteID = itemData.GetSuiteID()
|
| | | itemJob = itemData.GetJobLimit()
|
| | |
| | | if itemJob and itemJobList and itemJob not in itemJobList:
|
| | | continue
|
| | | curIsSuit = suiteID > 0
|
| | | if curIsSuit != isSuit:
|
| | | if isSuit != None and curIsSuit != isSuit:
|
| | | continue
|
| | | itemIDList.append(itemID)
|
| | |
|
| | |
| | | % (findType, findID, classLV, color, isSuit, placeList, itemJobList))
|
| | | return itemIDList
|
| | |
|
| | | def __GetNPCPieRateEquipDrop(ipyDrop, doCnt, equipDropPlus):
|
| | | ## 获取NPC饼图掉率装备掉落信息
|
| | | dropEquipInfoList = []
|
| | | pieRateDropList = ipyDrop.GetPieRateDrop() # 饼图概率掉落信息 [(概率,0),(概率,(阶,颜色)),...]
|
| | | dropRateList = pieRateDropList if not equipDropPlus else GameWorld.GetPlusPieList(pieRateDropList, equipDropPlus)
|
| | | #GameWorld.DebugLog("掉落饼图概率: %s, equipDropPlus=%s" % (pieRateDropList, equipDropPlus))
|
| | | #GameWorld.DebugLog("实际饼图概率: %s" % (dropRateList))
|
| | | for _ in xrange(doCnt):
|
| | | dropInfo = GameWorld.GetResultByRandomList(dropRateList)
|
| | | if dropInfo:
|
| | | dropEquipInfoList.append(dropInfo)
|
| | | #GameWorld.DebugLog("饼图装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList))
|
| | | return dropEquipInfoList
|
| | |
|
| | | def __GetNPCIndepRateEquipDrop(mapID, ipyDrop, doCnt, equipDropPlus, curGrade=0):
|
| | | ## 获取NPC独立掉率装备掉落信息
|
| | | npcID = ipyDrop.GetNPCID()
|
| | | indepRateDict = ipyDrop.GetIndepRateDrop() # 独立概率掉落信息 {(阶,颜色):概率,...}
|
| | | #GameWorld.DebugLog("独立概率装备掉落处理: indepRateDict=%s,equipDropPlus=%s" % (indepRateDict, equipDropPlus))
|
| | | gradeColorRateDict = {}
|
| | | fbGradeColorRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 1) #{npcID:{颜色:[D级影响概率, ..., S级影响概率], ...}, ...}
|
| | | if npcID in fbGradeColorRateDict:
|
| | | gradeColorRateDict = fbGradeColorRateDict[npcID]
|
| | | |
| | | orangeEquipPer = 0
|
| | | fbGradeOrangeEquipPerDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate2", 1) # 地图评级影响橙装概率百分率 {"mapID":[D级影响概率, ..., S级影响概率], ..}
|
| | | if str(mapID) in fbGradeOrangeEquipPerDict and curGrade:
|
| | | orangeEquipPerList = fbGradeOrangeEquipPerDict[str(mapID)]
|
| | | orangeEquipPer = 0 if (curGrade <= 0 or curGrade > len(orangeEquipPerList)) else orangeEquipPerList[curGrade - 1]
|
| | | |
| | | #colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | dropEquipInfoList = []
|
| | | for _ in xrange(doCnt):
|
| | | for dropInfo, rate in indepRateDict.iteritems():
|
| | | dropRate = rate
|
| | | color = dropInfo[1]
|
| | | if color in gradeColorRateDict:
|
| | | colorRateList = gradeColorRateDict[color]
|
| | | colorRate = 10000 if (curGrade <= 0 or curGrade > len(colorRateList)) else colorRateList[curGrade - 1]
|
| | | dropRate = int(dropRate * colorRate / 10000.0)
|
| | | #GameWorld.DebugLog(" 评级影响颜色概率: curGrade=%s,colorRate=%s,dropRate=%s" % (curGrade, colorRate, dropRate))
|
| | | |
| | | if color == ChConfig.Def_Quality_Orange and orangeEquipPer:
|
| | | dropRate = int(dropRate * orangeEquipPer / 100.0)
|
| | | #GameWorld.DebugLog("评级橙装掉率加成: orangeEquipPer=%s,dropRate=%s" % (orangeEquipPer, dropRate))
|
| | | |
| | | dropRate = dropRate if not equipDropPlus else (dropRate + int(dropRate * equipDropPlus / 10000.0))
|
| | | mustDropCount = dropRate / Def_NPCMaxDropRate
|
| | | dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
|
| | | #GameWorld.DebugLog(" dropInfo=%s,rate=%s,mustDropCount=%s,dropRate=%s" % (dropInfo, rate, mustDropCount, dropRate))
|
| | | curDropCount = mustDropCount
|
| | | if GameWorld.CanHappen(dropRate, maxRate=Def_NPCMaxDropRate):
|
| | | curDropCount += 1
|
| | | if not curDropCount:
|
| | | continue
|
| | | |
| | | for _ in xrange(curDropCount):
|
| | | dropEquipInfoList.append(dropInfo)
|
| | | #GameWorld.DebugLog("独立概率装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList))
|
| | | return dropEquipInfoList
|
| | |
|
| | | def __GetDropMoneyValue(curPlayer, ipyDrop, realmNPCIpyData):
|
| | | baseMoney = FBLogic.OnGetNPCDropMoney(curPlayer)
|
| | | if baseMoney <= 0:
|
| | | # 获得掉落数量
|
| | | if realmNPCIpyData:
|
| | | baseMoney = random.randint(realmNPCIpyData.GetDropMoneyMin(), realmNPCIpyData.GetDropMoneyMax())
|
| | | else:
|
| | | baseMoney = random.randint(ipyDrop.GetDropMoneyMin(), ipyDrop.GetDropMoneyMax())
|
| | | |
| | | if baseMoney <= 0:
|
| | | return 0
|
| | | |
| | | moneyValue = baseMoney
|
| | | # 玩家金钱掉落加成
|
| | | if curPlayer != None:
|
| | | |
| | | addRateEx = 0
|
| | | |
| | | addRate = float(curPlayer.GetGoldFoundRate() + addRateEx) / ShareDefine.Def_MaxRateValue
|
| | | moneyValue = int(moneyValue + moneyValue * addRate)
|
| | | #特殊地图杀怪金币外层加成
|
| | | outerMoneyRate = FBLogic.OnGetOuterMoneyRate(curPlayer)
|
| | | if outerMoneyRate > 0:
|
| | | moneyValue = int(moneyValue * outerMoneyRate / float(ShareDefine.Def_MaxRateValue))
|
| | | |
| | | if moneyValue >= 65535:
|
| | | moneyValue = random.randint(65000, 65530)
|
| | | return moneyValue
|
| | |
|
| | | def GetKillCountDropItemList(curPlayer, npcID, needKillCount, killDropItemList):
|
| | | ## 获取击杀次数额外掉落
|
| | | killCountValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCKillCount % npcID)
|
| | | killCountPri = killCountValue / 10000
|
| | | if killCountPri >= needKillCount:
|
| | | #GameWorld.DebugLog("杀掉次数已经掉落过! npcID=%s,killCountValue=%s,dropRecord=%s" % (npcID, killCountValue, dropRecord), curPlayer.GetPlayerID())
|
| | | return []
|
| | | |
| | | killCountPri += 1
|
| | | updRecordValue = killCountPri * 10000 + killCountValue % 10000
|
| | | |
| | | jobDropInfo = []
|
| | | if killCountPri >= needKillCount:
|
| | | isJobLimit = 1
|
| | | #[itemID,...]
|
| | | for dropItemID in killDropItemList:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(dropItemID)
|
| | | if not itemData:
|
| | | GameWorld.ErrLog("掉落物品ID不存在, dropItemID=%s" % dropItemID)
|
| | | continue
|
| | | itemJob = itemData.GetJobLimit()
|
| | | if isJobLimit and itemJob and itemJob != curPlayer.GetJob():
|
| | | # 非本职业可用,不掉落
|
| | | #GameWorld.DebugLog("非本职业可用,不掉落! dropItemID=%s" % dropItemID)
|
| | | continue
|
| | | jobDropInfo.append(dropItemID)
|
| | | GameWorld.DebugLog("击杀次数必掉落! npcID=%s,needKillCount=%s,jobDropInfo=%s,killDropItemList=%s,updRecordValue=%s" |
| | | % (npcID, needKillCount, jobDropInfo, killDropItemList, updRecordValue), curPlayer.GetPlayerID())
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_NPCKillCount % npcID, updRecordValue)
|
| | | GameWorld.DebugLog("更新击杀次数比掉落值: killCountValue=%s,killCountPri=%s,updRecordValue=%s" % (killCountValue, killCountPri, updRecordValue), curPlayer.GetPlayerID())
|
| | | return jobDropInfo
|
| | | ######################################################################
|
| | | #---------------------------------------------------------------------
|
| | | #移动相关
|
| | |
| | | self.__MissionOnKillNPC(eventPlayer, True)
|
| | | return
|
| | |
|
| | | |
| | | #---------------------------------------------------------------------
|
| | | def __GetDropMoneyModelID(self, moneyValue):
|
| | | ## 获取掉落金币模型ID
|
| | | if not moneyValue:
|
| | | return 0
|
| | | moneyItemList = IpyGameDataPY.GetFuncEvalCfg("GoldModel", 1) # 金币掉落数量对应模型-[(最大金币数,物品模型ID), ...]
|
| | | if not moneyItemList:
|
| | | return 0
|
| | | for count, moneyID in moneyItemList:
|
| | | if moneyValue <= count:
|
| | | return moneyID
|
| | | return moneyItemList[-1][1]
|
| | | |
| | | def __NPCSpecialDropItem(self, dropPlayer, ownerPlayerList, ipyDrop):
|
| | | '''特殊掉落 (私有特殊掉落 + 击杀次数特殊掉落), 支持摸怪
|
| | | @return: None
|
| | | @return: [[ownerPlayer, itemID, isAuctionItem, isDropInItemPack], ...]
|
| | | '''
|
| | | curNPC = self.__Instance
|
| | | npcID = curNPC.GetNPCID()
|
| | | specDropItemList = []
|
| | | |
| | | #playerLV = dropPlayer.GetLV()
|
| | | #maxDropLV = ipyDrop.GetMaxDropLV()
|
| | | #if maxDropLV and playerLV > maxDropLV:
|
| | | # GameWorld.DebugLog("超过最大可掉落等级,不掉落物品,特殊掉落!npcID=%s,playerLV(%s) > maxDropLV(%s)" % (npcID, playerLV, maxDropLV))
|
| | | # return specDropItemList
|
| | | |
| | | auctionItemCanSell = ipyDrop.GetAucionItemCanSell()
|
| | | # 击杀次数掉落算摸怪
|
| | | killCountDropInfo = ipyDrop.GetKillCountDropPri()
|
| | | if killCountDropInfo:
|
| | | for feelPlayer in self.__FeelPlayerList:
|
| | | needKillCount, killDropItemList, isDropInItemPack = killCountDropInfo
|
| | | killCountDropItemList = GetKillCountDropItemList(feelPlayer, npcID, needKillCount, killDropItemList)
|
| | | for dropItemID in killCountDropItemList:
|
| | | isAuctionItem = 1 if auctionItemCanSell and IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", dropItemID) else 0
|
| | | specDropItemList.append([feelPlayer, dropItemID, isAuctionItem, isDropInItemPack])
|
| | | GameWorld.DebugLog("击杀次数必掉(可摸怪): npcID=%s,dropItemID=%s,needKillCount=%s,isDropInItemPack=%s,isAuctionItem=%s" |
| | | % (npcID, dropItemID, needKillCount, isDropInItemPack, isAuctionItem), feelPlayer.GetPlayerID())
|
| | | |
| | | # 私有掉落
|
| | | isDropInItemPack = False
|
| | | fbGradePriItemIDDropDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 3)
|
| | | if npcID in fbGradePriItemIDDropDict:
|
| | | gradePriItemIDDropDict = fbGradePriItemIDDropDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | priDropInfoList = gradePriItemIDDropDict.get(curGrade, [])
|
| | | priDropIDList = []
|
| | | for priItemID, priItemCount in priDropInfoList:
|
| | | priDropIDList += [priItemID] * priItemCount
|
| | | else:
|
| | | priDropIDList = ipyDrop.GetPriItemIDDrop()
|
| | | for dropItemID in priDropIDList:
|
| | | isAuctionItem = 1 if auctionItemCanSell and IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", dropItemID) else 0
|
| | | for ownerPlayer in ownerPlayerList:
|
| | | specDropItemList.append([ownerPlayer, dropItemID, isAuctionItem, isDropInItemPack]) # 默认绑定
|
| | | #GameWorld.DebugLog("私有物品掉落: dropItemID=%s" % dropItemID, ownerPlayer.GetPlayerID())
|
| | | |
| | | return specDropItemList
|
| | | |
| | | ## 物品掉落
|
| | | # @param self 类实例
|
| | | # @param dropPlayer 掉落判断相关玩家
|
| | |
| | | # @param HurtID 伤血ID
|
| | | # @return 返回值无意义
|
| | | def __NPCDropItem(self, dropPlayer, hurtType, hurtID, ownerPlayerList=[], isOnlySelfSee=False):
|
| | | if not dropPlayer:
|
| | | return
|
| | | curNPC = self.__Instance
|
| | | PlayerActCollectWords.OnKillNPCDrop(dropPlayer, curNPC)
|
| | | if curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
|
| | | GameWorld.DebugLog("木桩怪,不掉落物品!")
|
| | | return
|
| | | npcID = curNPC.GetNPCID()
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | isGameBoss = ChConfig.IsGameBoss(curNPC)
|
| | | if mapID in [ChConfig.Def_FBMapID_MunekadoTrial, ChConfig.Def_FBMapID_DemonKing, ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss,
|
| | | ChConfig.Def_FBMapID_KillDevil]:
|
| | | GameWorld.DebugLog("该地图不走直接掉落物品逻辑!mapID=%s" % mapID) |
| | | return
|
| | | if isGameBoss:
|
| | | GameWorld.Log("NPC开始掉落: npcID=%s,dropPlayerID=%s" % (npcID, dropPlayer.GetPlayerID()), dropPlayer.GetPlayerID())
|
| | | ipyDrop = GetNPCDropIpyData(npcID)
|
| | | if not ipyDrop:
|
| | | if isGameBoss:
|
| | | curWorldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | GameWorld.ErrLog("取不到NPC掉落信息!npcID=%s,curWorldLV=%s" % (npcID, curWorldLV))
|
| | | return
|
| | | |
| | | dropIDList, auctionIDList, dropMoneyCnt, moneyValue = [], [], 0, 0
|
| | | dropInfo = GetNPCDropInfo(dropPlayer, mapID, npcID, ownerPlayerList, ipyDrop, False)
|
| | | if dropInfo:
|
| | | dropIDList, auctionIDList, dropMoneyCnt, moneyValue = dropInfo
|
| | | |
| | | moneyID = self.__GetDropMoneyModelID(moneyValue)
|
| | | if moneyID and dropMoneyCnt:
|
| | | dropIDList += [moneyID] * dropMoneyCnt
|
| | | |
| | | specItemSign = "SpecItem"
|
| | | playerSpecDropList = []
|
| | | if dropInfo:
|
| | | playerSpecDropList = self.__NPCSpecialDropItem(dropPlayer, ownerPlayerList, ipyDrop) # 特殊掉落 [[ownerPlayer, itemID, isAuctionItem, isDropInItemPack], ...] 私有特殊掉落 + 击杀次数特殊掉落
|
| | | dropIDList += [specItemSign] * len(playerSpecDropList)
|
| | | |
| | | if len(dropIDList) > 5:
|
| | | #打乱物品顺序
|
| | | random.shuffle(playerSpecDropList)
|
| | | random.shuffle(dropIDList)
|
| | | |
| | | if not dropIDList and isGameBoss:
|
| | | GameWorld.ErrLog("Boss没有掉落: dropPlayerLV=%s,ipyWorldLV=%s,maxDropLV=%s" |
| | | % (dropPlayer.GetLV(), ipyDrop.GetMaxWorldLV(), ipyDrop.GetMaxDropLV()), dropPlayer.GetPlayerID())
|
| | | |
| | | sightLevel = PlayerControl.GetMapRealmDifficulty(dropPlayer)
|
| | | gameMap = GameWorld.GetMap()
|
| | | dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY() # 以NPC为中心点开始掉落
|
| | | index = 0
|
| | | for posX, posY in ChConfig.Def_DropItemAreaMatrix:
|
| | | resultX = dropPosX + posX
|
| | | resultY = dropPosY + posY
|
| | | |
| | | if not gameMap.CanMove(resultX, resultY):
|
| | | #玩家不可移动这个点
|
| | | continue
|
| | | |
| | | if index > len(dropIDList) - 1:
|
| | | break
|
| | | |
| | | isDropInItemPack = False
|
| | | itemID = dropIDList[index]
|
| | | index += 1
|
| | | if itemID == specItemSign:
|
| | | if not playerSpecDropList:
|
| | | continue
|
| | | itemCnt = 1
|
| | | ownerPlayer, itemID, isAuctionItem, isDropInItemPack = playerSpecDropList[0]
|
| | | ownerType, ownerID = ChConfig.Def_NPCHurtTypePlayer, ownerPlayer.GetPlayerID()
|
| | | playerSpecDropList = playerSpecDropList[1:]
|
| | | else:
|
| | | ownerPlayer = dropPlayer
|
| | | ownerType, ownerID = hurtType, hurtID
|
| | | itemCnt = moneyValue if itemID == moneyID else 1
|
| | | isAuctionItem = itemID in auctionIDList
|
| | | |
| | | curItem = self.__CreateDropItem(curNPC, itemID, itemCnt, isAuctionItem, dropPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | | |
| | | if mapID == ChConfig.Def_FBMapID_GatherSoul:#聚魂副本特殊处理
|
| | | GameLogic_GatherSoul.KillGatherSoulNPCDropAward(itemID, itemCnt, isAuctionItem)
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | SendVirtualItemDrop(ownerPlayer, itemID, resultX, resultY, dropItemDataStr)
|
| | | curItem.Clear()
|
| | | continue
|
| | | |
| | | if isDropInItemPack:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetSource, ShareDefine.Item_Source_VirtualItemDrop)
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | #可以放入背包
|
| | | if ItemControler.DoLogic_PutItemInPack(ownerPlayer, curItem, event=["NPCDrop", False, {"npcID":npcID}]):
|
| | | #通知客户端
|
| | | SendVirtualItemDrop(ownerPlayer, itemID, resultX, resultY, dropItemDataStr)
|
| | | |
| | | else:
|
| | | self.__MapCreateItem(curItem, resultX, resultY, ownerType, ownerID, isOnlySelfSee=isOnlySelfSee, sightLevel=sightLevel)
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | ## NPC被杀死逻辑处理
|
| | |
| | | def PlayerOnDay(curPlayer):
|
| | | #采集次数重置
|
| | | CollNPCTimeOnDay(curPlayer)
|
| | | itemDropLimitDayInfo = IpyGameDataPY.GetFuncEvalCfg("ItemDropCountLimit", 2, {})
|
| | | itemDropLimitDayInfo = {} #IpyGameDataPY.GetFuncEvalCfg("ItemDropCountLimit", 2, {})
|
| | | for itemID in itemDropLimitDayInfo.keys():
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DropCountToday % itemID):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DropCountToday % itemID, 0)
|
| | |
| | | return
|
| | |
|
| | | def SendGameServerGoodItemRecord(curPlayer, mapID, lineID, npcID, itemID, equipInfo=[]):
|
| | | # @param equipInfo: [equipPlace, itemClassLV, itemColor, itemQuality, itemUserData]
|
| | | # GameWorld.DebugLog("检查物品是否发送GameServer: mapID=%s, npcID=%s, playerName=%s, itemID=%s" |
| | | # % (mapID, npcID, playerName, itemID))
|
| | | recBossIDList = IpyGameDataPY.GetFuncEvalCfg('DropRecordBossID', 1)
|
| | | if npcID not in recBossIDList:
|
| | | return
|
| | | recDropEquipInfoDict = IpyGameDataPY.GetFuncEvalCfg('DropRecordEquipment', 1, {})
|
| | | recSpecialItemIDList = IpyGameDataPY.GetFuncEvalCfg('DropRecordValue', 1)
|
| | | recItemIDList = IpyGameDataPY.GetFuncEvalCfg('DropRecordNormal', 1)
|
| | | # weightValue 珍惜度 数值越大越珍贵(用于排序)
|
| | | needRecord = False
|
| | | itemUserData = ""
|
| | | if itemID in recItemIDList:
|
| | | needRecord = True
|
| | | weightValue = recItemIDList.index(itemID)
|
| | | elif itemID in recSpecialItemIDList:
|
| | | needRecord = True
|
| | | weightValue = recSpecialItemIDList.index(itemID) + 10000
|
| | | else:
|
| | | equipPlace, itemClassLV, itemColor, suiteID, itemUserData = equipInfo
|
| | | isSuit = 1 if suiteID else 0
|
| | | weightValue = itemColor*1000+isSuit*100+itemClassLV
|
| | | |
| | | recordCondition = GameWorld.GetDictValueByKey(recDropEquipInfoDict, equipPlace)
|
| | | if recordCondition:
|
| | | needClassLV, needItemColor, needItemSuite = recordCondition
|
| | | if itemClassLV >= needClassLV and itemColor >= needItemColor and isSuit >= needItemSuite:
|
| | | needRecord = True
|
| | | if not needRecord:
|
| | | return
|
| | | playerID = curPlayer.GetID()
|
| | | playerName = curPlayer.GetName()
|
| | | serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
|
| | | dropEquipMsg = str([playerID, playerName, mapID, lineID, npcID, itemID, itemUserData, weightValue, serverGroupID, curPlayer.GetLV()])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'BossDropGoodItem', dropEquipMsg, len(dropEquipMsg))
|
| | | GameWorld.DebugLog("发送GameServer记录拾取掉落好物品: %s" % dropEquipMsg, playerID)
|
| | | return
|
| | |
|
| | | #// A5 52 购买功能NPC采集次数 #tagCMBuyCollectionCnt
|
| | |
| | | #初始化寻宝背包
|
| | | PlayerControl.Init_TreasurePack(curPlayer)
|
| | |
|
| | | #初始化鉴定背包
|
| | | curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
| | | curPack.SetCount(ItemCommon.GetPackInitCount(IPY_GameWorld.rptIdentify))
|
| | | curPack.Sync_PackCanUseCount()
|
| | | |
| | | #初始化英雄背包
|
| | | PlayerControl.Init_HeroPack(curPlayer)
|
| | |
|
| | |
| | | #轮回殿
|
| | | PlayerActLunhuidian.AddLunhuidianValue(curPlayer, PlayerActLunhuidian.AwardType_PayMoney, type_Price, price)
|
| | | if type_Price == ShareDefine.TYPE_Price_Xiantao:
|
| | | unXiantaoCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCnt)
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCnt, unXiantaoCnt + price)
|
| | | unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp)
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntExp, unXiantaoCntExp + price)
|
| | | unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip)
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip + price)
|
| | | PlayerPrestigeSys.AddRealmTaskValue(curPlayer, PlayerPrestigeSys.RealmTaskType_UseXiantao, price)
|
| | | unitPrice = price if quantity == 1 else int(math.ceil(price * 1.0 / quantity)) # 单价
|
| | | #reason_name = "Unknown" if not costType else costType
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | |
|
| | | #副本获得经验, 无论获得多少经验均需通知, 有些副本逻辑需要通过获得经验时机处理
|
| | | if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
|
| | | FBLogic.OnGetExp(curPlayer, finalAddExp, expViewType)
|
| | | |
| | | #if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
|
| | | # FBLogic.OnGetExp(curPlayer, finalAddExp, expViewType)
|
| | | |
| | | return finalAddExp
|
| | |
|
| | | # 参数 addSkillID 表示因什么技能杀死NPC获得经验
|
| | | def __AddExp(self, curPlayer, addExp, expViewType, isSysHint, addSkillID=0, expRateEx=0):
|
| | | if addExp == 0:
|
| | | if addExp <= 0:
|
| | | # 不进入计算
|
| | | return addExp, expViewType
|
| | |
|
| | | #取得人物当前经验
|
| | | #curTotalExp = GetPlayerTotalExp(curPlayer)
|
| | | curTotalExp = curPlayer.GetExpPoint() * ChConfig.Def_PerPointValue + curPlayer.GetTotalExp()
|
| | |
|
| | | maxLV = GetPlayerMaxLV(curPlayer)
|
| | | maxLVExpStore = IpyGameDataPY.GetFuncCfg("MaxLVExpStore", 1)
|
| | | curTotalExp = GetPlayerTotalExp(curPlayer)
|
| | |
|
| | | curLV = curPlayer.GetLV() |
| | | # # 检查转生等级
|
| | | # if curLV >= nextReinLV and curTotalExp >= maxLVExpStore:
|
| | | # self.__NotifyExpFull(curPlayer, "GeRen_liubo_260986")
|
| | | # GameWorld.DebugLog("经验已满!需先转生!curLV=%s,reinLV=%s" % (curLV, nextReinLV), curPlayer.GetPlayerID())
|
| | | # return 0
|
| | |
|
| | | maxLV = GetPlayerMaxLV(curPlayer)
|
| | | maxLVExpStore = IpyGameDataPY.GetFuncCfg("PlayerMaxLV", 2)
|
| | | |
| | | curLV = curPlayer.GetLV()
|
| | | |
| | | # 检查最大等级,maxLVExpStore -1时不限累计经验上限
|
| | | if curLV >= maxLV and curTotalExp >= maxLVExpStore and maxLVExpStore != -1:
|
| | | self.__NotifyExpFull(curPlayer, "GeRen_admin_825676")
|
| | |
| | | # 杀怪
|
| | | if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
|
| | | exp_rate = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)
|
| | | superRate = PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(curPlayer, None, None, ChConfig.TriggerType_AddExpRate)
|
| | | if superRate:
|
| | | # 龙凤镯 经验
|
| | | expViewType = ShareDefine.Def_ViewExpType_KillNPCSuper
|
| | | if addSkillID == ChConfig.Def_SkillID_LXHY_AddExpRate:
|
| | | addSkill = GameWorld.GetGameData().GetSkillBySkillID(addSkillID)
|
| | | hasEffect = SkillCommon.GetSkillEffectByEffectID(addSkill, ChConfig.Def_Skill_Effect_AddExpRate)
|
| | | if hasEffect:
|
| | | #烈焰战神 经验
|
| | | superRate += hasEffect.GetEffectValue(0)
|
| | | expViewType = ShareDefine.Def_ViewExpType_LYZS
|
| | | exp_rate += superRate
|
| | | |
| | | elif expViewType in [ShareDefine.Def_ViewExpType_GameEvent, ShareDefine.Def_ViewExpType_Sit]:
|
| | | exp_rate = curPlayer.GetGameEventExpRate()
|
| | | exp_rate += GetFamilySitExpPer(curPlayer)
|
| | | else:
|
| | | exp_rate = max(GameWorld.GetGameWorld().GetExpRate(), ChConfig.Def_MaxRateValue)
|
| | | |
| | | |
| | | exp_rate += expRateEx
|
| | | #输入的经验有可能为long型
|
| | | addExp = int(addExp * exp_rate / float(ChConfig.Def_MaxRateValue))
|
| | |
|
| | | #防沉迷计算
|
| | | addExp = PlayerGameWallow.ChangeExpByWallow(curPlayer, addExp)
|
| | | |
| | | #===========================================================================================
|
| | | # #特殊地图杀怪经验外层加成
|
| | | # if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
|
| | | # #mapID = GameWorld.GetMap().GetMapID()
|
| | | # #if mapID in ChConfig.Def_FBMapID_BZZDAll:
|
| | | # # nobleVIPOuterRate = ...
|
| | | # # #nobleVIPAddExp += 0 if not nobleVIPOuterRate else int(addExp * nobleVIPOuterRate / float(ChConfig.Def_MaxRateValue))
|
| | | # # nobleVIPAddExp += nobleVIPOuterRate
|
| | | # |
| | | # outerExpRate = FBLogic.OnGetOuterExpRate(curPlayer)
|
| | | # if outerExpRate > 0:
|
| | | # addExp = int(addExp * outerExpRate / float(ChConfig.Def_MaxRateValue))
|
| | | #===========================================================================================
|
| | | |
| | | # 不可再升级时,增加后的经验不可超过最大可存储经验
|
| | | #if curLV >= nextReinLV or curLV >= maxLV:
|
| | | if curLV >= maxLV and maxLVExpStore > 0:
|
| | | addExp = min(addExp, max(0, maxLVExpStore - curTotalExp))
|
| | |
|
| | | |
| | | if addExp <= 0:
|
| | | #无法获得经验
|
| | | GameWorld.DebugLog("无法获得经验")
|
| | | return 0, expViewType
|
| | |
|
| | | #addExp = min(addExp, ChConfig.Def_UpperLimit_DWord) # 单次加经验不超过20亿
|
| | |
|
| | | #缓存获取的经验值, 用于兑换家族荣誉
|
| | | #if curPlayer.GetFamilyID() != 0:
|
| | | # curPlayer.SetPerExp(min(curPlayer.GetPerExp() + addExp, ChConfig.Def_UpperLimit_DWord))
|
| | |
|
| | | #人物头顶提示
|
| | | #=======================================================================
|
| | | # viewExpCnt = min(2, addExp / ChConfig.Def_UpperLimit_DWord) # 最多飘两次20亿的
|
| | | # viewExp = addExp % ChConfig.Def_UpperLimit_DWord
|
| | | # for _ in range(viewExpCnt):
|
| | | # curPlayer.Notify_GetExpView(ChConfig.Def_UpperLimit_DWord, expViewType)
|
| | | # if viewExp:
|
| | | # curPlayer.Notify_GetExpView(viewExp, expViewType)
|
| | | # |
| | | # if isSysHint:
|
| | | # # 杀怪附加加成显示
|
| | | # if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
|
| | | # nobleVIPAddExp = int(nobleVIPAddExp / 100.0)
|
| | | # #NotifyCode(curPlayer, "GeRen_liubo_74717", [addExp, nobleVIPAddExp])
|
| | | # elif expViewType in [ShareDefine.Def_ViewExpType_GameEvent,
|
| | | # ShareDefine.Def_ViewExpType_Sit]:
|
| | | # #小游戏事件特殊提示,打坐获取经验
|
| | | # NotifyCode(curPlayer, "ObtainExperience", [addExp])
|
| | | # elif expViewType == ShareDefine.Def_ViewExpType_MousePos:
|
| | | # #鼠标位置提示获得经验
|
| | | # NotifyCode(curPlayer, "GeRen_admin_887936", [addExp])
|
| | | # else:
|
| | | # #正常信息提示
|
| | | # NotifyCode(curPlayer, "GeRen_lhs_0", [addExp])
|
| | | #=======================================================================
|
| | | |
| | | #给人物经验 先设经验后升级
|
| | | #SetPlayerTotalExp(curPlayer, curTotalExp + addExp)
|
| | | totalExp = curTotalExp + addExp
|
| | | curExp = totalExp % ChConfig.Def_PerPointValue
|
| | | expPoint = totalExp / ChConfig.Def_PerPointValue
|
| | |
| | | curPlayer.SetExpPoint(expPoint)
|
| | | if curPlayer.GetTotalExp() != curExp:
|
| | | curPlayer.SetTotalExp(curExp)
|
| | | |
| | | #GameWorld.Log("玩家 = %s 得到经验 = %s ,当前经验倍率 = %s"%(curPlayer.GetName(), addExp,expRate ))
|
| | | #小于转生等级才可升级
|
| | | #if curLV < nextReinLV and curLV < maxLV:
|
| | | |
| | | if curLV < maxLV:
|
| | | self.PlayerLvUp()
|
| | | |
| | | |
| | | #添加经验成功
|
| | | return addExp, expViewType
|
| | |
|
| | |
| | | #玩家死亡不可升级
|
| | | return
|
| | |
|
| | | #lvIpyData = GetPlayerLVIpyData(curPlayer.GetLV())
|
| | | lvIpyData = IpyGameDataPY.GetIpyGameData("PlayerLV", curPlayer.GetLV())
|
| | | lvIpyData = GetPlayerLVIpyData(curPlayer.GetLV())
|
| | | if not lvIpyData:
|
| | | GameWorld.ErrLog("经验表异常 lv= %s" % curPlayer.GetLV())
|
| | | return
|
| | | |
| | | #lvUpNeedExp = GetLVUPTotalExpNeed(lvIpyData)
|
| | | lvUpNeedExp = lvIpyData.GetExpPoint() * ChConfig.Def_PerPointValue + lvIpyData.GetExp()
|
| | | |
| | | lvUpNeedExp = GetLVUPTotalExpNeed(lvIpyData)
|
| | | if lvUpNeedExp <= 0:
|
| | | return
|
| | |
|
| | | #增加经验
|
| | | #curTotalExp = GetPlayerTotalExp(curPlayer)
|
| | | curTotalExp = curPlayer.GetExpPoint() * ChConfig.Def_PerPointValue + curPlayer.GetTotalExp()
|
| | | curTotalExp = GetPlayerTotalExp(curPlayer)
|
| | | #未达到升级经验
|
| | | if curTotalExp < lvUpNeedExp:
|
| | | return
|
| | | needSyncTalentPoint = False
|
| | | playerNeedDoLVUp = False
|
| | | curLV = curPlayer.GetLV()
|
| | | maxLV = GetPlayerMaxLV(curPlayer)
|
| | |
| | | curPlayer.BeginRefreshState()
|
| | | #befXP = curPlayer.GetXP()
|
| | | befLV = curPlayer.GetLV()
|
| | | befFreePoint = curPlayer.GetFreePoint()
|
| | | befBaseSTR = curPlayer.GetBaseSTR()
|
| | | befBasePNE = curPlayer.GetBasePNE()
|
| | | befBasePHY = curPlayer.GetBasePHY()
|
| | | befBaseCON = curPlayer.GetBaseCON()
|
| | | |
| | | #升级前的世界等级经验
|
| | | #beforeExpRate = PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer)
|
| | | #befFreePoint = curPlayer.GetFreePoint()
|
| | |
|
| | | while curTotalExp >= lvUpNeedExp and curLV < maxLV:
|
| | |
|
| | |
| | | isNotifyServer = False
|
| | |
|
| | | curPlayer.SetLV(curLV, isNotifyServer)
|
| | | EventReport.WriteEvent_level_up(curPlayer)
|
| | | #EventReport.WriteEvent_level_up(curPlayer)
|
| | |
|
| | | # 记录玩家升级
|
| | | DataRecordPack.DR_PlayerUpgrade(curPlayer, curPlayer.GetLV(), GetPlayerTotalExp(curPlayer), lvUpNeedExp)
|
| | | DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_LVUP, {'lv':curLV})
|
| | | self.__GiveLVMailAward(curLV)
|
| | | self.__DoLVUPAddPoint() # 升级加点
|
| | | #self.__DoLVUPAddPoint() # 升级加点
|
| | | #self.__DoLvUpAddSkill() # 升级加技能
|
| | |
|
| | | lvIpyData = GetPlayerLVIpyData(curPlayer.GetLV())
|
| | | # 大师天赋点
|
| | | if lvIpyData:
|
| | | addTalentPoint = lvIpyData.GetTalentPoint()
|
| | | if addTalentPoint:
|
| | | needSyncTalentPoint = True
|
| | | PlayerGreatMaster.AddGreatMasterSkillPointByLV(curPlayer, addTalentPoint)
|
| | |
|
| | | PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_LVUp, 1)
|
| | | #---是否继续循环---
|
| | | curTotalExp = curTotalExp - lvUpNeedExp
|
| | |
|
| | |
| | | #有升级, 转生时刚好是转生等级会默认+1级
|
| | | if playerNeedDoLVUp:
|
| | | aftLV = curPlayer.GetLV()
|
| | | aftFreePoint = curPlayer.GetFreePoint()
|
| | | aftBaseSTR = curPlayer.GetBaseSTR()
|
| | | aftBasePNE = curPlayer.GetBasePNE()
|
| | | aftBasePHY = curPlayer.GetBasePHY()
|
| | | aftBaseCON = curPlayer.GetBaseCON()
|
| | | #aftFreePoint = curPlayer.GetFreePoint()
|
| | | if aftLV > befLV:
|
| | | curPlayer.SetLV(aftLV, False) # 这里不再通知GameServer
|
| | | PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_LV, aftLV)
|
| | | PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_LVUp, aftLV - befLV)
|
| | | PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_LV)
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_HeroLV, aftLV)
|
| | | PlayerActivity.DoAddActivityByLV(curPlayer, befLV, aftLV)
|
| | |
|
| | | if aftFreePoint > befFreePoint:
|
| | | curPlayer.SetFreePoint(aftFreePoint)
|
| | | #NotifyCode(curPlayer, "ObtainAttributeDot", [aftFreePoint - befFreePoint])
|
| | | if aftBaseSTR > befBaseSTR:
|
| | | curPlayer.SetBaseSTR(aftBaseSTR)
|
| | | if aftBasePNE > befBasePNE:
|
| | | curPlayer.SetBasePNE(aftBasePNE)
|
| | | if aftBasePHY > befBasePHY:
|
| | | curPlayer.SetBasePHY(aftBasePHY)
|
| | | if aftBaseCON > befBaseCON:
|
| | | curPlayer.SetBaseCON(aftBaseCON)
|
| | | #if aftFreePoint > befFreePoint:
|
| | | # curPlayer.SetFreePoint(aftFreePoint)
|
| | | PlayerGubao.DoGubaoAddFreePoint(curPlayer)
|
| | | #===================================================================
|
| | | # if curPlayer.GetXP() != befXP:
|
| | | # curPlayer.SetXP(curPlayer.GetXP())
|
| | | #===================================================================
|
| | | |
| | | #享受世界等级
|
| | | #===================================================================
|
| | | #curExpRate = PlayerWorldAverageLv.GetWorldAverageLvExpRate(curPlayer)
|
| | | #if beforeExpRate <= 0 and curExpRate > 0:
|
| | | # NotifyCode(curPlayer, "GeRen_liubo_127574")
|
| | |
|
| | | #===================================================================
|
| | | # 天赋点通知
|
| | | if needSyncTalentPoint:
|
| | | PlayerGreatMaster.Sync_GreatMasterFreeSkillPoint(curPlayer)
|
| | | # 升级需要执行的游戏功能处理
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | ChEquip.RefreshPlayerLingQiEquipAttr(curPlayer) # 灵器属性会随等级成长
|
| | | if aftLV%10 == 0:
|
| | | # 控制下刷新次数
|
| | | PlayerPet.CalcPetItemAddPlayerAttr(curPlayer) # 宠物有随等级变化的技能
|
| | | #if aftLV%10 == 0:
|
| | | # # 控制下刷新次数
|
| | | # PlayerPet.CalcPetItemAddPlayerAttr(curPlayer) # 宠物有随等级变化的技能
|
| | |
|
| | | self.RefreshPlayerAttrState(billboardFunc=PlayerBillboard.UpdatePlayerLVBillboard)
|
| | | #放在功能开启后面
|
| | |
| | | count += 1
|
| | | return count
|
| | |
|
| | |
|
| | |
|
| | | ## 获取节假日经验加成
|
| | | # @param curPlayer: 玩家实例
|
| | | # @return: 节假日经验加成
|
| | | def GetHolidayExpRate(curPlayer):
|
| | | return 0
|
| | |
|
| | |
|
| | | ## 获取世界boss经验加成
|
| | | # @param curPlayer: 玩家实例
|
| | | # @return: 世界boss经验加成
|
| | | def GetWorldBossExpRate(curPlayer):
|
| | | return 0
|
| | |
|
| | | ## 获取玩家当前等级升级所需总经验
|
| | | # @param playerLv 玩家等级
|
| | | # @return 返回值, 升级需要的总经验
|
| | | def GetLVUPTotalNeedExp(curPlayer):
|
| | | curLV = curPlayer.GetLV()
|
| | | #if curLV >= IpyGameDataPY.GetFuncCfg("PlayerMaxLV") and PlayerGreatMaster.IsGreatMasterOpen(curPlayer):
|
| | | # return PlayerGreatMaster.GetTotalExpByGreatMasterLV(curPlayer.GetLV2())
|
| | | |
| | | return GetTotalExpByPlayerLv(curLV)
|
| | |
|
| | | ## 根据等级获得升级需要的总经验
|
| | |
| | | def GetLVUPTotalExpNeed(lvIpyData):
|
| | | if not lvIpyData:
|
| | | return 0
|
| | | return lvIpyData.GetExpPoint() * ChConfig.Def_PerPointValue + lvIpyData.GetExp()
|
| | | return lvIpyData.GetExp()
|
| | |
|
| | | def GetPlayerMaxLV(curPlayer):
|
| | | ## 获取玩家实际可升的最大等级
|
| | |
| | |
|
| | | # 给物品
|
| | | if itemDict:
|
| | | itemDict['IsBind'] = isBind
|
| | | ItemControler.GivePlayerEquip(curPlayer, itemDict, event=[ChConfig.ItemGive_FamilyStore, False, {}])
|
| | | pass
|
| | | #itemDict['IsBind'] = isBind
|
| | | #ItemControler.GivePlayerEquip(curPlayer, itemDict, event=[ChConfig.ItemGive_FamilyStore, False, {}])
|
| | | else:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem],
|
| | | event=[ChConfig.ItemGive_FamilyStore, False, {}])
|
| | |
| | | import EventReport
|
| | | import ItemCommon
|
| | | import DataRecordPack
|
| | | import ShareDefine
|
| | | import PlayerCoin
|
| | |
|
| | | import md5
|
| | |
| | | succGiveItemList = []
|
| | | for itemInfo in awardItemList:
|
| | | itemID, itemCount, itemBind = itemInfo[:3]
|
| | | isAppoint = itemInfo[3] if len(itemInfo) > 3 else 0
|
| | | |
| | | if isAppoint:
|
| | | isOK = ItemControler.GivePlayerAppointItem(curPlayer, itemID, False)
|
| | | else:
|
| | | isOK = ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
|
| | | appointID = itemInfo[3] if len(itemInfo) > 3 else 0
|
| | | setAttrDict = {ShareDefine.Def_CItemKey_AppointID:appointID}
|
| | | isOK = ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem], setAttrDict=setAttrDict)
|
| | | if isOK:
|
| | | succGiveItemList.append(itemInfo)
|
| | |
|
| | |
| | | elif equipPlace == ShareDefine.retWing:
|
| | | PlayerControl.NotifyCode(curPlayer, 'WingTiyan_Timeout')
|
| | |
|
| | | tryItemDict = IpyGameDataPY.GetFuncEvalCfg('FirstGoldTryItem', 1, {})
|
| | | tryItemID = tryItemDict.get(curPlayer.GetJob(), 0)
|
| | | if tryItemID and ItemControler.GetAppointItemRealID(tryItemID) == equipID:
|
| | | #首充试用武器过期并且还没首充的提示()
|
| | | if not curPlayer.GetChangeCoinPointTotal():
|
| | | PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')
|
| | | PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)
|
| | | #tryItemDict = IpyGameDataPY.GetFuncEvalCfg('FirstGoldTryItem', 1, {})
|
| | | #tryItemID = tryItemDict.get(curPlayer.GetJob(), 0)
|
| | | #if tryItemID and ItemControler.GetAppointItemRealID(tryItemID) == equipID:
|
| | | # #首充试用武器过期并且还没首充的提示()
|
| | | # if not curPlayer.GetChangeCoinPointTotal():
|
| | | # PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')
|
| | | # PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)
|
| | |
|
| | | return True
|
| | | #---------------------------------------------------------------------
|
| | |
| | | SetSuccFinishValue(curPlayer, succType, condition, 0)
|
| | | return
|
| | |
|
| | | def DoEquipSuccessLogic(curPlayer, classLV):
|
| | | #玩家当前可装备的装备类型
|
| | | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'ClassLV':classLV}, True)
|
| | | if not ipyDataList:
|
| | | return
|
| | | |
| | | placeCountDict, colorCountDict, suitCountDict = {}, {}, {}
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for ipyData in ipyDataList:
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | curEquip = playerEquip.GetAt(equipIndex)
|
| | | if curEquip.IsEmpty():
|
| | | continue
|
| | | itemPlace = curEquip.GetEquipPlace()
|
| | | |
| | | # 套装、颜色 成就 统计基础部位
|
| | | if itemPlace in ChConfig.EquipPlace_Base:
|
| | | itemColor = curEquip.GetItemColor()
|
| | | colorConditionKey = (classLV, itemColor)
|
| | | colorCountDict[colorConditionKey] = colorCountDict.get(colorConditionKey, 0) + 1
|
| | | |
| | | # 统计套装数
|
| | | if curEquip.GetSuiteID():
|
| | | suitConditionKey = (classLV, )
|
| | | suitCountDict[suitConditionKey] = suitCountDict.get(suitConditionKey, 0) + 1
|
| | | |
| | | # 部位 成就 统计特殊部位
|
| | | elif itemPlace in ChConfig.EquipPlace_Special:
|
| | | placeConditionKey = (classLV, itemPlace)
|
| | | placeCountDict[placeConditionKey] = placeCountDict.get(placeConditionKey, 0) + 1
|
| | | |
| | | # 更新成就
|
| | | #GameWorld.DebugLog("装备阶部位成就数据: classLV=%s,placeCountDict=%s" % (classLV, placeCountDict))
|
| | | UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipPlace, placeCountDict)
|
| | | |
| | | #GameWorld.DebugLog("装备阶颜色成就数据: classLV=%s,colorCountDict=%s" % (classLV, colorCountDict))
|
| | | UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipColorItem, colorCountDict)
|
| | | |
| | | #GameWorld.DebugLog("装备阶套装成就数据: classLV=%s,suitCountDict=%s" % (classLV, suitCountDict))
|
| | | UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipSuit, suitCountDict)
|
| | | return
|
| | |
|
| | | def UpdateSuccessProgressByConditions(curPlayer, successType, conditionCountDict):
|
| | | if successType not in ShareDefine.SuccessTypeList:
|
| | | return
|
| | |
| | | maxRefineExp = wingAttrIpyData.GetMaxRefineExp()
|
| | | if curPlayer and wingProgress < maxRefineExp <= updWingProgress:
|
| | | PlayerControl.WorldNotify(0, "WingsRefinePerfect", [curPlayer.GetPlayerName(), curItemID, curWing.GetUserData()])
|
| | | #if curPlayer and isColorChange:
|
| | | # PlayerSuccess.DoEquipSuccessLogic(curPlayer)
|
| | | return
|
| | |
|
| | | def GetWingRefineAttrData(itemID):
|
| | |
| | | #鞋履基础属性值 百分比
|
| | | Def_Effect_ShoesAddPer = 128
|
| | | #仙器A基础属性值 百分比
|
| | | Def_Effect_FairyCanAddPer = 129
|
| | | Def_Effect_ShawlAddPer = 129
|
| | | #仙器B基础属性值 百分比
|
| | | Def_Effect_FairyCan2AddPer = 130
|
| | | Def_Effect_RingAddPer = 130
|
| | | #仙绳基础属性值 百分比
|
| | | Def_Effect_NeckAddPer = 131
|
| | | #莲台基础属性值 百分比
|
| | | Def_Effect_JadeAddPer = 132
|
| | | Def_Effect_AmuletAddPer = 132
|
| | |
|
| | | Def_Effect_MinAtk = 67 # 最小攻击
|
| | | Def_Effect_MaxAtk = 68 # 最大攻击
|
| | |
| | | Def_Effect_PetWeakenPer = 218 # 弱化灵兽
|
| | | Def_Effect_SuperHitHurtPer = 219 # 强化暴伤
|
| | | Def_Effect_SuperHitHurtDefPer = 220 # 弱化暴伤
|
| | | Def_Effect_DamBlockRate = 221 # 格挡概率
|
| | | Def_Effect_DamBlockDefRate = 222 # 抗格挡概率
|
| | |
|
| | | #增加%d物理伤害值,其中a值为伤害值
|
| | | Def_Effect_AddAtk = 1005
|
| | |
| | | Def_IudetMapLoaction = 15 # 物品记录地图坐标[mapid, posx, posy]
|
| | | Def_IudetLegendAttrID = 17 # 物品传奇属性ID列表
|
| | | Def_IudetLegendAttrValue = 19 # 物品传奇属性值列表
|
| | | Def_IudetBaseAttrID = 21 # 物品基础属性ID列表,适用于随机范围基础属性(非物品表配置的固定属性)
|
| | | Def_IudetBaseAttrValue = 23 # 物品基础属性值列表
|
| | | Def_IudetPartSuiteLV = 25 # 部位套装等级 [套装类型1等级, 套装类型2等级, ...]
|
| | | Def_IudetWingMaterialItemID = 27 # 翅膀精炼材料ID列表
|
| | | Def_IudetWingMaterialItemCount = 29 # 翅膀精炼材料个数列表
|
| | |
| | | Def_IudetItemColor = 16 # 物品颜色,如果该值没有就取物品
|
| | | Def_IudetItemCount = 18 # 物品个数,支持20亿,目前仅特殊转化物品会用到
|
| | | Def_IudetCancelUseLimit = 20 # 物品取消使用限制
|
| | | Def_IudetItemLV = 22 # 物品等级,适用于动态物品等级(非物品表配置的固定等级)
|
| | | Def_IudetSource = 24 # 物品来源
|
| | | Def_IudetSuiteLV = 30 # 套装等级
|
| | | Def_IudetHasOpenCnt = 32 # 物品累积开启次数
|
| | |
| | | Def_IudetPet_Skill = 201 # 技能列表
|
| | |
|
| | | Def_IudetHorsePetSkinIndex = 210 # 骑宠觉醒外观索引
|
| | |
|
| | | # 以下为自定义的设置物品属性key
|
| | | Def_CItemKey_AppointID = "AppointID"
|
| | | # ----------------------------------------------------
|
| | |
|
| | | LineupObjMax = 6 # 阵容最大上阵武将数
|
| | |
| | | # 手游不使用C++定义 enum RoleEquipType
|
| | | # 装备位定义
|
| | | RoleEquipType = (
|
| | | retWeapon, #1 主手
|
| | | retWeapon2, #2 副手
|
| | | retHat, #3 帽子
|
| | | retClothes, #4 衣服
|
| | | retBelt, #5 腰带
|
| | | retTrousers, #6 裤子
|
| | | retShoes, #7 鞋子
|
| | | retGlove, #8 手套
|
| | | retNeck, #9 项链
|
| | | retFairyCan, #10 仙器1
|
| | | retFairyCan2, #11 仙器2
|
| | | retJade, #12 玉佩
|
| | | retWeapon, #1 主手/武器
|
| | | retWeapon2, #2 副手/护手
|
| | | retHat, #3 帽子/头盔
|
| | | retClothes, #4 衣服/衣服
|
| | | retBelt, #5 腰带/腰带
|
| | | retTrousers, #6 裤子/长裤
|
| | | retShoes, #7 鞋子/鞋子
|
| | | retGlove, #8 手套/护腕
|
| | | retShawl, #9 仙器1/披肩
|
| | | retNeck, #10 项链/项链
|
| | | retRing, #11 仙器2/戒指
|
| | | retAmulet, #12 玉佩/护符 Amulet
|
| | | retWing, #13 翅膀
|
| | | retGuard1, #14 守护1
|
| | | retGuard2, #15 守护2
|
| | |
| | | #统一调用攻击结束动作
|
| | | if isDoAttackResult:
|
| | | BaseAttack.DoLogic_AttackResult(buffOwner, curObj, None, tick)
|
| | | |
| | | TurnAttack.OnTurnfightAttackResult(buffOwner, curObj, curSkill)
|
| | | return lostHP
|
| | |
|
| | | ## 检查增加淬毒buff
|
| | |
| | | import FBCommon
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | | import TurnAttack
|
| | | #---------------------------------------------------------------------
|
| | | GameWorld.ImportAll("Script\\Skill\\" , "GameSkills")
|
| | | GameWorld.ImportAll("Script\\Skill\\" , "GameBuffs")
|
| | |
| | | return False
|
| | |
|
| | | return True
|
| | |
|
| | |
|
| | | ##弓和弩普攻技能
|
| | | # @param curPlayer 玩家实例
|
| | | # @param skillID 技能ID
|
| | | # @return 特别的普攻ID
|
| | | #===============================================================================
|
| | | # def GetBowNormalAttackID(curPlayer, skillID):
|
| | | # #刷新人物攻击距离
|
| | | # playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | # #获得当前人物使用的武器
|
| | | # curUseWeapon = playerEquip.GetAt(ShareDefine.retWeapon)
|
| | | # curUseWeapon2 = playerEquip.GetAt(ShareDefine.retWeapon2)
|
| | | # #空手
|
| | | # if curUseWeapon.IsEmpty() and curUseWeapon2.IsEmpty():
|
| | | # return skillID
|
| | | # |
| | | # if curUseWeapon.GetType() in [ChConfig.Def_ItemType_Crossbow, ChConfig.Def_ItemType_Bow]:
|
| | | # curEffect = ItemCommon.GetItemEffectByEffectID(curUseWeapon, ChConfig.Def_Effect_WeaponAttack)
|
| | | # if curEffect == None:
|
| | | # GameWorld.DebugAnswer(curPlayer, '没有物品效果ID %s'%ChConfig.Def_Effect_WeaponAttack)
|
| | | # return skillID
|
| | | # |
| | | # return curEffect.GetEffectValue(0)
|
| | | # |
| | | # if curUseWeapon2.GetType() in [ChConfig.Def_ItemType_Crossbow, ChConfig.Def_ItemType_Bow]:
|
| | | # curEffect = ItemCommon.GetItemEffectByEffectID(curUseWeapon2, ChConfig.Def_Effect_WeaponAttack)
|
| | | # if curEffect == None:
|
| | | # GameWorld.DebugAnswer(curPlayer, '没有物品效果ID %s'%ChConfig.Def_Effect_WeaponAttack)
|
| | | # return skillID
|
| | | # |
| | | # return curEffect.GetEffectValue(0)
|
| | | # |
| | | # return skillID
|
| | | #===============================================================================
|
| | |
|
| | |
|
| | | #===============================================================================
|
| | | # //B4 02 对象击退 #tagCMNPCBeatBack
|
| | |
| | |
|
| | | #调用攻击惩罚逻辑
|
| | | BaseAttack.DoLogic_AttackResult(attacker, defender, None, tick)
|
| | | |
| | | TurnAttack.OnTurnfightAttackResult(attacker, defender, curSkill)
|
| | | |
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | ##释放普通技能
|