#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package UseItem.Item_ResetBossKillCnt
|
#
|
# @todo:ÖØÖÃboss»÷ɱƣÀÍ
|
# @author hxp
|
# @date 2018-03-09
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÖØÖÃboss»÷ɱƣÀÍ
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2018-03-09 12:00"""
|
#-------------------------------------------------------------------------------
|
|
import ItemCommon
|
import BossHurtMng
|
import IpyGameDataPY
|
import PlayerControl
|
import CrossRealmPlayer
|
import ShareDefine
|
import GameWorld
|
import ChConfig
|
|
import math
|
|
def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
|
##ÅúÁ¿Ê¹ÓÃÎïÆ·
|
itemTypeID = curRoleItem.GetItemTypeID()
|
curEff = curRoleItem.GetEffectByIndex(0)
|
index = curEff.GetEffectValue(0)
|
reduceCnt = curEff.GetEffectValue(1)
|
killBossCntLimitDict = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit')
|
if index not in killBossCntLimitDict.values():
|
GameWorld.ErrLog("²»´æÔÚ¸Ãboss»÷ɱƣÀÍÀàÐÍ£¬ÎÞ·¨ÖØÖã¡ÀàÐÍ=%s" % index)
|
return
|
curKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt % index)
|
if not curKillCnt:
|
PlayerControl.NotifyCode(curPlayer, 'WorldBossCountItem1', [index])
|
#GameWorld.Log("µ±ÈÕδ»÷ɱboss£¬ÎÞÐèʹÓã¡")
|
return
|
realUseCnt = min(int(math.ceil(float(curKillCnt)/reduceCnt)), useCnt)
|
newCnt = max(0, curKillCnt-realUseCnt*reduceCnt)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCnt % index, newCnt)
|
#PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Boss_KillCntBuyCnt % index, 0)
|
BossHurtMng.NotifyAttackBossCnt(curPlayer, index)
|
|
PlayerControl.NotifyCode(curPlayer, 'WorldBossCountItem', [itemTypeID, curKillCnt-newCnt, index])
|
ItemCommon.DelItem(curPlayer, curRoleItem, realUseCnt, True, ChConfig.ItemDel_ResetBossKillCnt)
|
|
if index == ShareDefine.Def_Boss_Func_Dogz:
|
setCrossDict = {ChConfig.Def_PDict_Boss_KillCnt % index:0}
|
CrossRealmPlayer.SetCrossPlayerNomalDict(curPlayer, setCrossDict, isDelay=False)
|
return True, realUseCnt
|
|