9341 【BT5】【主干】【后端】情缘系统(吃喜糖改为随机获得一种物品)
| | |
| | | BYTE IsDayReset; //是否每日重置
|
| | | DWORD Prosperity; //初始繁荣度
|
| | | WORD CandyTimes; //喜糖持续时间秒
|
| | | list CandyItemInfo; //喜糖物品列表[[物品ID,个数,是否拍品], ...]
|
| | | list CandyItemWeightInfo; //喜糖物品库权重列表[[权重, 物品ID,个数,是否拍品], ...]
|
| | | list CandyNotifyItemInfo; //喜糖需要广播的物品ID列表
|
| | | list BrideGiftItemInfo; //聘礼物品列表[[物品ID,个数,是否拍品], ...]
|
| | | char WorldNotifyKey; //广播key
|
| | | };
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr())
|
| | | GameWorld.DebugAnswer(curPlayer, "清除伴侣: Couple 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置聘礼: Couple 0 1")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置伴侣: Couple 1 目标ID [可选聘礼ID]")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置成亲: Couple 1 伴侣ID [可选聘礼ID]")
|
| | | GameWorld.DebugAnswer(curPlayer, "设亲密度: Couple 2 目标ID 亲密度")
|
| | | GameWorld.DebugAnswer(curPlayer, "增加密度: Couple 3 目标ID 亲密度")
|
| | | return
|
| | |
| | |
|
| | | return
|
| | |
|
| | | # 设置伴侣
|
| | | # 设置成亲
|
| | | elif value1 == 1:
|
| | | if couple:
|
| | | GameWorld.DebugAnswer(curPlayer, "已有伴侣! coupleID=%s" % couple.GetCoupleID(playerID))
|
| | | return
|
| | | tagPlayerID = gmList[1] if len(gmList) > 1 else 0
|
| | | if not tagPlayerID or tagPlayerID == playerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "非法伴侣玩家ID:%s,playerID=%s" % (tagPlayerID, playerID))
|
| | | return
|
| | | if couple:
|
| | | if couple.GetCoupleID(playerID) != tagPlayerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "已有伴侣! coupleID=%s" % couple.GetCoupleID(playerID))
|
| | | return
|
| | | tagCouple = coupleMgr.GetCouple(tagPlayerID)
|
| | | if tagCouple:
|
| | | GameWorld.DebugAnswer(curPlayer, "对方已有伴侣! tagCoupleID=%s" % tagCouple.GetCoupleID(tagPlayerID))
|
| | | return
|
| | | if tagCouple.GetCoupleID(tagPlayerID) != playerID:
|
| | | GameWorld.DebugAnswer(curPlayer, "对方已有伴侣! tagCoupleID=%s" % tagCouple.GetCoupleID(tagPlayerID))
|
| | | return
|
| | |
|
| | | bridePriceID = gmList[2] if len(gmList) > 2 else 1
|
| | |
|
| | |
| | |
|
| | | ## 从列表中产生物品,[[权重, object], ....]
|
| | | # @param weightList 待选列表
|
| | | def GetResultByWeightList(weightList):
|
| | | def GetResultByWeightList(weightList, defValue=None):
|
| | | randList = []
|
| | | weight = 0
|
| | | for info in weightList:
|
| | | weight += info[0]
|
| | | randList.append([weight, info[1] if len(info) == 2 else info[1:]])
|
| | | if not randList:
|
| | | return
|
| | | return defValue
|
| | | rate = random.randint(1, randList[-1][0])
|
| | | return GetResultByRiseList(randList, rate)
|
| | | return GetResultByRiseList(randList, rate, defValue)
|
| | |
|
| | | ## 获得对应数位的值
|
| | | # @param numValue 数值
|
| | |
| | | ("BYTE", "IsDayReset", 0),
|
| | | ("DWORD", "Prosperity", 0),
|
| | | ("WORD", "CandyTimes", 0),
|
| | | ("list", "CandyItemInfo", 0),
|
| | | ("list", "CandyItemWeightInfo", 0),
|
| | | ("list", "CandyNotifyItemInfo", 0),
|
| | | ("list", "BrideGiftItemInfo", 0),
|
| | | ("char", "WorldNotifyKey", 0),
|
| | | ),
|
| | |
| | | self.IsDayReset = 0
|
| | | self.Prosperity = 0
|
| | | self.CandyTimes = 0
|
| | | self.CandyItemInfo = []
|
| | | self.CandyItemWeightInfo = []
|
| | | self.CandyNotifyItemInfo = []
|
| | | self.BrideGiftItemInfo = []
|
| | | self.WorldNotifyKey = "" |
| | | return |
| | |
| | | def GetIsDayReset(self): return self.IsDayReset # 是否每日重置
|
| | | def GetProsperity(self): return self.Prosperity # 初始繁荣度
|
| | | def GetCandyTimes(self): return self.CandyTimes # 喜糖持续时间秒
|
| | | def GetCandyItemInfo(self): return self.CandyItemInfo # 喜糖物品列表[[物品ID,个数,是否拍品], ...]
|
| | | def GetCandyItemWeightInfo(self): return self.CandyItemWeightInfo # 喜糖物品库权重列表[[权重, 物品ID,个数,是否拍品], ...]
|
| | | def GetCandyNotifyItemInfo(self): return self.CandyNotifyItemInfo # 喜糖需要广播的物品ID列表
|
| | | def GetBrideGiftItemInfo(self): return self.BrideGiftItemInfo # 聘礼物品列表[[物品ID,个数,是否拍品], ...]
|
| | | def GetWorldNotifyKey(self): return self.WorldNotifyKey # 广播key |
| | | |
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("Marry", bridePriceID)
|
| | | if not ipyData:
|
| | | return
|
| | | candyItemInfo = ipyData.GetCandyItemInfo()
|
| | | candyItemInfo = []
|
| | | candyItemWeightInfo = ipyData.GetCandyItemWeightInfo()
|
| | | candyNotifyItemInfo = ipyData.GetCandyNotifyItemInfo()
|
| | |
|
| | | playerFreeEatCount = candyObj.playerFreeEatCountDict.get(playerID, 0)
|
| | | playerFireworksCount = candyObj.fireworksCountDict.get(playerID, 0)
|
| | |
| | |
|
| | | updProsperity = candyObj.prosperity
|
| | | updPlayerFreeEatCount = candyObj.playerFreeEatCountDict.get(playerID, 0)
|
| | | GameWorld.Log("更新喜糖宴会: updProsperity=%s,updPlayerFreeEatCount=%s" % (updProsperity, updPlayerFreeEatCount), playerID)
|
| | | |
| | | getCandyItemInfo = GameWorld.GetResultByWeightList(candyItemWeightInfo, [])
|
| | | if getCandyItemInfo:
|
| | | candyItemInfo.append(getCandyItemInfo)
|
| | | itemID, itemCount = getCandyItemInfo[:2]
|
| | | if itemID in candyNotifyItemInfo:
|
| | | PlayerControl.WorldNotify(0, "EatCandyItemNotify", [curPlayer.GetName(), itemID, itemCount])
|
| | | GameWorld.Log("更新喜糖宴会: updProsperity=%s,updPlayerFreeEatCount=%s,getCandyItemInfo=%s" |
| | | % (updProsperity, updPlayerFreeEatCount, getCandyItemInfo), playerID)
|
| | |
|
| | | return canBuy, isFree, costMoneyType, costMoneyValue, candyItemInfo
|
| | |
|