提交 | 用户 | age
|
a7d7f9
|
1 |
#!/usr/bin/python
|
H |
2 |
# -*- coding: GBK -*-
|
|
3 |
#-------------------------------------------------------------------------------
|
|
4 |
#
|
|
5 |
##@package Player.PlayerTongTianLing
|
|
6 |
#
|
|
7 |
# @todo:通天令
|
|
8 |
# @author hxp
|
|
9 |
# @date 2022-01-17
|
|
10 |
# @version 1.0
|
|
11 |
#
|
|
12 |
# 详细描述: 通天令
|
|
13 |
#
|
|
14 |
#-------------------------------------------------------------------------------
|
|
15 |
#"""Version = 2022-01-17 19:00"""
|
|
16 |
#-------------------------------------------------------------------------------
|
|
17 |
|
|
18 |
import GameWorld
|
b8d9c8
|
19 |
import ShareDefine
|
a7d7f9
|
20 |
import PlayerControl
|
H |
21 |
import IpyGameDataPY
|
|
22 |
import ChPyNetSendPack
|
|
23 |
import NetPackCommon
|
|
24 |
import ItemControler
|
|
25 |
import ChConfig
|
0e5941
|
26 |
import time
|
H |
27 |
|
|
28 |
TTL_LVAwardKeyCount = 2
|
|
29 |
TTL_TaskAwardKeyCount = 9
|
a7d7f9
|
30 |
|
H |
31 |
def OnPlayerLogin(curPlayer):
|
0e5941
|
32 |
if CheckTongTianLingReset(curPlayer):
|
H |
33 |
return
|
a7d7f9
|
34 |
SyncTongTianLVInfo(curPlayer)
|
H |
35 |
SyncTongTianTaskInfo(curPlayer)
|
|
36 |
SyncTongTianTaskAward(curPlayer)
|
|
37 |
return
|
|
38 |
|
b8d9c8
|
39 |
def OnDay(curPlayer, onEventType):
|
0e5941
|
40 |
|
b8d9c8
|
41 |
if onEventType == ShareDefine.Def_OnEventType:
|
H |
42 |
# 常规时间0点过天检查重置
|
|
43 |
if CheckTongTianLingReset(curPlayer):
|
|
44 |
return
|
0e5941
|
45 |
return
|
a7d7f9
|
46 |
|
H |
47 |
resetTaskTypeList, resetTaskIDList = [], []
|
|
48 |
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
|
49 |
for index in xrange(ipyDataMgr.GetTongTianTaskCount()):
|
|
50 |
ipyData = ipyDataMgr.GetTongTianTaskByIndex(index)
|
|
51 |
if not ipyData.GetIsDailyTask():
|
|
52 |
continue
|
|
53 |
ttTaskID = ipyData.GetTTTaskID()
|
|
54 |
ttTaskType = ipyData.GetTTTaskType()
|
|
55 |
resetTaskTypeList.append(ttTaskType)
|
|
56 |
|
|
57 |
if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID):
|
|
58 |
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID, 0)
|
|
59 |
resetTaskIDList.append(ttTaskID)
|
|
60 |
|
81c3d2
|
61 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_DailyTaskPointToday, 0)
|
a7d7f9
|
62 |
isDailyTask = 1 # 只处理每日重置的任务
|
H |
63 |
syncTaskInfoList = []
|
|
64 |
for ttTaskType in resetTaskTypeList:
|
|
65 |
curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
|
|
66 |
if not curValue:
|
|
67 |
continue
|
|
68 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), 0)
|
|
69 |
syncTaskInfoList.append([ttTaskType, isDailyTask])
|
|
70 |
|
|
71 |
if syncTaskInfoList:
|
|
72 |
#GameWorld.DebugLog("重置通天任务进度: syncTaskInfoList=%s" % syncTaskInfoList)
|
|
73 |
SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
|
|
74 |
|
|
75 |
if resetTaskIDList:
|
|
76 |
#GameWorld.DebugLog("重置通天任务奖励: resetTaskIDList=%s" % resetTaskIDList)
|
|
77 |
SyncTongTianTaskAward(curPlayer)
|
|
78 |
|
|
79 |
return
|
0e5941
|
80 |
|
H |
81 |
def CheckTongTianLingReset(curPlayer):
|
|
82 |
## 检查通天令重置
|
|
83 |
|
|
84 |
playerID = curPlayer.GetPlayerID()
|
|
85 |
resetDays = IpyGameDataPY.GetFuncCfg("TongTianLing", 4)
|
|
86 |
if resetDays <= 0:
|
|
87 |
return
|
|
88 |
|
|
89 |
curTime = int(time.time())
|
|
90 |
startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_StartTime)
|
|
91 |
passDays = GameWorld.GetDiff_Day(curTime, startTime) + 1
|
|
92 |
if passDays <= resetDays:
|
|
93 |
GameWorld.DebugLog("通天令本轮天数未完,不重置! startTime(%s),passDays=%s <= %s"
|
|
94 |
% (GameWorld.ChangeTimeNumToStr(startTime), passDays, resetDays), playerID)
|
|
95 |
return
|
|
96 |
|
|
97 |
syncTaskInfoList = []
|
|
98 |
for ttTaskType in ChConfig.TTLTaskTypeList:
|
|
99 |
for isDailyTask in [0, 1]:
|
|
100 |
curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
|
|
101 |
if not curValue:
|
|
102 |
continue
|
|
103 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), 0)
|
|
104 |
syncTaskInfoList.append([ttTaskType, isDailyTask])
|
|
105 |
|
|
106 |
for i in xrange(TTL_LVAwardKeyCount):
|
|
107 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord % i, 0)
|
|
108 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord % i, 0)
|
|
109 |
|
|
110 |
for i in xrange(TTL_TaskAwardKeyCount):
|
|
111 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord % i, 0)
|
|
112 |
|
|
113 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_StartTime, curTime)
|
|
114 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVInfo, 0)
|
|
115 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, 0)
|
|
116 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_DailyTaskPointToday, 0)
|
|
117 |
|
|
118 |
GameWorld.Log("通天令重置! StartTime=%s" % curTime, playerID)
|
|
119 |
SyncTongTianLVInfo(curPlayer)
|
|
120 |
SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
|
|
121 |
SyncTongTianTaskAward(curPlayer)
|
|
122 |
return True
|
a7d7f9
|
123 |
|
H |
124 |
def GetTongTianLingLVInfo(curPlayer):
|
|
125 |
## 获取通天令等级状态信息
|
|
126 |
# @return: 通天令等级, 是否激活通天令
|
|
127 |
lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVInfo)
|
|
128 |
ttLV, ttState = lvInfo / 10, lvInfo % 10
|
|
129 |
return ttLV, ttState
|
|
130 |
|
|
131 |
def SetTongTianLingLVInfo(curPlayer, ttLV, ttState):
|
|
132 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVInfo, ttLV * 10 + ttState)
|
|
133 |
return
|
|
134 |
|
|
135 |
def AddTongTianTaskValue(curPlayer, ttTaskType, addValue):
|
|
136 |
## 增加通天令任务进度
|
|
137 |
|
|
138 |
taskIpyList = IpyGameDataPY.GetIpyGameDataByCondition("TongTianTask", {"TTTaskType":ttTaskType}, True, False)
|
|
139 |
if not taskIpyList:
|
|
140 |
return
|
|
141 |
|
|
142 |
addValueDict = {}
|
|
143 |
for ipyData in taskIpyList:
|
|
144 |
taskID = ipyData.GetTTTaskID()
|
|
145 |
if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, taskID):
|
|
146 |
# 已领奖的不再处理
|
|
147 |
continue
|
|
148 |
isDailyTask = ipyData.GetIsDailyTask()
|
|
149 |
finishNeedValue = ipyData.GetFinishNeedValue()
|
|
150 |
maxValue = addValueDict.get((ttTaskType, isDailyTask), 0)
|
|
151 |
if finishNeedValue > maxValue:
|
|
152 |
addValueDict[(ttTaskType, isDailyTask)] = finishNeedValue
|
|
153 |
|
|
154 |
syncTaskInfoList = []
|
|
155 |
for key, finishNeedValue in addValueDict.items():
|
|
156 |
ttTaskType, isDailyTask = key
|
|
157 |
curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
|
|
158 |
if curValue >= finishNeedValue:
|
|
159 |
continue
|
|
160 |
updValue = min(curValue + addValue, finishNeedValue)
|
|
161 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask), updValue)
|
|
162 |
#GameWorld.DebugLog("更新通天令任务进度: ttTaskType=%s,isDailyTask=%s,curValue=%s,addValue=%s,updValue=%s"
|
|
163 |
# % (ttTaskType, isDailyTask, curValue, addValue, updValue), curPlayer.GetPlayerID())
|
|
164 |
syncTaskInfoList.append([ttTaskType, isDailyTask])
|
|
165 |
|
|
166 |
if syncTaskInfoList:
|
|
167 |
SyncTongTianTaskInfo(curPlayer, syncTaskInfoList)
|
|
168 |
|
|
169 |
return
|
|
170 |
|
|
171 |
def AddTongTianPoint(curPlayer, addPoint):
|
|
172 |
## 增加通天令经验点
|
|
173 |
playerID = curPlayer.GetPlayerID()
|
|
174 |
ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
|
|
175 |
ttPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
|
|
176 |
ipyData = IpyGameDataPY.GetIpyGameData("TongTianLV", ttLV)
|
|
177 |
if not ipyData:
|
|
178 |
return
|
|
179 |
lvUPPoint = ipyData.GetLVUPPoint()
|
|
180 |
if not lvUPPoint:
|
|
181 |
GameWorld.DebugLog("通天令已满级!", playerID)
|
|
182 |
return
|
|
183 |
updLV = ttLV
|
|
184 |
updPoint = ttPoint + addPoint
|
|
185 |
GameWorld.DebugLog("增加通天令经验: ttLV=%s,ttPoint=%s,addPoint=%s,updPoint=%s,lvUPPoint=%s"
|
|
186 |
% (ttLV, ttPoint, addPoint, updPoint, lvUPPoint), playerID)
|
|
187 |
doCount = 0
|
|
188 |
while lvUPPoint and updPoint >= lvUPPoint and doCount < 50:
|
|
189 |
doCount += 1
|
|
190 |
updPoint -= lvUPPoint
|
|
191 |
updLV += 1
|
|
192 |
nextLVIPYData = IpyGameDataPY.GetIpyGameDataNotLog("TongTianLV", updLV)
|
|
193 |
lvUPPoint = nextLVIPYData.GetLVUPPoint() if nextLVIPYData else 0
|
|
194 |
GameWorld.DebugLog(" 通天令升级: updLV=%s,updPoint=%s,nextLVUPPoint=%s" % (updLV, updPoint, lvUPPoint), playerID)
|
|
195 |
|
|
196 |
SetTongTianLingLVInfo(curPlayer, updLV, ttState)
|
|
197 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_LVPoint, updPoint)
|
|
198 |
SyncTongTianLVInfo(curPlayer)
|
|
199 |
return updLV, updPoint
|
|
200 |
|
|
201 |
#// A5 43 通天令领取任务奖励 #tagCMGetTongTianTaskAward
|
|
202 |
#
|
|
203 |
#struct tagCMGetTongTianTaskAward
|
|
204 |
#{
|
|
205 |
# tagHead Head;
|
|
206 |
# BYTE TaskID; // 任务ID
|
|
207 |
#};
|
|
208 |
def OnGetTongTianTaskAward(index, clientData, tick):
|
|
209 |
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
|
210 |
playerID = curPlayer.GetPlayerID()
|
|
211 |
ttTaskID = clientData.TaskID
|
|
212 |
|
|
213 |
ipyData = IpyGameDataPY.GetIpyGameData("TongTianTask", ttTaskID)
|
|
214 |
if not ipyData:
|
|
215 |
return
|
|
216 |
|
|
217 |
if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID):
|
|
218 |
GameWorld.DebugLog("通天任务已领奖! ttTaskID=%s" % ttTaskID, playerID)
|
|
219 |
return
|
|
220 |
|
|
221 |
ttTaskType = ipyData.GetTTTaskType()
|
|
222 |
isDailyTask = ipyData.GetIsDailyTask()
|
|
223 |
finishNeedValue = ipyData.GetFinishNeedValue()
|
|
224 |
curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
|
|
225 |
if curValue < finishNeedValue:
|
|
226 |
GameWorld.DebugLog("通天任务进度未完成,无法领奖! ttTaskID=%s,ttTaskType=%s,isDailyTask=%s,curValue=%s < %s"
|
|
227 |
% (ttTaskID, ttTaskType, isDailyTask, curValue, finishNeedValue), playerID)
|
|
228 |
return
|
|
229 |
|
81c3d2
|
230 |
addTaskPoint = ipyData.GetTaskPoint()
|
H |
231 |
dailyTaskPointMax = IpyGameDataPY.GetFuncCfg("TongTianLing", 3)
|
|
232 |
if isDailyTask and dailyTaskPointMax:
|
|
233 |
dailyTaskPointToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_DailyTaskPointToday)
|
|
234 |
if dailyTaskPointToday >= dailyTaskPointMax:
|
|
235 |
GameWorld.DebugLog("通天任务日常任务积分奖励已达上限! ttTaskID=%s,ttTaskType=%s,dailyTaskPointToday=%s >= %s"
|
|
236 |
% (ttTaskID, ttTaskType, dailyTaskPointToday, dailyTaskPointMax), playerID)
|
|
237 |
return
|
|
238 |
addTaskPoint = min(addTaskPoint, dailyTaskPointMax - dailyTaskPointToday)
|
|
239 |
dailyTaskPointToday += addTaskPoint
|
|
240 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TTL_DailyTaskPointToday, dailyTaskPointToday)
|
|
241 |
GameWorld.DebugLog("更新通天任务日常任务今日已获得积分: dailyTaskPointToday=%s" % dailyTaskPointToday, playerID)
|
a7d7f9
|
242 |
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_TaskAwardRecord, ttTaskID, 1)
|
81c3d2
|
243 |
AddTongTianPoint(curPlayer, addTaskPoint)
|
H |
244 |
SyncTongTianTaskAward(curPlayer)
|
a7d7f9
|
245 |
return
|
H |
246 |
|
|
247 |
#// A5 44 通天令领取等级奖励 #tagCMGetTongTianLVAward
|
|
248 |
#
|
|
249 |
#struct tagCMGetTongTianLVAward
|
|
250 |
#{
|
|
251 |
# tagHead Head;
|
|
252 |
# BYTE TTLV; // 领取对应等级奖励,发255为一键领取所有等级奖励,包含仙品奖励
|
|
253 |
# BYTE IsXian; // 是否领取仙品奖励,仅指定等级奖励有效
|
|
254 |
#};
|
|
255 |
def OnGetTongTianLVAward(index, clientData, tick):
|
|
256 |
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
|
257 |
playerID = curPlayer.GetPlayerID()
|
|
258 |
getTTLVLV = clientData.TTLV
|
|
259 |
isXian = clientData.IsXian
|
|
260 |
|
|
261 |
ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
|
|
262 |
if getTTLVLV == 255:
|
|
263 |
awardLVList = range(0, ttLV + 1)
|
|
264 |
isXian = 1 # 一键领取的默认包含仙品奖励
|
|
265 |
else:
|
|
266 |
awardLVList = [getTTLVLV]
|
|
267 |
|
|
268 |
GameWorld.DebugLog("领取通天令奖励: getTTLVLV=%s,isXian=%s,awardLVList=%s" % (getTTLVLV, isXian, awardLVList), playerID)
|
|
269 |
|
|
270 |
notifyItemIDList = []
|
|
271 |
itemList = []
|
|
272 |
for awardTTLV in awardLVList:
|
|
273 |
if awardTTLV > ttLV:
|
|
274 |
GameWorld.DebugLog(" 通天等级不足,无法领奖! awardTTLV=%s < %s" % (awardTTLV, ttLV), playerID)
|
|
275 |
break
|
|
276 |
ipyData = IpyGameDataPY.GetIpyGameData("TongTianLV", awardTTLV)
|
|
277 |
if not ipyData:
|
|
278 |
continue
|
|
279 |
commAwardItemList = ipyData.GetCommAwardItemList()
|
|
280 |
xianAwardItemList = ipyData.GetXianAwardItemList()
|
|
281 |
notifyItemIDList.extend(ipyData.GetNotifyItemIDList())
|
|
282 |
|
|
283 |
if commAwardItemList and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord, awardTTLV):
|
|
284 |
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_CommAwardRecord, awardTTLV, 1)
|
|
285 |
itemList.extend(commAwardItemList)
|
|
286 |
GameWorld.DebugLog(" 常规奖励: awardTTLV=%s,commAwardItemList=%s" % (awardTTLV, commAwardItemList), playerID)
|
|
287 |
#elif commAwardItemList:
|
|
288 |
# GameWorld.DebugLog(" 已领取过该奖励: awardTTLV=%s" % (awardTTLV), playerID)
|
|
289 |
|
|
290 |
getXian = (isXian and xianAwardItemList)
|
|
291 |
if getXian and ttState and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord, awardTTLV):
|
|
292 |
GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_TTL_XianAwardRecord, awardTTLV, 1)
|
|
293 |
itemList.extend(xianAwardItemList)
|
|
294 |
GameWorld.DebugLog(" 仙品奖励: awardTTLV=%s,xianAwardItemList=%s" % (awardTTLV, xianAwardItemList), playerID)
|
|
295 |
#elif getXian:
|
|
296 |
# GameWorld.DebugLog(" 仙品通天令未激活或已领奖: awardTTLV=%s,ttState=%s" % (awardTTLV, ttState), playerID)
|
|
297 |
|
|
298 |
GameWorld.DebugLog(" 最终奖励: itemList=%s" % itemList, playerID)
|
|
299 |
if not itemList:
|
|
300 |
return
|
|
301 |
|
|
302 |
giveItemDict = {}
|
|
303 |
for itemID, itemCount, isBind in itemList:
|
|
304 |
key = (itemID, isBind)
|
|
305 |
giveItemDict[key] = giveItemDict.get(key, 0) + itemCount
|
|
306 |
|
|
307 |
awardItemList = []
|
|
308 |
for key, itemCount in giveItemDict.items():
|
|
309 |
itemID, isBind = key
|
|
310 |
awardItemList.append([itemID, itemCount, isBind])
|
|
311 |
if itemID in notifyItemIDList:
|
|
312 |
PlayerControl.NotifyCode(curPlayer, "TongTianLingLVAward", [curPlayer.GetPlayerName(), itemID, itemCount])
|
|
313 |
|
|
314 |
GameWorld.DebugLog(" 汇总奖励: awardItemList=%s" % awardItemList, playerID)
|
|
315 |
dataDict = {"awardLVList":awardLVList, "isXian":isXian}
|
|
316 |
ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["TongTianLing", False, dataDict])
|
|
317 |
SyncTongTianLVInfo(curPlayer)
|
|
318 |
return
|
|
319 |
|
|
320 |
#// A5 45 兑换通天令等级经验积分点 #tagCMExchangeTongTianLVPoint
|
|
321 |
#
|
|
322 |
#struct tagCMExchangeTongTianLVPoint
|
|
323 |
#{
|
|
324 |
# tagHead Head;
|
|
325 |
# DWORD ExchangePoint; // 兑换点数
|
|
326 |
#};
|
|
327 |
def OnExchangeTongTianLVPoint(index, clientData, tick):
|
|
328 |
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
|
329 |
playerID = curPlayer.GetPlayerID()
|
|
330 |
exchangePoint = clientData.ExchangePoint
|
|
331 |
exchangeCostInfo = IpyGameDataPY.GetFuncEvalCfg("TongTianLing", 1)
|
|
332 |
if len(exchangeCostInfo) != 2:
|
|
333 |
return
|
|
334 |
costMoneyType, costMoneyValue = exchangeCostInfo
|
|
335 |
if not costMoneyType or not costMoneyValue:
|
|
336 |
return
|
|
337 |
|
|
338 |
ttLV = GetTongTianLingLVInfo(curPlayer)[0]
|
|
339 |
ttPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
|
|
340 |
canBuyPointMax = 0
|
|
341 |
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
|
342 |
for index in xrange(ttLV, ipyDataMgr.GetTongTianLVCount()):
|
|
343 |
ipyData = ipyDataMgr.GetTongTianLVByIndex(index)
|
|
344 |
canBuyPointMax += ipyData.GetLVUPPoint()
|
|
345 |
canBuyPointMax -= ttPoint
|
|
346 |
|
|
347 |
exchangePoint = min(exchangePoint, canBuyPointMax)
|
|
348 |
costMoneyTotal = costMoneyValue * exchangePoint
|
|
349 |
GameWorld.DebugLog("兑换通天令等级经验: ttLV=%s,ttPoint=%s,exchangePoint=%s,canBuyPointMax=%s,costMoneyType=%s,costMoneyTotal=%s"
|
|
350 |
% (ttLV, ttPoint, exchangePoint, canBuyPointMax, costMoneyType, costMoneyTotal), playerID)
|
|
351 |
|
|
352 |
if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyTotal):
|
|
353 |
return
|
|
354 |
|
|
355 |
updInfo = AddTongTianPoint(curPlayer, exchangePoint)
|
|
356 |
updLV, updPoint = updInfo if updInfo else (ttLV, ttPoint)
|
|
357 |
|
|
358 |
infoDict = {ChConfig.Def_Cost_Reason_SonKey:"ExchangeTongTianLVPoint", "exchangePoint":exchangePoint,
|
|
359 |
"ttLV":ttLV, "ttPoint":ttPoint, "updLV":updLV, "updPoint":updPoint}
|
|
360 |
PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyTotal, ChConfig.Def_Cost_TongTianLing, infoDict)
|
|
361 |
return
|
|
362 |
|
|
363 |
#// A5 46 购买通天令 #tagCMBuyTongTianLing
|
|
364 |
#
|
|
365 |
#struct tagCMBuyTongTianLing
|
|
366 |
#{
|
|
367 |
# tagHead Head;
|
|
368 |
#};
|
|
369 |
def OnBuyTongTianLing(index, clientData, tick):
|
f96a32
|
370 |
# 废弃,改为充值激活
|
H |
371 |
return
|
|
372 |
|
|
373 |
def OnActiviteTTTByCTGID(curPlayer, ctgID):
|
|
374 |
ctgIDList = IpyGameDataPY.GetFuncEvalCfg("TongTianLing", 5)
|
|
375 |
if ctgID not in ctgIDList:
|
|
376 |
return
|
|
377 |
|
a7d7f9
|
378 |
playerID = curPlayer.GetPlayerID()
|
H |
379 |
ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
|
|
380 |
if ttState:
|
|
381 |
GameWorld.DebugLog("通天令已经购买过了!", playerID)
|
|
382 |
return
|
|
383 |
|
|
384 |
ttState = 1
|
|
385 |
SetTongTianLingLVInfo(curPlayer, ttLV, ttState)
|
|
386 |
GameWorld.DebugLog("购买激活通天令!", playerID)
|
|
387 |
PlayerControl.NotifyCode(curPlayer, "TongTianLingActive")
|
81c3d2
|
388 |
SyncTongTianLVInfo(curPlayer)
|
a7d7f9
|
389 |
return
|
H |
390 |
|
|
391 |
def SyncTongTianLVInfo(curPlayer):
|
|
392 |
## 等级信息
|
|
393 |
ttLV, ttState = GetTongTianLingLVInfo(curPlayer)
|
|
394 |
clientPack = ChPyNetSendPack.tagMCTongTianLingInfo()
|
|
395 |
clientPack.TTLBuyState = ttState
|
|
396 |
clientPack.TTLLV = ttLV
|
|
397 |
clientPack.CurPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_LVPoint)
|
|
398 |
clientPack.CommAwardStateList = []
|
|
399 |
clientPack.XianAwardStateList = []
|
0e5941
|
400 |
for i in xrange(TTL_LVAwardKeyCount):
|
a7d7f9
|
401 |
clientPack.CommAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_CommAwardRecord % i))
|
H |
402 |
clientPack.XianAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_XianAwardRecord % i))
|
|
403 |
clientPack.AwardStateCount = len(clientPack.CommAwardStateList)
|
cfba2f
|
404 |
clientPack.StartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_StartTime)
|
a7d7f9
|
405 |
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
H |
406 |
return
|
|
407 |
|
|
408 |
def SyncTongTianTaskInfo(curPlayer, syncTaskInfoList=None):
|
|
409 |
## 任务进度信息
|
|
410 |
syncAppoint = True
|
|
411 |
if syncTaskInfoList == None:
|
|
412 |
syncAppoint = False
|
|
413 |
syncTaskInfoList = []
|
|
414 |
for ttTaskType in ChConfig.TTLTaskTypeList:
|
|
415 |
syncTaskInfoList.append([ttTaskType, 0])
|
|
416 |
syncTaskInfoList.append([ttTaskType, 1])
|
|
417 |
|
|
418 |
clientPack = ChPyNetSendPack.tagMCTongTianLingTaskValueInfo()
|
|
419 |
clientPack.TaskValueList = []
|
|
420 |
for ttTaskType, isDailyTask in syncTaskInfoList:
|
|
421 |
curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskValue % (ttTaskType, isDailyTask))
|
|
422 |
if not curValue and not syncAppoint:
|
|
423 |
continue
|
|
424 |
task = ChPyNetSendPack.tagMCTongTianLingTaskValue()
|
|
425 |
task.TaskType = ttTaskType
|
|
426 |
task.IsDaily = isDailyTask
|
|
427 |
task.TaskValue = curValue
|
|
428 |
clientPack.TaskValueList.append(task)
|
|
429 |
clientPack.Count = len(clientPack.TaskValueList)
|
|
430 |
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
|
431 |
return
|
|
432 |
|
|
433 |
def SyncTongTianTaskAward(curPlayer):
|
|
434 |
## 任务奖励信息
|
|
435 |
clientPack = ChPyNetSendPack.tagMCTongTianLingTaskAwardInfo()
|
|
436 |
clientPack.TaskAwardStateList = []
|
0e5941
|
437 |
for i in xrange(TTL_TaskAwardKeyCount):
|
a7d7f9
|
438 |
clientPack.TaskAwardStateList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TTL_TaskAwardRecord % i))
|
H |
439 |
clientPack.AwardStateCount = len(clientPack.TaskAwardStateList)
|
|
440 |
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
|
441 |
return
|
|
442 |
|
|
443 |
|