示例#1
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = parent.Current.User.PersonalId;
    actionResult.userID = userId
    user = parent.Current.User

    cacheSet = GameDataCacheSet[UserAchieve]()
    achievePackage = cacheSet.FindKey(userId);
    if not achievePackage:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("LoadError");
        actionResult.Result = False
        return actionResult
    AchievementList =  List[AchievementInfo]
    if urlParam.AchieveType == AchieveType.QuanBu:
        AchievementList= ConfigCacheSet[AchievementInfo]().FindAll()
        actionResult.CompleteNum = achievePackage.AchievePackage.FindAll(match = lambda s:s.TaskStatus == TaskStatus.Complete).Count
    else :
        AchievementList= ConfigCacheSet[AchievementInfo]().FindAll(match = lambda s:s.AchieveType == urlParam.AchieveType)
        actionResult.CompleteNum = achievePackage.AchievePackage.FindAll(match = lambda s: s.AchieveType == urlParam.AchieveType and s.TaskStatus == TaskStatus.Complete).Count
    actionResult.AchieveNum = AchievementList.Count
    result = MathUtils.GetPaging[AchievementInfo](AchievementList,urlParam.PageIndex, urlParam.PageSize) 
    if result:
        actionResult.AchieveList = result[0]
        actionResult.PageCount = result[1]
    
    return actionResult
示例#2
0
文件: Action2010.py 项目: Jachon/Scut
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    if table.OutCardList.Count > 0:
        cardData = table.OutCardList[table.OutCardList.Count-1];
        actionResult.UserId = cardData.UserId
        actionResult.DeckType = int(cardData.Type)
        actionResult.CardSize = cardData.CardSize
        actionResult.Cards = sorted(cardData.Cards, cmp = compeareTo)
        actionResult.NextUserId = table.OutCardUserId
        if not table.PreCardData or table.PreCardData.PosId==position.Id:
            actionResult.IsReNew = 1
        actionResult.MultipleNum = table.MultipleNum
        actionResult.AnteNum = table.AnteNum
        actionResult.PlayerList = table.Positions
        actionResult.IsAI = position.IsAI and 1 or 0

    return actionResult
示例#3
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if not table:
        parent.ErrorCode = 1
        parent.ErrorInfo = Lang.getLang("St2011_Gameover")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = 1
        parent.ErrorInfo = Lang.getLang("St2011_Gameover")
        actionResult.Result = False
        return actionResult

    position.IsAI = urlParam.Op == 1 and True or False
    GameTable.Current.NotifyAutoAiUser(user.UserId, position.IsAI)
    return actionResult
示例#4
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    if table.IsCallEnd:
        actionResult.IsEnd = 1;
        actionResult.LandlordId = table.LandlordId
        actionResult.LandlordName = ''
    else:
        actionResult.IsEnd = 0;
        actionResult.LandlordId = table.CallLandlordId
        actionResult.LandlordName = table.CallLandlordName
    actionResult.MultipleNum = table.MultipleNum > 0 and table.MultipleNum or table.MinMultipleNum
    actionResult.AnteNum = table.AnteNum
    actionResult.IsCall = urlParam.IsCall
    actionResult.IsRob = urlParam.IsRob
    #需要实现
    return actionResult
示例#5
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not user or not table:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    position = GameTable.Current.GetUserPosition(user, table)
    actionResult.MultipleNum = table.MultipleNum > 0 and table.MultipleNum or table.MinMultipleNum
    actionResult.AnteNum = table.MinAnteNum
    actionResult.LandlordId = table.LandlordId
    actionResult.IsAI = position.IsAI and 1 or 0
    actionResult.IsShow = table.IsShow and 1 or 0
    actionResult.BackCardData = table.BackCardData
    actionResult.PlayerList = table.Positions
    actionResult.CodeTime = GameTable.Current.CodeTime
    actionResult.OutCardUserId = table.OutCardUserId
    if not table.PreCardData or table.PreCardData.PosId == position.Id:
        actionResult.IsReNew = 1
    actionResult.GameCoin = user.GameCoin
    if table.PreCardData:
        actionResult.PreUserId = table.PreCardData.UserId
        actionResult.DeckType = int(table.PreCardData.Type)
        actionResult.CardSize = table.PreCardData.CardSize
        for card in table.PreCardData.Cards:
            actionResult.PreCardData.append(card)
    return actionResult
示例#6
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    if table.IsCallEnd:
        actionResult.IsEnd = 1
        actionResult.LandlordId = table.LandlordId
        actionResult.LandlordName = ''
    else:
        actionResult.IsEnd = 0
        actionResult.LandlordId = table.CallLandlordId
        actionResult.LandlordName = table.CallLandlordName
    actionResult.MultipleNum = table.MultipleNum > 0 and table.MultipleNum or table.MinMultipleNum
    actionResult.AnteNum = table.AnteNum
    actionResult.IsCall = urlParam.IsCall
    actionResult.IsRob = urlParam.IsRob
    #需要实现
    return actionResult
示例#7
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    userId = str(parent.Current.UserId)
    contextUser = PersonalCacheStruct.Get[GameUser](userId)

    goldNum = ConfigEnvSet.GetInt("Archeology.ChallengeBossGold");

    # 判断晶石是否足够使用
    if contextUser.GoldNum < goldNum:
        parent.ErrorCode = Lang.getLang("1");  # 晶石不足,跳转到充值界面
        parent.ErrorInfo = Lang.getLang("LoadError");
        actionResult.Result = False;
        return actionResult;

    # 减晶石数
    contextUser.UseGold = MathUtils.Addition(contextUser.UseGold, goldNum, sys.maxint)

    userPlotPackage = GameDataCacheSet[UserPlotPackage]().FindKey(userId);
    if not userPlotPackage:
        return loadError();

    plotPackage = userPlotPackage.PlotPackage.Find(lambda x:x.CurrPlotNpcID == urlParam.plotNpcID);
    if not plotPackage:
        return loadError();
    plotPackage.BossChallengeCount += 1;

    return actionResult;
示例#8
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.IsLandlord = position.IsLandlord and 1 or 0
    actionResult.IsLandlordWin = table.IsLandlordWin and 1 or 0
    actionResult.ScoreNum = position.ScoreNum
    actionResult.CoinNum = position.CoinNum
    actionResult.GameCoin = user.GameCoin
    for card in table.PreCardData.Cards:
        actionResult.LastCards.append(card)
    actionResult.LastCards = sorted(actionResult.LastCards, cmp=compeareTo)
    actionResult.LastUserId = table.PreCardData.UserId
    actionResult.MultipleNum = table.MultipleNum
    actionResult.AnteNum = table.AnteNum
    for pos in table.Positions:
        if pos.UserId != user.UserId:
            actionResult.UserList.append(pos)

    return actionResult
示例#9
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    userId = str(parent.Current.UserId)
    contextUser = PersonalCacheStruct.Get[GameUser](userId)

    goldNum = ConfigEnvSet.GetInt("Archeology.ChallengeBossGold");

    # 判断晶石是否足够使用
    if contextUser.GoldNum < goldNum:
        parent.ErrorCode = Lang.getLang("1");  # 晶石不足,跳转到充值界面
        parent.ErrorInfo = Lang.getLang("LoadError");
        actionResult.Result = False;
        return actionResult;

    # 减晶石数
    contextUser.UseGold = MathUtils.Addition(contextUser.UseGold, goldNum, sys.maxint)

    userPlotPackage = PersonalCacheStruct[UserPlotPackage]().FindKey(userId);
    if not userPlotPackage:
        return loadError();

    plotPackage = userPlotPackage.PlotPackage.Find(lambda x:x.CurrPlotNpcID == urlParam.plotNpcID);
    if not plotPackage:
        return loadError();
    plotPackage.BossChallengeCount += 1;

    return actionResult;
示例#10
0
文件: action360.py 项目: ioying/Scut
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    userId = parent.Current.User.PersonalId;
    contextUser = parent.Current.User;
    sec = SdkSectionFactory.Section360;
    appKey =''
    appSecret = ''
    url = '{0}?grant_type=refresh_token&refresh_token={1}&client_id={2}&client_secret={3}&scope={4}'
    
    if sec:
        els = sec.Channels[urlParam.RetailID];
        if els:
            appKey = els.AppKey
            appSecret = els.AppSecret
            url =url.format(sec.GetAceessTokenUrl,urlParam.RefeshToken,appKey,appSecret,urlParam.Scope)
            TraceLog.WriteError('获取360 access_token:url={0}',url)
    result = HttpRequestManager.GetStringData(url,'GET')
    
    getToken = JsonUtils.Deserialize[Login360_V2.SDK360GetTokenError](result)
    if getToken == None:
        actionResult.AccessToken = contextUser.AccessToken
    else:
        if getToken and getToken.error_code != None  and getToken.error_code !='':
            parent.ErrorCode = Lang.getLang("ErrorCode")
            parent.ErrorInfo = Lang.getLang("GetAccessFailure")
            actionResult.Result = False;
            TraceLog.WriteError('获取360 access_token 失败:url={0},result={1},error_code={2},error={3}',url,result,getToken.error_code,getToken.error)
            return actionResult;
        actionResult.AccessToken = getToken.access_token
        contextUser.AccessToken = actionResult.AccessToken
    return actionResult;
示例#11
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    if table.OutCardList.Count > 0:
        cardData = table.OutCardList[table.OutCardList.Count - 1]
        actionResult.UserId = cardData.UserId
        actionResult.DeckType = int(cardData.Type)
        actionResult.CardSize = cardData.CardSize
        actionResult.Cards = sorted(cardData.Cards, cmp=compeareTo)
        actionResult.NextUserId = table.OutCardUserId
        if not table.PreCardData or table.PreCardData.PosId == position.Id:
            actionResult.IsReNew = 1
        actionResult.MultipleNum = table.MultipleNum
        actionResult.AnteNum = table.AnteNum
        actionResult.PlayerList = table.Positions
        actionResult.IsAI = position.IsAI and 1 or 0

    return actionResult
示例#12
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if not table:
        parent.ErrorCode = 1
        parent.ErrorInfo = Lang.getLang("St2011_Gameover")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = 1
        parent.ErrorInfo = Lang.getLang("St2011_Gameover")
        actionResult.Result = False
        return actionResult

    position.IsAI = urlParam.Op == 1 and True or False
    GameTable.Current.NotifyAutoAiUser(user.UserId, position.IsAI)
    return actionResult
示例#13
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not user or not table:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    position = GameTable.Current.GetUserPosition(user, table)
    actionResult.MultipleNum = table.MultipleNum > 0 and table.MultipleNum or table.MinMultipleNum
    actionResult.AnteNum = table.MinAnteNum
    actionResult.LandlordId = table.LandlordId
    actionResult.IsAI = position.IsAI and 1 or 0
    actionResult.IsShow = table.IsShow and 1 or 0
    actionResult.BackCardData = table.BackCardData
    actionResult.PlayerList = table.Positions
    actionResult.CodeTime = GameTable.Current.CodeTime
    actionResult.OutCardUserId = table.OutCardUserId
    if not table.PreCardData or table.PreCardData.PosId==position.Id:
        actionResult.IsReNew = 1
    actionResult.GameCoin = user.GameCoin
    if table.PreCardData:
        actionResult.PreUserId = table.PreCardData.UserId
        actionResult.DeckType = int(table.PreCardData.Type)
        actionResult.CardSize = table.PreCardData.CardSize
        for card in table.PreCardData.Cards:
            actionResult.PreCardData.append(card)
    return actionResult
示例#14
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.IsLandlord = position.IsLandlord and 1 or 0
    actionResult.IsLandlordWin = table.IsLandlordWin and 1 or 0
    actionResult.ScoreNum = position.ScoreNum
    actionResult.CoinNum = position.CoinNum
    actionResult.GameCoin = user.GameCoin
    for card in table.PreCardData.Cards:
        actionResult.LastCards.append(card)
    actionResult.LastCards = sorted(actionResult.LastCards, cmp = compeareTo)
    actionResult.LastUserId = table.PreCardData.UserId
    actionResult.MultipleNum = table.MultipleNum
    actionResult.AnteNum = table.AnteNum
    for pos in table.Positions:
        if pos.UserId != user.UserId:
            actionResult.UserList.append(pos)

    return actionResult
示例#15
0
def buildPacket(writer, urlParam, actionResult):
    writer.PushIntoStack(len(actionResult.userMail))
    mailInfoCacheSet = ShareCacheStruct[MailInfo]()

    for item in actionResult.userMail:
        dsItem = DataStruct()
        mailType = item.MailType
        dsItem.PushIntoStack(item.UserId)
        dsItem.PushShortIntoStack(MathUtils.ToShort(mailType))
        dsItem.PushIntoStack(item.FromUserId)
        dsItem.PushIntoStack(item.FromUserName if item.FromUserName else '')
        dsItem.PushIntoStack(item.Title)
        dsItem.PushIntoStack(item.Content)
        diffDays = (DateTime.Now - item.SendDate).Days
        if diffDays < 1:
            diffHours = (DateTime.Now - item.SendDate).Hours
            if diffHours < 1:
                diffMinutes = (DateTime.Now - item.SendDate).Minutes
                minutesMsg = Lang.getLang("St9302_Minutes")
                dsItem.PushIntoStack('{0}{1}'.format(diffMinutes, minutesMsg))
            else:
                hourMsg = Lang.getLang("St9302_Hours")
                dsItem.PushIntoStack('{0}{1}'.format(diffHours, hourMsg))
        elif diffDays >= 1 and diffDays < 3:
            dayMsg = Lang.getLang("St9302_Days")
            dsItem.PushIntoStack('{0}{1}'.format(diffDays, dayMsg))
        else:
            dsItem.PushIntoStack(item.SendDate.ToString())
        #diffDays = (DateTime.Now-item.SendDate).TotalDays;
        #if diffDays < 1:
        #    diffHours = (DateTime.Now-item.SendDate).TotalHours;
        #    dsItem.PushIntoStack('{0}{1}'.format(diffHours, Lang.getLang("St9302_Hours")));
        #elif diffDays >= 1 and diffDays < 3:
        #    dsItem.PushIntoStack('{0}{1}'.format(diffDays, Lang.getLang("St9302_Days")));
        #else:
        #    dsItem.PushIntoStack(item.SendDate.ToString());
        #dsItem.PushByteIntoStack(item.IsRead);
        dsItem.PushByteIntoStack(item.IsGuide)

        if item.IsGuide == 1:
            mailInfo = mailInfoCacheSet.Find(
                lambda s: s.MailType == MathUtils.ToInt(mailType))
            if mailInfo:
                dsItem.PushIntoStack(mailInfo.GuideContent)
            else:  # 如果获取不到相应类型的引导内容,下发空
                dsItem.PushIntoStack('')
        else:
            dsItem.PushIntoStack('')
        dsItem.PushByteIntoStack(item.IsReply)
        dsItem.PushShortIntoStack(MathUtils.ToShort(item.ReplyStatus))
        dsItem.PushIntoStack(MathUtils.ToNotNullString(item.MailID))
        dsItem.PushIntoStack(
            item.CounterattackUserID if item.CounterattackUserID else 0)
        dsItem.PushIntoStack(MathUtils.ToNotNullString(item.SendDate))
        writer.PushIntoStack(dsItem)
    return True
示例#16
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    gameHall = GameHall(parent.Current.User)
    actionResult.Result = gameHall.ChangeUserHead(urlParam.HeadIcon)
    if not actionResult.Result:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St1010_ChangeHeadError")
        return actionResult

    return actionResult
示例#17
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    gameHall = GameHall(parent.Current.User)
    actionResult.Result = gameHall.ChangeUserHead(urlParam.HeadIcon)
    if not actionResult.Result:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St1010_ChangeHeadError")
        return actionResult

    return actionResult
示例#18
0
def buildPacket(writer, urlParam, actionResult):
    writer.PushIntoStack(len(actionResult.userMail));
    mailInfoCacheSet = ShareCacheStruct[MailInfo]();

    for item in actionResult.userMail:
        dsItem = DataStruct();
        mailType = item.MailType;
        dsItem.PushIntoStack(item.UserId);
        dsItem.PushShortIntoStack(MathUtils.ToShort(mailType));
        dsItem.PushIntoStack(item.FromUserId);
        dsItem.PushIntoStack(item.FromUserName if item.FromUserName else '');
        dsItem.PushIntoStack(item.Title);
        dsItem.PushIntoStack(item.Content);
        diffDays = (DateTime.Now-item.SendDate).Days;
        if diffDays < 1:
            diffHours = (DateTime.Now-item.SendDate).Hours;
            if diffHours < 1:
                diffMinutes = (DateTime.Now-item.SendDate).Minutes;
                minutesMsg = Lang.getLang("St9302_Minutes");
                dsItem.PushIntoStack('{0}{1}'.format(diffMinutes, minutesMsg));
            else:
                hourMsg = Lang.getLang("St9302_Hours");
                dsItem.PushIntoStack('{0}{1}'.format(diffHours, hourMsg));
        elif diffDays >= 1 and diffDays < 3:
            dayMsg = Lang.getLang("St9302_Days");
            dsItem.PushIntoStack('{0}{1}'.format(diffDays, dayMsg));
        else:
            dsItem.PushIntoStack(item.SendDate.ToString());
        #diffDays = (DateTime.Now-item.SendDate).TotalDays;
        #if diffDays < 1:
        #    diffHours = (DateTime.Now-item.SendDate).TotalHours;
        #    dsItem.PushIntoStack('{0}{1}'.format(diffHours, Lang.getLang("St9302_Hours")));
        #elif diffDays >= 1 and diffDays < 3:
        #    dsItem.PushIntoStack('{0}{1}'.format(diffDays, Lang.getLang("St9302_Days")));
        #else:
        #    dsItem.PushIntoStack(item.SendDate.ToString());
        #dsItem.PushByteIntoStack(item.IsRead);
        dsItem.PushByteIntoStack(item.IsGuide);

        if item.IsGuide == 1:
            mailInfo = mailInfoCacheSet.Find(lambda s:s.MailType == MathUtils.ToInt(mailType));
            if mailInfo:
                dsItem.PushIntoStack(mailInfo.GuideContent);
            else: # 如果获取不到相应类型的引导内容,下发空
                dsItem.PushIntoStack('');
        else:
            dsItem.PushIntoStack('');
        dsItem.PushByteIntoStack(item.IsReply);
        dsItem.PushShortIntoStack(MathUtils.ToShort(item.ReplyStatus));
        dsItem.PushIntoStack(MathUtils.ToNotNullString(item.MailID));
        dsItem.PushIntoStack(item.CounterattackUserID if item.CounterattackUserID else 0);
        dsItem.PushIntoStack(MathUtils.ToNotNullString(item.SendDate));
        writer.PushIntoStack(dsItem);
    return True;
示例#19
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.UserId = user.UserId
    actionResult.Status = urlParam.Status
    return actionResult
示例#20
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.UserId = user.UserId
    actionResult.Status = urlParam.Status
    return actionResult
示例#21
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    broadcastService = DdzBroadcastService(user)
    actionResult.MessageList = broadcastService.GetMessages()
    return actionResult
示例#22
0
文件: Action1010.py 项目: bmjoy/ddz
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    gameHall = GameHall(user)
    actionResult.Result = gameHall.ChangeUserHead(urlParam.HeadIcon)
    if not actionResult.Result:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St1010_ChangeHeadError")
        return actionResult

    return actionResult;
示例#23
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.UserId = user.UserId
    actionResult.Status = urlParam.Status
    return actionResult
示例#24
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    broadcastService = DdzBroadcastService(user)
    actionResult.MessageList = broadcastService.GetMessages()
    return actionResult
示例#25
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableDataByUserId(parent.Current.UserId)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    actionResult.PlayerList = table.Positions
    return actionResult
示例#26
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.UserId = user.UserId
    actionResult.Status = urlParam.Status
    return actionResult
示例#27
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    gameHall = GameHall(user)
    actionResult.Result = gameHall.ChangeUserHead(urlParam.HeadIcon)
    if not actionResult.Result:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St1010_ChangeHeadError")
        return actionResult

    return actionResult
示例#28
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableDataByUserId(parent.Current.UserId)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    actionResult.PlayerList = table.Positions
    return actionResult
示例#29
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    #需要实现
    userId = str(parent.Current.UserId)
    contextUser = PersonalCacheStruct.Get[GameUser](userId)
    userExtend = contextUser.UserExtend
    LairTreasure=ShareCacheStruct[LairTreasureInfo]().FindKey(urlParam.LairTreasureType)
    if not LairTreasure:
         parent.ErrorCode = Lang.getLang("ErrorCode");
         parent.ErrorInfo = Lang.getLang("St12101_NotLairTreasure");
         actionResult.Result = False;
         return actionResult;
    actionResult.LairList=LairTreasure.LairTreasureList
    actionResult.ExpendNum=LairTreasure.UseNum
    if LairTreasure.UseType==0:
        actionResult.HaveNum=contextUser.GameCoin
    if LairTreasure.UseType==1:
        actionResult.HaveNum=contextUser.GoldNum
    actionResult.UserType = LairTreasure.UseType
    actionResult.MaxNum = LairTreasure.LairTreasureNum
    if(userExtend.LairDate.Date != DateTime.Now.Date):
        userExtend.LairNum = 0
        userExtend.LairDate = DateTime.Now
    if(userExtend.DaLairDate.Date != DateTime.Now.Date):
        userExtend.DaLairNum = 0
        userExtend.DaLairDate = DateTime.Now
    if(userExtend.ZhongLairDate.Date != DateTime.Now.Date):
        userExtend.ZhongLairNum = 0
        userExtend.ZhongLairDate = DateTime.Now
    if urlParam.LairTreasureType == MathUtils.ToInt(LairTreasureType.ZhuanJiaQuBao):
        #actionResult.MaxNum = ConfigEnvSet.GetInt("UserLair.Num")
        actionResult.LastNum = MathUtils.Subtraction(actionResult.MaxNum,userExtend.LairNum)
    if urlParam.LairTreasureType == MathUtils.ToInt(LairTreasureType.DaShiQuBao):
        #actionResult.MaxNum = ConfigEnvSet.GetInt("UserDaLair.Num")
        actionResult.LastNum = MathUtils.Subtraction(actionResult.MaxNum,userExtend.DaLairNum)
    if urlParam.LairTreasureType == MathUtils.ToInt(LairTreasureType.ZongShiQuBao):
        #actionResult.MaxNum = ConfigEnvSet.GetInt("UserZhongLair.Num")
        actionResult.LastNum = MathUtils.Subtraction(actionResult.MaxNum,userExtend.ZhongLairNum)
    cacheSetFes =  ShareCacheStruct[FestivalInfo]();
    festivalInfo = cacheSetFes.Find(lambda s:s.FestivalType==FestivalType.KaoGu);
    if festivalInfo:
        index = MathUtils.ToInt(MathUtils.DiffDate(DateTime.Now, festivalInfo.EndDate).TotalDays);
        if(index==0):
            actionResult.ActivityEndTime = Lang.getLang("Today")
        else:
            if(index == -1):
                actionResult.ActivityEndTime = Lang.getLang("Tomorrow")
            else:
                if(index < -1):
                    actionResult.ActivityEndTime = festivalInfo.EndDate.ToString(Lang.getLang("DateFormatMMdd"))

    return actionResult;
示例#30
0
文件: Action9202.py 项目: bmjoy/ddz
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    broadcastService = DdzBroadcastService(user)
    actionResult.MessageList = broadcastService.GetMessages()
    return actionResult
示例#31
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.Cards = GameTable.Current.GetLandlordCardData(table)
    actionResult.MultipleNum = table.MultipleNum
    actionResult.AnteNum = table.AnteNum
    return actionResult
示例#32
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    actionResult.Cards = GameTable.Current.GetLandlordCardData(table)
    actionResult.MultipleNum = table.MultipleNum
    actionResult.AnteNum = table.AnteNum
    return actionResult
示例#33
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    broadcastService = DdzBroadcastService(user)
    actionResult.MessageList = broadcastService.GetMessages()
    return actionResult
示例#34
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    gameUser = PersonalCacheStruct.Get[GameUser](userId)
    actionResult.UserLv = gameUser.UserLv
    if actionResult.UserLv >= 10:
        userShengJiTa = GameDataCacheSet[UserShengJiTa]().FindKey(
            userId)  #获取玩家信息
        if userShengJiTa == None:
            GameDataCacheSet[UserShengJiTa]().Add(
                UserShengJiTa(MathUtils.ToInt(userId)))
            userShengJiTa = GameDataCacheSet[UserShengJiTa]().FindKey(
                userId)  #获取玩家信息
        if userShengJiTa.EndTime == None or DateTime.Now.Date != userShengJiTa.EndTime.Date:  #判断时间是否同一天
            userShengJiTa.MaxTierNum = 0
            userShengJiTa.ScoreStar = 0
            userShengJiTa.LifeNum = 0
            userShengJiTa.WuLiNum = 0
            userShengJiTa.FunJiNum = 0
            userShengJiTa.MofaNum = 0
            userShengJiTa.FiveTierRewardList.Clear()
            userShengJiTa.IsTierNum = 0  #当前层数
            userShengJiTa.IsTierStar = 0  #当前五层得分
            userShengJiTa.BattleRount = 0
            userShengJiTa.SJTStatus = 0
            userShengJiTa.RoundPoor = 0
            List = []
            List = userShengJiTa.RewardStatusList  #附加奖励是否领取置为否
            for i in List:
                i.IsReceive = 0
        actionResult.BattleRount = userShengJiTa.BattleRount
        if actionResult.BattleRount > 3:
            parent.ErrorCode = Lang.getLang("ErrorCode")
            parent.ErrorInfo = Lang.getLang("St13002_BattleRount")
        actionResult.LastBattleRount = 3 - actionResult.BattleRount
        actionResult.MaxTierNum = userShengJiTa.MaxTierNum
        actionResult.ScoreStar = userShengJiTa.ScoreStar
        rankList = RankingFactory.Get[UserRank](
            ShengJiTaRanking.RankingKey)  #获取玩家的排行
        ranKingUser = rankList.Find(lambda u: u.UserID == userId)
        if ranKingUser:
            actionResult.UserRank = ranKingUser.SJTRankId
        else:
            actionResult.UserRank = 0  #未进入排行榜
        actionResult.SJTStatus = userShengJiTa.SJTStatus  #跳转界面
    else:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St4405_UserLvNotEnough")
        actionResult.Result = False
        return actionResult
    return actionResult
示例#35
0
文件: Action7002.py 项目: bmjoy/ddz
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
示例#36
0
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
示例#37
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    actionResult.LandlordId = table.CallLandlordId
    actionResult.LandlordName = table.CallLandlordName
    actionResult.CodeTime = GameTable.Current.CodeTime
    actionResult.BackCardData = table.BackCardData
    actionResult.UserCardData = GameTable.Current.GetUserCardData(user, table)
    return actionResult
示例#38
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    actionResult.LandlordId = table.CallLandlordId
    actionResult.LandlordName = table.CallLandlordName
    actionResult.CodeTime = GameTable.Current.CodeTime
    actionResult.BackCardData = table.BackCardData
    actionResult.UserCardData = GameTable.Current.GetUserCardData(user, table)
    return actionResult
示例#39
0
文件: action4401.py 项目: 0jpq0/Scut
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = parent.Current.User.PersonalId
    gameUser =parent.Current.User
    actionResult.UserLv=gameUser.UserLv   
    if actionResult.UserLv>=10:       
        userShengJiTa = GameDataCacheSet[UserShengJiTa]().FindKey(userId)    #获取玩家信息
        if userShengJiTa == None:
            GameDataCacheSet[UserShengJiTa]().Add(UserShengJiTa(MathUtils.ToInt(userId)), GameEnvironment.CacheUserPeriod)
            userShengJiTa = GameDataCacheSet[UserShengJiTa]().FindKey(userId)    #获取玩家信息
        if userShengJiTa.EndTime==None or DateTime.Now.Date!=userShengJiTa.EndTime.Date:  #判断时间是否同一天
            userShengJiTa.MaxTierNum = 0;
            userShengJiTa.ScoreStar = 0;
            userShengJiTa.LifeNum = 0;
            userShengJiTa.WuLiNum = 0;
            userShengJiTa.FunJiNum = 0;
            userShengJiTa.MofaNum = 0;
            userShengJiTa.FiveTierRewardList.Clear();
            userShengJiTa.IsTierNum=0     #当前层数
            userShengJiTa.IsTierStar=0             #当前五层得分  
            userShengJiTa.BattleRount=0
            userShengJiTa.SJTStatus=0
            userShengJiTa.RoundPoor = 0;
            List=[]
            List=userShengJiTa.RewardStatusList            #附加奖励是否领取置为否
            for i in List:
                i.IsReceive=0
        actionResult.BattleRount=userShengJiTa.BattleRount
        if actionResult.BattleRount>3:
             parent.ErrorCode = Lang.getLang("ErrorCode");
             parent.ErrorInfo = Lang.getLang("St13002_BattleRount")
        actionResult.LastBattleRount=3-actionResult.BattleRount
        actionResult.MaxTierNum=userShengJiTa.MaxTierNum
        actionResult.ScoreStar=userShengJiTa.ScoreStar
        rankList = RankingFactory.Get[UserRank](ShengJiTaRanking.RankingKey)   #获取玩家的排行
        ranKingUser=rankList.Find(lambda u:u.UserID==userId)
        if ranKingUser:
            actionResult.UserRank=ranKingUser.SJTRankId   
        else:
            actionResult.UserRank=0     #未进入排行榜
        actionResult.SJTStatus=userShengJiTa.SJTStatus   #跳转界面
    else:
         parent.ErrorCode = Lang.getLang("ErrorCode");
         parent.ErrorInfo = Lang.getLang("St4405_UserLvNotEnough")
         actionResult.Result = False;
         return actionResult;
    return actionResult;
示例#40
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    user = parent.Current.User;
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("St9002_NotJoinedTheRoom");
        actionResult.Result = False;
        return actionResult;
    chatService = DdzChatService(user)
    actionResult.ChatMaxNum = chatService.CurrVersion;
    chatAll = chatService.Receive();
    actionResult.chatList = chatAll.FindAll(lambda s:s.RoomId == user.Property.RoomId and s.TableId == user.Property.TableId)
    user.Property.ChatVesion = actionResult.ChatMaxNum;

    #需要实现
    return actionResult;
示例#41
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    contextUser = PersonalCacheStruct.Get[GameUser](userId)
    userName = contextUser.NickName

    mailInfoCacheSet = ShareCacheStruct[MailInfo]()
    mailInfo = mailInfoCacheSet.Find(
        lambda s: s.MailType == MathUtils.ToInt(MailType.Friends))
    if not mailInfo:
        actionResult.Result = False
        return actionResult

    # 判断是否为好友
    userFriendsCacheSet = ShareCacheStruct[UserFriends]()
    isUserFriends = userFriendsCacheSet.FindKey(userId.ToString(),
                                                urlParam.toUserID)
    isFriends = userFriendsCacheSet.FindKey(urlParam.toUserID,
                                            userId.ToString())
    if (isUserFriends and (isUserFriends.FriendType == FriendType.Friend)) or (
            isFriends and (isFriends.FriendType == FriendType.Friend)):
        contentLength = Text.Encoding.Default.GetByteCount(urlParam.content)
        if contentLength > mailInfo.MaxLength:
            parent.ErrorCode = Lang.getLang("ErrorCode")
            parent.ErrorInfo = Lang.getLang("St9302_OverMaxLength")
            actionResult.Result = False
            return actionResult
        tempMail = UserMail(Guid.NewGuid())
        tempMail.UserId = urlParam.toUserID
        tempMail.MailType = MailType.Friends
        tempMail.FromUserId = userId
        tempMail.FromUserName = userName
        tempMail.ToUserID = urlParam.toUserID
        tempMail.ToUserName = urlParam.toUserName
        tempMail.Title = urlParam.title
        tempMail.Content = urlParam.content
        tempMail.SendDate = DateTime.Now
        tempMail.IsGuide = urlParam.isGuide
        tjxMailService = TjxMailService(contextUser)
        tjxMailService.Send(tempMail)
        return actionResult

    parent.ErrorCode = Lang.getLang("ErrorCode")
    parent.ErrorInfo = Lang.getLang("St9302_IsNotFriend")
    actionResult.Result = False
    return actionResult
示例#42
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    gameRoom = GameRoom.Current
    roomInfo = gameRoom.GetRoom(urlParam.RoomId)
    if not roomInfo or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    #if not user.RemoteAddress or user.RemoteAddress=='':
    #    parent.ErrorCode = Lang.getLang("ErrorCode")
    #    parent.ErrorInfo = Lang.getLang("St2001_ConnectError")
    #    actionResult.Result = False
    #    return actionResult
    if urlParam.Op == 2:
        #续局
        GameRoom.Current.Exit(user)
    else:
        #每日赠送金豆
        result = gameRoom.CheckDailyGiffCoin(user, roomInfo)
        if result:
            parent.ErrorCode = 3
            parent.ErrorInfo = gameRoom.Tip(Lang.getLang("St2001_GiffCoin"),
                                            roomInfo.GiffCion)
            pass

    if user.GameCoin < roomInfo.MinGameCion:
        parent.ErrorCode = 2
        parent.ErrorInfo = gameRoom.Tip(Lang.getLang("St2001_CoinNotEnough"),
                                        user.GameCoin, roomInfo.MinGameCion)
        actionResult.Result = False
        return actionResult

    table = GameRoom.Current.GetTableData(user)
    actionResult.GameCoin = user.GameCoin
    if table and table.IsStarting and user.Property.TableId > 0:
        GameTable.Current.SyncNotifyAction(ActionIDDefine.Cst_Action2015, user,
                                           None, None)
        return actionResult
    else:
        gameRoom.Enter(user, roomInfo)
    return actionResult
示例#43
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St9002_NotJoinedTheRoom")
        actionResult.Result = False
        return actionResult
    chatService = DdzChatService(user)
    actionResult.ChatMaxNum = chatService.CurrVersion
    chatAll = chatService.Receive()
    actionResult.chatList = chatAll.FindAll(
        lambda s: s.RoomId == user.Property.RoomId and s.TableId == user.
        Property.TableId)
    user.Property.ChatVesion = actionResult.ChatMaxNum

    #需要实现
    return actionResult
示例#44
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)

    # 加载数据出错
    def loadError():
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    userInfo = PersonalCacheStruct[GameUser]().FindKey(userId)
    if not userInfo:
        return loadError()

    # 判断精灵数目 True if x >= 1 else False
    if userInfo.WizardNum >= 1:
        cacheSetFestivalInfo = ShareCacheStruct[FestivalInfo]().Find(
            match=lambda x: x.FestivalType == FestivalType.SpiritBlessing)
        if not cacheSetFestivalInfo or not cacheSetFestivalInfo.Reward:
            return loadError()

        rewardInfo = UserPrayHelper.GetUserTake(
            cacheSetFestivalInfo.Reward.ToList(), userId, 1)

        if not rewardInfo:
            return loadError()

        userInfo.WizardNum = userInfo.WizardNum - 1

        itemInfo = rewardInfo.split('*')
        reward = Reward()
        reward.content = itemInfo[0]
        reward.num = itemInfo[1]
        reward.headPic = itemInfo[2]
        reward.quality = itemInfo[3]
        actionResult.reward = reward
    else:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St3013_NoWizard")
        actionResult.Result = False
    return actionResult
示例#45
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    userId = str(parent.Current.UserId)
    contextUser = PersonalCacheStruct.Get[GameUser](userId)
    userName = contextUser.NickName;
    
    mailInfoCacheSet = ShareCacheStruct[MailInfo]();
    mailInfo = mailInfoCacheSet.Find(lambda s:s.MailType ==  MathUtils.ToInt(MailType.Friends));
    if not mailInfo:
        actionResult.Result = False;
        return actionResult;

    # 判断是否为好友
    userFriendsCacheSet = ShareCacheStruct[UserFriends]();
    isUserFriends = userFriendsCacheSet.FindKey(userId.ToString(), urlParam.toUserID);
    isFriends = userFriendsCacheSet.FindKey(urlParam.toUserID, userId.ToString());
    if (isUserFriends and (isUserFriends.FriendType == FriendType.Friend)) or (isFriends and (isFriends.FriendType == FriendType.Friend)):
        contentLength = Text.Encoding.Default.GetByteCount(urlParam.content)
        if contentLength > mailInfo.MaxLength:
            parent.ErrorCode = Lang.getLang("ErrorCode");
            parent.ErrorInfo = Lang.getLang("St9302_OverMaxLength");
            actionResult.Result = False;
            return actionResult;
        tempMail = UserMail(Guid.NewGuid());
        tempMail.UserId = urlParam.toUserID;
        tempMail.MailType =  MailType.Friends;
        tempMail.FromUserId = userId;
        tempMail.FromUserName = userName;
        tempMail.ToUserID = urlParam.toUserID;
        tempMail.ToUserName = urlParam.toUserName;
        tempMail.Title = urlParam.title;
        tempMail.Content = urlParam.content;
        tempMail.SendDate = DateTime.Now;
        tempMail.IsGuide = urlParam.isGuide;
        tjxMailService = TjxMailService(contextUser);
        tjxMailService.Send(tempMail);
        return actionResult;

    parent.ErrorCode = Lang.getLang("ErrorCode");
    parent.ErrorInfo = Lang.getLang("St9302_IsNotFriend");
    actionResult.Result = False;
    return actionResult;
示例#46
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if (not table.PreCardData or table.PreCardData.PosId==position.Id)\
        and urlParam.Cards == '':
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St2009_ReOutCardError")
        actionResult.Result = False
        return actionResult

    if position.IsAI:
        position.IsAI = False
        GameTable.Current.NotifyAutoAiUser(user.UserId, False)
    result = GameTable.Current.DoOutCard(user.UserId, user.Property.PositionId,
                                         table, urlParam.Cards)
    if not result[0]:
        errorCode = result[1]
        parent.ErrorCode = Lang.getLang("ErrorCode")
        if errorCode == 1:
            parent.ErrorInfo = Lang.getLang("St2009_OutCardError")
        elif errorCode == 2:
            parent.ErrorInfo = Lang.getLang("St2009_OutCardNoExist")
        elif errorCode == 3:
            parent.ErrorInfo = Lang.getLang("St2009_OutCardExitPos")
        actionResult.Result = False
        return actionResult

    GameTable.Current.ReStarTableTimer(table)
    return actionResult
示例#47
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = parent.Current.User.PersonalId

    # 加载数据出错
    def loadError():
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    userInfo = GameDataCacheSet[GameUser]().FindKey(userId)
    if not userInfo:
        return loadError()

    # 判断精灵数目 True if x >= 1 else False
    if userInfo.WizardNum >= 1:
        cacheSetFestivalInfo = ShareCacheStruct[FestivalInfo]().Find(
            match=lambda x: x.FestivalType == FestivalType.SpiritBlessing)
        if not cacheSetFestivalInfo or not cacheSetFestivalInfo.Reward:
            return loadError()

        rewardInfo = UserPrayHelper.GetUserTake(
            cacheSetFestivalInfo.Reward.ToList(), userId, 1)

        if not rewardInfo:
            return loadError()

        userInfo.WizardNum = userInfo.WizardNum - 1

        itemInfo = rewardInfo.split('*')
        reward = Reward()
        reward.content = itemInfo[0]
        reward.num = itemInfo[1]
        reward.headPic = itemInfo[2]
        reward.quality = itemInfo[3]
        actionResult.reward = reward
    else:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St3013_NoWizard")
        actionResult.Result = False
    return actionResult
示例#48
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    userId = parent.Current.UserId;
    userName = parent.Current.User.NickName;
    
    mailInfoCacheSet = ShareCacheStruct[MailInfo]();
    mailInfo = mailInfoCacheSet.Find(lambda s:s.MailType ==  MathUtils.ToInt(MailType.Friends));
    if not mailInfo:
        actionResult.Result = False;
        return actionResult;

    # 判断是否为好友
    userFriendsCacheSet = ShareCacheStruct[UserFriends]();
    isUserFriends = userFriendsCacheSet.FindKey(userId.ToString(), urlParam.toUserID);
    isFriends = userFriendsCacheSet.FindKey(urlParam.toUserID, userId.ToString());
    if (isUserFriends and (isUserFriends.FriendType == FriendType.Friend)) or (isFriends and (isFriends.FriendType == FriendType.Friend)):
        contentLength = Text.Encoding.Default.GetByteCount(urlParam.content)
        if contentLength > mailInfo.MaxLength:
            parent.ErrorCode = Lang.getLang("ErrorCode");
            parent.ErrorInfo = Lang.getLang("St9302_OverMaxLength");
            actionResult.Result = False;
            return actionResult;
        tempMail = UserMail(Guid.NewGuid());
        tempMail.UserId = urlParam.toUserID;
        tempMail.MailType =  MailType.Friends;
        tempMail.FromUserId = userId;
        tempMail.FromUserName = userName;
        tempMail.ToUserID = urlParam.toUserID;
        tempMail.ToUserName = urlParam.toUserName;
        tempMail.Title = urlParam.title;
        tempMail.Content = urlParam.content;
        tempMail.SendDate = DateTime.Now;
        tempMail.IsGuide = urlParam.isGuide;
        tjxMailService = TjxMailService(parent.Current.User);
        tjxMailService.Send(tempMail);
        return actionResult;

    parent.ErrorCode = Lang.getLang("ErrorCode");
    parent.ErrorInfo = Lang.getLang("St9302_IsNotFriend");
    actionResult.Result = False;
    return actionResult;
示例#49
0
文件: Action2009.py 项目: bmjoy/ddz
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if (not table.PreCardData or table.PreCardData.PosId==position.Id)\
        and urlParam.Cards == '':
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St2009_ReOutCardError")
        actionResult.Result = False
        return actionResult

    if position.IsAI:
        position.IsAI = False
        GameTable.Current.NotifyAutoAiUser(user.UserId, False)
    result = GameTable.Current.DoOutCard(user.UserId, user.Property.PositionId, table, urlParam.Cards)
    if not result[0]:
        errorCode = result[1]
        parent.ErrorCode = Lang.getLang("ErrorCode")
        if errorCode == 1:
            parent.ErrorInfo = Lang.getLang("St2009_OutCardError")
        elif errorCode == 2:
            parent.ErrorInfo = Lang.getLang("St2009_OutCardNoExist")
        elif errorCode == 3:
            parent.ErrorInfo = Lang.getLang("St2009_OutCardExitPos")
        actionResult.Result = False
        return actionResult

    GameTable.Current.ReStarTableTimer(table)
    return actionResult
示例#50
0
文件: Action2001.py 项目: bmjoy/ddz
def takeAction(urlParam, parent):
    actionResult = ActionResult()    
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    gameRoom = GameRoom.Current
    roomInfo = gameRoom.GetRoom(urlParam.RoomId)
    if not roomInfo or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    #if not user.RemoteAddress or user.RemoteAddress=='':
    #    parent.ErrorCode = Lang.getLang("ErrorCode")
    #    parent.ErrorInfo = Lang.getLang("St2001_ConnectError")
    #    actionResult.Result = False
    #    return actionResult
    if urlParam.Op == 2:
        #续局
        GameRoom.Current.Exit(user)
    else:
        #每日赠送金豆
        result = gameRoom.CheckDailyGiffCoin(user, roomInfo)
        if result:
            parent.ErrorCode = 3
            parent.ErrorInfo = gameRoom.Tip( Lang.getLang("St2001_GiffCoin"),  roomInfo.GiffCion)
            pass

    if user.GameCoin < roomInfo.MinGameCion:
        parent.ErrorCode = 2
        parent.ErrorInfo = gameRoom.Tip( Lang.getLang("St2001_CoinNotEnough"), user.GameCoin, roomInfo.MinGameCion)
        actionResult.Result = False
        return actionResult
    
    table = GameRoom.Current.GetTableData(user)
    actionResult.GameCoin = user.GameCoin
    if table and table.IsStarting and user.Property.TableId > 0:
        GameTable.Current.SyncNotifyAction(ActionIDDefine.Cst_Action2015, user, None, None)
        return actionResult
    else:
        gameRoom.Enter(user, roomInfo)
    return actionResult
示例#51
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    
    if table.IsCallEnd:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St2005_CalledIsEnd")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if position.IsAI:
        position.IsAI = False
        GameTable.Current.NotifyAutoAiUser(user.UserId, False)
    isCall = urlParam.op == 1 and True or False
    GameTable.Current.CallCard(user.Property.PositionId, table, isCall)
    GameTable.Current.ReStarTableTimer(table)
    return actionResult
示例#52
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = str(parent.Current.UserId)
    user = PersonalCacheStruct.Get[GameUser](userId)
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    if table.IsCallEnd:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St2005_CalledIsEnd")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if position.IsAI:
        position.IsAI = False
        GameTable.Current.NotifyAutoAiUser(user.UserId, False)
    isCall = urlParam.op == 1 and True or False
    GameTable.Current.CallCard(user.Property.PositionId, table, isCall)
    GameTable.Current.ReStarTableTimer(table)
    return actionResult
示例#53
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = parent.Current.User.PersonalId
    packageCacheSet = GameDataCacheSet[UserItemPackage]()
    if not packageCacheSet:
        actionResult.Result = False
        return actionResult
    userItemPack = packageCacheSet.FindKey(userId)
    if not userItemPack or not userItemPack.ItemPackage:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    userItem = userItemPack.ItemPackage.Find(
        lambda s: s.UserItemID == urlParam.userItemID)
    if userItem == None:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    itemID = userItem.ItemID
    if userItem.ItemType != ItemType.DaoJu or userItem.PropType != 19:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St1114_IsNotGiftBag")
        actionResult.Result = False
        return actionResult
    itemBaseInfoCacheStruct = ShareCacheStruct[ItemBaseInfo]()
    baseInfo = itemBaseInfoCacheStruct.FindKey(itemID.ToString())
    if not baseInfo:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if baseInfo.ItemType != ItemType.DaoJu or baseInfo.PropType != 19:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St1114_IsNotGiftBag")
        actionResult.Result = False
        return actionResult
    actionResult.prizeInfoList = baseInfo.ItemPack
    return actionResult
示例#54
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    #需要实现
    actionResult.FleeUserId = urlParam.FleeUserId
    if actionResult.FleeUserId > 0:
        fuser = GameTable.Current.GetUser(actionResult.FleeUserId)
        if fuser:
            actionResult.FleeNickName = fuser.NickName
    table = GameRoom.Current.GetTableData(user)
    if table:
        pos = GameTable.Current.GetUserPosition(user, table)
        actionResult.InsScoreNum = pos.ScoreNum
        actionResult.InsCoinNum = pos.CoinNum
    actionResult.GameCoin = user.GameCoin
    actionResult.ScoreNum = user.ScoreNum
    return actionResult
示例#55
0
def takeAction(urlParam, parent):
    actionResult = ActionResult();
    userId = str(parent.Current.UserId)
    packageCacheSet = PersonalCacheStruct[UserItemPackage]();
    if not packageCacheSet:
        actionResult.Result = False;
        return actionResult;
    userItemPack = packageCacheSet.FindKey(userId);
    if not userItemPack or not userItemPack.ItemPackage:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("LoadError");
        actionResult.Result = False;
        return actionResult;
    userItem = userItemPack.ItemPackage.Find(lambda s:s.UserItemID == urlParam.userItemID);
    if userItem == None:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("LoadError");
        actionResult.Result = False;
        return actionResult;
    itemID = userItem.ItemID;
    if userItem.ItemType != ItemType.DaoJu or userItem.PropType != 19:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("St1114_IsNotGiftBag");
        actionResult.Result = False;
        return actionResult;
    itemBaseInfoCacheStruct = ShareCacheStruct[ItemBaseInfo]();
    baseInfo = itemBaseInfoCacheStruct.FindKey(itemID.ToString());
    if not baseInfo:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("LoadError");
        actionResult.Result = False;
        return actionResult;
    if baseInfo.ItemType != ItemType.DaoJu or baseInfo.PropType != 19:
        parent.ErrorCode = Lang.getLang("ErrorCode");
        parent.ErrorInfo = Lang.getLang("St1114_IsNotGiftBag");
        actionResult.Result = False;
        return actionResult;
    actionResult.prizeInfoList = baseInfo.ItemPack;
    return actionResult;
示例#56
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    if not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    # 需要实现
    actionResult.FleeUserId = urlParam.FleeUserId
    if actionResult.FleeUserId > 0:
        fuser = GameTable.Current.GetUser(actionResult.FleeUserId)
        if fuser:
            actionResult.FleeNickName = fuser.NickName
    table = GameRoom.Current.GetTableData(user)
    if table:
        pos = GameTable.Current.GetUserPosition(user, table)
        actionResult.InsScoreNum = pos.ScoreNum
        actionResult.InsCoinNum = pos.CoinNum
    actionResult.GameCoin = user.GameCoin
    actionResult.ScoreNum = user.ScoreNum
    return actionResult
示例#57
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    userId = parent.Current.User.PersonalId
    contextUser = parent.Current.User

    # 加载数据出错
    def loadError():
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult

    # 判断玩家等级是否达到 20 级
    if contextUser.UserLv < 20:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("St12057_UserLvNotEnough")
        actionResult.Result = False
        return actionResult

    userPlotPackage = GameDataCacheSet[UserPlotPackage]().FindKey(userId)
    # 下发地图列表
    plotList = ConfigCacheSet[PlotInfo]().FindAll(
        match=lambda x: x.PlotType == PlotType.KaoGuPlot)
    # 副本地图信息
    if not plotList or not userPlotPackage:
        return loadError()

    # 当玩家等级达到 20 级时,初始化地图数据
    plotMapList = userPlotPackage.PlotPackage.FindAll(
        match=lambda x: x.PlotType == PlotType.KaoGuPlot)
    if not plotMapList and contextUser.UserLv >= 20:
        UserArchaeologyHelper.InitializeMapInfo(userId)
        userPlotPackage = GameDataCacheSet[UserPlotPackage]().FindKey(userId)

    actionResult.mapList = plotList
    actionResult.userPlotPackage = userPlotPackage.PlotPackage

    return actionResult
示例#58
0
def takeAction(urlParam, parent):
    actionResult = ActionResult()
    user = parent.Current.User
    table = GameRoom.Current.GetTableData(user)
    if not table or not user:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    position = GameTable.Current.GetUserPosition(user, table)
    if not position:
        parent.ErrorCode = Lang.getLang("ErrorCode")
        parent.ErrorInfo = Lang.getLang("LoadError")
        actionResult.Result = False
        return actionResult
    if position.IsAI:
        position.IsAI = False
        GameTable.Current.NotifyAutoAiUser(user.UserId, False)
    if urlParam.Op == 1:
        GameTable.Current.ShowCard(user, table)
    else:
        pass
    return actionResult