|  |  |  | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def __DoPickup(curPlayer, mapItemID, tick, isGuard): | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  | mapItemManager = GameWorld.GetMapItemManager() | 
|---|
|  |  |  | mapItem = mapItemManager.GetItemByID(mapItemID) | 
|---|
|  |  |  | if mapItem == None or mapItem.IsEmpty(): | 
|---|
|  |  |  | GameWorld.Log("当前物品不存在或已经被回收,玩家拾取失败,mapItemID=%s" % mapItemID, playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | dropItemNPCID = GetMapItemUserDataValue(mapItem, ShareDefine.Def_MapItemInfo_NPCID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #镖车中,无法拾取 | 
|---|
|  |  |  | if not isGuard and curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvTruck: | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "Old_hgg_21675") | 
|---|
|  |  |  | #GameWorld.Log("使用交通工具时,无法拾取物品") | 
|---|
|  |  |  | GameWorld.Log("使用交通工具时,无法拾取物品!mapItemID=%s,dropItemNPCID=%s" % (mapItemID, dropItemNPCID), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curPlayer.GetHP() == 0: | 
|---|
|  |  |  | #玩家已经死亡 | 
|---|
|  |  |  | #GameWorld.Log("当前玩家已经死亡") | 
|---|
|  |  |  | GameWorld.Log("玩家已死亡,无法拾取物品!mapItemID=%s,dropItemNPCID=%s" % (mapItemID, dropItemNPCID), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | mapItemManager = GameWorld.GetMapItemManager() | 
|---|
|  |  |  | mapItem = mapItemManager.GetItemByID(mapItemID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if mapItem == None or mapItem.IsEmpty(): | 
|---|
|  |  |  | GameWorld.Log("当前物品已经被回收,玩家拾取失败,mapItemID=%s" % mapItemID, curPlayer.GetPlayerID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | pickDist = GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), | 
|---|
|  |  |  | mapItem.GetPosX(), mapItem.GetPosY()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | posX, posY, itemPosX, itemPosY = curPlayer.GetPosX(), curPlayer.GetPosY(), mapItem.GetPosX(), mapItem.GetPosY() | 
|---|
|  |  |  | pickDist = GameWorld.GetDist(posX, posY, itemPosX, itemPosY) | 
|---|
|  |  |  | # 守护拾取不验证拾取范围 | 
|---|
|  |  |  | if not isGuard and pickDist > curPlayer.GetPickupDist(): | 
|---|
|  |  |  | #距离过远, 不能捡起 | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_805889") | 
|---|
|  |  |  | #        GameWorld.Log("当前距离过远, 玩家(%d,%d)-物品(%d,%d)"%(curPlayer.GetPosX(), curPlayer.GetPosY(), | 
|---|
|  |  |  | #                                                                                 mapItem.GetPosX(), mapItem.GetPosY())) | 
|---|
|  |  |  | GameWorld.Log("当前距离过远, mapItemID=%s,dropItemNPCID=%s,玩家(%d,%d)-物品(%d,%d),pickDist=%s > playerPickupDist=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, posX, posY, itemPosX, itemPosY, pickDist, curPlayer.GetPickupDist()), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #拾取判断 | 
|---|
|  |  |  | if not __CheckPickUpItemTime(curPlayer , mapItem , tick): | 
|---|
|  |  |  | if not __CheckPickUpItemTime(curPlayer, mapItem, tick, mapItemID, dropItemNPCID): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_913598") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | singItem.Clear() | 
|---|
|  |  |  | #=============================================================================================== | 
|---|
|  |  |  | # # (跨服掉落功勋物品, 不给实际物品,转化为功勋值) | 
|---|
|  |  |  | # elif curEffID == ChConfig.Def_Effect_ItemGiveGongXun and GameWorld.IsMergeServer(): | 
|---|
|  |  |  | # elif curEffID == ChConfig.Def_Effect_ItemGiveGongXun and GameWorld.IsCrossServer(): | 
|---|
|  |  |  | #    #======================================================================= | 
|---|
|  |  |  | #    # # 不需要队伍提示 | 
|---|
|  |  |  | #    # if not isTeamNotify: | 
|---|
|  |  |  | 
|---|
|  |  |  | #    # 队伍拾取装备时,先保存物品的xml属性,用于提示的xml显示 | 
|---|
|  |  |  | #    itemMsgList = ItemCommon.GetItemXMLMsg(singItem) | 
|---|
|  |  |  | #======================================================================= | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curItemCount = singItem.GetCount() | 
|---|
|  |  |  | curItemID = singItem.GetItemTypeID() | 
|---|
|  |  |  | curItemIsBind = singItem.GetIsBind() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isPutInTemp = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PickupItemPutInTemp) | 
|---|
|  |  |  | packIndex = ShareDefine.rptTempItem if isPutInTemp else IPY_GameWorld.rptItem | 
|---|
|  |  |  | packIndex = ChConfig.GetItemPackType(singItem.GetType(), packIndex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 是否可放入 | 
|---|
|  |  |  | if not itemControl.CanPutInItem(packIndex, curItemID, curItemCount, curItemIsBind): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packIndex]) | 
|---|
|  |  |  | GameWorld.Log("拾取物品无法放入背包!mapItemID=%s,dropItemNPCID=%s,curItemID=%s,packIndex=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, curItemID, packIndex), curPlayer.GetPlayerID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 副本拾取物品 | 
|---|
|  |  |  | FBLogic.OnFBPickUpItem(curPlayer, singItem, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dropItemNPCID = GetMapItemUserDataValue(mapItem, ShareDefine.Def_MapItemInfo_NPCID) | 
|---|
|  |  |  | equipInfo = [singItem.GetEquipPlace(), ItemCommon.GetItemClassLV(singItem), singItem.GetItemColor(), | 
|---|
|  |  |  | singItem.GetItemQuality(), singItem.GetUserData()] | 
|---|
|  |  |  | if not itemControl.PutInItem(packIndex, singItem, event=[ChConfig.ItemGive_Pickup, False, {"NPCID":dropItemNPCID}]): | 
|---|
|  |  |  | #物品不能放入 | 
|---|
|  |  |  | #PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packIndex]) | 
|---|
|  |  |  | GameWorld.ErrLog("拾取物品放入背包失败!mapItemID=%s,dropItemNPCID=%s,curItemID=%s,packIndex=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, curItemID, packIndex), curPlayer.GetPlayerID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if dropItemNPCID: | 
|---|
|  |  |  | 
|---|
|  |  |  | mapID = curPlayer.GetMapID() | 
|---|
|  |  |  | fbIpyData = FBCommon.GetFBIpyData(mapID) | 
|---|
|  |  |  | if fbIpyData and not fbIpyData.GetGuardPick(): | 
|---|
|  |  |  | GameWorld.DebugLog("该地图守护无法拾取物品! mapID=%s" % mapID, curPlayer.GetPlayerID()) | 
|---|
|  |  |  | GameWorld.Log("该地图守护无法拾取物品! mapID=%s" % mapID, curPlayer.GetPlayerID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #    #单人副本一键拾取 | 
|---|
|  |  |  | 
|---|
|  |  |  | #        SingleFBTPickUP(curPlayer, mapItemID, tick) | 
|---|
|  |  |  | #        return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not mapItemIDList: | 
|---|
|  |  |  | GameWorld.ErrLog("没有指定要拾取的地图物品ID!", curPlayer.GetPlayerID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | succMapItemIDList = [] # 成功拾取的地图物品 | 
|---|
|  |  |  | for mapItemID in mapItemIDList: | 
|---|
|  |  |  | if __DoPickup(curPlayer, mapItemID, tick, isGuard): | 
|---|
|  |  |  | succMapItemIDList.append(mapItemID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("请求拾取物品, isGuard=%s, MapItemID=%s, SuccMapItemID=%s" | 
|---|
|  |  |  | % (isGuard, mapItemIDList, succMapItemIDList), curPlayer.GetPlayerID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if succMapItemIDList: | 
|---|
|  |  |  | GameWorld.Log("成功拾取地图物品, succMapItemIDList=%s" % (succMapItemIDList), curPlayer.GetPlayerID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 守护拾取的,附加同步守护拾取结果 | 
|---|
|  |  |  | if isGuard and succMapItemIDList: | 
|---|
|  |  |  | guradPickupSucc = ChPyNetSendPack.tagMCGuradPickupItemSucc() | 
|---|
|  |  |  | 
|---|
|  |  |  | ChConfig.Def_Effect_ResetBossKillCnt:"Item_ResetBossKillCnt", # 重置boss击杀疲劳 | 
|---|
|  |  |  | ChConfig.Def_Effect_AddFBCnt:"Item_AddFBCnt", # 增加副本可进入次数 | 
|---|
|  |  |  | ChConfig.Def_Effect_AddKillBossCnt:"Item_AddKillBossCnt", # 增加BOSS可击杀次数 | 
|---|
|  |  |  | ChConfig.Def_Effect_AddMagicWeaponUpExp:"Item_AddMagicWeaponUpExp", # 增加法宝升星经验 | 
|---|
|  |  |  | ChConfig.Def_Effect_ChatBubbleBox:"Item_ChatBubbleBox", # 激活聊天气泡框 | 
|---|
|  |  |  | #ChConfig.Def_PhoneVip_EffID:"Item_AddPhoneVip", # 手机VIP物品卡 | 
|---|
|  |  |  | #ChConfig.Def_Effect_AddZhenQiByTimes:"Item_AddZhenQiByTimes", # 增加真气按一天使用次数减少 | 
|---|
|  |  |  | #ChConfig.Def_Effect_AddPrestige:"Item_AddPrestige",  # 给人物威望 | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @param tick 当前时间 | 
|---|
|  |  |  | #  @return True or False | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def __CheckPickUpItemTime(curPlayer , mapItem , tick): | 
|---|
|  |  |  | def __CheckPickUpItemTime(curPlayer, mapItem, tick, mapItemID, dropItemNPCID): | 
|---|
|  |  |  | #判断物品保护时间 | 
|---|
|  |  |  | #玩家击杀掉落的 | 
|---|
|  |  |  | if mapItem.GetRemainTick(tick) == 0: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | itemOwnerType =  mapItem.GetOwnerType() | 
|---|
|  |  |  | itemOwnerType = mapItem.GetOwnerType() | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  | ownerID = mapItem.GetOwnerID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #所有人都可以拾取的物品 | 
|---|
|  |  |  | if itemOwnerType == ChConfig.Def_NPCHurtTypeAll: | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | #个人物品 | 
|---|
|  |  |  | elif itemOwnerType == ChConfig.Def_NPCHurtTypePlayer: | 
|---|
|  |  |  | if mapItem.GetOwnerID() != curPlayer.GetPlayerID(): | 
|---|
|  |  |  | #GameWorld.Log("该物品不属于你,不能拾取1") | 
|---|
|  |  |  | if ownerID != playerID: | 
|---|
|  |  |  | GameWorld.Log("玩家没有归属权,不能拾取! mapItemID=%s,dropItemNPCID=%s,ownerID=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, ownerID), playerID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | #队伍物品 | 
|---|
|  |  |  | elif itemOwnerType == ChConfig.Def_NPCHurtTypeTeam: | 
|---|
|  |  |  | curTeam = curPlayer.GetTeam() | 
|---|
|  |  |  | if curTeam == None: | 
|---|
|  |  |  | #GameWorld.Log("该物品不属于你,不能拾取2") | 
|---|
|  |  |  | GameWorld.Log("没有队伍不能拾取归属队伍物品! mapItemID=%s,dropItemNPCID=%s,ownerID=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, ownerID), playerID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | if curTeam.GetTeamID() != mapItem.GetOwnerID(): | 
|---|
|  |  |  | #GameWorld.Log("该物品不属于你,不能拾取3") | 
|---|
|  |  |  | if curTeam.GetTeamID() != ownerID: | 
|---|
|  |  |  | GameWorld.Log("队伍没有归属权,不能拾取! mapItemID=%s,dropItemNPCID=%s,ownerID=%s,curTeamID=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, ownerID, curTeam.GetTeamID()), playerID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | #阵营物品 | 
|---|
|  |  |  | elif itemOwnerType == ChConfig.Def_NPCHurtTypeFaction: | 
|---|
|  |  |  | if mapItem.GetOwnerID() != curPlayer.GetFaction(): | 
|---|
|  |  |  | #GameWorld.Log("该物品不属于你,不能拾取5") | 
|---|
|  |  |  | if ownerID != curPlayer.GetFaction(): | 
|---|
|  |  |  | GameWorld.Log("阵营没有归属权,不能拾取! mapItemID=%s,dropItemNPCID=%s,ownerID=%s,curFaction=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, ownerID, curPlayer.GetFaction()), playerID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | #特殊玩家ID归属 | 
|---|
|  |  |  | elif itemOwnerType == ChConfig.Def_NPCHurtTypeSpecial: | 
|---|
|  |  |  | ownerIDList = GetMapItemUserDataValue(mapItem, ShareDefine.Def_MapItemInfo_SpecOwner, []) | 
|---|
|  |  |  | if curPlayer.GetPlayerID() not in ownerIDList: | 
|---|
|  |  |  | #GameWorld.Log("该物品不属于你,不能拾取6! ownerIDList=%s" % ownerIDList, curPlayer.GetPlayerID()) | 
|---|
|  |  |  | if playerID not in ownerIDList: | 
|---|
|  |  |  | GameWorld.Log("玩家没有归属权,不能拾取! mapItemID=%s,dropItemNPCID=%s,ownerIDList=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, ownerIDList), playerID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | #仙盟归属 | 
|---|
|  |  |  | elif itemOwnerType == ChConfig.Def_NPCHurtTypeFamily: | 
|---|
|  |  |  | if ownerID != curPlayer.GetFamilyID(): | 
|---|
|  |  |  | GameWorld.Log("仙盟没有归属权,不能拾取! mapItemID=%s,dropItemNPCID=%s,ownerID=%s,curFamilyID=%s" | 
|---|
|  |  |  | % (mapItemID, dropItemNPCID, ownerID, curPlayer.GetFamilyID()), playerID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | 
|---|
|  |  |  | curMapItem.SetOwnerType(ownerType) | 
|---|
|  |  |  | curMapItem.SetOwnerID(ownerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #GameWorld.DebugLog("AddMapDropItem ID=%s,ownerType=%s,ownerID=%s,GetDropTick=%s,isBind=%s" | 
|---|
|  |  |  | #                   % (curMapItem.GetID(), ownerType, ownerID, curMapItem.GetDropTick(), curItem.GetIsBind())) | 
|---|
|  |  |  | if dropNPCID: | 
|---|
|  |  |  | itemNoteDict = ItemCommon.GetItemNoteDict(curItem, curItem.GetCount()) | 
|---|
|  |  |  | GameWorld.Log("AddMapDropItem mapItemID=%s,ownerType=%s,ownerID=%s,mapItemDataStr=%s,itemNoteDict=%s" | 
|---|
|  |  |  | % (curMapItem.GetID(), curMapItem.GetOwnerType(), curMapItem.GetOwnerID(), itemDataStr, itemNoteDict)) | 
|---|
|  |  |  | return curMapItem | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetMapDropItemDataStr(curItem, effIndex=0, ownerInfo=[], dropNPCID=0, isOnlySelfSee=False): | 
|---|