| | |
| | | import ChEquip
|
| | | import QuestCommon
|
| | | import random
|
| | | import GameObj
|
| | |
|
| | | # 可吞噬的装备位
|
| | | Def_EatItem_EquipPlace = [
|
| | |
| | |
|
| | | # 切换守护
|
| | | 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
|
| | |
|
| | |
|
| | |
| | | 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() # 会心一击
|
| | |
| | | ## 装备一件件给
|
| | | if ItemCommon.GetIsEquip(curItemData):
|
| | | for _ in xrange(dropCount):
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, isDropBind)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, False)
|
| | | 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, False)
|
| | | if not curItem:
|
| | | continue
|
| | |
|