| | |
| | | import NetPackCommon
|
| | | import PlayerBourse
|
| | | import PlayerFamily
|
| | | import ShareDefine
|
| | | import ChConfig
|
| | |
|
| | | import operator
|
| | |
| | | ## 仙盟拍卖中的拍品列表
|
| | | return PyDataManager.GetAuctionItemManager().familyAuctionItemDict.get(familyID, [])
|
| | |
|
| | | def IsFamilyMemberBiddingAuctionItem(familyID, memberID):
|
| | | ## 仙盟成员是否最高竞价拍品中
|
| | | familyAuctionItemList = GetFamilyAuctionItemList(familyID)
|
| | | for auctionItem in familyAuctionItemList:
|
| | | if auctionItem.BidderID == memberID:
|
| | | return True
|
| | | return False
|
| | |
|
| | | def OnAuctionItemTimeProcess(curTime, tick):
|
| | | ## 拍卖行拍品定时处理,每秒触发一次
|
| | | allAuctionItemByEndTimeList = PyDataManager.GetAuctionItemManager().allAuctionItemByEndTimeList
|
| | |
| | | auctionItemMgr.allAuctionItemByEndTimeList.append(auctionItem)
|
| | | auctionItemMgr.worldAuctionItemList.append(auctionItem)
|
| | | notifyWorldAddItemList.append([itemGUID, itemID, playerID])
|
| | | |
| | | AddAuctionRecord(auctionItem, AuctionRecordResult_MoveToWorld)
|
| | |
|
| | | # 添加进我的关注
|
| | | for attentionPlayerID, attentionList in auctionItemMgr.myAttentionItemDict.items():
|
| | |
| | | # 拍卖成功收益,都以玩家收益向上取整
|
| | | if familyID and auctionItem.FamilyPlayerIDInfo:
|
| | | familyPlayerIDList = json.loads(auctionItem.FamilyPlayerIDInfo)
|
| | | taxRate = IpyGameDataPY.GetFuncCfg("AuctionTaxrate", 2) # 仙盟拍品税率百分比
|
| | | personMaxRate = IpyGameDataPY.GetFuncCfg("AuctionTaxrate", 3) # 仙盟拍品个人最大收益百分比
|
| | | taxGold = max(1, int(bidderPrice * taxRate / 100.0)) # 最少收税1
|
| | | giveTotalGold = max(0, bidderPrice - taxGold)
|
| | | giveMaxGold = int(math.ceil(giveTotalGold * personMaxRate / 100.0))
|
| | | memCount = len(familyPlayerIDList)
|
| | | giveGoldAverage = min(giveMaxGold, int(math.ceil(giveTotalGold * 1.0 / memCount))) # 有收益的人平分
|
| | | |
| | | # 仙盟拍品收益邮件
|
| | | detail = {"ItemGUID":itemGUID, "ItemID":itemID, "Count":itemCount, "BidderPrice":bidderPrice, "FamilyPlayerIDList":familyPlayerIDList}
|
| | | paramList = [itemID, itemID, auctionItem.BidderName, bidderPrice, taxRate, giveGoldAverage, personMaxRate]
|
| | | PlayerCompensation.SendMailByKey("PaimaiMail6", familyPlayerIDList, [], paramList, gold=giveGoldAverage, |
| | | detail=detail, moneySource=ChConfig.Def_GiveMoney_AuctionGain)
|
| | | |
| | | if familyPlayerIDList:
|
| | | taxRate = IpyGameDataPY.GetFuncCfg("AuctionTaxrate", 2) # 仙盟拍品税率百分比
|
| | | personMaxRate = IpyGameDataPY.GetFuncCfg("AuctionTaxrate", 3) # 仙盟拍品个人最大收益百分比
|
| | | taxGold = max(1, int(bidderPrice * taxRate / 100.0)) # 最少收税1
|
| | | giveTotalGold = max(0, bidderPrice - taxGold)
|
| | | giveMaxGold = int(math.ceil(giveTotalGold * personMaxRate / 100.0))
|
| | | memCount = len(familyPlayerIDList)
|
| | | giveGoldAverage = min(giveMaxGold, int(math.ceil(giveTotalGold * 1.0 / memCount))) # 有收益的人平分
|
| | | |
| | | # 仙盟拍品收益邮件
|
| | | detail = {"ItemGUID":itemGUID, "ItemID":itemID, "Count":itemCount, "BidderPrice":bidderPrice, "FamilyPlayerIDList":familyPlayerIDList}
|
| | | paramList = [itemID, itemID, auctionItem.BidderName, bidderPrice, taxRate, giveGoldAverage, personMaxRate]
|
| | | PlayerCompensation.SendMailByKey("PaimaiMail6", familyPlayerIDList, [], paramList, gold=giveGoldAverage, |
| | | detail=detail, moneySource=ChConfig.Def_GiveMoney_AuctionGain)
|
| | | else:
|
| | | GameWorld.ErrLog("仙盟拍品没有人获得收益!familyID=%s,itemID=%s,itemGUID=%s" % (familyID, itemID, itemGUID))
|
| | | |
| | | elif playerID:
|
| | | taxRate = IpyGameDataPY.GetFuncCfg("AuctionTaxrate", 1) # 全服拍品税率百分比
|
| | | taxGold = max(1, int(bidderPrice * taxRate / 100.0)) # 最少收税1
|
| | |
| | | @param curPlayer: 可能为None
|
| | | '''
|
| | |
|
| | | notifyWorldAddItemList = [] # 新增全服拍品通知 [[itemGUID, itemID, playerID], ...]
|
| | | isSortWorldItem = False
|
| | | notifyAddItemList = [] # 新增拍品通知 [[itemGUID, itemID, playerID], ...]
|
| | | notifyFamilyAddItemDict = {} # 新增仙盟拍品通知 {familyID:[auctionItem, ...], ...}
|
| | | for playerID, familyID, familyPlayerIDList, itemData in addAuctionItemList:
|
| | | if not playerID and not familyID:
|
| | |
| | | if not auctionItem:
|
| | | continue
|
| | |
|
| | | itemGUID = auctionItem.ItemGUID
|
| | | itemID = auctionItem.ItemID
|
| | | notifyAddItemList.append([itemGUID, itemID, playerID])
|
| | | if familyID:
|
| | | familyAddItemList = notifyFamilyAddItemDict.get(familyID, [])
|
| | | familyAddItemList.append(auctionItem)
|
| | | notifyFamilyAddItemDict[familyID] = familyAddItemList
|
| | | else:
|
| | | itemGUID = auctionItem.ItemGUID
|
| | | itemID = auctionItem.ItemID
|
| | | notifyWorldAddItemList.append([itemGUID, itemID, playerID])
|
| | | isSortWorldItem = True
|
| | |
|
| | | if notifyFamilyAddItemDict or notifyWorldAddItemList:
|
| | | isSortWorldItem = notifyWorldAddItemList != []
|
| | | if notifyAddItemList:
|
| | | __SortAuctionitem(isSortWorldItem=isSortWorldItem)
|
| | |
|
| | | # 通知新增仙盟拍品
|
| | | for familyID, familyAddItemList in notifyFamilyAddItemDict.items():
|
| | | Sync_FamilyAuctionItemInfo(None, familyID, familyAddItemList)
|
| | |
|
| | | # 通知全服拍品关注玩家
|
| | | __NotifyAuctionPlayerAddItem(notifyWorldAddItemList)
|
| | | # 通知拍品关注玩家
|
| | | __NotifyAuctionPlayerAddItem(notifyAddItemList)
|
| | | return
|
| | |
|
| | | def __DoAddAuctionItem(curPlayer, playerID, familyID, familyPlayerIDList, itemData):
|
| | |
| | | GameWorld.DebugLog("更新拍品数: %s" % len(auctionItemMgr.allAuctionItemDict))
|
| | | return auctionItem
|
| | |
|
| | | def __NotifyAuctionPlayerAddItem(notifyWorldAddItemList):
|
| | | def __NotifyAuctionPlayerAddItem(notifyAddItemList):
|
| | | ## 通知关注物品的玩家新上架物品了
|
| | | if not notifyWorldAddItemList:
|
| | | if not notifyAddItemList:
|
| | | return
|
| | | attentionMgr = PyDataManager.GetAuctionAttentionManager()
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | |
| | | if not playerAttentionIDList:
|
| | | continue
|
| | | infoPack = None
|
| | | for itemGUID, itemID, playerID in notifyWorldAddItemList:
|
| | | if playerID == player.GetPlayerID():
|
| | | for itemGUID, itemID, playerID in notifyAddItemList:
|
| | | if playerID and playerID == player.GetPlayerID():
|
| | | # 自己上架的物品不通知
|
| | | continue
|
| | | if itemID not in playerAttentionIDList:
|
| | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | tagItemGUID = clientData.ItemGUID
|
| | | queryDir = 3
|
| | | __Sync_WorldAuctionItemQueryResult(curPlayer, fromItemGUID=tagItemGUID, queryDir=queryDir)
|
| | | __Sync_WorldAuctionItemQueryResult(curPlayer, fromItemGUID=tagItemGUID, queryDir=queryDir, isNotify=True)
|
| | | return
|
| | |
|
| | | def __Sync_WorldAuctionItemQueryResult(curPlayer, job=0, itemTypeList=[], classLV=0, specItemIDList=[], fromItemGUID="", queryDir=1, queryCount=10):
|
| | | def __Sync_WorldAuctionItemQueryResult(curPlayer, job=0, itemTypeList=[], classLV=0, specItemIDList=[], fromItemGUID="", queryDir=1, queryCount=10, isNotify=False):
|
| | | ## 根据过滤条件同步全服拍品列表,目前仅全服拍品需要通过查询服务器获得,个人拍品及仙盟拍品由于个数较少直接由上线或变更时主动同步
|
| | |
|
| | | fromAuctionItem = None
|
| | |
| | | fromAuctionItem = GetAuctionItem(fromItemGUID)
|
| | | if not fromAuctionItem:
|
| | | GameWorld.DebugLog("查询的目标拍品不存在! fromItemGUID=%s" % fromItemGUID)
|
| | | PlayerControl.NotifyCode(curPlayer, "Paimai5")
|
| | | if isNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "Paimai5")
|
| | | return
|
| | |
|
| | | # {(job, (itemType, ...), itemClassLV, (itemID, ...)):[tagDBAuctionItem, ...], ...}
|
| | |
| | | # 载入对应查询条件拍品缓存
|
| | | auctionItemQueryList = []
|
| | | for worldAuctionItem in auctionItemMgr.worldAuctionItemList:
|
| | | if job and worldAuctionItem.ItemJobLimit != job:
|
| | | if job and worldAuctionItem.ItemJobLimit != job and worldAuctionItem.ItemJobLimit:
|
| | | continue
|
| | | if itemTypeList and worldAuctionItem.ItemType not in itemTypeList:
|
| | | continue
|
| | |
| | | if fromAuctionItem:
|
| | | if fromAuctionItem not in auctionItemQueryList:
|
| | | GameWorld.ErrLog("查询的目标拍品不在所在的过滤的条件里! fromItemGUID=%s" % fromItemGUID)
|
| | | PlayerControl.NotifyCode(curPlayer, "Paimai5")
|
| | | if isNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "Paimai5")
|
| | | return
|
| | | fromIndex = auctionItemQueryList.index(fromAuctionItem)
|
| | |
|
| | |
| | | DataRecordPack.SendEventPack("AuctionHouse", dataDict, curPlayer)
|
| | | return
|
| | |
|
| | | def DoAddFamilyAuctionItem(mapID, familyAuctionItemDict):
|
| | | ''' 上架仙盟拍品,因为仙盟拍品默认上架,所以使用批量上架
|
| | | @param familyAuctionItemDict: {仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,个数], [拍品ID,个数,是否拍品], ...]], ...}
|
| | | '''
|
| | | GameWorld.Log("发送地图上架仙盟拍品: mapID=%s, %s" % (mapID, familyAuctionItemDict))
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_AddFamilyAuctionItem, [mapID, familyAuctionItemDict])
|
| | | return
|
| | |
|