| | |
| | |
|
| | | if ItemCommon.GetIsEquip(itemData):
|
| | | for _ in xrange(itemCount):
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | if curItem:
|
| | | needSpace += 1
|
| | | prizeItemList.append(curItem)
|
| | |
| | | #GameWorld.DebugLog(" totalExp=%s,totalMoney=%s,needSpace=%s,jsonItemList=%s" % (totalExp, totalMoney, needSpace, jsonItemList))
|
| | | return jsonItemList, totalExp, totalMoney
|
| | |
|
| | | def DoVirtualItemDrop(curPlayer, dropItemList, dropPosX, dropPosY):
|
| | | ##前端假掉落表现
|
| | | gameMap = GameWorld.GetMap()
|
| | | 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(dropItemList) - 1:
|
| | | break
|
| | | itemInfo = dropItemList[index]
|
| | | index += 1
|
| | | itemID, itemCount, isAuctionItem = itemInfo
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem)
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | SendVirtualItemDrop(curPlayer, itemID, resultX, resultY, dropItemDataStr)
|
| | | curItem.Clear()
|
| | | return
|
| | |
|
| | | def DoMapDropPrizeItem(curPlayer, prizeItemList, npcID, dropPosX, dropPosY, isDropDisperse=True, isOnlySelfSee=True):
|
| | | ## 奖励物品真实掉落地图,先拆开分散再掉落
|
| | |
|
| | |
| | | index += 1
|
| | | if isinstance(curItem, list):
|
| | | itemID, itemCount, isAuctionItem = curItem
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | |
|
| | | if not curItem:
|
| | | continue
|
| | |
| | | def DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID, dropPosX=0, dropPosY=0, isDropDisperse=True, mailTypeKey="ItemNoPickUp"):
|
| | | ## 给物品并且做假掉落表现,直接先堆叠给物品,再拆开做虚假掉落表现
|
| | |
|
| | | mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | | #lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
|
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if not mapID:
|
| | | mapID = GameWorld.GetGameWorld().GetMapID()
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mailItemList = []
|
| | | giveItemObjList = []
|
| | | virtualItemDropList = []
|
| | | itemControl = ItemControler.PlayerItemControler(curPlayer)
|
| | | for itemInfo in giveItemList:
|
| | |
| | | itemID = curItem.GetItemTypeID()
|
| | | itemCount = curItem.GetCount()
|
| | | isAuctionItem = ItemControler.GetIsAuctionItem(curItem)
|
| | | jsonItem = ItemCommon.GetJsonItem(curItem)
|
| | | dropItemDataStr = ChItem.GetMapDropItemDataStr(curItem)
|
| | | equipInfo = [curItem.GetEquipPlace(), ItemCommon.GetItemClassLV(curItem), curItem.GetItemColor(), |
| | | curItem.GetItemQuality(), curItem.GetUserData()]
|
| | | packIndex = ChConfig.GetItemPackType(curItem.GetType())
|
| | | if not itemControl.PutInItem(packIndex, curItem, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
|
| | | mailItemList.append(jsonItem)
|
| | | |
| | | if npcID:
|
| | | serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
|
| | | SendGameServerGoodItemRecord(mapID, npcID, curPlayer.GetName(), playerID, itemID, equipInfo, serverGroupID)
|
| | | giveItemObjList.append(curItem)
|
| | |
|
| | | # 散开掉落
|
| | | if isDropDisperse:
|
| | |
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | else:
|
| | | virtualItemDropList.append([itemID, dropItemDataStr])
|
| | | |
| | | if mailItemList:
|
| | | PlayerControl.SendMailByKey(mailTypeKey, [playerID], mailItemList, [mapID])
|
| | |
|
| | | # 先通知掉落,再给物品,因为前端表现弹框需要这个顺序需求
|
| | | gameMap = GameWorld.GetMap()
|
| | | index = 0
|
| | | for posX, posY in ChConfig.Def_DropItemAreaMatrix:
|
| | |
| | | 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.GetItemQuality(), itemObj.GetUserData()]
|
| | | packIndex = ChConfig.GetItemPackType(itemObj.GetType())
|
| | | if not itemControl.PutInItem(packIndex, itemObj, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":npcID}]):
|
| | | mailItemList.append(mailItem)
|
| | | |
| | | if npcID:
|
| | | serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
|
| | | SendGameServerGoodItemRecord(mapID, lineID, npcID, curPlayer.GetName(), playerID, itemID, equipInfo, serverGroupID)
|
| | | |
| | | # 放不下的发邮件 |
| | | if mailItemList:
|
| | | PlayerControl.SendMailByKey(mailTypeKey, [playerID], mailItemList, [mapID])
|
| | | return
|
| | |
|
| | | ################################### NPC掉落 ###################################
|
| | |
| | | # tagHead Head;
|
| | | # DWORD NPCID;
|
| | | # BYTE Count; //默认1个,最多5个
|
| | | # DWORD HP; //默认0取最大值,其中一个血量数值大于0则用指定血量
|
| | | # DWORD HPEx; //默认0取最大值,其中一个血量数值大于0则用指定血量
|
| | | #};
|
| | | def OnSummonPriWoodPile(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | npcID = clientData.NPCID
|
| | | count = clientData.Count
|
| | | SummonPriWoodPile(curPlayer, npcID, count)
|
| | | hp = clientData.HP
|
| | | hpEx = clientData.HPEx
|
| | | SummonPriWoodPile(curPlayer, npcID, count, hp, hpEx)
|
| | | return
|
| | |
|
| | | def SummonPriWoodPile(curPlayer, npcID, count):
|
| | | def SummonPriWoodPile(curPlayer, npcID, count, hp=0, hpEx=0):
|
| | | ''' 召唤私有专属木桩怪
|
| | | '''
|
| | |
|
| | |
| | | GameWorld.DebugLog("玩家当前不是在自定义场景中,不允许招木桩!")
|
| | | return
|
| | |
|
| | | mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | | lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
|
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | if mapID:
|
| | | if not FBLogic.OnCanSummonPriWoodPile(curPlayer, mapID, lineID, npcID, count):
|
| | | GameWorld.ErrLog("无法召唤木桩怪!mapID=%s,lineID=%s,npcID=%s,count=%s" % (mapID, lineID, npcID, count))
|
| | | return
|
| | | |
| | | if count != 1:
|
| | | hp, hpEx = 0, 0 # 指定血量的暂仅适用于单只的
|
| | |
|
| | | maxCount = 10
|
| | | nowCount = 0
|
| | |
| | | nowCount += 1
|
| | |
|
| | | summonCount = min(count, maxCount - nowCount)
|
| | | #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s" |
| | | # % (count, maxCount, nowCount, summonCount))
|
| | | #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s,hp=%s,hpEx=%s" |
| | | # % (count, maxCount, nowCount, summonCount, hp, hpEx))
|
| | | if summonCount <= 0:
|
| | | return
|
| | |
|
| | |
| | | #玩家周围随机出生点
|
| | | #技能召唤坐标 ChConfig.Def_SummonAppearDist
|
| | | summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), 3)
|
| | | summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY())
|
| | | |
| | | if not curPlayer.GetSight():
|
| | | summonNPCAppear = ChNetSendPack.tagPlayerSummonNPCAppear()
|
| | | summonNPCAppear.Clear()
|
| | | summonNPCAppear.PlayerID = curPlayer.GetPlayerID()
|
| | | summonNPCAppear.ObjID = summonNPC.GetID()
|
| | | summonNPCAppear.NPCID = summonNPC.GetNPCID()
|
| | | summonNPCAppear.PosX = summonNPC.GetPosX()
|
| | | summonNPCAppear.PosY = summonNPC.GetPosY()
|
| | | summonNPCAppear.HP = summonNPC.GetHP()
|
| | | summonNPCAppear.HPEx = summonNPC.GetHPEx()
|
| | | summonNPCAppear.MaxHP = summonNPC.GetMaxHP()
|
| | | summonNPCAppear.MaxHPEx = summonNPC.GetMaxHPEx()
|
| | | summonNPCAppear.Speed = summonNPC.GetSpeed()
|
| | | summonNPCAppear.LV = GetNPCLV(summonNPC)
|
| | | summonNPCAppear.OwnerName = curPlayer.GetPlayerName()
|
| | | summonNPCAppear.OwnerNameLen = len(summonNPCAppear.OwnerName)
|
| | | NetPackCommon.SendFakePack(curPlayer, summonNPCAppear)
|
| | | summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY(), False)
|
| | | if hp or hpEx:
|
| | | summonNPC.SetHP(hp)
|
| | | summonNPC.SetHPEx(hpEx)
|
| | |
|
| | | #if not curPlayer.GetSight():
|
| | | summonNPCAppear = ChNetSendPack.tagPlayerSummonNPCAppear()
|
| | | summonNPCAppear.Clear()
|
| | | summonNPCAppear.PlayerID = curPlayer.GetPlayerID()
|
| | | summonNPCAppear.ObjID = summonNPC.GetID()
|
| | | summonNPCAppear.NPCID = summonNPC.GetNPCID()
|
| | | summonNPCAppear.PosX = summonNPC.GetPosX()
|
| | | summonNPCAppear.PosY = summonNPC.GetPosY()
|
| | | summonNPCAppear.HP = summonNPC.GetHP()
|
| | | summonNPCAppear.HPEx = summonNPC.GetHPEx()
|
| | | summonNPCAppear.MaxHP = summonNPC.GetMaxHP()
|
| | | summonNPCAppear.MaxHPEx = summonNPC.GetMaxHPEx()
|
| | | summonNPCAppear.Speed = summonNPC.GetSpeed()
|
| | | summonNPCAppear.LV = GetNPCLV(summonNPC)
|
| | | summonNPCAppear.OwnerName = curPlayer.GetPlayerName()
|
| | | summonNPCAppear.OwnerNameLen = len(summonNPCAppear.OwnerName)
|
| | | NetPackCommon.SendFakePack(curPlayer, summonNPCAppear)
|
| | | |
| | | return
|
| | |
|
| | | def ClearPriWoodPile(curPlayer):
|
| | |
| | | if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | GameWorld.DebugLog("非自定义场景中,无法获取定义采集奖励!")
|
| | | return
|
| | | mapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | | lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
|
| | | mapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | lineID = PlayerControl.GetCustomLineID(curPlayer)
|
| | | GameWorld.DebugLog("前端场景采集: mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID))
|
| | |
|
| | | if mapID:
|
| | | #if FBCommon.GetCustomSceneState(curPlayer, mapID, lineID) != ChConfig.CustomSceneState_Fight:
|
| | | #if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
|
| | | # return
|
| | | FBLogic.OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID)
|
| | |
|
| | |
| | |
|
| | | if not awardItemList:
|
| | | alchemyDiffLV = collectNPCIpyData.GetAlchemyDiffLV()
|
| | | giveItemWeightList = []
|
| | | if alchemyDiffLV:
|
| | | curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | for itemInfo in collectAwardCfg:
|
| | | itemID = itemInfo[1][0]
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | if ItemCommon.GetItemClassLV(itemData) > curAlchemyLV + alchemyDiffLV:
|
| | | continue
|
| | | giveItemWeightList.append(itemInfo)
|
| | | else:
|
| | | giveItemWeightList = collectAwardCfg
|
| | | |
| | | giveItemWeightList = ItemCommon.GetWeightItemListByAlchemyDiffLV(curPlayer, collectAwardCfg, alchemyDiffLV)
|
| | | GameWorld.DebugLog(" 常规采集物品权重列表: alchemyDiffLV=%s,collectAwardCfg=%s,giveItemWeightList=%s" % (alchemyDiffLV, collectAwardCfg, giveItemWeightList))
|
| | | giveItemInfo = GameWorld.GetResultByWeightList(giveItemWeightList)
|
| | | if giveItemInfo:
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, npcInfoPack)
|
| | | return
|
| | |
|
| | | def SendGameServerGoodItemRecord(mapID, npcID, playerName, playerID, itemID, equipInfo=[], serverGroupID=0):
|
| | | def SendGameServerGoodItemRecord(mapID, lineID, npcID, playerName, playerID, itemID, equipInfo=[], serverGroupID=0):
|
| | | # @param equipInfo: [equipPlace, itemClassLV, itemColor, itemQuality, itemUserData]
|
| | | # GameWorld.DebugLog("检查物品是否发送GameServer: mapID=%s, npcID=%s, playerName=%s, itemID=%s"
|
| | | # % (mapID, npcID, playerName, itemID))
|
| | |
| | | if not needRecord:
|
| | | return
|
| | |
|
| | | dropEquipMsg = str([playerID, playerName, mapID, npcID, itemID, itemUserData, weightValue, serverGroupID])
|
| | | dropEquipMsg = str([playerID, playerName, mapID, lineID, npcID, itemID, itemUserData, weightValue, serverGroupID])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'BossDropGoodItem', dropEquipMsg, len(dropEquipMsg))
|
| | | GameWorld.DebugLog("发送GameServer记录拾取掉落好物品: %s" % dropEquipMsg, playerID)
|
| | | return
|
| | |
| | | if not dropItemList:
|
| | | return
|
| | |
|
| | | mapID = attackPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | | mapID = PlayerControl.GetCustomMapID(attackPlayer)
|
| | | if mapID:
|
| | | DoGiveItemByVirtualDrop(attackPlayer, dropItemList, npcID)
|
| | | GameLogic_CrossGrassland.RecordGrasslandAward(attackPlayer, dropItemList)
|