| | |
| | | import ChEquip
|
| | | import QuestCommon
|
| | | import random
|
| | |
|
| | | # 可吞噬的装备位
|
| | | Def_EatItem_EquipPlace = [
|
| | | ShareDefine.retWeapon, #1 主手
|
| | | ShareDefine.retWeapon2, #2 副手
|
| | | ShareDefine.retHat, #3 帽子
|
| | | ShareDefine.retClothes, #4 衣服
|
| | | ShareDefine.retBelt, #5 腰带
|
| | | ShareDefine.retTrousers, #6 裤子
|
| | | ShareDefine.retShoes, #7 鞋子
|
| | | ShareDefine.retNeck, #8 项链
|
| | |
|
| | | ]
|
| | | import GameObj
|
| | |
|
| | | Def_EatSpace = 5 # 低于X格自动吞噬
|
| | |
|
| | |
|
| | | def DoTJGOpen(curPlayer):
|
| | | ##脱机挂功能开启 赠送脱机时间
|
| | | addTime = IpyGameDataPY.GetFuncCfg('TJGGiftTime')
|
| | | AddTJGTime(curPlayer, addTime)
|
| | | GameWorld.DebugLog('脱机挂功能开启 赠送脱机时间 %s'%addTime, curPlayer.GetID())
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | | # //B2 01 脱机挂状态 # tagCMLoginState
|
| | | # struct tagCMLoginState
|
| | |
| | |
|
| | | # 切换守护
|
| | | def ChangeGuard(curPlayer, tick):
|
| | | # 检查过背包中无守护则不再执行
|
| | | if curPlayer.GetDictByKey("AutoCGuardID") == 1:
|
| | | return
|
| | | |
| | | curGuardID = 0 # 装备的守护ID
|
| | | itemIDList = IpyGameDataPY.GetFuncEvalCfg('AutoUseGuardian', 1)
|
| | | guardItem = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip).GetAt(ShareDefine.retGuard)
|
| | | # 1。 守护存在,判断是否最优先守护
|
| | | if ItemCommon.CheckItemCanUse(guardItem) and ItemCommon.CheckItemCanUseByExpireTime(guardItem):
|
| | | curGuardID = guardItem.GetItemTypeID()
|
| | | if curGuardID == itemIDList[0]:
|
| | | # 最高优先级
|
| | | return
|
| | | if curPlayer.GetDictByKey("AutoCGuardID") == 2:
|
| | | # 当前背包最高
|
| | | return
|
| | | |
| | |
|
| | | findItemList = []
|
| | | curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | |
| | | # 找到背包中优先级最高的守护物品
|
| | | for i in range(0, curPack.GetCount()):
|
| | | item = curPack.GetAt(i)
|
| | | |
| | | if not ItemCommon.CheckItemCanUse(item):
|
| | | continue
|
| | | |
| | | if item.GetItemTypeID() not in itemIDList:
|
| | | continue
|
| | | |
| | | if not ItemCommon.CheckItemCanUseByExpireTime(item):
|
| | | # 背包有不过期的物品
|
| | | continue
|
| | | |
| | | findItemList.append(item)
|
| | | |
| | | if not findItemList:
|
| | | curPlayer.SetDict("AutoCGuardID", 1) # 设置无可替换的标志
|
| | | return
|
| | | |
| | | findItemList.sort(cmp=SortGuard)
|
| | | if curGuardID in itemIDList and itemIDList.index(curGuardID) <= itemIDList.index(findItemList[0].GetItemTypeID()):
|
| | | # 当前装备最高,减少遍历
|
| | | curPlayer.SetDict("AutoCGuardID", 2)
|
| | | return
|
| | | |
| | |
|
| | | #---执行玩家换装逻辑---
|
| | | ChEquip.DoPlayerEquipItem(curPlayer, findItemList[0], ShareDefine.retGuard, tick)
|
| | | curPlayer.SetDict("AutoCGuardID", 0)
|
| | | return #新版本不需要切换
|
| | | # # 检查过背包中无守护则不再执行
|
| | | # if curPlayer.GetDictByKey("AutoCGuardID") == 1:
|
| | | # return
|
| | | # |
| | | # curGuardID = 0 # 装备的守护ID
|
| | | # itemIDList = IpyGameDataPY.GetFuncEvalCfg('AutoUseGuardian', 1)
|
| | | # guardItem = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip).GetAt(ShareDefine.retGuard1)
|
| | | # # 1。 守护存在,判断是否最优先守护
|
| | | # if ItemCommon.CheckItemCanUse(guardItem) and ItemCommon.CheckItemCanUseByExpireTime(guardItem):
|
| | | # curGuardID = guardItem.GetItemTypeID()
|
| | | # if curGuardID == itemIDList[0]:
|
| | | # # 最高优先级
|
| | | # return
|
| | | # if curPlayer.GetDictByKey("AutoCGuardID") == 2:
|
| | | # # 当前背包最高
|
| | | # return
|
| | | # |
| | | #
|
| | | # findItemList = []
|
| | | # curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | # |
| | | # # 找到背包中优先级最高的守护物品
|
| | | # for i in range(0, curPack.GetCount()):
|
| | | # item = curPack.GetAt(i)
|
| | | # |
| | | # if not ItemCommon.CheckItemCanUse(item):
|
| | | # continue
|
| | | # |
| | | # if item.GetItemTypeID() not in itemIDList:
|
| | | # continue
|
| | | # |
| | | # if not ItemCommon.CheckItemCanUseByExpireTime(item):
|
| | | # # 背包有不过期的物品
|
| | | # continue
|
| | | # |
| | | # findItemList.append(item)
|
| | | # |
| | | # if not findItemList:
|
| | | # curPlayer.SetDict("AutoCGuardID", 1) # 设置无可替换的标志
|
| | | # return
|
| | | # |
| | | # findItemList.sort(cmp=SortGuard)
|
| | | # if curGuardID in itemIDList and itemIDList.index(curGuardID) <= itemIDList.index(findItemList[0].GetItemTypeID()):
|
| | | # # 当前装备最高,减少遍历
|
| | | # curPlayer.SetDict("AutoCGuardID", 2)
|
| | | # return
|
| | | # |
| | | #
|
| | | # #---执行玩家换装逻辑---
|
| | | # ChEquip.DoPlayerEquipItem(curPlayer, findItemList[0], ItemCommon.GetEquipPackIndex(findItemList[0]), tick)
|
| | | # curPlayer.SetDict("AutoCGuardID", 0)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | curPlayer.SetSight(min(ChConfig.Def_PlayerSight_Default, clientData.Sight))
|
| | | GameWorld.DebugLog("OnSightZoom:%s"%clientData.Sight)
|
| | |
|
| | | # 脱机玩家过多,需要隐身一部分
|
| | | if curPlayer.GetLV() < 190:
|
| | | if random.randint(0, 5) != 2:
|
| | | curPlayer.SetVisible(False)
|
| | | return
|
| | |
|
| | | # 需要处理的点,防沉迷
|
| | |
| | | aMinAtk = curPlayer.GetMinAtk() # 攻击方最小攻击
|
| | | aMaxAtk = curPlayer.GetMaxAtk() # 攻击方最大攻击
|
| | | aSuperHitRate = curPlayer.GetSuperHitRate() # 暴击率
|
| | | aSuperHit = curPlayer.GetSuperHit() # 暴击伤害
|
| | | aSuperHit = curPlayer.GetSuperHit() # 暴击伤害固定值
|
| | | aIceAtk = curPlayer.GetIceAtk() # 真实伤害
|
| | | aDamagePer = PlayerControl.GetDamagePer(curPlayer) # 外层伤害加成
|
| | | aDamagePVE = PlayerControl.GetDamagePVE(curPlayer) # PVE固定伤害
|
| | | aSkillAtkRate = curPlayer.GetSkillAtkRate() # 技能攻击力加成
|
| | | petMinAtk = PlayerControl.GetPetMinAtk(curPlayer) #灵宠最小攻击
|
| | | petMaxAtk = PlayerControl.GetPetMaxAtk(curPlayer) #灵宠最大攻击
|
| | | petDamPer = PlayerControl.GetPetDamPer(curPlayer) #灵宠增加伤害
|
| | | petDamPer = GameObj.GetPetDamPer(curPlayer) #灵宠增加伤害
|
| | | atkSpeed = PlayerControl.GetAtkSpeed(curPlayer) # 攻击速度
|
| | | aIgnoreDefRate = curPlayer.GetIgnoreDefRate() # 无视防御比率
|
| | | aLuckyHit = curPlayer.GetLuckyHitVal() # 会心一击
|
| | | aLuckyHit = curPlayer.GetLuckyHitVal() # 会心一击固定值
|
| | | aLuckyHitRate = curPlayer.GetLuckyHitRate() # 会心一击概率
|
| | | aBleedDamage = PlayerControl.GetBleedDamage(curPlayer) # 流血伤害 万分率
|
| | | aFinalHurt = PlayerControl.GetFinalHurt(curPlayer) # 最终固定伤害
|
| | | aFinalHurtPer = PlayerControl.GetFinalHurtPer(curPlayer) # 最终伤害加成万分率
|
| | | aFightPower = curPlayer.GetFightPower() # 战力
|
| | | aReFightPower = lvIpyData.GetReFightPower() # 等级表对应的战力
|
| | | |
| | | aNPCHurtAddPer = PlayerControl.GetNPCHurtAddPer(curPlayer) #PVE 伤害加成万分率
|
| | |
|
| | | npcExp = npcData.GetExp()
|
| | | npcMaxHP = npcData.GetHP() + npcData.GetHPEx()*ShareDefine.Def_PerPointValue
|
| | |
| | | for i in range(len(skills)):
|
| | | locals()["skill%s"%(i+1)] = 1 if skills[i] in PassiveBuffEffMng.FindUsePassiveSkills(curPlayer) else 0
|
| | |
|
| | | |
| | | GameWorld.DebugLog("""CalcTJGExp--%s-%s-%s-%s-reExp:%s, attackEff:%s, aMinAtk:%s, aMaxAtk:%s, aSuperHitRate:%s, aSuperHit:%s, |
| | | aIceAtk:%s, aDamagePer:%s, aSkillAtkRate:%s, petMinAtk:%s, petMaxAtk:%s, petDamPer:%s, atkSpeed:%s,
|
| | | aIgnoreDefRate:%s, aLuckyHit:%s, aLuckyHitRate:%s, aBleedDamage:%s, aFinalHurt:%s, npcExp:%s, npcMaxHP:%s, npcCommendFightPower:%s,
|
| | | petSkillLV:%s, petSkillPer:%s, skill:%s, petSkill:%s"""%(curPlayer.GetID(), curPlayer.GetLV(), times, npcData.GetNPCID(),
|
| | | reExp, attackEff, aMinAtk, aMaxAtk, aSuperHitRate, aSuperHit,
|
| | | aIceAtk, aDamagePer, aSkillAtkRate, petMinAtk, petMaxAtk, petDamPer,
|
| | | atkSpeed, aIgnoreDefRate, aLuckyHit, aLuckyHitRate, aBleedDamage, aFinalHurt, npcExp, npcMaxHP, npcCommendFightPower, petSkillLV,
|
| | | petSkillPer, eval("[" +", ".join(["skill%s"%i for i in range(1, 11)]) + "]"), |
| | | eval("[" +", ".join(["PetSkill%s"%i for i in range(1, 10)]) + "]")))
|
| | | if GameWorld.GetGameWorld().GetDebugLevel():
|
| | | GameWorld.DebugLog("""CalcTJGExp--%s-%s-%s-%s-reExp:%s, attackEff:%s, aMinAtk:%s, aMaxAtk:%s, aSuperHitRate:%s, aSuperHit:%s,
|
| | | aNPCHurtAddPer:%s, aFinalHurtPer:%s, |
| | | aIceAtk:%s, aDamagePVE:%s, aSkillAtkRate:%s, petMinAtk:%s, petMaxAtk:%s, petDamPer:%s, atkSpeed:%s,
|
| | | aIgnoreDefRate:%s, aLuckyHit:%s, aLuckyHitRate:%s, aBleedDamage:%s, aFinalHurt:%s, npcExp:%s, npcMaxHP:%s, npcCommendFightPower:%s,
|
| | | petSkillLV:%s, petSkillPer:%s, skill:%s, petSkill:%s"""%(curPlayer.GetID(), curPlayer.GetLV(), times, npcData.GetNPCID(),
|
| | | reExp, attackEff, aMinAtk, aMaxAtk, aSuperHitRate, aSuperHit, aNPCHurtAddPer, aFinalHurtPer,
|
| | | aIceAtk, aDamagePVE, aSkillAtkRate, petMinAtk, petMaxAtk, petDamPer,
|
| | | atkSpeed, aIgnoreDefRate, aLuckyHit, aLuckyHitRate, aBleedDamage, aFinalHurt, npcExp, npcMaxHP, npcCommendFightPower, petSkillLV,
|
| | | petSkillPer, eval("[" +", ".join(["skill%s"%i for i in range(1, 11)]) + "]"), |
| | | eval("[" +", ".join(["PetSkill%s"%i for i in range(1, 10)]) + "]")))
|
| | |
|
| | | # 1. 经验
|
| | | exp = eval(IpyGameDataPY.GetFuncCompileCfg('TJG', 1))
|
| | |
| | | # 满了不再给物品
|
| | | return
|
| | |
|
| | | dropIDCountDict, dropIDBindDict, money = {}, {}, 0
|
| | | dropIDCountDict, auctionIDList, money = {}, [], 0
|
| | | dropRet = NPCCommon.GetNPCDropInfoTJG(curPlayer, curPlayer.GetMapID(), npcID, killCnt)
|
| | | if dropRet:
|
| | | dropIDCountDict, dropIDBindDict, money = dropRet
|
| | | dropIDCountDict, auctionIDList, money = dropRet
|
| | | # 1. 出售为铜钱 2.放入背包 3.满则不继续给物品
|
| | | for itemID, dropCount in dropIDCountDict.items():
|
| | | if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
|
| | |
| | | if not curItemData:
|
| | | continue
|
| | |
|
| | | # 掉落绑定, 默认绑定
|
| | | isDropBind = dropIDBindDict.get(itemID, 1)
|
| | | isAuctionItem = itemID in auctionIDList
|
| | | itemControl = ItemControler.PlayerItemControler(curPlayer)
|
| | |
|
| | | ## 装备物品 白蓝直接换算铜钱
|
| | |
| | | ## 装备一件件给
|
| | | if ItemCommon.GetIsEquip(curItemData):
|
| | | for _ in xrange(dropCount):
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, isDropBind)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | | if not itemControl.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_TJGDropItem, False, {}]):
|
| | |
| | | #记录紫橙装数量用于通知
|
| | | NoteEquip(curPlayer, curItemData.GetItemColor())
|
| | | else:
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, dropCount, isDropBind)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, dropCount, isAuctionItem, curPlayer=curPlayer)
|
| | | if not curItem:
|
| | | continue
|
| | |
|
| | |
| | |
|
| | | equipScores = {}
|
| | | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for i in Def_EatItem_EquipPlace:
|
| | | for i in ChConfig.EquipPlace_Base:
|
| | | equipItem = equipPack.GetAt(i)
|
| | | if not equipItem or equipItem.IsEmpty():
|
| | | continue
|
| | |
| | | #GameWorld.DebugLog("equipScores----%s"%equipScores)
|
| | |
|
| | | eatIndexList = []
|
| | | eatItemIDList = []
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | for i in range(0, itemPack.GetCount()):
|
| | | curItem = itemPack.GetAt(i)
|
| | |
| | | continue
|
| | |
|
| | | eatIndexList.append(i)
|
| | | |
| | | eatItemIDList.append(curItem.GetItemTypeID())
|
| | | #GameWorld.DebugLog("eatIndexList-----------%s"%len(eatIndexList))
|
| | | eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList)
|
| | | eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList, eatItemIDList)
|
| | | NoteEatEquip(curPlayer, eatCount, giveCnt)
|
| | | CheckPackFull(curPlayer)
|
| | |
|
| | |
| | |
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | |
|
| | | maxMapID = 0
|
| | | maxMapID = 0 # 高级地图按表顺序行排
|
| | | # ---找到可以挂机的最高级地图---
|
| | | for i in xrange(ipyDataMgr.GetMapEventPointCount()):
|
| | | mapInfo = ipyDataMgr.GetMapEventPointByIndex(i)
|
| | |
| | | # ---判断地图表的任务和等级限制---
|
| | | mapData = GameWorld.GetGameData().GetChinMap().GetMapByID(mapID)
|
| | | if not mapData:
|
| | | continue |
| | | continue
|
| | | enterLV = mapData.GetLV()
|
| | |
|
| | | if curPlayer.GetLV() < enterLV:
|
| | |
| | | if missionMapStep < openMapStep:
|
| | | continue
|
| | |
|
| | | if mapID < maxMapID:
|
| | | continue
|
| | | maxMapID = mapID
|
| | |
|
| | | if not maxMapID:
|