#!/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 TurnAttack
|
import ShareDefine
|
import IpyGameDataPY
|
import PlayerControl
|
import ChPyNetSendPack
|
import ItemControler
|
import IPY_GameWorld
|
import NetPackCommon
|
import ItemCommon
|
import PlayerTask
|
import NPCCommon
|
import BattleObj
|
import ChEquip
|
import ObjPool
|
|
import random
|
|
def OnFBPlayerOnLogin(curPlayer):
|
SyncDropBootyInfo(curPlayer)
|
return
|
|
def OnFBPlayerOnDay(curPlayer):
|
ResetBootyDropToday(curPlayer)
|
return
|
|
def ResetBootyDropToday(curPlayer):
|
bootyItemIDList = GetBootyItemIDList()
|
for itemID in bootyItemIDList:
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntBooty % itemID, 0)
|
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 OnPlayerLineupAttackResult(curPlayer, atkObj, killObjList, useSkill, mapID, funcLineID):
|
## »ØºÏÕ½¶·Ö÷¶¯·¢ÆðµÄÍæ¼ÒÕóÈݹ¥»÷½á¹û¶îÍâ´¦Àí £¬Ò»°ã´¦Àí¸±±¾Ïà¹ØµÄµôÂä¡¢½±ÀøµÈ
|
|
if mapID == ChConfig.Def_FBMapID_Main:
|
__doKillAward(curPlayer, atkObj, killObjList)
|
|
return
|
|
def __doKillAward(curPlayer, atkObj, killObjList):
|
## ¼ÆËã»÷ɱ½±Àø
|
if not killObjList:
|
GameWorld.DebugLog("ûÓл÷ɱ²»ÐèÒª´¦Àí!")
|
return
|
# ½áËã¾Ñé
|
unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp)
|
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, killObjList)
|
return
|
|
def __doMainDrop(curPlayer, killObjList):
|
# ×°±¸µôÂä
|
if __doDropEquip(curPlayer, killObjList) == -1:
|
return
|
|
playerID = curPlayer.GetPlayerID()
|
DailyBootyUpperList = []
|
chapterID = PlayerControl.GetMainLevelNowInfo(curPlayer)[0]
|
chapterIpyData = IpyGameDataPY.GetIpyGameData("MainChapter", chapterID)
|
if chapterIpyData:
|
DailyBootyUpperList = chapterIpyData.GetDailyBootyUpperList()
|
|
GameWorld.DebugLog("¿ÉµôÂäÕ½ÀûÆ·ÉÏÏÞ: chapterID=%s, %s" % (chapterID, DailyBootyUpperList), playerID)
|
|
# Õ½ÀûÆ·µôÂäĬÈϲ»¶Ñµþ£¬¹Ê×î¶àÖ»ÄܵôÂäÊ£Óà¿Õ¸ñ×Ó¸öÊýµÄÎïÆ·
|
spaceCount = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptIdentify)
|
|
# ÆäËûÕ½ÀûÆ·µôÂä
|
bootyDropNeedDict = IpyGameDataPY.GetFuncEvalCfg("MainBootyDrop", 1, {})
|
bootyDropCntDict = IpyGameDataPY.GetFuncEvalCfg("MainBootyDrop", 2, {})
|
for itemID, dropUpper in DailyBootyUpperList:
|
if spaceCount <= 0:
|
GameWorld.DebugLog("µôÂä±³°üÒÑÂú!", playerID)
|
break
|
if dropUpper <= 0:
|
continue
|
todyDropCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID)
|
if todyDropCnt >= dropUpper:
|
GameWorld.DebugLog("Õ½ÀûÆ·ÒÑ´ï½ñÈÕµôÂäÉÏÏÞ! itemID=%s,todyDropCnt=%s >= %s" % (itemID, todyDropCnt, dropUpper), playerID)
|
continue
|
if itemID not in bootyDropNeedDict or itemID not in bootyDropCntDict:
|
continue
|
dropOneNeed = bootyDropNeedDict[itemID]
|
unXiantaoCntBooty = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntBooty % itemID)
|
dropBootyCnt = unXiantaoCntBooty / dropOneNeed
|
if dropBootyCnt <= 0:
|
continue
|
|
dropCntRange = bootyDropCntDict[itemID]
|
if not isinstance(dropCntRange, (list, tuple)) or len(dropCntRange) != 2:
|
continue
|
dropMin = dropCntRange[0]
|
dropMax = dropCntRange[1]
|
|
dropCntTotal = 0
|
for _ in range(dropBootyCnt):
|
if dropMin == dropMax:
|
dropCnt = dropMin
|
else:
|
dropCnt = random.randint(dropMin, dropMax)
|
dropCntTotal += dropCnt
|
dropCntTotal = min(dropCntTotal, dropUpper - todyDropCnt)
|
if dropCntTotal <= 0:
|
continue
|
|
GameWorld.DebugLog("µôÂäÕ½ÀûÆ·! itemID=%s,unXiantaoCntBooty=%s,´ÎÊý=%s,dropCntTotal=%s,spaceCount=%s"
|
% (itemID, unXiantaoCntBooty, dropBootyCnt, dropCntTotal, spaceCount), playerID)
|
curItem = ItemControler.GetOutPutItemObj(itemID, dropCntTotal, False, curPlayer=curPlayer)
|
if curItem == None:
|
continue
|
curItem.SetIsBind(1) # Ϊ1ʱ´ú±íÊǵôÂä
|
if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
|
continue
|
unXiantaoCntBooty = unXiantaoCntBooty % dropOneNeed
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntBooty % itemID, unXiantaoCntBooty)
|
SetBootyDropToday(curPlayer, itemID, todyDropCnt + dropCntTotal)
|
spaceCount -= 1
|
|
return
|
|
def __doDropEquip(curPlayer, killObjList):
|
## Ö÷ÏßµôÂä×°±¸
|
playerID = curPlayer.GetPlayerID()
|
unXiantaoCntEquip = PlayerControl.GetUnXiantaoCntEquip(curPlayer)
|
bossTypeDropInfo = IpyGameDataPY.GetFuncCfg("MainEquipDrop", 1) # ÿÏûºÄX¸öÕ½´¸µôÂäÒ»¼þ×°±¸
|
fightPoint = max(curPlayer.GetFightPoint(), 1) # ÏûºÄ±¶ÂÊÒ²ÊǵôÂä±¶ÂÊ
|
dropEquipCnt = 0
|
objDropCntDict = {}
|
for tagObj in killObjList:
|
tagID = tagObj.GetID()
|
npcID = tagObj.GetNPCID()
|
if not npcID:
|
continue
|
npcData = NPCCommon.GetNPCDataPy(npcID)
|
if not npcData:
|
continue
|
bossType = npcData.GetBossType()
|
if bossType not in bossTypeDropInfo:
|
continue
|
dropCnt = GameWorld.GetResultByRandomList(bossTypeDropInfo[bossType])
|
if not dropCnt:
|
continue
|
dropCnt *= fightPoint # ¶à±¶µôÂä
|
objDropCntDict[tagID] = [tagObj, dropCnt, bossType]
|
dropEquipCnt += dropCnt
|
|
if dropEquipCnt <= 0:
|
GameWorld.DebugLog("Ö÷ÏßÔݲ»ÄܵôÂä! unXiantaoCntEquip=%s,dropEquipCnt=%s" % (unXiantaoCntEquip, dropEquipCnt), playerID)
|
return
|
# ¸ù¾ÝµôÂä±³°ü¿Õ¼äÐÞÕý×îÖտɵôÂä×°±¸Êý
|
dropEquipCnt = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptIdentify, dropEquipCnt)
|
if not dropEquipCnt:
|
GameWorld.DebugLog("µôÂä±³°üÒÑÂú!", playerID)
|
return -1
|
|
treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
|
ipyData = IpyGameDataPY.GetIpyGameData("TreeLV", treeLV)
|
if not ipyData:
|
return
|
GameWorld.DebugLog("Ö÷ÏßµôÂä×°±¸: unXiantaoCntEquip=%s,dropEquipCnt=%s,treeLV=%s,objDropCntDict=%s"
|
% (unXiantaoCntEquip, dropEquipCnt, treeLV, objDropCntDict), playerID)
|
|
for tagID, dropInfo in objDropCntDict.items():
|
tagObj, dropCnt, bossType = dropInfo
|
if hasattr(ipyData, "GetEquipColorRateList%s" % bossType):
|
equipColorRateList = getattr(ipyData, "GetEquipColorRateList%s" % bossType)()
|
else:
|
equipColorRateList = ipyData.GetEquipColorRateList()
|
|
GameWorld.DebugLog("tagID=%s,bossType=%s,dropCnt=%s,treeLV=%s,equipColorRateList=%s"
|
% (tagID, bossType, dropCnt, treeLV, equipColorRateList), playerID)
|
if not equipColorRateList:
|
continue
|
|
totalRate = 0
|
colorRateList = []
|
for equipColor, colorRate in enumerate(equipColorRateList, 1):
|
if not colorRate:
|
continue
|
totalRate += colorRate
|
colorRateList.append([totalRate, equipColor])
|
|
#maxRate = 10000
|
#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(dropCnt):
|
if dropEquipCnt <= 0:
|
break
|
itemColor = GameWorld.GetResultByRandomList(colorRateList)
|
if not itemColor:
|
continue
|
equipIDList = NPCCommon.__GetEquipIDList(0, color=itemColor, placeList=ChConfig.Def_MainEquipPlaces, 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
|
|
dropEquipCnt -= 1
|
|
return
|
|
def GMTestKill(curPlayer, useXiantao):
|
## GM²âÊÔ»÷ɱ
|
|
mainFightMgr = TurnAttack.GetMainFightMgr(curPlayer)
|
turnFight = mainFightMgr.turnFight
|
if not turnFight.isInFight():
|
GameWorld.DebugAnswer(curPlayer, "·ÇÖ÷ÏßÕ½¶·ÖÐ!")
|
return
|
|
useSkill = None
|
batObjMgr = BattleObj.GetBatObjMgr()
|
|
# Ëæ±ãȡһ¸öÎ佫»÷ɱ¶Ô·½ËùÓйÖÎï¼´¿É
|
atkObj = None
|
batFactionA = turnFight.getBatFaction(ChConfig.Def_FactionA)
|
batLineup = batFactionA.getBatlineup(1)
|
for objID in batLineup.posObjIDDict.values():
|
atkObj = batObjMgr.getBatObj(objID)
|
if atkObj.IsAlive():
|
break
|
|
if not atkObj:
|
GameWorld.DebugAnswer(curPlayer, "Ö÷ÕóÈÝûÓдæ»îÎ佫!")
|
return
|
|
clientPack = ChPyNetSendPack.tagSCTurnFightReportSign()
|
clientPack.Sign = 0
|
NetPackCommon.SendFakePack(curPlayer, clientPack) # ±ê¼Ç¿ªÊ¼
|
|
killObjList = []
|
batFactionB = turnFight.getBatFaction(ChConfig.Def_FactionB)
|
batLineup = batFactionB.getBatlineup(1)
|
for objID in batLineup.posObjIDDict.values():
|
tagObj = batObjMgr.getBatObj(objID)
|
if tagObj.IsAlive():
|
killObjList.append(tagObj)
|
TurnAttack.SetObjKilled(turnFight, tagObj, atkObj, useSkill)
|
|
unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp) + useXiantao
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntExp, unXiantaoCntExp)
|
GameWorld.DebugAnswer(curPlayer, "δ½áËã¾ÑéÕ½´¸Êý: %s" % unXiantaoCntExp)
|
GameWorld.DebugAnswer(curPlayer, "δ½áËã×°±¸Õ½´¸Êý: %s" % PlayerControl.AddUnXiantaoCntEquip(curPlayer, useXiantao))
|
chapterID = PlayerControl.GetMainLevelNowInfo(curPlayer)[0]
|
chapterIpyData = IpyGameDataPY.GetIpyGameData("MainChapter", chapterID)
|
if chapterIpyData:
|
DailyBootyUpperList = chapterIpyData.GetDailyBootyUpperList()
|
for itemID, upperCnt in DailyBootyUpperList:
|
if upperCnt <= 0:
|
continue
|
unXiantaoCntBooty = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntBooty % itemID) + useXiantao
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntBooty % itemID, unXiantaoCntBooty)
|
GameWorld.DebugAnswer(curPlayer, "δ½áËãÕ½ÀûÆ·(%s)Õ½´¸Êý: %s" % (itemID, unXiantaoCntBooty))
|
|
OnPlayerLineupAttackResult(curPlayer, atkObj, killObjList, useSkill, turnFight.mapID, turnFight.funcLineID)
|
turnFight.checkOverByKilled()
|
|
# ±ê¼Ç½áÊø
|
clientPack.Sign = 1
|
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
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)
|
|
ItemCommon.SyncMakeItemAnswer(curPlayer, ShareDefine.Def_mitMainDropItemOP, ChConfig.Def_ComposeState_Sucess, opType)
|
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Ð޸IJ»Í¨Öª
|
if not ItemCommon.DoLogicSwitchItem(curPlayer, curEquip, destEquip, IPY_GameWorld.rptEquip):
|
continue
|
|
if isAutoDecompose and canDecomp:
|
decomposeIndexList.append(itemIndex)
|
|
if decomposeIndexList:
|
__doDecomposeMainEquip(curPlayer, decomposeIndexList)
|
|
# Ë¢ÊôÐÔ
|
ChEquip.RefreshRoleEquipAttr(curPlayer)
|
|
PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_EquipColor)
|
return
|
|
def __doDecomposeMainEquip(curPlayer, itemIndexList):
|
playerID = curPlayer.GetPlayerID()
|
GameWorld.DebugLog("·Ö½âÖ÷Ïß×°±¸: itemIndexList=%s" % (itemIndexList), playerID)
|
moneyType, moneyBase = IpyGameDataPY.GetFuncEvalCfg("MainEquipDrop", 2)
|
if not moneyType or not moneyBase:
|
return
|
|
equipDict = {}
|
IdentifyPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
|
for index in range(IdentifyPack.GetCount()):
|
curEquip = IdentifyPack.GetAt(index)
|
if not ItemCommon.CheckItemCanUse(curEquip):
|
#GameWorld.DebugLog("ÎïÆ·Îª¿Õ»ò²»¿ÉÓÃ: index=%s" % index, playerID)
|
continue
|
if not ItemCommon.GetIsMainEquip(curEquip):
|
#GameWorld.DebugLog("·ÇÖ÷Ïß×°±¸: index=%s" % index, playerID)
|
continue
|
equipDict[index] = curEquip
|
|
if not equipDict:
|
return
|
|
equipCnt = len(equipDict)
|
unXiantaoCntEquip = PlayerControl.GetUnXiantaoCntEquip(curPlayer)
|
perEquipXiantao = unXiantaoCntEquip / float(equipCnt) if equipCnt > 1 else unXiantaoCntEquip
|
decomposeMoney = max(1, moneyBase * perEquipXiantao) # ÖÁÉÙ1¸ö
|
GameWorld.DebugLog("unXiantaoCntEquip=%s,equipCnt=%s,perEquipXiantao=%s,equipIndexList=%s"
|
% (unXiantaoCntEquip, equipCnt, perEquipXiantao, equipDict.keys()), playerID)
|
GameWorld.DebugLog("moneyBase=%s,decomposeMoney=%s" % (moneyBase, decomposeMoney), playerID)
|
|
moneyTotal = 0
|
|
decomposeCnt = 0
|
decomposeIndexList = []
|
for itemIndex in itemIndexList:
|
if itemIndex not in equipDict:
|
continue
|
curEquip = equipDict[itemIndex]
|
|
moneyTotal += decomposeMoney
|
GameWorld.DebugLog(" itemIndex=%s,moneyBase=%s,perEquipXiantao=%s,decomposeMoney=%s,×Ü:%s"
|
% (itemIndex, moneyBase, perEquipXiantao, decomposeMoney, moneyTotal), playerID)
|
|
ItemCommon.DelItem(curPlayer, curEquip, curEquip.GetCount(), True, ChConfig.ItemDel_EquipDecompose)
|
decomposeIndexList.append(itemIndex)
|
decomposeCnt += 1
|
unXiantaoCntEquip -= perEquipXiantao
|
|
if not moneyTotal:
|
return
|
|
moneyTotal = int(round(moneyTotal)) # ËÄÉáÎåÈëÈ¡Õû
|
unXiantaoCntEquip = PlayerControl.SetUnXiantaoCntEquip(curPlayer, unXiantaoCntEquip)
|
GameWorld.DebugLog("moneyTotal=%s,unXiantaoCntEquip=%s" % (moneyTotal, unXiantaoCntEquip), playerID)
|
|
PlayerControl.GiveMoney(curPlayer, moneyType, moneyTotal, "DecomposeMainEquip", isSysHint=False)
|
PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_EquipDecompose, decomposeCnt)
|
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]
|
poolMgr = ObjPool.GetPoolMgr()
|
clientPack = poolMgr.acquire(ChPyNetSendPack.tagSCDropBootyInfo)
|
clientPack.DropBootyList = []
|
for itemID in syncItemIDList:
|
dropBooty = poolMgr.acquire(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
|
|
def OnTurnFightOver(curPlayer, turnFight, mapID, funcLineID, overMsg):
|
## »ØºÏÕ½¶·½áÊø
|
|
if not curPlayer:
|
return
|
|
#winFaction = turnFight.winFaction
|
isWin = turnFight.isWin
|
|
playerID = curPlayer.GetPlayerID()
|
mainFightMgr = TurnAttack.GetMainFightMgr(curPlayer)
|
chapterID, levelNum, wave = PlayerControl.GetMainLevelNowInfo(curPlayer)
|
|
if not isWin:
|
nextWave = max(1, wave - 1)
|
nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, nextWave)
|
GameWorld.DebugLog("Ö÷ÏßС¹ÖÕ½¶·Ê§°Ü£¬½µÒ»²¨! chapterID=%s,levelNum=%s,wave=%s,nextWave=%s,nowValue=%s"
|
% (chapterID, levelNum, wave, nextWave, nowValue), playerID)
|
return
|
|
if turnFight.haveNextLineup():
|
GameWorld.DebugLog("Ö÷ÏßС¹ÖÕ½¶·Ê¤Àû£¬ÓÐÏÂһС¶Ó! chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID)
|
return
|
|
# »ñʤ¹ý²¨
|
if wave < mainFightMgr.waveMax:
|
nextWave = min(mainFightMgr.waveMax, wave + 1)
|
nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, nextWave)
|
GameWorld.DebugLog("Ö÷ÏßС¹Ö²¨Õ½¶·Ê¤Àû£¬ÏÂÒ»²¨! chapterID=%s,levelNum=%s,wave=%s,nextWave=%s,nowValue=%s"
|
% (chapterID, levelNum, wave, nextWave, nowValue), playerID)
|
else:
|
GameWorld.DebugLog("Ö÷ÏßС¹Ö²¨Õ½¶·Ê¤Àû£¬×îºóÒ»²¨Ñ»·Ë¢! chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID)
|
|
# С¹Ö¿ÉÄÜ»áÍ˲¨£¬ËùÒÔÖ»ÔÚÓг¬¹ýÒѹý¹Ø¿¨½ø¶Èʱ²Å¸üÐÂÖµ
|
hisPassValue = PlayerControl.GetMainLevelPassValue(curPlayer)
|
curPassValue = PlayerControl.ComMainLevelValue(chapterID, levelNum, wave)
|
if curPassValue > hisPassValue:
|
GameWorld.DebugLog("¸üе±Ç°¹ý¹Ø½ø¶È! curPassValue=%s,hisPassValue=%s" % (curPassValue, hisPassValue), playerID)
|
PlayerControl.SetMainLevelPassValue(curPlayer, curPassValue)
|
else:
|
GameWorld.DebugLog("䳬¹ýµ±Ç°¹ý¹Ø½ø¶È£¬²»¸üÐÂ! curPassValue=%s <= hisPassValue=%s" % (curPassValue, hisPassValue), playerID)
|
|
return
|
|