def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(MathUtils.ToNotNullString(actionResult.AchieveName)) writer.PushShortIntoStack(MathUtils.ToShort(actionResult.AchieveType)) writer.PushIntoStack(MathUtils.ToNotNullString(actionResult.HeadID)) writer.PushIntoStack(MathUtils.ToNotNullString(actionResult.AchieveDesc)) writer.PushShortIntoStack(MathUtils.ToShort(actionResult.IsComplete)) writer.PushIntoStack(actionResult.CompleteNum) writer.PushIntoStack(actionResult.AchieveNum) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.PageCount) writer.PushIntoStack(len(actionResult.gameNoticelsit)) for info in actionResult.gameNoticelsit: DsItem = DataStruct() DsItem.PushIntoStack(MathUtils.ToNotNullString(info.Title)) DsItem.PushIntoStack(MathUtils.ToNotNullString(info.Content)) DsItem.PushIntoStack(MathUtils.ToNotNullString(info.CreateDate)) writer.PushIntoStack(DsItem) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.PageCount) writer.PushIntoStack(len(actionResult.userRankList)) for info in actionResult.userRankList: wining = PythonHelper.TransformString(info.Wining) DsItem = DataStruct() DsItem.PushIntoStack(info.RankId) DsItem.PushIntoStack(info.UserID) DsItem.PushIntoStack(MathUtils.ToNotNullString(info.NickName)) DsItem.PushIntoStack(info.GameCoin) DsItem.PushIntoStack(MathUtils.ToNotNullString(wining)) writer.PushIntoStack(DsItem) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.ChatMaxNum) writer.PushIntoStack(len(actionResult.chatList)) for info in actionResult.chatList: DsItem = DataStruct() DsItem.PushIntoStack(info.FromUserID) DsItem.PushIntoStack(MathUtils.ToNotNullString(info.FromUserName)) DsItem.PushIntoStack(info.ChatID) DsItem.PushIntoStack(MathUtils.ToNotNullString(info.Content)) DsItem.PushIntoStack(info.SendDate.ToString("HH:mm:ss")) writer.PushIntoStack(DsItem) return True
def takeAction(urlParam, parent): actionResult = ActionResult() userId = str(parent.Current.UserId) user = PersonalCacheStruct.Get[GameUser](userId) shopinfo = ConfigCacheSet[ShopInfo]().FindKey(urlParam.ItemID) if shopinfo == None: parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("St_7002_ShopOffTheShelf") actionResult.Result = False return actionResult gameHall = GameHall(user) useGold = shopinfo.Price if user.VipLv > 0: userGold = shopinfo.VipPrice if gameHall.UserGold < useGold: parent.ErrorCode = 1 parent.ErrorInfo = Lang.getLang("St_2909_StGoldNumNullEnough") actionResult.Result = False return actionResult if shopinfo.ShopType == ShopType.HeadID: if gameHall.CheckUserItem(urlParam.ItemID): parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("St_7002_PurchasedHeadID") actionResult.Result = False return actionResult gameHall.AddUserItem(urlParam.ItemID, shopinfo.ShopType) ClientNotifier.NotifyAction(ActionIDDefine.Cst_Action1013, user, None) if shopinfo.ShopType == ShopType.Beans: user.GameCoin = MathUtils.Addition(user.GameCoin, shopinfo.GameCoin) user.UseGold = MathUtils.Addition(user.UseGold, useGold) GameTable.Current.NotifyUserChange(user.UserId) mallItemLog = MallItemLog() mallItemLog.ItemID = urlParam.ItemID mallItemLog.Uid = user.UserId mallItemLog.Num = 1 mallItemLog.CurrencyType = MathUtils.ToInt(shopinfo.ShopType) mallItemLog.Amount = useGold mallItemLog.CreateDate = MathUtils.Now mallItemLog.RetailID = user.RetailId mallItemLog.MobileType = user.MobileType mallItemLog.Pid = user.Pid mallItemLog.ItemName = shopinfo.ShopName sender = DataSyncManager.GetDataSender() sender.Send(mallItemLog) #需要实现 return actionResult
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.CompleteNum) writer.PushIntoStack(actionResult.AchieveNum) writer.PushIntoStack(actionResult.PageCount) writer.PushIntoStack(len(actionResult.AchieveList)) for info in actionResult.AchieveList: isGain = AchieveTask.GetAchieveStatus(actionResult.userID, info.Id) dsItem = DataStruct() dsItem.PushIntoStack(info.Id) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.Name)) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.HeadIcon)) dsItem.PushShortIntoStack(MathUtils.ToShort(isGain)) writer.PushIntoStack(dsItem) return True
def buildPacket(writer, urlParam, actionResult): writer.PushShortIntoStack(actionResult.Postion) writer.PushIntoStack(MathUtils.ToNotNullString(actionResult.RewardContent)) writer.PushIntoStack(actionResult.FreeNum) writer.PushIntoStack(actionResult.UserCoin) writer.PushIntoStack(actionResult.UserGold) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(len(actionResult.chatList)) for info in actionResult.chatList: DsItem = DataStruct() DsItem.PushIntoStack(info.Id) DsItem.PushIntoStack(MathUtils.ToNotNullString(info.Content)) writer.PushIntoStack(DsItem) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.PageCount) writer.PushIntoStack(actionResult.GameCoin) writer.PushIntoStack(actionResult.GoldNum) writer.PushIntoStack(len(actionResult.ShopList)) for info in actionResult.ShopList: dsItem = DataStruct() dsItem.PushIntoStack(info.ShopID) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.ShopName)) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.HeadID)) dsItem.PushIntoStack(info.Price) dsItem.PushIntoStack(info.VipPrice) dsItem.PushIntoStack(info.GameCoin) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.ShopDesc)) dsItem.PushIntoStack(info.SeqNO) writer.PushIntoStack(dsItem) return True
def buildPacket(writer, urlParam, actionResult): postion = 0 writer.PushShortIntoStack(actionResult.IsFree) writer.PushIntoStack(actionResult.FreeNum) writer.PushIntoStack(len(actionResult.DailList)) for info in actionResult.DailList: postion = MathUtils.Addition(postion, 1) Probability = PythonHelper.TransformString(info.Probability) dsItem = DataStruct() dsItem.PushIntoStack(postion) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.HeadID)) dsItem.PushIntoStack(MathUtils.ToNotNullString(Probability)) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.ItemDesc)) dsItem.PushIntoStack(info.GameCoin) writer.PushIntoStack(dsItem) writer.PushIntoStack(actionResult.UserCoin) writer.PushIntoStack(actionResult.UserGold) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.PageCount) writer.PushIntoStack(len(actionResult.userItemList)) for info in actionResult.userItemList: itemName = '' headID = '' shopInfo = ConfigCacheSet[ShopInfo]().FindKey(info.ItemID) if shopInfo: itemName = shopInfo.ShopName headID = shopInfo.HeadID dsItem = DataStruct() dsItem.PushIntoStack(MathUtils.ToNotNullString(info.UserItemID)) dsItem.PushIntoStack(info.ItemID) dsItem.PushIntoStack(MathUtils.ToNotNullString(itemName)) dsItem.PushShortIntoStack(MathUtils.ToShort(info.ShopType)) dsItem.PushIntoStack(info.Num) dsItem.PushIntoStack(MathUtils.ToNotNullString(headID)) writer.PushIntoStack(dsItem) return True
def __init__(self, filename, data_dir='data/'): self.file_df = pd.read_csv(data_dir + filename) self.mutils = MathUtils() self.time_s = np.arange(0., len(self.file_df), 1.0) * u.second self.col_units = { 'latitude {deg}': u.degree, 'longitude {deg}': u.degree, 'h_ellipsiod {m}': u.meter }
def UpdateArcheologyRestrain(self,user, npcinfoID): """通关考古副本活动,更新通关次数与奖励""" def IsArcheologyPlot(self,plotID,npcInfoID): """是否当前考古副本的npc""" npcinfoList = ConfigCacheSet[PlotNPCInfo]().FindAll(match = lambda s:s.PlotID == plotID and s.NpcSeqNo>0); for npcInfo in npcinfoList: if npcInfoID == npcInfo.PlotNpcID: return True; return False festivalInfosList = ShareCacheStruct[FestivalInfo]().FindAll(match = lambda m:m.FestivalType == FestivalType.Archeology); for info in festivalInfosList: if not NoviceHelper.IsFestivalOpen(info.FestivalID) or info.FestivalExtend == None or info.FestivalExtend.PlotID == 0: continue; if not IsArcheologyPlot(self,info.FestivalExtend.PlotID,npcinfoID): continue cacheSet = GameDataCacheSet[FestivalRestrain](); restrain = cacheSet.FindKey(user.UserID,info.FestivalID); if restrain != None and restrain.IsReceive: continue; if restrain == None : restrain = FestivalRestrain(); restrain.FestivalID = info.FestivalID; restrain.UserID = user.UserID; restrain.RestrainNum = 0; restrain.RefreashDate = DateTime.Now; restrain.IsReceive = False; cacheSet.Add(restrain); userExtend = restrain.UserExtend.Find(lambda s:s.ID == npcinfoID); if userExtend: userExtend.Num = MathUtils.Addition(userExtend.Num, 1); else : userExtend = RestrainExtend(); userExtend.ID = npcinfoID; userExtend.Num = 1; restrain.UserExtend.Add(userExtend); isGo = True; if restrain ==None or restrain.UserExtend.Count == 0 or info.FestivalExtend == None or info.FestivalExtend.PlotID == 0: isGo = False; npcinfoList = ConfigCacheSet[PlotNPCInfo]().FindAll(match = lambda s:s.PlotID == info.FestivalExtend.PlotID and s.NpcSeqNo>0); for npcInfo in npcinfoList: userExtend = restrain.UserExtend.Find(lambda s:s.ID == npcInfo.PlotNpcID) if userExtend and userExtend.Num >= info.RestrainNum: continue; isGo = False; break; if isGo: restrain.IsReceive = True; content = PrizeHelper.GetPrizeUserTake(user, info.Reward.ToList()); if content and info.FestivalExtend.Desc : content = content.Replace(",","") TjxChatService().SystemSendWhisper(user, info.FestivalExtend.Desc %content)
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.goldNum) writer.PushIntoStack(actionResult.gameCoin) writer.PushIntoStack(actionResult.freeNum) writer.PushIntoStack(actionResult.isSale) writer.PushIntoStack(actionResult.issTelegrams) writer.PushIntoStack(len(actionResult.grayCrystalArray)) for info in actionResult.grayCrystalArray: crystalName = '' headID = '' crystalQuality = 0 crystalInfo = ConfigCacheSet[CrystalInfo]().FindKey(info.CrystalID) if crystalInfo is not None: crystalName = crystalInfo.CrystalName headID = crystalInfo.HeadID crystalQuality = MathUtils.ToShort(crystalInfo.CrystalQuality) DsItem = DataStruct() DsItem.PushIntoStack(MathUtils.ToNotNullString(info.UserCrystalID)) DsItem.PushIntoStack(info.CrystalID) DsItem.PushIntoStack(MathUtils.ToNotNullString(crystalName)) DsItem.PushIntoStack(MathUtils.ToNotNullString(headID)) DsItem.PushShortIntoStack(crystalQuality) writer.PushIntoStack(DsItem) writer.PushIntoStack(actionResult.userLightArray.Count) for info in actionResult.userLightArray: probabilityInfo = ConfigCacheSet[ProbabilityInfo]().FindKey( info.HuntingID) price = 0 if probabilityInfo is not None: price = probabilityInfo.Price DsItem = DataStruct() DsItem.PushIntoStack(info.HuntingID) DsItem.PushIntoStack(price) DsItem.PushIntoStack(info.IsLight) writer.PushIntoStack(DsItem) writer.PushIntoStack(MathUtils.ToNotNullString(actionResult.prompt)) return True
def buildPacket(writer, urlParam, actionResult): writer.PushIntoStack(actionResult.PageCount) writer.PushIntoStack(len(actionResult.TaskList)) for info in actionResult.TaskList: CompleteNum = 0 IsReceive = 1 usertaskInfo = AchieveTask.GetUserTaskInfo(actionResult.userID,info.TaskID) if usertaskInfo: CompleteNum = usertaskInfo.TaskNum if CompleteNum>info.RestraintNum: CompleteNum =info.RestraintNum IsReceive = MathUtils.ToShort(usertaskInfo.TaskStatus) dsItem = DataStruct() dsItem.PushIntoStack(info.TaskID) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.TaskName)) dsItem.PushIntoStack(CompleteNum) dsItem.PushIntoStack(info.RestraintNum) dsItem.PushIntoStack(MathUtils.ToNotNullString(info.TaskDesc)) dsItem.PushIntoStack(info.GameCoin) dsItem.PushShortIntoStack(IsReceive) writer.PushIntoStack(dsItem) return True
def takeAction(urlParam, parent): actionResult = ActionResult() userId = parent.Current.User.PersonalId; user = parent.Current.User achievement = ConfigCacheSet[AchievementInfo]().FindKey(urlParam.AchieveID) if achievement: actionResult.AchieveName = achievement.Name actionResult.AchieveType = achievement.Type actionResult.HeadID = achievement.HeadIcon actionResult.AchieveDesc = achievement.Description actionResult.AchieveNum = achievement.TargetNum cacheSet = GameDataCacheSet[UserAchieve]() achievePackage = cacheSet.FindKey(userId); if achievePackage: userAchievement = achievePackage.AchievePackage.Find(match = lambda s: s.AchieveID == urlParam.AchieveID) if userAchievement: actionResult.IsComplete = MathUtils.ToShort(userAchievement.TaskStatus) actionResult.CompleteNum = userAchievement.TaskNum #需要实现 return actionResult
def takeAction(urlParam, parent): actionResult = ActionResult() userId = str(parent.Current.UserId) user = PersonalCacheStruct.Get[GameUser](userId) gameRoom = GameRoom.Current dailyFreeNum = ConfigEnvSet.GetInt("User.DailyFreeNum", 3) useNum = 0 userRestrain = GameDataCacheSet[UserDailyRestrain]().FindKey(userId) if userRestrain != None: gameRoom.RefreshRestrain(userRestrain) if userRestrain.RestrainProperty != None: useNum = userRestrain.RestrainProperty.DialFreeNum if dailyFreeNum > useNum: actionResult.FreeNum = MathUtils.Subtraction(dailyFreeNum, useNum) else: actionResult.IsFree = 1 actionResult.DailList = ConfigCacheSet[DialInfo]().FindAll() actionResult.UserCoin = user.GameCoin gameHall = GameHall(user) actionResult.UserGold = gameHall.UserGold #需要实现 return actionResult
def takeAction(urlParam, parent): actionResult = ActionResult() user = parent.Current.User userId = parent.Current.User.PersonalId AchieveTask.RefreashUserTask(userId) usertaskInfo = AchieveTask.GetUserTaskInfo(userId, urlParam.TaskID) if not usertaskInfo or usertaskInfo.TaskStatus == TaskStatus.Unfinished: parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("St3004_CurrentTaskIsNotCompleted") actionResult.Result = False return actionResult if usertaskInfo.TaskStatus == TaskStatus.Receive: parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("St3004_CurrentTaskrewardHasReceived") actionResult.Result = False return actionResult taskInfo = ConfigCacheSet[TaskInfo]().FindKey(urlParam.TaskID) if taskInfo: user.GameCoin = MathUtils.Addition(user.GameCoin, taskInfo.GameCoin) usertaskInfo.TaskStatus = TaskStatus.Receive GameTable.Current.NotifyUserChange(user.UserId) #需要实现 return actionResult
def takeAction(urlParam, parent): def compareToCrystal(x, y): if x == None and y == None: return 0 if x != None and y == None: return 1 if x == None: return -1 return x.CreateDate.CompareTo(y.CreateDate) actionResult = ActionResult() userId = parent.Current.User.PersonalId urlParam.userID = parent.Current.User.PersonalId contextUser = parent.Current.User if contextUser.VipLv < 5: parent.ErrorCode = LanguageManager.GetLang().ErrorCode parent.ErrorInfo = LanguageManager.GetLang().St_VipNotEnough actionResult.Result = False return actionResult UserHelper.GetUserLightOpen(userId) if CrystalHelper.CheckAllowCrystall(contextUser) == False: parent.ErrorCode = LanguageManager.GetLang().ErrorCode parent.ErrorInfo = LanguageManager.GetLang().St1305_FateBackpackFull actionResult.Result = False return actionResult saleNum = CrystalHelper.SellGrayCrystal(contextUser, None) actionResult.prompt = CrystalHelper.AkeyHuntingLife(contextUser) dailyRestrainSet = ShareCacheStruct[DailyRestrainSet]().FindKey( RestrainType.MianFeiLieMing) userRestrain = GameDataCacheSet[UserDailyRestrain]().FindKey(userId) if dailyRestrainSet is not None and userRestrain is not None: if MathUtils.Now.Date == userRestrain.RefreshDate.Date: actionResult.freeNum = VipHelper.GetVipUseNum( contextUser.VipLv, RestrainType.MianFeiLieMing) actionResult.freeNum = MathUtils.Subtraction( actionResult.freeNum, userRestrain.Funtion2, 0) else: actionResult.freeNum = VipHelper.GetVipUseNum( contextUser.VipLv, RestrainType.MianFeiLieMing) actionResult.userLightArray = GameDataCacheSet[UserLight]().FindAll( contextUser.UserID) allowSale = False allowTake = False list = CrystalHelper.GetNotSaleCrystalNum(contextUser) if list.Count > 0: actionResult.grayCrystalArray = list[0] MathUtils.QuickSort[GrayCrystal](actionResult.grayCrystalArray, lambda x, y: compareToCrystal(x, y)) if list.Count > 1: allowSale = list[1] if list.Count > 2: allowTake = list[2] if allowSale is True: actionResult.isSale = 1 else: actionResult.isSale = 2 if allowTake is True: actionResult.issTelegrams = 1 else: actionResult.issTelegrams = 2 actionResult.goldNum = contextUser.GoldNum actionResult.gameCoin = contextUser.GameCoin #需要实现 return actionResult
def takeAction(urlParam, parent): actionResult = ActionResult() userId = parent.Current.User.PersonalId user = parent.Current.User gameRoom = GameRoom.Current dailyFreeNum = ConfigEnvSet.GetInt("User.DailyFreeNum", 3) useNum = 0 useGold = 0 userRestrain = GameDataCacheSet[UserDailyRestrain]().FindKey(userId) if userRestrain == None: parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("LoadError") actionResult.Result = False return actionResult gameRoom.RefreshRestrain(userRestrain) gameHall = GameHall(user) if userRestrain.RestrainProperty != None: useNum = userRestrain.RestrainProperty.DialFreeNum if useNum > dailyFreeNum: useGold = MathUtils.Subtraction(useNum, dailyFreeNum) * 2 useGold = MathUtils.Addition(useGold, 2) if useNum == dailyFreeNum: useGold = 2 if useGold > 20: useGold = 20 if urlParam.Ops == 1 and useNum >= dailyFreeNum: parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("St12002_FreeNotEnough") actionResult.Result = False return actionResult #useNum = userRestrain.RestrainProperty.DialFreeNum if urlParam.Ops == 1: userRestrain.RestrainProperty.DialFreeNum = MathUtils.Addition( userRestrain.RestrainProperty.DialFreeNum, 1) if urlParam.Ops == 2: if useNum < dailyFreeNum: parent.ErrorCode = Lang.getLang("ErrorCode") parent.ErrorInfo = Lang.getLang("St12002_FreeEnough") actionResult.Result = False return actionResult parent.ErrorCode = urlParam.Ops parent.ErrorInfo = Lang.getLang("St12002_UseGoldTurntable") % useGold actionResult.Result = False return actionResult if urlParam.Ops == 3: if gameHall.UserGold < useGold: parent.ErrorCode = 4 parent.ErrorInfo = Lang.getLang("St_2909_StGoldNumNullEnough") actionResult.Result = False return actionResult user.UseGold = MathUtils.Addition(user.UseGold, useGold) userRestrain.RestrainProperty.DialFreeNum = MathUtils.Addition( userRestrain.RestrainProperty.DialFreeNum, 1) postion = gameHall.DialPrizePostion() dialList = ConfigCacheSet[DialInfo]().FindAll() if dialList.Count > postion: dialInfo = dialList[postion] user.GameCoin = MathUtils.Addition(user.GameCoin, dialInfo.GameCoin) actionResult.Postion = MathUtils.Addition(postion, 1) actionResult.RewardContent = Lang.getLang( "St12002_GoldenBeanAwards") % dialInfo.GameCoin #需要实现 parent.ErrorCode = urlParam.Ops if dailyFreeNum > userRestrain.RestrainProperty.DialFreeNum: actionResult.FreeNum = MathUtils.Subtraction( dailyFreeNum, userRestrain.RestrainProperty.DialFreeNum) actionResult.UserCoin = user.GameCoin actionResult.UserGold = gameHall.UserGold GameTable.Current.NotifyUserChange(user.UserId) return actionResult