From 69a763fb7cdb30bd5f7a860e4fd4a9270adb23b9 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 09 五月 2019 20:41:56 +0800
Subject: [PATCH] 6628 查看玩家 技能总等级信息

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py |  237 ++++++++++++++++++++---------------------------------------
 1 files changed, 80 insertions(+), 157 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
index 4e52c5d..61edf87 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -45,7 +45,6 @@
 import ShareDefine
 import PlayerAttrFruit
 import DataRecordPack
-import PyMapTable
 import ChPyNetSendPack
 import NetPackCommon
 import IpyGameDataPY
@@ -54,6 +53,7 @@
 import NPCCommon
 import FBCommon
 
+import random
 import json
 #---------------------------------------------------------------------
 #导入
@@ -240,14 +240,14 @@
         
         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())
@@ -544,7 +544,7 @@
 #  @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
     
@@ -725,7 +725,7 @@
                             ChConfig.Def_Effect_ChatBubbleBox:"Item_ChatBubbleBox", # 激活聊天气泡框
                             ChConfig.Def_Effect_ItemGiveWeekPartyPoint:"Item_WeekPartyPoint", # 增加活动巡礼积分
                             ChConfig.Def_Effect_ItemGiveWeekPartyPoint1:"Item_WeekPartyPoint", # 增加活动巡礼积分
-                            #ChConfig.Def_Effect_AddZhenQiByTimes:"Item_AddZhenQiByTimes", # 增加真气按一天使用次数减少
+                            ChConfig.Def_Effect_AddRealmExpRate:"Item_AddRealmExpRate", # 增加聚灵效率
                             #ChConfig.Def_Effect_AddPrestige:"Item_AddPrestige",  # 给人物威望
                             #ChConfig.Def_Effect_FamilyImpeach:"Item_FamilyImpeach",  # 弹劾符
                             #ChConfig.Def_Effect_ClothesCoatSkin:"Item_ClothesCoatSkin", #激活时装皮肤
@@ -957,17 +957,12 @@
 #        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
     
 #===============================================================================
@@ -1003,7 +998,7 @@
         PlayerControl.NotifyCode(curPlayer, "UseResLost10")
         return False
     
-    #绑定物品不可掉落
+    #绑定物品不可丢弃
     if curItem.GetIsBind():
         PlayerControl.NotifyCode(curPlayer, "UseResLost10")
         return False
@@ -1059,7 +1054,7 @@
     curItem = curPack.GetAt(itemIndex)
     
     #物品不存在
-    if not ItemCommon.CheckItemCanUse(curItem):
+    if not ItemCommon.CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem):
         return
 
     #检查物品可否丢弃
@@ -1531,8 +1526,9 @@
         return
     
     # 使用拍品
-    if curItem.GetIsBind():
-        DoLogic_PlayerUseAuctionItem(curPlayer, curItem)
+    if ItemControler.GetIsAuctionItem(curItem):
+        GameWorld.DebugLog("玩家使用拍品: itemID=%s" % (curItem.GetItemTypeID()), curPlayer.GetPlayerID())
+        ItemControler.SetIsAuctionItem(curItem, False, curPlayer)
         return
     
     if useCnt <= 0:
@@ -1541,34 +1537,6 @@
         
     __DoLogic_PlayerUseItemSelf(curPlayer, itemIndex, tick, useCnt, exData)
 
-    return
-
-def DoLogic_PlayerUseAuctionItem(curPlayer, curItem):
-    ## 玩家使用拍品
-    playerID = curPlayer.GetPlayerID()
-    itemID = curItem.GetItemTypeID()
-        
-    curItem.SetIsBind(0) # 设置为非拍品
-    curItem.ClearUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime)
-    GameWorld.DebugLog("玩家使用拍品: itemID=%s" % (itemID), playerID)
-    
-    if ItemCommon.GetIsEquip(curItem):
-        # 生成传奇属性
-        legendAttrInfo = ItemControler.GetAddEquipLegendAttr(curItem, curPlayer)
-        if not legendAttrInfo:
-            GameWorld.ErrLog("使用装备拍品没有传奇属性!itemID=%s" % (itemID), playerID)
-            return
-        attrIDList, attrValueList = legendAttrInfo
-        # 传奇属性
-        if attrIDList and attrValueList and len(attrIDList) == len(attrValueList):
-            curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
-            curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
-            for i, attrID in enumerate(attrIDList):
-                value = attrValueList[i]
-                curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, attrID)
-                curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, value)
-        ItemCommon.MakeEquipGS(curItem)
-        
     return
 
 #---------------------------------------------------------------------
@@ -1813,6 +1781,54 @@
     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
@@ -1882,8 +1898,8 @@
 #  @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
@@ -1952,118 +1968,6 @@
     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):
-#                GameWorld.ErrLog("使用特殊运营物品 给予定制物品失败")
-#                return
-#        else:
-#            #给予物品
-#            if not ItemControler.GivePlayerItem(curPlayer, newItemId, itemCount, 0, [IPY_GameWorld.rptItem]):
-#                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
 #
 #struct    tagCMItemRenew
@@ -2121,4 +2025,23 @@
 #    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

--
Gitblit v1.8.0