| | |
| | | import ShareDefine
|
| | | import PlayerAttrFruit
|
| | | import DataRecordPack
|
| | | import PyMapTable
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | |
| | | import NPCCommon
|
| | | import FBCommon
|
| | |
|
| | | import random
|
| | | import json
|
| | | #---------------------------------------------------------------------
|
| | | #导入
|
| | |
| | | # @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()
|
| | | curItemIsAuctionItem = ItemControler.GetIsAuctionItem(singItem)
|
| | |
|
| | | 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):
|
| | | if not itemControl.CanPutInItem(packIndex, curItemID, curItemCount, curItemIsAuctionItem):
|
| | | 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()]
|
| | | singItem.GetSuiteID(), 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 = GameWorld.GetGameWorld().GetMapID()
|
| | | NPCCommon.SendGameServerGoodItemRecord(mapID, dropItemNPCID, curPlayer.GetName(), |
| | | curPlayer.GetPlayerID(), curItemID, equipInfo)
|
| | | lineID = 0 if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull else PlayerControl.GetFBFuncLineID(curPlayer)
|
| | | NPCCommon.SendGameServerGoodItemRecord(curPlayer, mapID, lineID, dropItemNPCID, curItemID, equipInfo)
|
| | |
|
| | | # 不需要队伍提示
|
| | | #=======================================================================
|
| | |
| | | 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()
|
| | |
| | | # @remarks
|
| | | def CheckPlayerUseItemSelf(curPlayer, curItem, tick):
|
| | | #----------------------检查非法物品属性
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | if not ItemCommon.CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem):
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_644055")
|
| | | return False
|
| | |
|
| | |
| | | maxCnt = ItemCommon.GetCanUseCountDaily(curItem)
|
| | | if maxCnt <= 0:
|
| | | return -1
|
| | | curItemID = curItem.GetItemTypeID()
|
| | | useCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ItemUseCntToday % curItemID)
|
| | | for itemIDList in IpyGameDataPY.GetFuncEvalCfg('ShareUseCntItem'):
|
| | | if curItemID not in itemIDList:
|
| | | continue
|
| | | for itemID in itemIDList:
|
| | | if itemID == curItemID:
|
| | | continue
|
| | | useCnt += curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ItemUseCntToday % itemID)
|
| | |
|
| | | itemID = curItem.GetItemTypeID()
|
| | | useCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ItemUseCntToday % itemID)
|
| | | canUseCnt = max(0, maxCnt - useCnt)
|
| | |
|
| | | if canUseCnt <= 0:
|
| | | GameWorld.DebugLog("已达到今日使用次数上限!itemID=%s,useCnt=%s,maxCnt=%s" % (itemID, useCnt, maxCnt))
|
| | | GameWorld.DebugLog("已达到今日使用次数上限!itemID=%s,useCnt=%s,maxCnt=%s" % (curItemID, useCnt, maxCnt))
|
| | | #PlayerControl.NotifyCode(curPlayer, notifyMark, [itemID])
|
| | |
|
| | | #GameWorld.DebugLog("物品ID(%s)今日已使用次数(%s), maxCnt=%s" % (itemID, useCnt, maxCnt))
|
| | |
| | | ChConfig.Def_ItemType_GiveMoney:"Item_GiveMoney", # 给人物金钱
|
| | | ChConfig.Def_ItemType_AddLimitBuff:"Item_Add_LimitingBuff", # 给限时buff物品
|
| | | ChConfig.Def_ItemType_AddExpBuff:"Item_Add_LimitingBuff", # 给限时buff物品
|
| | | ChConfig.Def_ItemType_ResetAttrPoint:"Item_ResetAttrPoint" #单个属性点重置
|
| | | ChConfig.Def_ItemType_ResetAttrPoint:"Item_ResetAttrPoint", #单个属性点重置
|
| | | ChConfig.Def_ItemType_AddCrossRealmPKCnt:"Item_AddCrossRealmPKCnt" #增加跨服PK次数
|
| | | }
|
| | |
|
| | | #根据物品效果使用{物品效果ID:call的py名}
|
| | |
| | | ChConfig.Def_Effect_ResetBossKillCnt:"Item_ResetBossKillCnt", # 重置boss击杀疲劳
|
| | | ChConfig.Def_Effect_AddFBCnt:"Item_AddFBCnt", # 增加副本可进入次数
|
| | | ChConfig.Def_Effect_AddKillBossCnt:"Item_AddKillBossCnt", # 增加BOSS可击杀次数
|
| | | #ChConfig.Def_PhoneVip_EffID:"Item_AddPhoneVip", # 手机VIP物品卡
|
| | | #ChConfig.Def_Effect_AddZhenQiByTimes:"Item_AddZhenQiByTimes", # 增加真气按一天使用次数减少
|
| | | #ChConfig.Def_Effect_AddPrestige:"Item_AddPrestige", # 给人物威望
|
| | | ChConfig.Def_Effect_AddMagicWeaponUpExp:"Item_AddMagicWeaponUpExp", # 增加法宝升星经验
|
| | | ChConfig.Def_Effect_ChatBubbleBox:"Item_ChatBubbleBox", # 激活聊天气泡框
|
| | | ChConfig.Def_Effect_ItemGiveWeekPartyPoint:"Item_WeekPartyPoint", # 增加活动巡礼积分
|
| | | ChConfig.Def_Effect_ItemGiveWeekPartyPoint1:"Item_WeekPartyPoint", # 增加活动巡礼积分
|
| | | ChConfig.Def_Effect_AddRealmExpRate:"Item_AddRealmExpRate", # 增加聚灵效率
|
| | | ChConfig.Def_Effect_TouchMission:"Item_TouchMission", # 触发任务接口
|
| | | #ChConfig.Def_Effect_FamilyImpeach:"Item_FamilyImpeach", # 弹劾符
|
| | | #ChConfig.Def_Effect_ClothesCoatSkin:"Item_ClothesCoatSkin", #激活时装皮肤
|
| | | #ChConfig.Def_Effect_AddOfficialExp:"Item_AddOfficialExp", # 增加爵位经验
|
| | |
| | | # return
|
| | |
|
| | | #职业限制
|
| | | if not ItemCommon.JobUseable(curPlayer, curItem):
|
| | | if not ItemCommon.CheckJob(curPlayer, curItem):
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_31379")
|
| | | return
|
| | |
|
| | | #物品使用等级检查
|
| | | if not ItemControler.CheckItemUseLV(curPlayer, curItem):
|
| | | return
|
| | |
|
| | | #使用物品检查是否满足属性
|
| | | if not ItemControler.CheckItemAttrLimit(curPlayer, curItem):
|
| | | PlayerControl.NotifyCode(curPlayer, "itemuse_andyshao_671654")
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, "UseResLost10")
|
| | | return False
|
| | |
|
| | | #绑定物品不可掉落
|
| | | #绑定物品不可丢弃
|
| | | if curItem.GetIsBind():
|
| | | PlayerControl.NotifyCode(curPlayer, "UseResLost10")
|
| | | return False
|
| | |
| | | curItem = curPack.GetAt(itemIndex)
|
| | |
|
| | | #物品不存在
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | if not ItemCommon.CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem):
|
| | | return
|
| | |
|
| | | #检查物品可否丢弃
|
| | |
| | | # @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 mapItem.GetOwnerID() != curPlayer.GetFamilyID():
|
| | | #GameWorld.Log("该物品不属于你仙盟的,不能拾取7! ownerFamilyID=%s,curFamilyID=%s" |
| | | # % (mapItem.GetOwnerID(), curPlayer.GetFamilyID()), curPlayer.GetPlayerID())
|
| | | if ownerID != curPlayer.GetFamilyID():
|
| | | GameWorld.Log("仙盟没有归属权,不能拾取! mapItemID=%s,dropItemNPCID=%s,ownerID=%s,curFamilyID=%s" |
| | | % (mapItemID, dropItemNPCID, ownerID, curPlayer.GetFamilyID()), playerID)
|
| | | return False
|
| | |
|
| | | return True
|
| | |
| | | GameWorld.DebugLog(" 物品无法使用!")
|
| | | return
|
| | |
|
| | | # 使用拍品
|
| | | if ItemControler.GetIsAuctionItem(curItem):
|
| | | GameWorld.DebugLog("玩家使用拍品: itemID=%s" % (curItem.GetItemTypeID()), curPlayer.GetPlayerID())
|
| | | ItemControler.SetIsAuctionItem(curItem, False, curPlayer)
|
| | | return
|
| | | |
| | | if useCnt <= 0:
|
| | | useCnt = curItem.GetCount()
|
| | | GameWorld.DebugLog(" 没指定使用个数,默认使用全部=%s" % useCnt)
|
| | |
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | def DoMapDropItem(curPlayer, itemList, npcID, dropPosX, dropPosY, isOnlySelfSee=True, isDropDisperse=True):
|
| | | if not itemList:
|
| | | return
|
| | | if isDropDisperse:
|
| | | dropItemList = []
|
| | | for itemInfo in itemList:
|
| | | if isinstance(itemInfo, list):
|
| | | itemID, itemCount, isAuctionItem = itemInfo
|
| | | # 拍品不拆
|
| | | if isAuctionItem:
|
| | | dropItemList.append(itemInfo)
|
| | | continue
|
| | | for _ in xrange(itemCount):
|
| | | dropItemList.append([itemID, 1, isAuctionItem])
|
| | | else:
|
| | | dropItemList.append(itemInfo)
|
| | | else:
|
| | | dropItemList = itemList
|
| | | |
| | | random.shuffle(dropItemList) # 打乱顺序
|
| | | index = 0
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gameMap = GameWorld.GetMap()
|
| | | 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
|
| | | |
| | | curItem = dropItemList[index]
|
| | | index += 1
|
| | | if isinstance(curItem, list):
|
| | | itemID, itemCount, isAuctionItem = curItem
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | |
| | | if not curItem:
|
| | | continue
|
| | | |
| | | AddMapDropItem(resultX, resultY, curItem, ownerInfo=[ChConfig.Def_NPCHurtTypePlayer, playerID], |
| | | dropNPCID=npcID, isOnlySelfSee=isOnlySelfSee) |
| | | return
|
| | |
|
| | | ## 在地上添加物品(统一接口)
|
| | | # @param itemPosX 位置x
|
| | | # @param itemPosY 位置y
|
| | |
| | | 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):
|
| | |
| | | # @return
|
| | | def EquipAddAdditionEx(curItem, equipData):
|
| | | # 绑定
|
| | | if equipData.isBind:
|
| | | ItemControler.SetItemIsBind(curItem, equipData.isBind)
|
| | | #if equipData.isBind:
|
| | | # ItemControler.SetItemIsBind(curItem, equipData.isBind)
|
| | |
|
| | | if not ItemCommon.CheckItemIsEquip(curItem):
|
| | | return
|
| | |
| | | #===========================================================================
|
| | |
|
| | | # 套装
|
| | | if equipData.isSuite:
|
| | | curItem.SetIsSuite(equipData.isSuite)
|
| | | if equipData.suiteLV:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetSuiteLV, equipData.suiteLV)
|
| | | #if equipData.isSuite:
|
| | | # curItem.SetIsSuite(equipData.isSuite)
|
| | | #if equipData.suiteLV:
|
| | | # curItem.SetUserAttr(ShareDefine.Def_IudetSuiteLV, equipData.suiteLV)
|
| | | # 物品来源
|
| | | if equipData.source:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetSource, equipData.source)
|
| | |
| | | for i in xrange(len(equipData.legendAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, equipData.legendAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, equipData.legendAttrValueList[i])
|
| | | |
| | | #绝版属性
|
| | | if equipData.OutOfPrintAttrIDList and equipData.OutOfPrintAttrValueList:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue)
|
| | | for i in xrange(len(equipData.OutOfPrintAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID, equipData.OutOfPrintAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue, equipData.OutOfPrintAttrValueList[i])
|
| | |
|
| | | ItemCommon.MakeEquipGS(curItem)
|
| | | return
|
| | |
| | | Def_Discount_ItemType, #折扣卡物品类型
|
| | | Def_SelectMore_ItemType #多选礼包物品类型
|
| | | ) = range(2)
|
| | |
|
| | | #//A3 21 使用特殊运营物品 #tagCMUseSpecialItem
|
| | | #
|
| | | #struct tagCMUseSpecialItem
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE SpeicalItemType; //特殊运营物品类型,0打折卡,1多选礼包
|
| | | # int ItemID; //物品ID
|
| | | # BYTE ItemIndex; //物品在背包中的索引位置
|
| | | # BYTE Select; //选择,只对多选礼包有用 |
| | | #};
|
| | | ## 使用特殊运营物品(封包参数) |
| | | # @param index 玩家索引
|
| | | # @param packData 接收到的封包数据
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def OnUseSpecialItem(index, packData, tick):
|
| | | # #GameWorld.Log("OnUseSpecialItem")
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # specialItemType = packData.SpeicalItemType
|
| | | # itemID = packData.ItemID
|
| | | # itemIndex = packData.ItemIndex
|
| | | # selectIndex = packData.Select
|
| | | # |
| | | # curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | # curItem = curPack.GetAt(itemIndex)
|
| | | # if curItem.GetItemTypeID() != itemID:
|
| | | # GameWorld.Log("使用特殊运营物品失败,物品ID不一致")
|
| | | # return
|
| | | # isBind = curItem.GetIsBind()#继承被使用物品的绑定属性,先记录
|
| | | # itemName = curItem.GetName()
|
| | | # |
| | | # needGold = 0 #需要消耗多少钻石
|
| | | # itemInfoList = []
|
| | | # useMoneyInfo = ""
|
| | | # #如果是打折卡类型
|
| | | # if specialItemType == Def_Discount_ItemType:
|
| | | # #GameWorld.Log("处理打折卡物品类型")
|
| | | # discountItem = ReadChConfig.GetEvalChConfig("DiscountItem")
|
| | | # #GameWorld.Log("读取到的打折卡物品配置信息=%s"%discountItem)
|
| | | # itemSetInfo = discountItem.get(itemID, None)
|
| | | # if not itemSetInfo:
|
| | | # GameWorld.ErrLog("折扣卡,没有找到对应物品的配置信息,物品ID:%s"%itemID)
|
| | | # return
|
| | | # needGold, itemInfo = itemSetInfo
|
| | | # itemInfoList.append(itemInfo)
|
| | | # useMoneyInfo = "UseSpecialItem_Discount"
|
| | | # else:
|
| | | # #GameWorld.Log("处理多选礼包物品类型")
|
| | | # selectMoreItem = ReadChConfig.GetEvalChConfig("SelectMoreItem")
|
| | | # #GameWorld.Log("读取到的多选礼包物品配置信息=%s"%selectMoreItem)
|
| | | # itemSetInfo = selectMoreItem.get(itemID, None)
|
| | | # if not itemSetInfo:
|
| | | # GameWorld.ErrLog("多选礼包,没有找到对应物品的配置信息,物品ID:%s"%itemID)
|
| | | # return
|
| | | # if selectIndex < 0 or selectIndex >= len(itemSetInfo):
|
| | | # GameWorld.ErrLog("多选礼包,选择索引越界,物品ID:%s 选择索引:%s"%(itemID, selectIndex))
|
| | | # return
|
| | | # itemSetInfo = itemSetInfo[selectIndex]
|
| | | # needGold, itemInfoList = itemSetInfo
|
| | | # useMoneyInfo = "UseSpecialItem_SelectMore"
|
| | | # #GameWorld.Log("needGold=%s itemInfoList=%s"%(needGold, itemInfoList))
|
| | | # |
| | | # #钻石不足
|
| | | # if not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold):
|
| | | # GameWorld.ErrLog("钻石不足")
|
| | | # return
|
| | | # #背包剩余空间
|
| | | # packSpace = ItemControler.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | # if packSpace < len(itemInfoList):
|
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | # GameWorld.ErrLog("背包空间不足")
|
| | | # return
|
| | | # #给物品
|
| | | # for itemInfo in itemInfoList:
|
| | | # newItemId, itemCount, bind, isAppoint = itemInfo
|
| | | # makeItemID = newItemId
|
| | | # #是定制物品
|
| | | # if isAppoint:
|
| | | # appointItemList = PyMapTable.GetPyMapTable("AppointItemList") #定制物品列表
|
| | | # itemData = appointItemList.GetRecord("ItemIndex", str(newItemId))
|
| | | # if not itemData:
|
| | | # GameWorld.ErrLog("使用特殊运营物品 找不到定制物品数据, itemID = %s"%newItemId)
|
| | | # return False
|
| | | # |
| | | # if len(itemData) != 1:
|
| | | # GameWorld.ErrLog("使用特殊运营物品 定制表配置的数据有误, itemID = %s"%newItemId)
|
| | | # return False
|
| | | # |
| | | # itemDictData = itemData[0]
|
| | | # makeItemID = int(itemDictData['ItemID'])
|
| | | # itemCount = 1
|
| | | # itemDictData['IsBind'] = isBind
|
| | | # if not ItemControler.GivePlayerEquip(curPlayer, itemDictData, False, |
| | | # [IPY_GameWorld.rptItem]):
|
| | | # GameWorld.ErrLog("使用特殊运营物品 给予定制物品失败")
|
| | | # return
|
| | | # else:
|
| | | # #给予物品
|
| | | # if not ItemControler.GivePlayerItem(curPlayer, newItemId, itemCount, isBind, |
| | | # [IPY_GameWorld.rptItem], False):
|
| | | # GameWorld.ErrLog("使用特殊运营物品 给予普通物品失败")
|
| | | # return
|
| | | # #PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [makeItemID, itemCount])
|
| | | # |
| | | # #扣除物品
|
| | | # itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | # #扣除物品
|
| | | # ItemCommon.ReduceItem(curPlayer, itemPack, [itemIndex], 1, False)
|
| | | # |
| | | # #扣金钱
|
| | | # addDataDict = {"SpecialItemType":specialItemType, "UseItemID":itemID, "SelectIndex":selectIndex, ChConfig.Def_Cost_Reason_SonKey:itemName}
|
| | | # PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold, ChConfig.Def_Cost_GiftBag, addDataDict)
|
| | | return
|
| | |
|
| | | #// A3 07 过期物品续费 #tagCMItemRenew
|
| | | #
|
| | |
| | | return
|
| | | #先删原物品再给新物品
|
| | | ItemCommon.DelItem(curPlayer, timeOutItem, 1, False, "RenewItem")
|
| | | ItemControler.GivePlayerItem(curPlayer, changeItemID, 1, True, [IPY_GameWorld.rptItem])
|
| | | ItemControler.GivePlayerItem(curPlayer, changeItemID, 1, 0, [IPY_GameWorld.rptItem])
|
| | | PlayerControl.NotifyCode(curPlayer, 'Guardian_ContinuePay')
|
| | | return |
| | | return
|
| | |
|
| | | #// A3 08 物品过期 #tagCMItemTimeout
|
| | | #
|
| | | #struct tagCMItemTimeout
|
| | | #
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE PackType; //背包类型
|
| | | # BYTE ItemIndex; //物品在背包中索引
|
| | | #};
|
| | | def OnItemTimeout(index, clientData, tick):
|
| | | packType = clientData.PackType
|
| | | itemIndex = clientData.ItemIndex
|
| | | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | backPack = curPlayer.GetItemManager().GetPack(packType)
|
| | | if not backPack:
|
| | | return
|
| | | curItem = backPack.GetAt(itemIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | GameWorld.DebugLog("物品不存在!")
|
| | | return
|
| | | |
| | | # 拍品
|
| | | if ItemControler.GetIsAuctionItem(curItem):
|
| | | GameWorld.DebugLog("玩家拍品过期: itemID=%s" % (curItem.GetItemTypeID()), curPlayer.GetPlayerID())
|
| | | ItemControler.SetIsAuctionItem(curItem, False, curPlayer)
|
| | | return
|
| | | |
| | | |
| | | return
|