6373 【后端】【2.0】删除无用功能代码、封包、配置(消费VIP、充值活动)
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A3 21 使用特殊运营物品 #tagCMUseSpecialItem
|
| | |
|
| | | class tagCMUseSpecialItem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("SpeicalItemType", c_ubyte), #特殊运营物品类型,0打折卡,1多选礼包
|
| | | ("ItemID", c_int), #物品ID
|
| | | ("ItemIndex", c_ubyte), #物品在背包中的索引位置
|
| | | ("Select", c_ubyte), #选择,只对多选礼包有用 |
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x21
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x21
|
| | | self.SpeicalItemType = 0
|
| | | self.ItemID = 0
|
| | | self.ItemIndex = 0
|
| | | self.Select = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMUseSpecialItem)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''//A3 21 使用特殊运营物品 //tagCMUseSpecialItem:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | SpeicalItemType:%d,
|
| | | ItemID:%d,
|
| | | ItemIndex:%d,
|
| | | Select:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.SpeicalItemType,
|
| | | self.ItemID,
|
| | | self.ItemIndex,
|
| | | self.Select
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMUseSpecialItem=tagCMUseSpecialItem()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMUseSpecialItem.Cmd,m_NAtagCMUseSpecialItem.SubCmd))] = m_NAtagCMUseSpecialItem
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 2F 宗门试炼兑换 #tagCMTrialExchange
|
| | |
|
| | | class tagCMTrialExchange(Structure):
|
| | |
| | | PacketSubCMD_1=0x02
|
| | | PacketCallFunc_1=PlayerDropItem
|
| | |
|
| | | PacketCMD_2=0xA3
|
| | | PacketSubCMD_2=0x21
|
| | | PacketCallFunc_2=OnUseSpecialItem
|
| | | PacketCMD_2=
|
| | | PacketSubCMD_2=
|
| | | PacketCallFunc_2=
|
| | |
|
| | | PacketCMD_3=0xA3
|
| | | PacketSubCMD_3=0x23
|
| | |
| | | Def_SkillID_Teleport = 1400 #瞬间移动 用于不影响攻击间隔
|
| | | Def_SkillID_VipBuff = 11500 # VIPbuff
|
| | | Def_SkillID_TeamVIPBuff = 22000 # VIP队伍buff, 攻守同盟
|
| | | Def_SkillID_CostVipBuff = 61018 # CostVIPbuff
|
| | | Def_SkillID_FBEncourageBuff = 20051 # 副本鼓舞buff
|
| | | Def_SkillID_FreshmanGuideBuff = 21219 # 新手指导员buff
|
| | | Def_SkillID_PoisonAtkBuff = 25180 # 毒攻buff
|
| | |
| | | Def_PDict_CTGCountResetTime = "CTGCountResetTime" # CTG次数重置时间time值
|
| | | Def_PDict_TodayCTGCount = "TodayCTGCount_%s" # 当日充值次数,参数(CTG对应的商品记录ID)
|
| | | Def_PDict_CTGGoodsBuyCount = "CTGGoodsBuyCount_%s" # 对应充值商品已购买次数,参数(CTG对应的商品记录ID)
|
| | | Def_PDict_GoldGiftGetRecord = "GoldGiftGetRecord" # 充值豪礼领取信息记录,按二进制位标示
|
| | | Def_PDict_GoldGiftMailRecord = "GoldGiftMailRecord" # 充值豪礼邮件发送记录,按二进制位标示
|
| | | Def_PDict_GoldGiftFirstRecord = "GoldGiftFirstRecord" # 首充领取记录,0-未领取;1-已领取
|
| | | Def_PDict_FirstGoldRemainTime = "FirstGoldRemainTime" # 首充提示剩余时间
|
| | | Def_PDict_FirstGoldTipStartTime = "FirstGoldTipStartTime" # 首充提示开始时间
|
| | | Def_PDict_FirstGoldTry = "FirstGoldTry" # 首充试用状态 0-不可试用 1-可试用 2-已试用
|
| | | Def_PDict_DailyGoldChargeState = "DailyGoldChargeState" # 天天首充活动状态,0-未开启;1-已开启
|
| | | Def_PDict_DailyChargeState = "DailyChargeState" # 当日是否已充值
|
| | | Def_PDict_SuperGiftStartTime = "SuperGiftStartTime" # 超值礼包开始时间
|
| | | Def_PDict_DailyGoldChargePrizeRecord = "DailyGoldChargePrizeRecord" # 天天首充领奖记录,0-不可领;1-可领;2-已领
|
| | | Def_PDict_DailyGoldChargeCnt = "DailyGoldChargeCnt" # 当日已充值数
|
| | | Def_PDict_IsReBorn = "Def_PDict_IsReBorn" # 是否回城复活
|
| | | Def_PDict_FamilyWarDailyReward = "FamilyWarDailyReward" # 王者仙盟每日俸禄领取状态
|
| | |
| | | Def_PDict_ClothesSkinLV = "ClothesSkinLV_%s" # 时装皮肤等级,参数时装索引
|
| | | Def_PDict_ClothesChestLV = "ClothesChestLV" # 时装柜等级
|
| | | Def_PDict_ClothesChestEXP = "ClothesChestEXP" # 时装柜经验
|
| | |
|
| | | Def_PDict_CostVIPExp = "CostVIPExp" # 消费VIP经验
|
| | | Def_PDict_CostVIPLVReward = "CostVIPLVReward" # 消费VIP等级奖励
|
| | | Def_PDict_CostVIPBuyItem = "CostVIPBuyItem" # 消费VIP购买物品
|
| | | Def_PDict_SpecialCostVIPLVExpMark = "SpecialCostVIPLVExpMark" # 特殊处理VIP等级经验标识
|
| | | Def_PDict_CostVIPGrowUpReward = "CostVIPGrowUpReward" # 消费VIP成长奖励
|
| | |
|
| | | Def_PDict_SplitExpLVCnt = "SplitExpLVCnt_%s" # 单位等级经验已拆分过的等级数, 参数为实际等级
|
| | |
|
| | |
| | | # 消费返利不处理的消费类型列表
|
| | | CostRebate_DisableType = [Def_Cost_BourseBuy, Def_Cost_BourseCharge, Def_Cost_FreeGoods, Def_Cost_FamilyRedPacket,
|
| | | Def_Cost_Unknown, "GMSetMoney", "Warehouse", Def_Cost_AuctionBid]
|
| | | CostProfit_CostType = [Def_Cost_BourseBuy, Def_Cost_BourseCharge, Def_Cost_Unknown,
|
| | | "GMSetMoney", "Warehouse", Def_Cost_AuctionBid]
|
| | |
|
| | | # 消费VIP不处理的消费类型列表
|
| | | CostVIP_CostType = [Def_Cost_BourseBuy, Def_Cost_BourseCharge, Def_Cost_Unknown,
|
| | | "GMSetMoney", "Warehouse", Def_Cost_AuctionBid]
|
| | |
|
| | | # 可在跨服中消费的类型列表
|
| | | MergeServerCanCostType = [Def_Cost_UseSpeaker, Def_Cost_Revive, Def_Cost_FBEncourage]
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | #A3 21 使用特殊运营物品 #tagCMUseSpecialItem
|
| | |
|
| | | class tagCMUseSpecialItem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("SpeicalItemType", c_ubyte), #特殊运营物品类型,0打折卡,1多选礼包
|
| | | ("ItemID", c_int), #物品ID
|
| | | ("ItemIndex", c_ubyte), #物品在背包中的索引位置
|
| | | ("Select", c_ubyte), #选择,只对多选礼包有用 |
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x21
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x21
|
| | | self.SpeicalItemType = 0
|
| | | self.ItemID = 0
|
| | | self.ItemIndex = 0
|
| | | self.Select = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMUseSpecialItem)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''//A3 21 使用特殊运营物品 //tagCMUseSpecialItem:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | SpeicalItemType:%d,
|
| | | ItemID:%d,
|
| | | ItemIndex:%d,
|
| | | Select:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.SpeicalItemType,
|
| | | self.ItemID,
|
| | | self.ItemIndex,
|
| | | self.Select
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMUseSpecialItem=tagCMUseSpecialItem()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMUseSpecialItem.Cmd,m_NAtagCMUseSpecialItem.SubCmd))] = m_NAtagCMUseSpecialItem
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 2F 宗门试炼兑换 #tagCMTrialExchange
|
| | |
|
| | | class tagCMTrialExchange(Structure):
|
| | |
| | | SendEventPack("TreasureResult", dataDict, curPlayer)
|
| | | return
|
| | |
|
| | | ## 消费VIP升级记录
|
| | | # @param curPlayer
|
| | | # @param lastLV ԭVIPLV
|
| | | # @param curExp 当前VIP经验
|
| | | # @param addExp 增加VIP经验
|
| | | # @param costType 花费类型
|
| | | # @param costGold 花费数
|
| | | # @return: None
|
| | | def DR_PlayerCostVIPLV(curPlayer, lastLV, curExp, addExp, costType, costGold):
|
| | | |
| | | dataDict = {'PlayerID':curPlayer.GetPlayerID(), 'PlayerName':curPlayer.GetPlayerName(), |
| | | 'AccID':curPlayer.GetAccID(), 'VIPLv':curPlayer.GetVIPLv(), 'lastVIPLv':lastLV,
|
| | | 'curExp':curExp, 'addExp':addExp, 'costType':costType, 'costGold':costGold}
|
| | |
|
| | | #发送封包
|
| | | SendEventPack("PlayerCostVIPLV", dataDict, curPlayer)
|
| | | return
|
| | |
|
| | | ## 玩家提交bug及建议
|
| | | def DR_BugSuggest(curPlayer, eventName, content):
|
| | |
|
| | |
| | | import ChEquip
|
| | | import PlayerActivity
|
| | | import PlayerSuccess
|
| | | import EventReport
|
| | | #import PlayerCostVIP
|
| | | import GameFuncComm
|
| | | import IpyGameDataPY
|
| | | import PlayerPet
|
| | | import PlayerArrestTask
|
| | |
| | | import PlayerActLogin
|
| | | import PlayerHorse
|
| | | import FBCommon
|
| | | import PyGameData
|
| | |
|
| | | import math
|
| | | import time
|
| | |
| | | randStarList = eval(ReadChConfig.GetChConfig('RunAround_Star'))
|
| | | aroundStar = GameWorld.GetResultByRandomList(randStarList, 1)
|
| | |
|
| | | #vipStar = PlayerCostVIP.GetRoundStar(curPlayer)
|
| | | vipStar = 0
|
| | | if vipStar > 0:
|
| | | aroundStar = vipStar
|
| | |
| | | import GameWorld
|
| | | import PlayerControl
|
| | | import QuestCommon
|
| | | import PyMapTable
|
| | | #---------------------------------------------------------------------
|
| | | ##获取服务器任务状态, State
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | import datetime
|
| | | import ChConfig
|
| | | import os
|
| | | import MapConfig
|
| | | import CommFunc
|
| | | import ShareDefine
|
| | | import PyMapTable
|
| | | #import psyco
|
| | | from decimal import Decimal
|
| | | import time
|
| | |
| | | import ChItem
|
| | | import ItemCommon
|
| | | import FBLogic
|
| | | import ReadChConfig
|
| | | import OperControlManager
|
| | | import Operate_EquipWash
|
| | | import ShareDefine
|
| | | import PyMapTable
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import EventShell
|
| | |
| | | import PlayerWing
|
| | | import Operate_EquipStone
|
| | | import PassiveBuffEffMng
|
| | | import SkillCommon
|
| | | import PlayerMagicWeapon
|
| | | import time
|
| | | import json
|
| | | import FormulaControl
|
| | |
| | | import ShareDefine
|
| | | import PlayerAttrFruit
|
| | | import DataRecordPack
|
| | | import PyMapTable
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | |
| | | 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):
|
| | | # 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
|
| | | #
|
| | |
| | | PlayerFlashGiftbag.OnPlayerLogin(curPlayer)
|
| | | #限时抢购
|
| | | PlayerFlashSale.OnPlayerLogin(curPlayer)
|
| | | # # 消费VIP
|
| | | # PlayerCostVIP.CostVIPOnLogin(curPlayer, tick)
|
| | | # |
| | | # # 世界boss
|
| | | # 世界boss
|
| | | BossHurtMng.OnLogin(curPlayer)
|
| | | ChItem.Sync_ItemDayUseCnt(curPlayer)
|
| | | # # 悬赏登录通知
|
| | |
| | | # 绝版降临
|
| | | PlayerFairyCeremony.AddFCCostGold(curPlayer, costType, price)
|
| | | PlayerNewFairyCeremony.AddFCCostGold(curPlayer, costType, price)
|
| | | # 消费VIP
|
| | | # if costVIPGold < 0:
|
| | | # costVIPGold = price
|
| | | #PlayerCostVIP.AddCostVIPExp(curPlayer, costType, costVIPGold)
|
| | |
|
| | | # 事件汇报
|
| | | #===========================================================================
|
| | |
| | | # if expViewType == ShareDefine.Def_ViewExpType_KillNPC:
|
| | | # #mapID = GameWorld.GetMap().GetMapID()
|
| | | # #if mapID in ChConfig.Def_FBMapID_BZZDAll:
|
| | | # # nobleVIPOuterRate = PlayerCostVIP.GetBZZDExpAddRate(curPlayer)
|
| | | # # nobleVIPOuterRate = ...
|
| | | # # #nobleVIPAddExp += 0 if not nobleVIPOuterRate else int(addExp * nobleVIPOuterRate / float(ChConfig.Def_MaxRateValue))
|
| | | # # nobleVIPAddExp += nobleVIPOuterRate
|
| | | #
|
| | |
| | | import DataRecordPack
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import PyMapTable
|
| | | import NPCCommon
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
| | | #------------------------------------------------------------------------------
|
| | | import GameWorld
|
| | | import IPY_GameWorld
|
| | | import ReadChConfig
|
| | | import ItemControler
|
| | | import ChConfig
|
| | | import ItemCommon
|
| | |
| | | import ChPyNetSendPack
|
| | | import PlayerFamilyRedPacket
|
| | | import NetPackCommon
|
| | | import PyMapTable
|
| | | import PlayerCoin
|
| | | import IpyGameDataPY
|
| | | import PlayerTJG
|
| | | import ChEquip
|
| | |
|
| | | import time
|
| | | import FunctionNPCCommon
|
| | |
|
| | | # 定义配表外围索引
|
| | | (
|
| | | Def_NotifyMark, # 系统提示mark
|
| | | Def_NeedSpace, # 所需格子数
|
| | | Def_GiftInfo, # 奖品信息
|
| | | ) = range(3)
|
| | |
|
| | | # 定义奖励物品信息索引
|
| | | (
|
| | | Def_InfoIndex_ItemType, # 物品类型 |
| | | Def_InfoIndex_ItemID, # 物品id或定制物品索引
|
| | | Def_InfoIndex_ItemCount, # 物品个数
|
| | | Def_InfoIndex_IsBind, # 是否绑定
|
| | | ) = range(4)
|
| | |
|
| | |
|
| | | # 定义物品类型
|
| | | (
|
| | | Def_ItemType_CommonItem, # 一般物品
|
| | | Def_ItemType_AppointItem, # 特殊定制物品
|
| | | ) = range(2)
|
| | |
|
| | | ## 领取玩家充值豪礼奖励
|
| | | # @param giftNum:豪礼编号,从0开始
|
| | | # @return None
|
| | | def GetPlayerGoldGift(curPlayer, giftNum):
|
| | | |
| | | # 检查可否领取
|
| | | if not __CheckCanGetGift(curPlayer, giftNum):
|
| | | GameWorld.DebugLog("return can not Get GoldGift!!!")
|
| | | return
|
| | | |
| | | goldGiftInfo = ReadChConfig.GetEvalChConfig("GoldGiftInfo_%s" % giftNum)
|
| | | |
| | | # 检查背包
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = goldGiftInfo[Def_NeedSpace]
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | # 给物品
|
| | | if not __GiveGoldGift(curPlayer, goldGiftInfo[Def_GiftInfo]):
|
| | | return
|
| | | |
| | | # 全服提示
|
| | | notifyMark = goldGiftInfo[Def_NotifyMark]
|
| | | #如果有消息提示
|
| | | if notifyMark.strip() != "":
|
| | | PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName()])
|
| | | vipLV = curPlayer.GetVIPLv()
|
| | | msgParamList = [vipLV, curPlayer.GetPlayerName(), giftNum + 1]
|
| | | PlayerControl.WorldNotify(0, "GeRen_liubo_927007", msgParamList)
|
| | | |
| | | # 更新已领取成功标记
|
| | | __UpdateLVAwardGetRecord(curPlayer, giftNum)
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, giftNum)
|
| | | |
| | | # 通知客户端
|
| | | Sync_GoldGiftGetRecordInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | ## 通知充值豪礼领取记录信息
|
| | | # @param None
|
| | | # @return None
|
| | | def Sync_GoldGiftGetRecordInfo(curPlayer):
|
| | | #getRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftGetRecord, 0,
|
| | | # ChConfig.Def_PDictType_GoldGift)
|
| | | #ChPlayer.Sync_RewardGetRecordInfo(curPlayer, ShareDefine.Def_RewardType_GoldGift, getRecord)
|
| | | return
|
| | |
|
| | |
|
| | | ## 给玩家充值豪礼奖励物品
|
| | | # @param curPlayer:玩家实例
|
| | | # @param goldGiftInfoDict:充值豪礼物品配置字典
|
| | | # @return None
|
| | | def __GiveGoldGift(curPlayer, goldGiftInfoDict):
|
| | |
|
| | | goldGiftInfoList = __GetGoldGiftInfoList(curPlayer, goldGiftInfoDict)
|
| | | |
| | | # 如果找不到对应的奖励信息,则返回False
|
| | | if not goldGiftInfoList:
|
| | | return False
|
| | | |
| | | # 给物品
|
| | | for giftInfo in goldGiftInfoList:
|
| | | itemType = giftInfo[Def_InfoIndex_ItemType]
|
| | | itemCount = giftInfo[Def_InfoIndex_ItemCount]
|
| | | itemID = giftInfo[Def_InfoIndex_ItemID]
|
| | | isBind = 0
|
| | | if len(giftInfo) > Def_InfoIndex_IsBind:
|
| | | isBind = giftInfo[Def_InfoIndex_IsBind]
|
| | |
|
| | | if itemCount <= 0:
|
| | | continue
|
| | | |
| | | # 一般物品
|
| | | if itemType == Def_ItemType_CommonItem:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
|
| | | |
| | | # 特殊定制物品
|
| | | elif itemType == Def_ItemType_AppointItem:
|
| | | itemData = PyMapTable.GetPyMapTable("AppointItemList").GetRecord("ItemIndex", str(itemID))
|
| | | GameWorld.DebugLog("__GiveGoldGift itemData=%s" % itemData)
|
| | | if not itemData:
|
| | | GameWorld.ErrLog("__GiveGoldGift()itemType=%s,ItemIndex=%s not data" % (itemType, itemID))
|
| | | continue
|
| | | |
| | | if len(itemData) != 1:
|
| | | GameWorld.ErrLog("__GiveGoldGift()itemType=%s,ItemIndex=%s,recordCount=%s !=1 error" % \
|
| | | (itemType, itemID, len(itemData)))
|
| | | continue
|
| | | |
| | | itemDictData = itemData[0]
|
| | | itemDictData['IsBind'] = str(isBind)
|
| | | ItemControler.GivePlayerEquip(curPlayer, itemDictData)
|
| | |
|
| | | return True
|
| | |
|
| | |
|
| | | ## 给玩家充值豪礼奖励物品信息列表
|
| | | # @param curPlayer:玩家实例
|
| | | # @param awardItemInfoDict:奖励物品配置字典
|
| | | # @return None
|
| | | def __GetGoldGiftInfoList(curPlayer, goldGiftInfoDict):
|
| | | infoKey = () # 默认key
|
| | | job = curPlayer.GetJob()
|
| | | for key in goldGiftInfoDict.keys():
|
| | | # 如果玩家职业在配置的key里,则取指定的key信息
|
| | | if job in key:
|
| | | infoKey = key
|
| | | break
|
| | | |
| | | return goldGiftInfoDict[infoKey]
|
| | |
|
| | |
|
| | | ## 更新领取记录
|
| | | # @param giftNum:豪礼编号,从0开始
|
| | | # @return None
|
| | | def __UpdateLVAwardGetRecord(curPlayer, giftNum):
|
| | | |
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftGetRecord, 0,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | |
| | | curValue = curValue|(1 << giftNum)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftGetRecord, curValue,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | return
|
| | |
|
| | | ## 检查可否领取
|
| | | # @param giftNum:豪礼编号
|
| | | # @return True-可领取
|
| | | def __CheckCanGetGift(curPlayer, giftNum):
|
| | | |
| | | needGoldCntList = ReadChConfig.GetEvalChConfig("NeedGoldCntList")
|
| | | |
| | | # 非法索引
|
| | | if giftNum < 0 or giftNum >= len(needGoldCntList):
|
| | | GameWorld.ErrLog("__CheckCanGetGift() error:not giftNum=%s" % (giftNum))
|
| | | return False
|
| | | |
| | | # 判断已冲元宝数是否满足
|
| | | curChangeCoin = curPlayer.GetChangeCoinPointTotal()
|
| | | curChangeGold = PlayerCoin.GetCoinRate() * curChangeCoin
|
| | | if curChangeGold < needGoldCntList[giftNum]:
|
| | | GameWorld.DebugLog("__CheckCanGetGift() curChangeGold not enough " + \
|
| | | "giftNum=%s,needGold=%s,changeGold=%s" % \
|
| | | (giftNum, needGoldCntList[giftNum], curChangeGold))
|
| | | return False
|
| | | |
| | | # 判断是否已领取
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftGetRecord, 0,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | return not (curValue & pow(2, giftNum))
|
| | |
|
| | |
|
| | | ##------------------------------------------------------------------------------
|
| | | def DoFirstGoldOpen(curPlayer):
|
| | |
| | | # @return: None
|
| | | def OnDay(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyChargeState, 0)
|
| | | |
| | | #===============================================================================================
|
| | | # curChangeCoin = curPlayer.GetChangeCoinPointTotal()
|
| | | # # 今天之前有充值过才需要处理天天首充
|
| | | # if curChangeCoin > 0:
|
| | | # # 天天首充状态开启
|
| | | # dailyGoldState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeState, 0)
|
| | | # if not dailyGoldState:
|
| | | # UpdateDailyGoldState(curPlayer, 1)
|
| | | # |
| | | # # 天天首充领奖状态 0-不可领;1-可领;2-已领
|
| | | # dailyGoldRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargePrizeRecord, 0)
|
| | | # if dailyGoldRecord != 1:
|
| | | # UpdateDailyGoldRecord(curPlayer, 0)
|
| | | #===============================================================================================
|
| | | |
| | | # 重置今日已充值数, 领取礼包索引
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt, 0)
|
| | | return
|
| | |
|
| | | ## 充值豪礼OnLogin
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt, updDailyGoldCnt)
|
| | | #PlayerControl.NotifyPlayerDictValue(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt)
|
| | |
|
| | | # 天天首充已开启才处理
|
| | | dailyGoldState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeState, 0)
|
| | | if dailyGoldState:
|
| | | # 天天首充领奖状态 0-不可领;1-可领;2-已领
|
| | | dailyGoldRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargePrizeRecord, 0)
|
| | | # 不可领的时候才置为可领
|
| | | if dailyGoldRecord == 0:
|
| | | UpdateDailyGoldRecord(curPlayer, 1)
|
| | | |
| | | # 充值达到额定元宝获得奖励,邮件发送
|
| | | __GiveGoldGiftByMail(curPlayer)
|
| | | return
|
| | |
|
| | | ## 玩家累计充值元宝发送邮件奖励
|
| | | # @param curPlayer: 玩家
|
| | | # @return: None
|
| | | def __GiveGoldGiftByMail(curPlayer):
|
| | | coinPointTotal = curPlayer.GetChangeCoinPointTotal()
|
| | | goldTotal = PlayerCoin.GetCoinRate() * coinPointTotal
|
| | | GameWorld.DebugLog("邮件发送充值豪礼:goldTotal=%s" % (goldTotal))
|
| | | if goldTotal <= 0:
|
| | | return
|
| | | |
| | | goldGiftByMailList = ReadChConfig.GetEvalChConfig("GoldGiftByMail")
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | for i, giftInfo in enumerate(goldGiftByMailList):
|
| | | |
| | | needGold = giftInfo[0]
|
| | | giftItemList = giftInfo[1]
|
| | | mailTitle = giftInfo[2]
|
| | | mailContent = giftInfo[3]
|
| | | getDays = giftInfo[4]
|
| | | |
| | | curMailRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftMailRecord, 0, |
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | |
| | | if curMailRecord&pow(2, i):
|
| | | GameWorld.DebugLog("邮件发送充值豪礼:已发送过!i=%s,needGold=%s" % (i, needGold))
|
| | | continue
|
| | | |
| | | if goldTotal < needGold:
|
| | | continue
|
| | | |
| | | if not PlayerControl.SendMail(mailTitle, mailContent, getDays, [playerID], giftItemList):
|
| | | continue
|
| | | |
| | | updMailRecord = curMailRecord|pow(2, i)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftMailRecord, updMailRecord,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | |
| | | GameWorld.DebugLog("邮件发送充值豪礼:i=%s,needGold=%s,giftItemList=%s,updMailRecord=%s" |
| | | % (i, needGold, str(giftItemList), updMailRecord))
|
| | | # 流向
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "GoldGiftSendMail_%s_%s" % (i, needGold))
|
| | | return
|
| | |
|
| | | ## 领取玩家天天首充奖励
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def GetPlayerDailyGoldChargeGift(curPlayer):
|
| | | |
| | | dailyGoldRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargePrizeRecord, 0)
|
| | | |
| | | if dailyGoldRecord != 1:
|
| | | GameWorld.DebugLog("天天首充不可领!当前状态=%s" % dailyGoldRecord)
|
| | | return
|
| | | |
| | | dailyFirstGoldPrizeInfo = ReadChConfig.GetEvalChConfig("GoldGiftInfoFirstDaily")
|
| | | |
| | | # 检查背包
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = dailyFirstGoldPrizeInfo[Def_NeedSpace]
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | # 给物品
|
| | | if not __GiveGoldGift(curPlayer, dailyFirstGoldPrizeInfo[Def_GiftInfo]):
|
| | | return
|
| | |
|
| | | # 全服提示
|
| | | notifyMark = dailyFirstGoldPrizeInfo[Def_NotifyMark]
|
| | | if notifyMark:
|
| | | PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName()])
|
| | |
|
| | | UpdateDailyGoldRecord(curPlayer, 2)
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "dailyFirstGoldPrize")
|
| | | return
|
| | |
|
| | |
|
| | | ## 更新天天首充奖励记录
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def UpdateDailyGoldRecord(curPlayer, record):
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargePrizeRecord, record)
|
| | | #Sync_DailyGoldRecordInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def Sync_FirstGoldInfo(curPlayer):
|
| | |
| | | import PlayerBillboard
|
| | | import PlayerActivity
|
| | | import PlayerSuccess
|
| | | import PyMapTable
|
| | | import ItemCommon
|
| | | import ItemControler
|
| | | import QuestCommon
|
| | |
| | | import PlayerControl
|
| | | import ShareDefine
|
| | | import EventShell
|
| | | import PyMapTable
|
| | | #---------------------------------------------------------------------
|
| | | Def_Exp_Formula = { ShareDefine.Def_Game_Exam_ZGTX:'ZGTX_GiveExp', #智冠天下
|
| | | ShareDefine.Def_Game_Exam_BSL:'BSL_GiveExp', #变色龙
|
| | |
| | | # @change: "2012-11-30 19:00" wdb 修改重读配置
|
| | | # @change: "2013-06-27 14:30" wdb 修改eval后加入缓存
|
| | | # @change: "2014-12-28 21:00" hxp PyMongoDataServer.ini配置读取
|
| | | # @change: "2015-08-19 13:50" xdh 支持重读pyMapTable
|
| | | # @change: "2017-07-03 20:00" hxp DB路径下配置文件读取支持
|
| | | #---------------------------------------------------------------------
|
| | | """Version = 2017-07-03 20:00"""
|
| | |
| | | import ConfigParser
|
| | | import ShareDefine
|
| | | import MapConfig
|
| | | import PyMapTable
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | #---------------------------------------------------------------------
|
| | |
| | |
|
| | | MapConfig.ClearConfig()
|
| | |
|
| | | PyMapTable.ClearPyMapTable()
|
| | | GameWorld.Log('MapServer_Reload_ChConfig')
|
| | | #关闭字典
|
| | | GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_ReloadConfig , 0)
|