From 515a08fe6e2937e086fcb65e886d521d70513b96 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 10 一月 2020 17:21:41 +0800
Subject: [PATCH] 8364 【恺英】【后端】缥缈随机任务(任务次数改为完成时才扣除;放弃任务改为只设置任务状态为未接)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPiaomiaoTask.py |   27 ++++++++++++++-------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py           |   12 ++++++------
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                |   12 ++++++------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |    2 +-
 4 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 07a2060..c39a7d2 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -21936,7 +21936,7 @@
 
 class  tagMCPiaomiaoTaskInfo(Structure):
     Head = tagHead()
-    TakeCount = 0    #(BYTE TakeCount)//今日已接次数
+    FinishCount = 0    #(BYTE FinishCount)//今日已完成次数
     RefreshCount = 0    #(BYTE RefreshCount)//今日已刷新次数
     TaskCount = 0    #(BYTE TaskCount)
     TaskIDList = list()    #(vector<DWORD> TaskIDList)//刷新任务ID列表[taskID,...]    
@@ -21951,7 +21951,7 @@
     def ReadData(self, _lpData, _pos=0, _Len=0):
         self.Clear()
         _pos = self.Head.ReadData(_lpData, _pos)
-        self.TakeCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.FinishCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.RefreshCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.TaskCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.TaskCount):
@@ -21964,7 +21964,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xA7
         self.Head.SubCmd = 0x20
-        self.TakeCount = 0
+        self.FinishCount = 0
         self.RefreshCount = 0
         self.TaskCount = 0
         self.TaskIDList = list()
@@ -21983,7 +21983,7 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
-        data = CommFunc.WriteBYTE(data, self.TakeCount)
+        data = CommFunc.WriteBYTE(data, self.FinishCount)
         data = CommFunc.WriteBYTE(data, self.RefreshCount)
         data = CommFunc.WriteBYTE(data, self.TaskCount)
         for i in range(self.TaskCount):
@@ -21993,14 +21993,14 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
-                                TakeCount:%d,
+                                FinishCount:%d,
                                 RefreshCount:%d,
                                 TaskCount:%d,
                                 TaskIDList:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
-                                self.TakeCount,
+                                self.FinishCount,
                                 self.RefreshCount,
                                 self.TaskCount,
                                 "..."
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 6b50cad..c631460 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3993,7 +3993,7 @@
 Def_PDict_TodayAssistMoneySocial = "TodayAssistMoneySocial" # 今日已获得协助货币 社交关系额外加成
 
 #缥缈任务
-Def_PDict_PiaomiaoTaskTakeCount = "PiaomiaoTaskTakeCount" # 今日已接任务次数
+Def_PDict_PiaomiaoTaskFinishCount = "PiaomiaoTaskFinishCount" # 今日已完成任务次数
 Def_PDict_PiaomiaoTaskRefreshCount = "PiaomiaoTaskRefreshCount" # 今日已刷新次数
 Def_PDict_PiaomiaoMaxGradeTaskID = "PiaomiaoMaxGradeTaskID" # 缥缈任务最大评分任务ID
 #-------------------------------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 07a2060..c39a7d2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -21936,7 +21936,7 @@
 
 class  tagMCPiaomiaoTaskInfo(Structure):
     Head = tagHead()
-    TakeCount = 0    #(BYTE TakeCount)//今日已接次数
+    FinishCount = 0    #(BYTE FinishCount)//今日已完成次数
     RefreshCount = 0    #(BYTE RefreshCount)//今日已刷新次数
     TaskCount = 0    #(BYTE TaskCount)
     TaskIDList = list()    #(vector<DWORD> TaskIDList)//刷新任务ID列表[taskID,...]    
@@ -21951,7 +21951,7 @@
     def ReadData(self, _lpData, _pos=0, _Len=0):
         self.Clear()
         _pos = self.Head.ReadData(_lpData, _pos)
-        self.TakeCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.FinishCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.RefreshCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.TaskCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.TaskCount):
@@ -21964,7 +21964,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xA7
         self.Head.SubCmd = 0x20
-        self.TakeCount = 0
+        self.FinishCount = 0
         self.RefreshCount = 0
         self.TaskCount = 0
         self.TaskIDList = list()
@@ -21983,7 +21983,7 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
-        data = CommFunc.WriteBYTE(data, self.TakeCount)
+        data = CommFunc.WriteBYTE(data, self.FinishCount)
         data = CommFunc.WriteBYTE(data, self.RefreshCount)
         data = CommFunc.WriteBYTE(data, self.TaskCount)
         for i in range(self.TaskCount):
@@ -21993,14 +21993,14 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
-                                TakeCount:%d,
+                                FinishCount:%d,
                                 RefreshCount:%d,
                                 TaskCount:%d,
                                 TaskIDList:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
-                                self.TakeCount,
+                                self.FinishCount,
                                 self.RefreshCount,
                                 self.TaskCount,
                                 "..."
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPiaomiaoTask.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPiaomiaoTask.py
index 6eed503..7d680ac 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPiaomiaoTask.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPiaomiaoTask.py
@@ -38,7 +38,7 @@
     return
 
 def OnDay(curPlayer):
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PiaomiaoTaskTakeCount, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PiaomiaoTaskFinishCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PiaomiaoTaskRefreshCount, 0)
     SyncPiaomiaoTaskInfo(curPlayer)
     return
@@ -144,10 +144,10 @@
 def OnTakePiaomiaoTask(curPlayer, curMission):
     ## 接缥缈任务
     
-    todayTakeCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoTaskTakeCount)
-    maxTakeCount = IpyGameDataPY.GetFuncCfg("PiaomiaoTask", 1)
-    if todayTakeCount >= maxTakeCount:
-        GameWorld.DebugLog("已达今日接任务上限!todayTakeCount=%s" % todayTakeCount)
+    finishCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoTaskFinishCount)
+    maxFinishCount = IpyGameDataPY.GetFuncCfg("PiaomiaoTask", 1)
+    if finishCount >= maxFinishCount:
+        GameWorld.DebugLog("已达今日任务上限!finishCount=%s" % finishCount)
         return
     
     for i in range(curPlayer.GetMissionCount()):
@@ -160,8 +160,6 @@
         if questData.Type == QuestCommon.Def_Mission_Type_Piaomiao and mission.GetState() != ChConfig.Def_Mission_State_NoAccept:
             GameWorld.DebugLog("已经有接了缥缈任务,无法再接!missionID=%s" % missionID)
             return
-        
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PiaomiaoTaskTakeCount, todayTakeCount + 1)
     
     QuestCommon.SetPlayerMissionState(curPlayer, curMission, 1)
     
@@ -175,6 +173,9 @@
 
 def OnFinishPiaomiaoTask(curPlayer, curMission):
     ## 完成缥缈任务
+    
+    finishTaskCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoTaskFinishCount) + 1
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PiaomiaoTaskFinishCount, finishTaskCount)
     
     missionID = curMission.GetMissionID()
     # 给奖励
@@ -199,8 +200,8 @@
     if delItemID:
         ItemCommon.DelMissionItem(curPlayer, IPY_GameWorld.rptItem, delItemID, 0, missionID)
         
-    GameWorld.DebugLog("完成缥缈任务: missionID=%s,exp=%s,goldPaper=%s,itemID=%s,delItemID=%s" 
-                       % (missionID, exp, goldPaper, itemID, delItemID))
+    GameWorld.DebugLog("完成缥缈任务: finishTaskCount=%s,missionID=%s,exp=%s,goldPaper=%s,itemID=%s,delItemID=%s" 
+                       % (finishTaskCount, missionID, exp, goldPaper, itemID, delItemID))
     
     # 删任务
     QuestCommon.DeleteMission(curPlayer, missionID)
@@ -209,11 +210,11 @@
     return
 
 def DoCancelPiaomiaoTask(curPlayer, curMission):
-    ## 放弃任务
+    ## 放弃任务,设置为未接状态,不重新刷新列表
     missionID = curMission.GetMissionID()
     GameWorld.DebugLog("放弃缥缈任务! missionID=%s" % missionID)
-    QuestCommon.DeleteMission(curPlayer, missionID)
-    __DoRefreshPiaomiaoTask(curPlayer)
+    QuestCommon.SetPlayerMissionState(curPlayer, curMission, ChConfig.Def_Mission_State_NoAccept)
+    EventShell.NotifyOneMission(curPlayer, curMission, isNotifyAll=False)
     return
 
 def SyncPiaomiaoTaskInfo(curPlayer):
@@ -231,7 +232,7 @@
         return
     
     taskInfo = ChPyNetSendPack.tagMCPiaomiaoTaskInfo()
-    taskInfo.TakeCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoTaskTakeCount)
+    taskInfo.FinishCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoTaskFinishCount)
     taskInfo.RefreshCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoTaskRefreshCount)
     taskInfo.TaskIDList = taskIDList
     taskInfo.TaskCount = len(taskIDList)

--
Gitblit v1.8.0