16 卡牌服务端(仙盟珍宝阁支持;仙盟行为数据查询通知;去除特殊时间5点过天、过周、过月逻辑,统一保留0点触发;)
| | |
| | | PacketSubCMD_4=0x11
|
| | | PacketCallFunc_4=UpdateFamilyName
|
| | |
|
| | | PacketCMD_5=
|
| | | PacketSubCMD_5=
|
| | | PacketCallFunc_5=
|
| | | PacketCMD_5=0xA6
|
| | | PacketSubCMD_5=0x17
|
| | | PacketCallFunc_5=OnQueryFamilyAction
|
| | |
|
| | | PacketCMD_6=0xA6
|
| | | PacketSubCMD_6=0x12
|
| | |
| | | 1000 * 10, # 跨服妖魔boss
|
| | | 1000 * 10, # 仙盟阵法
|
| | | 1000 * 20, # 仙盟充值互助
|
| | | 1000 * 20, # 仙盟珍宝阁
|
| | | 1000 * 20, # 仙盟攻城战
|
| | | ]
|
| | | TYPE_Player_Tick_Count = len(TYPE_Player_Tick_Time)
|
| | |
| | | TYPE_Player_Tick_CrossYaomoBoss, #跨服妖魔boss
|
| | | TYPE_Player_Tick_FamilyZhenfa, #仙盟阵法
|
| | | TYPE_Player_Tick_FamilyCTGAssist, #仙盟充值互助
|
| | | TYPE_Player_Tick_FamilyZhenbaoge, #仙盟珍宝阁
|
| | | TYPE_Player_Tick_FamilyGCZ, #仙盟攻城战
|
| | | ) = range(0, TYPE_Player_Tick_Count)
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A6 17 查询家族行为信息 #tagCMQueryFamilyAction
|
| | |
|
| | | class tagCMQueryFamilyAction(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ActionType", c_ubyte), # 行为类型
|
| | | ("FamilyID", c_int), # 家族ID,发0默认自己家族
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA6
|
| | | self.SubCmd = 0x17
|
| | | 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 = 0xA6
|
| | | self.SubCmd = 0x17
|
| | | self.ActionType = 0
|
| | | self.FamilyID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMQueryFamilyAction)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A6 17 查询家族行为信息 //tagCMQueryFamilyAction:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ActionType:%d,
|
| | | FamilyID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ActionType,
|
| | | self.FamilyID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMQueryFamilyAction=tagCMQueryFamilyAction()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMQueryFamilyAction.Cmd,m_NAtagCMQueryFamilyAction.SubCmd))] = m_NAtagCMQueryFamilyAction
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A6 02 申请加入家族#tagCMRequesJoinFamily
|
| | |
|
| | | class tagCMRequesJoinFamily(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 13 家族行为信息 #tagMCFamilyActionInfo
|
| | |
|
| | | class tagMCFamilyAction(Structure):
|
| | | Time = 0 #(DWORD Time)//时间
|
| | | NameLen = 0 #(BYTE NameLen)
|
| | | Name = "" #(String Name)
|
| | | Value1 = 0 #(DWORD Value1)//数值1
|
| | | Value2 = 0 #(DWORD Value2)//数值2
|
| | | Value3 = 0 #(DWORD Value3)//数值3
|
| | | Value4 = 0 #(DWORD Value4)//数值4
|
| | | Value5 = 0 #(DWORD Value5)//数值5
|
| | | Value6 = 0 #(DWORD Value6)//数值6
|
| | | UseDataLen = 0 #(WORD UseDataLen)
|
| | | UseData = "" #(String UseData)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.Time,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Name,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
|
| | | self.Value1,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value2,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value3,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value4,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value5,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value6,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.UseDataLen,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.UseData,_pos = CommFunc.ReadString(_lpData, _pos,self.UseDataLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Time = 0
|
| | | self.NameLen = 0
|
| | | self.Name = ""
|
| | | self.Value1 = 0
|
| | | self.Value2 = 0
|
| | | self.Value3 = 0
|
| | | self.Value4 = 0
|
| | | self.Value5 = 0
|
| | | self.Value6 = 0
|
| | | self.UseDataLen = 0
|
| | | self.UseData = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.Name)
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 2
|
| | | length += len(self.UseData)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteDWORD(data, self.Time)
|
| | | data = CommFunc.WriteBYTE(data, self.NameLen)
|
| | | data = CommFunc.WriteString(data, self.NameLen, self.Name)
|
| | | data = CommFunc.WriteDWORD(data, self.Value1)
|
| | | data = CommFunc.WriteDWORD(data, self.Value2)
|
| | | data = CommFunc.WriteDWORD(data, self.Value3)
|
| | | data = CommFunc.WriteDWORD(data, self.Value4)
|
| | | data = CommFunc.WriteDWORD(data, self.Value5)
|
| | | data = CommFunc.WriteDWORD(data, self.Value6)
|
| | | data = CommFunc.WriteWORD(data, self.UseDataLen)
|
| | | data = CommFunc.WriteString(data, self.UseDataLen, self.UseData)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Time:%d,
|
| | | NameLen:%d,
|
| | | Name:%s,
|
| | | Value1:%d,
|
| | | Value2:%d,
|
| | | Value3:%d,
|
| | | Value4:%d,
|
| | | Value5:%d,
|
| | | Value6:%d,
|
| | | UseDataLen:%d,
|
| | | UseData:%s
|
| | | '''\
|
| | | %(
|
| | | self.Time,
|
| | | self.NameLen,
|
| | | self.Name,
|
| | | self.Value1,
|
| | | self.Value2,
|
| | | self.Value3,
|
| | | self.Value4,
|
| | | self.Value5,
|
| | | self.Value6,
|
| | | self.UseDataLen,
|
| | | self.UseData
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCFamilyActionInfo(Structure):
|
| | | Head = tagHead()
|
| | | FamilyID = 0 #(DWORD FamilyID)//家族ID
|
| | | ActionType = 0 #(BYTE ActionType)//类型
|
| | | Count = 0 #(WORD Count)//数量
|
| | | FamilyActionList = list() #(vector<tagMCFamilyAction> FamilyActionList)//size = Count |
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA5
|
| | | self.Head.SubCmd = 0x13
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.FamilyID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.ActionType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temFamilyActionList = tagMCFamilyAction()
|
| | | _pos = temFamilyActionList.ReadData(_lpData, _pos)
|
| | | self.FamilyActionList.append(temFamilyActionList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA5
|
| | | self.Head.SubCmd = 0x13
|
| | | self.FamilyID = 0
|
| | | self.ActionType = 0
|
| | | self.Count = 0
|
| | | self.FamilyActionList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 2
|
| | | for i in range(self.Count):
|
| | | length += self.FamilyActionList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.FamilyID)
|
| | | data = CommFunc.WriteBYTE(data, self.ActionType)
|
| | | data = CommFunc.WriteWORD(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.FamilyActionList[i].GetLength(), self.FamilyActionList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | FamilyID:%d,
|
| | | ActionType:%d,
|
| | | Count:%d,
|
| | | FamilyActionList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.FamilyID,
|
| | | self.ActionType,
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFamilyActionInfo=tagMCFamilyActionInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFamilyActionInfo.Head.Cmd,m_NAtagMCFamilyActionInfo.Head.SubCmd))] = m_NAtagMCFamilyActionInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 02 家族活跃令兑换结果 #tagMCFamilyActivityExchangeResult
|
| | |
|
| | | class tagMCFamilyActivityExchangeResult(Structure):
|
| | |
| | | #"""Version = 2024-10-29 17:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import GameWorld
|
| | | import PlayerControl
|
| | | import PlayerFamilyZhenbaoge
|
| | | import ChConfig
|
| | | import PlayerFamily
|
| | | import DBDataMgr
|
| | | import random
|
| | | import time
|
| | |
|
| | | ## GM命令执行入口
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "AB值没有填则按常规砍价价格计算")
|
| | | return
|
| | |
|
| | | if not curPlayer.GetFamilyID():
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if not familyID:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有仙盟")
|
| | | return
|
| | | |
| | | isSendGameServer = False
|
| | | curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
|
| | | if not curFamily:
|
| | | return
|
| | |
|
| | | value1 = msgList[0]
|
| | | if value1 == 0:
|
| | | isSendGameServer = True
|
| | | PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置仙盟珍宝阁OK")
|
| | | return
|
| | |
|
| | | elif value1 == "d":
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0)
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "设置退仙盟时间:%s" % GameWorld.ChangeTimeNumToStr(leaveFamilyTimeEx))
|
| | | return
|
| | |
|
| | | else:
|
| | | isSendGameServer = True
|
| | | #添加假砍价
|
| | | gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)
|
| | | if not gActionData:
|
| | | GameWorld.DebugAnswer(curPlayer, "请先重置珍宝阁")
|
| | | return
|
| | | |
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, PlayerFamilyZhenbaoge.ActionType)
|
| | | actionCount = familyAction.Count()
|
| | | |
| | | fackCount = value1
|
| | | randValue1 = msgList[1] if len(msgList) > 1 else 0
|
| | | randValue2 = msgList[2] if len(msgList) > 2 else 0
|
| | | syncActionDataList = [gActionData]
|
| | | startFackID = 1000 + actionCount
|
| | | FakeName = GameWorld.GbkToCode("假名字")
|
| | | for fackID in range(startFackID, startFackID + fackCount):
|
| | |
|
| | | return isSendGameServer
|
| | |
|
| | | playerID = fackID
|
| | | playerName = "%s%s" % (FakeName, fackID)
|
| | | |
| | | if randValue1 and randValue2 and randValue1 <= randValue2: |
| | | cutPrice = random.randint(randValue1, randValue2)
|
| | | else:
|
| | | cutPrice = PlayerFamilyZhenbaoge.CalcCutPrice(curFamily, gActionData, playerID)
|
| | | |
| | | if not cutPrice:
|
| | | continue
|
| | | |
| | | actionData = PlayerFamilyZhenbaoge.AddCutPrice(familyID, playerID, playerName, cutPrice, gActionData, False)
|
| | | syncActionDataList.append(actionData)
|
| | | nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
|
| | | GameWorld.DebugAnswer(curPlayer, "砍价人次:%s,砍价:%s,现价:%s" % (fackID % 1000, cutPrice, nowPrice))
|
| | | |
| | | PlayerFamily.SendFamilyAction(syncActionDataList)
|
| | | nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
|
| | | GameWorld.DebugAnswer(curPlayer, "添加假砍价数:%s,总砍价数:%s,当前价格:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
|
| | | return
|
| | |
| | | PlayerEventCounter.PlayerOnDay(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnDay(curPlayer, 0)
|
| | |
|
| | | if Get_PlayerGameServerInitOK_OnDayEx(curPlayer):
|
| | | PlayerEventCounter.PlayerOnDayEx(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnDayEx(curPlayer, 0)
|
| | | #if Get_PlayerGameServerInitOK_OnDayEx(curPlayer):
|
| | | # PlayerEventCounter.PlayerOnDayEx(curPlayer)
|
| | | # Set_PlayerGameServerInitOK_OnDayEx(curPlayer, 0)
|
| | |
|
| | | if Get_PlayerGameServerInitOK_OnWeek(curPlayer):
|
| | | PlayerEventCounter.PlayerOnWeek(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnWeek(curPlayer, 0)
|
| | |
|
| | | if Get_PlayerGameServerInitOK_OnWeekEx(curPlayer):
|
| | | PlayerEventCounter.PlayerOnWeekEx(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnWeekEx(curPlayer, 0)
|
| | | #if Get_PlayerGameServerInitOK_OnWeekEx(curPlayer):
|
| | | # PlayerEventCounter.PlayerOnWeekEx(curPlayer)
|
| | | # Set_PlayerGameServerInitOK_OnWeekEx(curPlayer, 0)
|
| | |
|
| | | if Get_PlayerGameServerInitOK_OnMonth(curPlayer):
|
| | | PlayerEventCounter.PlayerOnMonth(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnMonth(curPlayer, 0)
|
| | |
|
| | | if Get_PlayerGameServerInitOK_OnMonthEx(curPlayer):
|
| | | PlayerEventCounter.PlayerOnMonthEx(curPlayer)
|
| | | Set_PlayerGameServerInitOK_OnMonthEx(curPlayer, 0)
|
| | | #if Get_PlayerGameServerInitOK_OnMonthEx(curPlayer):
|
| | | # PlayerEventCounter.PlayerOnMonthEx(curPlayer)
|
| | | # Set_PlayerGameServerInitOK_OnMonthEx(curPlayer, 0)
|
| | |
|
| | | if Get_PlayerGameServerInitOK_OnYear(curPlayer):
|
| | | PlayerEventCounter.PlayerOnYear(curPlayer)
|
| | |
| | | def GetLeaveFamilyTimeEx(curPlayer):return curPlayer.GetExAttr19()
|
| | | def SetLeaveFamilyTimeEx(curPlayer, value):
|
| | | curPlayer.SetExAttr19(value)
|
| | | curPlayer.SendGameServerRefreshState(ShareDefine.CDBPlayerRefresh_ExAttr19, value, 0)
|
| | | #curPlayer.SendGameServerRefreshState(ShareDefine.CDBPlayerRefresh_ExAttr19, value, 0)
|
| | | curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ExAttr19, value, 0, False)
|
| | | return
|
| | |
|
| | |
| | | #删除所有的任务发布
|
| | | missionPubManager = GameWorld.GetGameWorld().GetDBMissionPubManager()
|
| | | missionPubManager.Clear()
|
| | | #仙盟
|
| | | PlayerFamily.FamilyOnDay()
|
| | |
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnDay(curPlayer)
|
| | | PlayerOnDayEx(curPlayer)
|
| | | |
| | | DoLogic_OnDayEx(tick)
|
| | | |
| | | PlayerBillboard.OnDay()
|
| | | PlayerViewCache.OnDay()
|
| | | return
|
| | |
|
| | | def DoLogic_OnDayEx(tick):
|
| | | GameWorld.Log("MapServer -> OnDayEx!")
|
| | | |
| | | |
| | | PlayerMail.OnDayEx()
|
| | | PlayerControl.RemoveTimeoutLeaveServerPlayerInfo(tick)
|
| | | PlayerBillboard.OnDay()
|
| | | PlayerViewCache.OnDay()
|
| | | return
|
| | |
|
| | | def DoLogic_OnHour(tick):
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnWeek(curPlayer)
|
| | | PlayerOnWeekEx(curPlayer)
|
| | |
|
| | | #副本OnWeek事件响应
|
| | | FBLogic.OnWeek(tick)
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnMonth(curPlayer)
|
| | | PlayerOnMonthEx(curPlayer)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | GameWorld.Log("PlayerOnDay! ondayValue=%s" % (ondayValue), playerID)
|
| | |
|
| | | __DoPlayerOnDay(curPlayer, ShareDefine.Def_OnEventType)
|
| | | |
| | | GameWorld.Log("PlayerOnDay OK!", playerID)
|
| | | return
|
| | | |
| | | def PlayerOnDayEx(curPlayer):
|
| | | #记录玩家字典值,待初始化后执行
|
| | | if not curPlayer.GetGameServerInitOK():
|
| | | GameServerRefresh.Set_PlayerGameServerInitOK_OnDayEx(curPlayer , 1)
|
| | | return
|
| | | |
| | | ondayValue = __Get_Can_OnDayEx(curPlayer)
|
| | | if not ondayValue:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDayEx, ondayValue)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("PlayerOnDayEx! ondayValue=%s" % (ondayValue), playerID)
|
| | | |
| | | __DoPlayerOnDay(curPlayer, ShareDefine.Def_OnEventTypeEx)
|
| | |
|
| | | GameWorld.Log("PlayerOnDayEx OK!", playerID)
|
| | | GameWorld.Log("PlayerOnDay OK!", playerID)
|
| | | return
|
| | |
|
| | | def __DoPlayerOnDay(curPlayer, onEventType):
|
| | |
| | | GameWorld.Log("PlayerOnWeek! onWeekValue=%s" % (onWeekValue), playerID)
|
| | |
|
| | | __DoPlayerOnWeek(curPlayer, ShareDefine.Def_OnEventType)
|
| | | |
| | | GameWorld.Log("PlayerOnWeek OK!", playerID)
|
| | | return
|
| | |
|
| | | def PlayerOnWeekEx(curPlayer):
|
| | | #记录玩家字典值,待初始化后执行
|
| | | if not curPlayer.GetGameServerInitOK():
|
| | | GameServerRefresh.Set_PlayerGameServerInitOK_OnWeekEx(curPlayer , 1)
|
| | | return
|
| | | |
| | | onWeekValue = __Get_Can_OnWeekEx(curPlayer)
|
| | | if not onWeekValue:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeekEx, onWeekValue)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("PlayerOnWeekEx! onWeekValue=%s" % (onWeekValue), playerID)
|
| | | |
| | | __DoPlayerOnWeek(curPlayer, ShareDefine.Def_OnEventTypeEx)
|
| | |
|
| | | GameWorld.Log("PlayerOnWeekEx OK!", playerID)
|
| | | GameWorld.Log("PlayerOnWeek OK!", playerID)
|
| | | return
|
| | |
|
| | | def __DoPlayerOnWeek(curPlayer, onEventType):
|
| | |
| | | GameWorld.Log("PlayerOnMonth! onMonthValue=%s" % (onMonthValue), playerID)
|
| | |
|
| | | __DoPlayerOnMonth(curPlayer, ShareDefine.Def_OnEventType)
|
| | | |
| | | GameWorld.Log("PlayerOnMonth OK!", playerID)
|
| | | return
|
| | |
|
| | | def PlayerOnMonthEx(curPlayer):
|
| | | #记录玩家字典值,待初始化后执行
|
| | | if not curPlayer.GetGameServerInitOK():
|
| | | GameServerRefresh.Set_PlayerGameServerInitOK_OnMonthEx(curPlayer , 1)
|
| | | return
|
| | | |
| | | onMonthValue = __Get_Can_OnMonthEx(curPlayer)
|
| | | if not onMonthValue:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnMonthEx, onMonthValue)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("PlayerOnMonthEx! onMonthValue=%s" % (onMonthValue), playerID)
|
| | | |
| | | __DoPlayerOnMonth(curPlayer, ShareDefine.Def_OnEventTypeEx)
|
| | |
|
| | | GameWorld.Log("PlayerOnMonthEx OK!", playerID)
|
| | | GameWorld.Log("PlayerOnMonth OK!", playerID)
|
| | | return
|
| | |
|
| | | def __DoPlayerOnMonth(curPlayer, onEventType):
|
| | |
| | | PlayerOnDay(curPlayer)
|
| | |
|
| | | #OnDayEx事件
|
| | | if __Get_Can_OnDayEx(curPlayer):
|
| | | PlayerOnDayEx(curPlayer)
|
| | | #if __Get_Can_OnDayEx(curPlayer):
|
| | | # PlayerOnDayEx(curPlayer)
|
| | |
|
| | | #OnWeek事件
|
| | | if __Get_Can_OnWeek(curPlayer):
|
| | | PlayerOnWeek(curPlayer)
|
| | |
|
| | | #OnWeekEx事件
|
| | | if __Get_Can_OnWeekEx(curPlayer):
|
| | | PlayerOnWeekEx(curPlayer)
|
| | | #if __Get_Can_OnWeekEx(curPlayer):
|
| | | # PlayerOnWeekEx(curPlayer)
|
| | |
|
| | | #OnMonth事件
|
| | | if __Get_Can_OnMonth(curPlayer):
|
| | | PlayerOnMonth(curPlayer)
|
| | |
|
| | | #OnMonthEx事件
|
| | | if __Get_Can_OnMonthEx(curPlayer):
|
| | | PlayerOnMonthEx(curPlayer)
|
| | | #if __Get_Can_OnMonthEx(curPlayer):
|
| | | # PlayerOnMonthEx(curPlayer)
|
| | |
|
| | | #OnYear事件
|
| | | if __Get_Can_OnYear(curPlayer):
|
| | |
| | | return dateTime_Day
|
| | | return 0
|
| | |
|
| | | def __Get_Can_OnDayEx(curPlayer):
|
| | | '''判断可否凌晨X点过天
|
| | | @return: 0-不可; >0-可以, 且代表的是过天需记录的值
|
| | | '''
|
| | | curDateTime = GameWorld.GetCurrentTime()
|
| | | |
| | | # 上次过天记录格式: 年月日, 如20171027
|
| | | lastOndayEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnDayEx)
|
| | | #GameWorld.DebugLog("__Get_Can_OnDayEx lastOndayEx=%s" % (lastOndayEx))
|
| | | if lastOndayEx:
|
| | | lastOndayEx_Year = lastOndayEx / 10000
|
| | | lastOndayEx_Month = lastOndayEx % 10000 / 100
|
| | | lastOndayEx_Day = lastOndayEx % 100
|
| | | #GameWorld.DebugLog("lastOndayEx_Year=%s,lastOndayEx_Month=%s,lastOndayEx_Day=%s" % (lastOndayEx_Year, lastOndayEx_Month, lastOndayEx_Day))
|
| | | |
| | | # 上次过天的日期0点
|
| | | lastDatetime = datetime.datetime(lastOndayEx_Year, lastOndayEx_Month, lastOndayEx_Day, 0, 0, 0)
|
| | | passTime = curDateTime - lastDatetime
|
| | | passDays = passTime.days
|
| | | passSeconds = passTime.seconds
|
| | | |
| | | # 如果时间差没有超过1天,代表还未过天
|
| | | if passDays == 0:
|
| | | #GameWorld.DebugLog("如果时间差没有超过1天,代表还未过天, passDays=%s" % passDays)
|
| | | return 0
|
| | | # 等于1天的, 时间差需 >= X时才可过天, 即 X * 3600 秒
|
| | | if passDays == 1 and passSeconds < ShareDefine.Def_OnEventHour * 3600:
|
| | | #GameWorld.DebugLog("等于1天的, 时间差需 >= X时才可过天, 即 X * 3600 秒, passSeconds=%s" % passSeconds)
|
| | | return 0
|
| | | #if passDays < 0:
|
| | | # GameWorld.DebugLog("时间天差小于0,一般为异常情况,只有时间往回调才回出现!默认允许过天,passDays=%s" % passDays)
|
| | | # 大于1天的无论什么时间点都可以过天
|
| | | |
| | | if curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | curDateTime = curDateTime - datetime.timedelta(days=1)
|
| | | #GameWorld.Log("OnDayEx 特殊X点之前过天的,代表天差大于1天的时间过天,这时候的过天值需设置为昨天 %s" % curDateTime)
|
| | | |
| | | dateTime_Day = curDateTime.day
|
| | | dateTime_Month = curDateTime.month
|
| | | dateTime_Year = curDateTime.year
|
| | | #GameWorld.DebugLog("可以过天")
|
| | | return dateTime_Year * 10000 + dateTime_Month * 100 + dateTime_Day
|
| | |
|
| | | ## 检查玩家是否可以OnWeek
|
| | | # @param curPlayer 当前玩家
|
| | | # @param curMission 当前任务
|
| | |
| | | if (dateTime_Week != player_Week):
|
| | | return dateTime_Week
|
| | | return 0
|
| | |
|
| | | def __Get_Can_OnWeekEx(curPlayer):
|
| | | '''判断可否凌晨X点过周
|
| | | @return: 0-不可; >0-可以, 且代表的是过周需记录的值
|
| | | '''
|
| | | curDateTime = GameWorld.GetCurrentTime()
|
| | | isocalendar = datetime.datetime.isocalendar(curDateTime)
|
| | | dateTime_year, dateTime_week, dateTime_day = isocalendar
|
| | | |
| | | # 上次过周记录格式: 年周, 如201752
|
| | | lastOnWeekEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnWeekEx)
|
| | | #GameWorld.DebugLog("__Get_Can_OnWeekEx lastOnWeekEx=%s,dateTime_year=%s,week=%s,day=%s" |
| | | # % (lastOnWeekEx, dateTime_year, dateTime_week, dateTime_day))
|
| | | if lastOnWeekEx:
|
| | | lastOnWeekEx_Year = lastOnWeekEx / 100
|
| | | lastOnWeekEx_Week = lastOnWeekEx % 100
|
| | | # 本周已经过周过
|
| | | if dateTime_year == lastOnWeekEx_Year and dateTime_week == lastOnWeekEx_Week:
|
| | | #GameWorld.DebugLog("本周已经过周过")
|
| | | return 0
|
| | | |
| | | # 当前天为每周第一天的时候,需判断周差为1时当前时间点是否超过5点
|
| | | if dateTime_day == 1:
|
| | | preWeekDateTime = curDateTime - datetime.timedelta(days=7) # 上一周的datetime(即周差为1)
|
| | | preWeek_year, preWeek_week, preWeek_day = datetime.datetime.isocalendar(preWeekDateTime)
|
| | | |
| | | # 上次过周的刚好是周差1, 则需判断当前时间点是否超过X时
|
| | | if preWeek_year == lastOnWeekEx_Year and preWeek_week == lastOnWeekEx_Week:
|
| | | if curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | #GameWorld.DebugLog("本周第一天,未到达过周时间点, hour=%s" % curDateTime.hour)
|
| | | return 0
|
| | | |
| | | # 周差不为1的时候,则无论什么时间点均可过周
|
| | | else:
|
| | | #GameWorld.DebugLog("周差不为1的时候,则无论什么时间点均可过周, 可以过周")
|
| | | pass
|
| | | |
| | | # 不是每周第一天的时候,则无论什么时间点均可过周
|
| | | else:
|
| | | #GameWorld.DebugLog("不是每周第一天的时候,则无论什么时间点均可过周, 可以过周")
|
| | | pass
|
| | | |
| | | if dateTime_day == 1 and curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | onWeekDateTime = curDateTime - datetime.timedelta(days=7) # 上一周的datetime(即周差为1)
|
| | | dateTime_year, dateTime_week, dateTime_day = datetime.datetime.isocalendar(onWeekDateTime)
|
| | | #GameWorld.Log("OnWeekEx 周一特殊X点之前过天的,代表周差大于1天的周一过周,这时候的过周值需设置为上周 %s" % onWeekDateTime)
|
| | | |
| | | #GameWorld.DebugLog("可以过周")
|
| | | return dateTime_year * 100 + dateTime_week
|
| | |
|
| | | ## 检查玩家是否可以OnMonth
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | if (dateTime_Month != player_Month or dateTime_Year != player_Year):
|
| | | return dateTime_Month
|
| | | return 0
|
| | |
|
| | | def __Get_Can_OnMonthEx(curPlayer):
|
| | | '''判断可否凌晨X点过月
|
| | | @return: 0-不可; >0-可以, 且代表的是过月需记录的值
|
| | | '''
|
| | | curDateTime = GameWorld.GetCurrentTime()
|
| | | dateTime_day = curDateTime.day
|
| | | dateTime_month = curDateTime.month
|
| | | dateTime_year = curDateTime.year
|
| | | |
| | | # 上次过月记录格式: 年月, 如201712
|
| | | lastOnMonthEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnMonthEx)
|
| | | #GameWorld.DebugLog("__Get_Can_OnMonthEx lastOnMonthEx=%s,dateTime_year=%s,dateTime_month=%s" |
| | | # % (lastOnMonthEx, dateTime_year, dateTime_month))
|
| | | if lastOnMonthEx:
|
| | | lastOnMonthEx_Year = lastOnMonthEx / 100
|
| | | lastOnMonthEx_Month = lastOnMonthEx % 100
|
| | | # 本月已经过月过
|
| | | if dateTime_year == lastOnMonthEx_Year and dateTime_month == lastOnMonthEx_Month:
|
| | | #GameWorld.DebugLog("本月已经过月过")
|
| | | return 0
|
| | | |
| | | # 当前天为每月第一天的时候,需判断月差为1时当前时间点是否超过5点
|
| | | if dateTime_day == 1:
|
| | | preMonth_month = 12 if dateTime_month == 1 else dateTime_month - 1 # 上一月
|
| | | preMonth_year = dateTime_year if preMonth_month != 12 else dateTime_year - 1 # 上一月所属年
|
| | | |
| | | # 上次过月的刚好是月差1, 则需判断当前时间点是否超过X时
|
| | | if preMonth_year == lastOnMonthEx_Year and preMonth_month == lastOnMonthEx_Month:
|
| | | if curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | #GameWorld.DebugLog("本月第一天,未到达过月时间点, hour=%s" % curDateTime.hour)
|
| | | return 0
|
| | | |
| | | # 月差不为1的时候,则无论什么时间点均可过月
|
| | | else:
|
| | | #GameWorld.DebugLog("月差不为1的时候,则无论什么时间点均可过月, 可以过月")
|
| | | pass
|
| | | |
| | | # 不是每月第一天的时候,则无论什么时间点均可过月
|
| | | else:
|
| | | #GameWorld.DebugLog("不是每月第一天的时候,则无论什么时间点均可过月, 可以过月")
|
| | | pass
|
| | | |
| | | if dateTime_day == 1 and curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | dateTime_month = 12 if dateTime_month == 1 else dateTime_month - 1 # 上一月
|
| | | dateTime_year = dateTime_year if dateTime_month != 12 else dateTime_year - 1 # 上一月所属年
|
| | | #GameWorld.Log("OnMonthEx 月1号特殊X点之前过天的,代表月差大于1的月1号过月,这时候的过月值需设置为上月。%d%02d" % (dateTime_year, dateTime_month))
|
| | | |
| | | #GameWorld.DebugLog("可以过月")
|
| | | return dateTime_year * 100 + dateTime_month
|
| | |
|
| | | ## 检查玩家是否可以OnYear
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | import PlayerFamilyTech
|
| | | import PlayerFamilyEmblem
|
| | | import PlayerFamilyZhenfa
|
| | | import PlayerFamilyZhenbaoge
|
| | | import IPY_PlayerDefine
|
| | | import IpyGameDataPY
|
| | | import IPY_GameWorld
|
| | |
| | | IPY_PlayerDefine.fmlViceLeader:"DeputyLeaderMax",
|
| | | }
|
| | |
|
| | | def FamilyOnDay():
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | |
| | | familyManager = DBDataMgr.GetFamilyMgr()
|
| | | for i in range(0, familyManager.GetCount()):
|
| | | family = familyManager.GetAt(i)
|
| | | #珍宝阁
|
| | | PlayerFamilyZhenbaoge.OnDay(family)
|
| | | |
| | | return
|
| | |
|
| | | def PlayerOnDay(curPlayer):
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Family):
|
| | | return
|
| | |
| | | Sync_FamilyDayRewardState(curPlayer)
|
| | | __FamilyAffair_Refresh(curPlayer, True)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 0)
|
| | | #PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer)
|
| | | PlayerFamilyZhenbaoge.PlayerOnDay(curPlayer)
|
| | | return
|
| | |
|
| | | def OnPlayerLogin(curPlayer, tick):
|
| | |
| | | PlayerFamilyTech.Sync_PlayerFamilyTechLV(curPlayer)
|
| | | __FamilyAffair_CheckReset(curPlayer)
|
| | | PlayerFamilyZhenfa.OnPlayerLogin(curPlayer)
|
| | | #PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer)
|
| | | PlayerFamilyZhenbaoge.OnPlayerLogin(curPlayer)
|
| | | return
|
| | |
|
| | | def OnPlayerLogout(curPlayer):
|
| | |
| | | #XW_JZ_EstablishSud <n color="255,255,0">恭喜您,家族建立成功!</n> 25 - -
|
| | | PlayerControl.NotifyCode(curPlayer, "XW_JZ_EstablishSud")
|
| | | PlayerControl.WorldNotify(0, "jiazu_liubo_671654", [curPlayer.GetName(), fullFamilyName, newFamilyID])
|
| | | #PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
|
| | | PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
|
| | | return
|
| | |
|
| | | def CheckInputFamilyName(curPlayer, inputName):
|
| | |
| | |
|
| | | ## ------------------------------------------------------------------------------------------------
|
| | |
|
| | | #// A6 17 查询家族行为信息 #tagCMQueryFamilyAction
|
| | | #
|
| | | #struct tagCMQueryFamilyAction
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE ActionType; // 行为类型
|
| | | # DWORD FamilyID; // 家族ID,发0默认自己家族
|
| | | #};
|
| | | def OnQueryFamilyAction(index, cliendData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | actionType = cliendData.ActionType
|
| | | familyID = cliendData.FamilyID
|
| | | if not familyID:
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | |
| | | SendFamilyActionInfo(curPlayer, familyID, actionType)
|
| | | return
|
| | |
|
| | | def SendFamilyActionInfo(curPlayer, familyID, actionType):
|
| | | ## 发送家族行为
|
| | | # @param curPlayer: 为None时通知该仙盟所有成员
|
| | | |
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, actionType)
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCFamilyActionInfo()
|
| | | clientPack.FamilyID = familyID
|
| | | clientPack.ActionType = actionType
|
| | | clientPack.FamilyActionList = []
|
| | | |
| | | for index in xrange(familyAction.Count()):
|
| | | familyActionData = familyAction.At(index)
|
| | | |
| | | actionData = ChPyNetSendPack.tagMCFamilyAction()
|
| | | actionData.Time = familyActionData.GetTime()
|
| | | actionData.Name = familyActionData.GetName()
|
| | | actionData.NameLen = len(actionData.Name)
|
| | | actionData.Value1 = familyActionData.GetValue1()
|
| | | actionData.Value2 = familyActionData.GetValue2()
|
| | | actionData.Value3 = familyActionData.GetValue3()
|
| | | actionData.Value4 = familyActionData.GetValue4()
|
| | | actionData.Value5 = familyActionData.GetValue5()
|
| | | actionData.Value6 = familyActionData.GetValue6()
|
| | | actionData.UseData = familyActionData.GetUserData()
|
| | | actionData.UseDataLen = len(actionData.UseData)
|
| | | clientPack.FamilyActionList.append(actionData)
|
| | | |
| | | clientPack.Count = len(clientPack.FamilyActionList)
|
| | | |
| | | if curPlayer:
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | | Broadcast_FamilyPack(familyID, clientPack)
|
| | | return
|
| | |
|
| | | def SendFamilyAction(actionDataList, curPlayer=None):
|
| | | ## 同步指定仙盟action
|
| | | # @param actionDataList: 支持列表或指定actionData
|
| | | # @param curPlayer: 为None时通知该仙盟所有成员
|
| | | if not isinstance(actionDataList, list):
|
| | | actionDataList = [actionDataList]
|
| | | if not actionDataList:
|
| | | return
|
| | | familyActionData = actionDataList[0]
|
| | | familyID = familyActionData.GetFamilyID()
|
| | | actionType = familyActionData.GetActionType()
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCFamilyActionInfo()
|
| | | clientPack.FamilyID = familyID
|
| | | clientPack.ActionType = actionType
|
| | | clientPack.FamilyActionList = []
|
| | | for familyActionData in actionDataList:
|
| | | actionData = ChPyNetSendPack.tagMCFamilyAction()
|
| | | actionData.Time = familyActionData.GetTime()
|
| | | actionData.Name = familyActionData.GetName()
|
| | | actionData.NameLen = len(actionData.Name)
|
| | | actionData.Value1 = familyActionData.GetValue1()
|
| | | actionData.Value2 = familyActionData.GetValue2()
|
| | | actionData.Value3 = familyActionData.GetValue3()
|
| | | actionData.Value4 = familyActionData.GetValue4()
|
| | | actionData.Value5 = familyActionData.GetValue5()
|
| | | actionData.Value6 = familyActionData.GetValue6()
|
| | | actionData.UseData = familyActionData.GetUserData()
|
| | | actionData.UseDataLen = len(actionData.UseData)
|
| | | clientPack.FamilyActionList.append(actionData)
|
| | | clientPack.Count = len(clientPack.FamilyActionList)
|
| | | |
| | | if curPlayer:
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | | Broadcast_FamilyPack(familyID, clientPack)
|
| | | return
|
| | |
|
| | | def GetFamilyDayAward(curPlayer):
|
| | | ##领取仙盟每日奖励 2小时脱机挂时间
|
| | | return
|
| | |
| | | import ChConfig
|
| | | import ShareDefine
|
| | | import IpyGameDataPY
|
| | | import NetPackCommon
|
| | | import ChPyNetSendPack
|
| | | import ItemControler
|
| | | import PlayerControl
|
| | | import PlayerFamily
|
| | | import GameWorld
|
| | | import DBDataMgr
|
| | |
|
| | | import random
|
| | | import time
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import ItemControler
|
| | | import PlayerControl
|
| | |
|
| | | ActionType = ShareDefine.Def_ActionType_Zhenbaoge
|
| | | ActionGlobalID = 1 # 全局记录ID
|
| | |
| | | SetFAPrice(gActionData, abs(totalPrice))
|
| | | SetFAIsNegative(gActionData, 1 if totalPrice < 0 else 0)
|
| | | return
|
| | | def GetFAItemList(gActionData): return eval(gActionData.GetUseData()) # 物品列表
|
| | | def SetFAItemList(gActionData, itemList):
|
| | | dataStr = str(itemList)
|
| | | gActionData.SetUseData(dataStr, len(dataStr))
|
| | | return
|
| | | def GetFAItemList(gActionData): return eval(gActionData.GetUserData()) # 物品列表
|
| | | def SetFAItemList(gActionData, itemList): gActionData.SetUserData(itemList)
|
| | |
|
| | | # 成员砍价记录
|
| | | #Time 砍价时间戳
|
| | |
| | | def GetFABuyState(actionData): return actionData.GetValue3() # 玩家是否已购买
|
| | | def SetFABuyState(actionData, buyState): return actionData.SetValue3(buyState)
|
| | |
|
| | | def OnDayEx(family):
|
| | | def OnDay(family):
|
| | | OnZhenbaogeReset(family)
|
| | | return
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | Sync_ZhenbaogeInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def PlayerOnDay(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 0)
|
| | | Sync_ZhenbaogeInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def OnZhenbaogeReset(family):
|
| | |
| | |
|
| | | familyID = family.GetID()
|
| | |
|
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
|
| | | actionMgr = DBDataMgr.GetFamilyActionMgr()
|
| | | actionMgr.DelFamilyAction(familyID, ActionType)
|
| | | familyAction = actionMgr.GetFamilyAction(familyID, ActionType)
|
| | | gActionData = familyAction.AddAction()
|
| | | SetFAPlayerID(gActionData, ActionGlobalID)
|
| | |
|
| | |
| | | SetFAPriceFinal(gActionData, initPrice)
|
| | | SetFAItemList(gActionData, itemList)
|
| | |
|
| | | #PlayerFamilyAction.SendFamilyAction(gActionData)
|
| | | PlayerFamily.SendFamilyAction(gActionData)
|
| | | GameWorld.DebugLog("珍宝阁重置! familyID=%s,itemList=%s" % (familyID, itemList), familyID)
|
| | | return
|
| | |
|
| | | def GetZhenbaogeActionData(familyID, playerID):
|
| | | ## 获取Action
|
| | | ## 获取珍宝阁Action
|
| | | findActionData = None
|
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
|
| | | for index in range(0, familyAction.Count()):
|
| | |
| | | break
|
| | | return findActionData
|
| | |
|
| | | def MapServer_ZhenbaogeOP(curPlayer, msgList):
|
| | | mapID = curPlayer.GetRealMapID()
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("MapServer_ZhenbaogeOP mapID=%s,msgList=%s" % (mapID, msgList), playerID)
|
| | | if not msgList:
|
| | | return
|
| | | |
| | | curFamily = curPlayer.GetFamily()
|
| | | if not curFamily:
|
| | | return
|
| | | |
| | | familyID = curFamily.GetID()
|
| | | gActionData = GetZhenbaogeActionData(familyID, ActionGlobalID)
|
| | | if not gActionData:
|
| | | GameWorld.DebugLog("珍宝阁还没有刷新! familyID=%s" % familyID, playerID)
|
| | | return
|
| | | |
| | | msgType, dataMsg = msgList
|
| | | ret = None
|
| | | |
| | | if msgType == "Cut":
|
| | | cutPrice = CalcCutPrice(curFamily, gActionData, playerID)
|
| | | if cutPrice:
|
| | | AddCutPrice(familyID, playerID, curPlayer.GetName(), cutPrice, gActionData)
|
| | | ret = [cutPrice]
|
| | | |
| | | elif msgType == "Buy":
|
| | | buyRet = __DoZhenbaogeBuy(familyID, playerID, gActionData, dataMsg)
|
| | | if buyRet:
|
| | | ret = [True] + list(buyRet)
|
| | | else:
|
| | | ret = [False]
|
| | | |
| | | if ret == None:
|
| | | return
|
| | | return msgList + (ret if isinstance(ret, list) else [ret])
|
| | |
|
| | | def CalcCutPrice(curFamily, gActionData, playerID):
|
| | | ## 计算砍价价格
|
| | | # @return: None-砍价限制等;>0-砍价值
|
| | |
|
| | | familyID = curFamily.GetID()
|
| | | if not curFamily:
|
| | | return
|
| | |
|
| | | familyID = curFamily.GetID()
|
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
|
| | | actionCount = familyAction.Count() # 其中1条是公共数据
|
| | | hadCutCount = actionCount - 1
|
| | | maxMemberCnt = PlayerFamily.GetFamilySetting(curFamily, ChConfig.Def_FamilySetting_MaxMemberCnt)
|
| | | |
| | | familyLV = curFamily.GetLV()
|
| | | fmLVIpyData = IpyGameDataPY.GetIpyGameData("Family", familyLV)
|
| | | if not fmLVIpyData:
|
| | | return
|
| | | maxMemberCnt = fmLVIpyData.GetMemberMax()
|
| | | if hadCutCount >= maxMemberCnt:
|
| | | GameWorld.ErrLog("已达到仙盟砍价人次上限! hadCutCount=%s >= %s,familyID=%s,familyLV=%s"
|
| | | % (hadCutCount, maxMemberCnt, familyID, curFamily.GetLV()), playerID)
|
| | | % (hadCutCount, maxMemberCnt, familyID, familyLV), playerID)
|
| | | return
|
| | |
|
| | | actionData = GetZhenbaogeActionData(familyID, playerID)
|
| | |
| | | cutWeight = cutIpyData.GetCutWeight()
|
| | | minRatio = cutIpyData.GetMinRatio()
|
| | | randRatio = cutIpyData.GetRandRatio()
|
| | | totalWeight = PlayerFamily.GetFamilySetting(curFamily, ChConfig.Def_FamilySetting_ZhenbaogeWeights)
|
| | | totalWeight = fmLVIpyData.GetZhenbaogeWeights()
|
| | | rand = random.random() #随机值 0~1
|
| | |
|
| | | initPrice = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 2)
|
| | |
| | | ## 添加砍价记录
|
| | | familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
|
| | | actionData = familyAction.AddAction()
|
| | | actionData.SetFamilyId(familyID)
|
| | | actionData.SetActionType(ActionType)
|
| | | actionData.SetTime(int(time.time()))
|
| | | actionData.SetName(playerName)
|
| | | SetFAPlayerID(actionData, playerID)
|
| | | SetFACutPrice(actionData, cutPrice)
|
| | |
| | | GameWorld.DebugLog("珍宝阁砍价更新: playerID=%s,cutPrice=%s,nowPrice=%s,updPrice=%s,familyID=%s"
|
| | | % (playerID, cutPrice, nowPrice, updPrice, familyID), playerID)
|
| | | if isNotify:
|
| | | pass
|
| | | #PlayerFamilyAction.SendFamilyAction([gActionData, actionData])
|
| | | PlayerFamily.SendFamilyAction([gActionData, actionData])
|
| | | return actionData
|
| | |
|
| | | def __DoZhenbaogeBuy(familyID, playerID, gActionData, dataMsg):
|
| | | playerMoneyValue = dataMsg[0]
|
| | | actionData = GetZhenbaogeActionData(familyID, playerID)
|
| | | if not actionData:
|
| | | GameWorld.DebugLog("珍宝阁未砍价,无法购买! familyID=%s" % familyID, playerID)
|
| | | return
|
| | | if GetFABuyState(actionData):
|
| | | GameWorld.DebugLog("珍宝阁已经购买过了! familyID=%s" % familyID, playerID)
|
| | | return
|
| | | nowPrice = GetFAPriceFinal(gActionData)
|
| | | if nowPrice > 0 and playerMoneyValue < nowPrice:
|
| | | GameWorld.DebugLog("玩家当前货币不足,无法购买珍宝阁物品! playerMoneyValue=%s < %s" % (playerMoneyValue, nowPrice), playerID)
|
| | | return
|
| | | |
| | | giveItemList = GetFAItemList(gActionData)
|
| | | GameWorld.DebugLog("珍宝阁购买! familyID=%s,nowPrice=%s,giveItemList=%s" % (familyID, nowPrice, giveItemList), playerID)
|
| | | |
| | | # 设置已买
|
| | | SetFABuyState(actionData, 1)
|
| | | #PlayerFamilyAction.SendFamilyAction(actionData)
|
| | | return nowPrice, giveItemList
|
| | |
|
| | |
|
| | |
|
| | | ##----------------------------------------- 珍宝阁 --------------------------------------------------
|
| | | #// A6 16 珍宝阁操作 #tagCMZhenbaogeOP
|
| | | #
|
| | | #struct tagCMZhenbaogeOP
|
| | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | opType = clientData.OpType
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if not curPlayer.GetFamilyID():
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if not familyID:
|
| | | GameWorld.DebugLog("没有仙盟无法操作珍宝阁!", playerID)
|
| | | return
|
| | | curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
|
| | | if not curFamily:
|
| | | return
|
| | | gActionData = GetZhenbaogeActionData(familyID, ActionGlobalID)
|
| | | if not gActionData:
|
| | | GameWorld.DebugLog("珍宝阁还没有刷新! familyID=%s" % familyID, playerID)
|
| | | return
|
| | |
|
| | | # 砍价
|
| | |
| | | if passTimes < cutCDTimes:
|
| | | GameWorld.DebugLog("今日已砍价变更仙盟砍价CD中! passTimes=%s < %s" % (passTimes, cutCDTimes), playerID)
|
| | | return
|
| | | SendGameServer_FamilyZhenbaoge(curPlayer, "Cut", [])
|
| | | |
| | | cutPrice = CalcCutPrice(curFamily, gActionData, playerID)
|
| | | if not cutPrice:
|
| | | return
|
| | |
|
| | | AddCutPrice(familyID, playerID, curPlayer.GetName(), cutPrice, gActionData)
|
| | | PlayerControl.NotifyCode(curPlayer, "ZhenbaogeCut", [cutPrice])
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeCut):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 1)
|
| | | Sync_ZhenbaogeInfo(curPlayer)
|
| | | |
| | | # 购买
|
| | | elif opType == 1:
|
| | | buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy)
|
| | |
| | | return
|
| | | moneyType = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 1)
|
| | | playerMoneyValue = PlayerControl.GetMoney(curPlayer, moneyType)
|
| | | SendGameServer_FamilyZhenbaoge(curPlayer, "Buy", [playerMoneyValue])
|
| | |
|
| | | return
|
| | |
|
| | | def SendGameServer_FamilyZhenbaoge(curPlayer, msgType, msgData):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_FamilyZhenbaoge, tick):
|
| | | GameWorld.DebugLog("请求CD中...", playerID)
|
| | | return
|
| | | GameWorld.DebugLog("珍宝阁同步GameServer: msgType=%s,%s" % (msgType, msgData), playerID)
|
| | | msgInfo = str([msgType, msgData])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "FamilyZhenbaoge", msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | def GameServer_FamilyZhenbaogeRet(curPlayer, resultList):
|
| | | curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_FamilyZhenbaoge, 0)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | msgType, _ = resultList[:2]
|
| | | retData = resultList[2:]
|
| | | GameWorld.Log("仙盟珍宝阁GameServer返回: %s" % str(resultList), playerID)
|
| | | if msgType == "Cut":
|
| | | cutPrice = retData[0]
|
| | | if not cutPrice:
|
| | | # 砍价失败不处理后续
|
| | | actionData = GetZhenbaogeActionData(familyID, playerID)
|
| | | if not actionData:
|
| | | GameWorld.DebugLog("珍宝阁未砍价,无法购买! familyID=%s" % familyID, playerID)
|
| | | return
|
| | | PlayerControl.NotifyCode(curPlayer, "ZhenbaogeCut", [cutPrice])
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeCut):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 1)
|
| | | Sync_ZhenbaogeInfo(curPlayer)
|
| | | if GetFABuyState(actionData):
|
| | | GameWorld.DebugLog("珍宝阁已经购买过了! familyID=%s" % familyID, playerID)
|
| | | return
|
| | |
|
| | | elif msgType == "Buy":
|
| | | isOK = retData[0]
|
| | | if not isOK:
|
| | | nowPrice = GetFAPriceFinal(gActionData)
|
| | | if nowPrice > 0 and playerMoneyValue < nowPrice:
|
| | | GameWorld.DebugLog("玩家当前货币不足,无法购买珍宝阁物品! playerMoneyValue=%s < %s" % (playerMoneyValue, nowPrice), playerID)
|
| | | return
|
| | | buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy)
|
| | | if buyState:
|
| | | #一天只能买一次,防止变更仙盟刷
|
| | | return
|
| | | nowPrice, giveItemList = retData[1:]
|
| | |
|
| | | moneyType = IpyGameDataPY.GetFuncCfg("Zhenbaoge", 1)
|
| | | giveItemList = GetFAItemList(gActionData)
|
| | | GameWorld.DebugLog("珍宝阁购买! familyID=%s,nowPrice=%s,giveItemList=%s" % (familyID, nowPrice, giveItemList), playerID)
|
| | | |
| | | # 设置已买
|
| | | SetFABuyState(actionData, 1)
|
| | | PlayerFamily.SendFamilyAction(actionData)
|
| | | |
| | | if nowPrice > 0:
|
| | | if not PlayerControl.PayMoney(curPlayer, moneyType, nowPrice, "Zhenbaoge"):
|
| | | GameWorld.ErrLog("珍宝阁购买货币不足! nowPrice=%s" % nowPrice, playerID)
|
| | |
| | | else: # 0不处理
|
| | | pass
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 1)
|
| | | Sync_ZhenbaogeInfo(curPlayer)
|
| | | |
| | | if giveItemList:
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, event=["Zhenbaoge", False, {}], isNotifyAward=False)
|
| | | ItemControler.NotifyGiveAwardInfo(curPlayer, giveItemList, "Zhenbaoge", moneyInfo={moneyType:0 if nowPrice > 0 else -nowPrice})
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 1)
|
| | | Sync_ZhenbaogeInfo(curPlayer)
|
| | | |
| | | |
| | | return
|
| | |
|
| | | def Sync_ZhenbaogeInfo(curPlayer):
|
| | |
| | | clientPack.BuyState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | ##--------------------------------------------------------------------------------------------------
|
| | |
|