| | |
| | | battleRatio = workerBattleRatioList[len(workerBattleRatioList) - 1] if batWorkerCount > len(workerBattleRatioList) else workerBattleRatioList[batWorkerCount - 1]
|
| | |
|
| | | needSeconds = int(dist * itemWeight * baseTime * workRatio * battleRatio) # 还需工作时长,秒
|
| | | if needSeconds <= 0:
|
| | | return 0, 0
|
| | | |
| | | moveSpeed = dist / float(needSeconds) # 移动速度 x格/秒
|
| | | needHms = "%02d:%02d:%02d" % (needSeconds / 3600, needSeconds % 3600 / 60, needSeconds % 60)
|
| | |
|
| | |
| | | GameWorld.Log("福地系统定时刷新! %s" % str(curHourMinute))
|
| | | mineItemMgr = PyDataManager.GetDBPyMineAreaItemManager()
|
| | | for playerID in mineItemMgr.playerMineItemDict.keys():
|
| | | __DoMineItemRefresh(playerID, isSuper=True)
|
| | | __DoMineItemRefresh(playerID, isSys=True)
|
| | | return
|
| | |
|
| | | def OnMineItemTimeProcess(curTime, tick):
|
| | |
| | | robPlayerID = mineItemData.RobPlayerID
|
| | | # 赶走抢夺者
|
| | | if robPlayerID and robPlayerID == tagPlayerID:
|
| | | __DoCancelPull(tagPlayerID, areaPlayerID, itemIndex)
|
| | | __DoCancelPull(tagPlayerID, areaPlayerID, itemIndex, "out")
|
| | |
|
| | | # 帮助的发奖
|
| | | if funcLineID == 0:
|
| | |
| | | return
|
| | | if workerCount <= 0:
|
| | | if not isPreview:
|
| | | __DoCancelPull(playerID, areaPlayerID, itemIndex)
|
| | | __DoCancelPull(playerID, areaPlayerID, itemIndex, "cancel")
|
| | | return
|
| | | GameWorld.DebugLog("请求福地拉物品! areaPlayerID=%s,itemIndex=%s,workerCount=%s,workerState=%s,workerTotal=%s,isPreview=%s"
|
| | | % (areaPlayerID, itemIndex, workerCount, workerState, workerTotal, isPreview), playerID)
|
| | |
| | | SyncMineAreaItemInfo(areaPlayerID, [itemIndex], notifyPlayerIDListEx)
|
| | | return True
|
| | |
|
| | | def __DoCancelPull(playerID, areaPlayerID, itemIndex):
|
| | | def __DoCancelPull(playerID, areaPlayerID, itemIndex, reason=""):
|
| | | ## 取消拉取
|
| | | mineItemMgr = PyDataManager.GetDBPyMineAreaItemManager()
|
| | | mineItemData = mineItemMgr.GetMineItem(areaPlayerID, itemIndex)
|
| | |
| | | __RefreshMineItemSpeed(mineItemData, True)
|
| | |
|
| | | SyncMineAreaItemInfo(areaPlayerID, [itemIndex], notifyPlayerIDListEx)
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if curPlayer:
|
| | | MapServer_QueryPlayerResult(curPlayer, "MineAreaCancelPull", [areaPlayerID, reason])
|
| | | return
|
| | |
|
| | | def __DoMineItemRefresh(areaPlayerID, areaPlayer=None, isSys=False, isSuper=False, isNotify=True, refreshIndexList=None, setPosition=None, setItemLV=None, setMineID=None):
|
| | |
| | | if areaPlayerID > Def_FakeAreaCount:
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(PlayerViewCache.FindViewCache(areaPlayerID))
|
| | | areaInfo.PlayerName = cacheDict.get("Name", "")
|
| | | areaInfo.Job = cacheDict.get("Job", 0)
|
| | | areaInfo.Face = cacheDict.get("Face", 0)
|
| | | areaInfo.FacePic = cacheDict.get("FacePic", 0)
|
| | |
|
| | | areaInfo.MineItemList = []
|
| | | if not mineIndexList:
|
| | |
| | | if mineItemData.RobPlayerID:
|
| | | robCacheDict = PlayerViewCache.GetCachePropDataDict(PlayerViewCache.FindViewCache(mineItemData.RobPlayerID))
|
| | | mineItem.RobPlayerName = robCacheDict.get("Name", "")
|
| | | mineItem.RobJob = robCacheDict.get("Job", 0)
|
| | | mineItem.RobFace = robCacheDict.get("Face", 0)
|
| | | mineItem.RobFacePic = robCacheDict.get("FacePic", 0)
|
| | | areaInfo.MineItemList.append(mineItem)
|
| | | areaInfo.MineCount = len(areaInfo.MineItemList)
|
| | |
|
| | |
| | | if playerID != recordInfo.TagPlayerID and recordInfo.TagPlayerID > Def_FakeAreaCount:
|
| | | tagCacheDict = PlayerViewCache.GetCachePropDataDict(PlayerViewCache.FindViewCache(recordInfo.TagPlayerID))
|
| | | recordInfo.TagPlayerName = tagCacheDict.get("Name", "")
|
| | | recordInfo.TagJob = tagCacheDict.get("Job", 0)
|
| | | recordInfo.TagFace = tagCacheDict.get("Face", 0)
|
| | | recordInfo.TagFacePic = tagCacheDict.get("FacePic", 0)
|
| | | clientPack.AreaRecordList.append(recordInfo)
|
| | | clientPack.RecordCount = len(clientPack.AreaRecordList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|