当前位置: 首页>>代码示例>>Python>>正文


Python Gcore.loadCfg方法代码示例

本文整理汇总了Python中sgLib.core.Gcore.loadCfg方法的典型用法代码示例。如果您正苦于以下问题:Python Gcore.loadCfg方法的具体用法?Python Gcore.loadCfg怎么用?Python Gcore.loadCfg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sgLib.core.Gcore的用法示例。


在下文中一共展示了Gcore.loadCfg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: BuyActPoint

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def BuyActPoint(self,para={}):
     '''购买行动点数'''
     optId = 91004
     MaxBuyActTimes = Gcore.loadCfg(9101).get('MaxBuyActTimes')
     TodayBuyTimes = self.mod.getTodayBuyTimes()
     print 'TodayBuyTimes',TodayBuyTimes
     if MaxBuyActTimes <= TodayBuyTimes:
         Gcore.out(optId, -91004001) #已达可购买上限
     else:
         TodayBuyTimes += 1
         CostValue = Gcore.loadCfg(9101).get('BuyTimesPrice').get( str(TodayBuyTimes) )
         if CostValue is None:
             CostValue = max( Gcore.loadCfg(9101).get('BuyTimesPrice').values() )
         #开始支付
         modCoin = Gcore.getMod('Coin', self.uid)
         pay = modCoin.PayCoin(optId, 1, CostValue, 'WarUI.BuyActTimes', para)
         if pay < 0:
             return Gcore.error(optId, -91004995) #支付失败
         else:            
             result = self.mod.buyActPoint()
             if not result:
                 return Gcore.error(optId, -91004002) #系统错误
     
     body = {}
     body['CanBuy'] = 1 if TodayBuyTimes < MaxBuyActTimes else 0
     RestPoint,MaxPoint = self.mod.getActPoint()
     body['RestPoint'] = RestPoint
     body['MaxPoint'] = MaxPoint
     return Gcore.out(optId, body)
开发者ID:fycheung,项目名称:misc,代码行数:31,代码来源:WarUI.py

示例2: WarInfoAll

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def WarInfoAll(self,para={}):
     '''战役主界面(新) by Lizr'''
     optId = 91003
     body = self.mod.getWarInfoAll()
     RestPoint,MaxPoint = self.mod.getActPoint()
     body['RestPoint'] = RestPoint
     body['MaxPoint'] = MaxPoint
     body['PerBuyAddPoint'] = Gcore.loadCfg(9101).get('PerBuyAddPoint')
     body['BuyTimesPrice'] = Gcore.loadCfg(9101).get('BuyTimesPrice')
     MaxBuyActTimes = Gcore.loadCfg(9101).get('MaxBuyActTimes')
     TodayBuyTimes = self.mod.getTodayBuyTimes()
     body['CanBuy'] = 1 if TodayBuyTimes < MaxBuyActTimes else 0
     body['AlreadyBuyTimes'] = TodayBuyTimes
     body['MaxBuyActTimes'] = MaxBuyActTimes
     return Gcore.out(optId, body)
开发者ID:fycheung,项目名称:misc,代码行数:17,代码来源:WarUI.py

示例3: getWallGeneralList

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def getWallGeneralList(self):
        '''获取布防武将列表  参考getWallGeneralList()  
        @call: WallUI
        @author: by Lizr
        '''
        kLeader = Gcore.loadCfg(Gcore.defined.CFG_BATTLE)["kLeaderAddNum"]
        SoldierTechs =  Gcore.getMod('Book',self.uid).getTechsLevel(1)
        
        InListGeneral = self.db.out_list('tb_wall_general','GeneralId',"UserId=%s"%self.uid) #已布防
        
        fields = ['GeneralId','GeneralType','GeneralLevel','ForceValue',
                  'WitValue','SpeedValue','LeaderValue','TakeType','TakeTypeDefense']
        rows = Gcore.getMod('General',self.uid).getMyGenerals(fields)
        #Gcore.printd( rows )
        GeneralList = []
        for row in rows:
            if not row['TakeTypeDefense']:
                row['TakeTypeDefense'] = row['TakeType']

            row['Skill'] = Gcore.getCfg('tb_cfg_general',row['GeneralType'],'SkillId')
            SoldierType = row['TakeTypeDefense']
            SoldierLevel = SoldierTechs.get( SoldierType )
            row['SoldierType'] = SoldierType
            row['SoldierLevel'] = SoldierLevel
            key = (SoldierType,SoldierLevel)
            SoldierNum = row['LeaderValue']*kLeader
            
            cfg_soldier = Gcore.getCfg('tb_cfg_soldier_up',key)
            if cfg_soldier:
                #row['Life'] = cfg_soldier['Life']* row['LeaderValue']*kLeader
                #row['Attack'] = cfg_soldier['Attack']*row['LeaderValue']*kLeader
                #row['Denfense'] = cfg_soldier['Defense']
                
                row['Life'] = F.getArmyLife(cfg_soldier['Life'], SoldierNum)
                row['Attack'] = F.getArmyAttack(
                                               generalType = row['GeneralType'],
                                               soldierType = row['SoldierType'],
                                               landForm = 4,
                                               soldierAttack = cfg_soldier['Attack'],
                                               soldierNum = SoldierNum,
                                               forceValue = row['ForceValue'],
                                               )
                row['Denfense'] = F.defenseAdd( cfg_soldier['Defense'],row['SpeedValue'],row['GeneralType']) 
            else:
                row['Life'] = 0
                row['Attack'] = 0
                row['Denfense'] = 0
                
            row['InWall'] = row['GeneralId'] in InListGeneral #是否在布防中
            
#            del row['ForceValue']
#            del row['WitValue']
#            del row['SpeedValue']
#            del row['LeaderValue']
            
            del row['TakeType']
            del row['TakeTypeDefense']
           
            GeneralList.append(row)
        return GeneralList
开发者ID:fycheung,项目名称:misc,代码行数:62,代码来源:WallMod.py

示例4: gainDeveote

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def gainDeveote(self,clubId,gainWay,**p):
     '''
     :获得贡献
     @param clubId:
     @param gainWay:获得方式 1贡献 3抽奖
     @param p:if gainWay==1: p{coinValue,coinType}
              elif gainWay==3: p{devoteNum}
     '''
     if not clubId:
         return 0
     
     devoteNum = p.get('devoteNum',0)
     record = {'ClubId':clubId,'UserId':self.uid,
               'UserType':Gcore.getUserData(self.uid,'UserType'),
               'ActionType':gainWay,'DevoteNum':devoteNum,
               'CreateTime':time.time()}
     if gainWay==1:#贡献获得
         coinType = p['coinType']
         coinValue = p['coinValue']
         devoteBase = Gcore.loadCfg(defined.CFG_BUILDING_CLUB).get('ClubGiveBase').get( str(coinType))
         devoteNum = coinValue/devoteBase
         record['DevoteNum'] = devoteNum
         record['DevoteCoinType'] = coinType
         record['DevoteCoinValue'] = coinValue
     sql = 'UPDATE tb_club_member \
             SET  DevoteCurrent=DevoteCurrent+%s,\
                  DevoteTotal=DevoteTotal+%s \
             WHERE UserId=%s AND ClubId=%s'%(devoteNum,devoteNum,self.uid,clubId)
     if self.db.execute(sql):
         self.db.insert('tb_log_club_devote',record)
         return devoteNum
     else:
         0
开发者ID:fycheung,项目名称:misc,代码行数:35,代码来源:Building_clubMod.py

示例5: GetSignInLog

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def GetSignInLog(self, param={}):
     '''获取签到日志'''
     optId = 23006
     data = self.mod.getSigninLog()
     a = list(data['SignInDate'])
     data['SignInDate'] = ','.join(a)
     #获取全勤奖励信息
     awards = Gcore.getCfg('tb_cfg_act_signin_award').values()
     fullWorkAwards = filter(lambda dic:dic['AwardId']>=3000 and dic['AwardId']<4000, awards)
     now = datetime.datetime.now()
     data['FullWorkAwardId'] = fullWorkAwards[now.month-1]['AwardId']
     #获取周期奖励信息
     finalAwards = Gcore.loadCfg(CFG_ACT_SIGNIN)['FinalAwardId']
     #awards = finalAwards.split(',')
     awards = finalAwards
     signCount = data['SignInCount']
     n = signCount / 30 % len(awards)
     if signCount % 30 == 0:
         n -= 1
     awardId = int(awards[n])
     data['FinalAwardId'] = awardId
     signCount = signCount % 30
     data['SignInDays'] = signCount if signCount else 30 #用于前台显示当前周期内的天数,30天一周期
     data['Refill'] = 5 - data['Refill']
     return Gcore.out(optId, data)
开发者ID:fycheung,项目名称:misc,代码行数:27,代码来源:ActivityUI.py

示例6: getRankReward

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def getRankReward(self):
     '''获取排名奖励界面'''
     data = {}
     data['RewardTime'] = Gcore.loadCfg(Gcore.defined.CFG_RANK_FIGHT).get('RewardTime','22:00:00')
     RankId = self.db.out_field('tb_rank_fight_last','RankId','UserId=%s'%self.uid)
     data['RewardRankId'] = RankId if RankId else 0
     cfg_rank_reward = Gcore.getCfg('tb_cfg_rank_reward')
     data['RewardBoxList'] = {}
     
     MyRewardRankId = data['RewardRankId']
     for k,v in cfg_rank_reward.iteritems():
         data['RewardBoxList'][k] = {
                                     'RewardId':v['RewardId'],
                                     'RankFrom':v['RankFrom'],
                                     'RankTo':v['RankTo'],
                                     'Bright':1 if v['RankFrom']<=MyRewardRankId<=v['RankTo'] else 0
                                     }
         data['RewardBoxList'][k]['Rewards'] = []
         for i in xrange(1,6):
             field1 = 'RewardType%s'%i
             field2 = 'GoodsId%s'%i
             field3 = 'GoodsNum%s'%i
             if v[field1] and v[field2]:
                 cell = {'RewardType':v[field1], 'GoodsId':v[field2], 'GoodsNum':v[field3]}
                 data['RewardBoxList'][k]['Rewards'].append(cell)
     return data
开发者ID:fycheung,项目名称:misc,代码行数:28,代码来源:RankFightMod.py

示例7: autoAddSoldier

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def autoAddSoldier(self, TimeStamp=None):
        '''自动补兵'''
        TimeStamp = TimeStamp if TimeStamp else time.time()

        #上阵武将的信息
        Generals = self.getLatestGeneralInfo(TimeStamp=TimeStamp)
        onembattle = sorted([General for General in Generals if General["PosId"] and \
                           General["TakeType"]], key=lambda dic:dic["PosId"])
        if not onembattle:
            return -1 #没有上阵武将

        #当前士兵总数
        modCamp = Gcore.getMod('Building_camp', self.uid)
        soldiers = modCamp.getSoldiers()

        #剩余的士兵
        for General in onembattle:
            soldiers["Soldier%d"%General['TakeType']] -= General['TakeNum']
            assert soldiers["Soldier%d"%General['TakeType']] >= 0

        kLeaderAddNum = Gcore.loadCfg(Gcore.defined.CFG_BATTLE).get('kLeaderAddNum')
        sql = 'UPDATE %s SET TakeNum=CASE GeneralId ' % self.tb_general()
        for General in onembattle:
            num = min(soldiers["Soldier%d"%General['TakeType']],
                      General['LeaderValue'] * kLeaderAddNum - General["TakeNum"])
            General["TakeNum"] += num
            soldiers["Soldier%d"%General['TakeType']] -= num
            sql += ' WHEN %d THEN %d ' % (General["GeneralId"], General["TakeNum"])

        where = 'UserId = %s AND ( GeneralId = ' % (self.uid, )+ \
        ' OR GeneralId = '.join([str(General["GeneralId"]) for General in onembattle]) + ' ) '
        sql += ' ELSE TakeNum END WHERE %s ' % where

        return self.db.execute(sql)
开发者ID:fycheung,项目名称:misc,代码行数:36,代码来源:GeneralMod.py

示例8: GetCrewList

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def GetCrewList(self,p={}):
        '''查询军团成员列表/申请列表
        @param ListView: 1:成员列表2:申请列表 '''
        optId = 15073
        listView = p['ListView']
        pageNum = p['PageNum']
        sortWay = 'ASC' if p['SortWay']==0 else 'DESC'
        sortField = p['SortField']
        if sortField == 1:
            sortField = 'u.VipLevel '+sortWay
        elif sortField == 2:
            sortField = 'm.DevoteTotal '+sortWay
        else:
            sortField = 'u.UserHonour '+sortWay
        clubId = self.mod.getUserClubId()
        if not clubId:
            return Gcore.error(optId,-15066920)#军团不存在
        pageSize = Gcore.loadCfg(Gcore.defined.CFG_BUILDING_CLUB ).get('MemPS')
        memberNum = self.mod.getCrewNum(listView,clubId)
        maxPage = int(math.ceil(float(memberNum)/pageSize))
        if 0<maxPage<pageNum:
            pageNum = maxPage
        if pageNum<1:
            pageNum = 1
        offset = (pageNum-1)*pageSize
#        end = offset+pageSize
        if memberNum>0:
            members = self.mod.getCrewList(listView,clubId,sortField,offset,pageSize)
        else:
            members = []
        clubLevel = self.mod.getClubInfo(clubId).get('ClubLevel')
        memberNum = self.mod.getClubMemberNum(clubId)
        return Gcore.out(optId,{'ClubLevel':clubLevel,'MemberNum':memberNum,'Members':members,'PageNum':pageNum,'MaxPage':maxPage})
开发者ID:fycheung,项目名称:misc,代码行数:35,代码来源:Building_clubUI.py

示例9: ModifyClub

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def ModifyClub(self,p={}):
     '''
     :修改军团信息(团长)
     '''
     optId = 15065
     logoId = p.get('LogoId')
     clubNotice = p.get('ClubNotice')
     allowState = p.get('AllowState')
     building = self.mod.getClubBuildingInfo()
     if building is None:
         return  Gcore.error(optId,-15065901)#外史院建筑不存在
     cfgClub = Gcore.loadCfg(defined.CFG_BUILDING_CLUB)
     noticeLimit = cfgClub.get('ClubNoticeLimit')
     flag = com.filterInput(clubNotice,0,noticeLimit)
     if flag == -1:
         return Gcore.error(optId, -15065993) #长度不符合要求
     elif flag == -2:
         return Gcore.error(optId, -15065992) #不能含有敏感字符
     if logoId not in range(1,7):
         return Gcore.error(optId,-15065999)#参数错误
     clubId = self.mod.getUserClubId()
     if not clubId:
         return Gcore.error(optId,-15065920)#军团不存在
     clubLeader = self.mod.getClubLeader(clubId)
     if self.uid != clubLeader.get('UserId'):
         return Gcore.error(optId,-15065998)#非法权限
     data = {'ClubLogoId':logoId,'ClubNotice':clubNotice,'AllowState':allowState}
     self.mod.modifyClub(clubId,data)
     return Gcore.out(optId,data)
开发者ID:fycheung,项目名称:misc,代码行数:31,代码来源:Building_clubUI.py

示例10: CreateUser

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def CreateUser(self,para={'NickName':'','UserCamp':0}): 
        '''创建用户默认数据
        #**param获取用户自定义的昵称,阵营等信息
        '''
        import random
        optId = 10002
        buildCfg = Gcore.loadCfg(CFG_BUILDING)
        userCamp = para['UserCamp']
        if userCamp==0:
            userCamp = random.randint(1,3) #1:魏,2:蜀,3:吴
        
        ctime = Gcore.common.datetime()
        data = {'CreateTime':ctime,'GoldCoin':buildCfg['InitGoldCoin'],\
                'WorkerNumber':buildCfg['InitWorkerNum'],'UserHonour':0,\
                'VipLevel':0,'NickName':para['NickName'],\
                'UserCamp':userCamp,'UserIcon':para.get('UserIcon',1),\
                'AccountId':para.get('TotalServiceId',0),\
                'OldAccount':para.get('OldAccount'),
                'ProtectEndTime':time.time()-5
                }
        UserId = self.db.insert('tb_user',data)
        self.uid = UserId
        playerMod = Gcore.getMod('Player', UserId)#此处会为用户获取新的连接
        playerMod.initUser() 
        
        #是否选择推荐阵营
        if userCamp==int(para.get('RCKey',0)):
            playerMod.sendCampGift(optId,userCamp)#发放奖励

        return UserId
开发者ID:fycheung,项目名称:misc,代码行数:32,代码来源:CLogin.py

示例11: login

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def login(self,loginIp=None,loginMode=None):
        '''登入时调用的方法'''
        now = time.time()
        sql = "UPDATE tb_user SET LastLoginTime=UNIX_TIMESTAMP(),Online=1,LoginTimes=LoginTimes+1 WHERE UserId=%s"%self.uid
        self.db.execute(sql)
        
        #if not self.uid in Gcore.StorageUser: #缓存基础用户信息
        if 1: # fixed by zhoujingjiang
            self.cacheUserData(self.uid)

        UserType = Gcore.getUserData(self.uid,'UserType')   
        #添加登录日志
#         loginLogTB = 'tb_log_login201306'
        loginLogTB = self.tb_log_login()
        data = {'UserId':self.uid,'LoginTime':now,'UserType':UserType,
                'LoginModel':loginMode,'LoginIP':loginIp}
        self.logId = self.db.insert(loginLogTB,data)
        print self.uid,'login get logId:%s at %s'%(self.logId,now)
        
        key = Gcore.redisKey(self.uid)
        Gcore.redisM.hset('sgLogin',key,'1')
        UserLevel = self.getUserLevel()
        modActivity=Gcore.getMod('Activity',self.uid)
        modActivity.signin(0,'')
        if UserLevel>=Gcore.loadCfg(9301).get('FightLevel'):
            row = {}
            row['Online']=1 
            row['UserId']=self.uid
开发者ID:fycheung,项目名称:misc,代码行数:30,代码来源:LoginMod.py

示例12: buyActPoint

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def buyActPoint(self,point=0):
        '''增加行动点数 
        @param point: 增加的点数'''
        print 'ps buyActPoint'
        if not point:
            point = Gcore.loadCfg(9101).get('PerBuyAddPoint')
        row = self.recoverActPoint(point,1)
#        if row:
#            todaytime = Gcore.common.today0time()
#            sql = "UPDATE tb_war_action SET ActPoint=ActPoint+%s WHERE UserId=%s AND LastWarTime>=%s" \
#            %(point,self.uid,todaytime)
#            self.db.execute(sql) #如果今日有打过 就修正累计记录
#            print 'buyActPoint',sql
            
        sql = "UPDATE tb_user SET BuyActPoint=BuyActPoint+%s WHERE UserId=%s"%(point,self.uid)
        AddResult = self.db.execute(sql)
        
        try: #可购买上限
            sql ="UPDATE tb_log_buy_act SET Times = Times+1 WHERE UserId=%s AND BuyDate = CURDATE()"%self.uid
            result = self.db.execute(sql)
            if not result: #无影响行数
                sql = "INSERT INTO tb_log_buy_act (UserId,Times,BuyDate) VALUES(%s,1,CURDATE())"%self.uid
                result = self.db.execute(sql)
        except:
            pass
        finally:
            return AddResult    
开发者ID:fycheung,项目名称:misc,代码行数:29,代码来源:WarMod.py

示例13: MailList

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def MailList(self,param={}):   
        '''
                    收件箱/发件箱列表
        @param param['MailType']=1 表示收件箱
               param['MailType']=2 表示发件箱 
        '''
        optId = 18003
        mailType = int(param['MailType'])
        page = int(param['Page']) #页码
        if not page: #默认为第一页
            page = 1
        if mailType not in (1,2):
            return Gcore.error(optId,-18003999)   #MailType值不对
        mailCfg = Gcore.loadCfg(Gcore.defined.CFG_MAIL)
        pagePerNum  = int(mailCfg['MailShowPerPageMax'])  #每页的邮件数
        mailCount = int(self.mod.mailCountByType(mailType)) #收件箱/发件箱中邮件总数
        mailDatas = self.mod.getMailList(mailType,page,pagePerNum)   #每页显示的邮件数据

        subjShowMax  = mailCfg['SubjectShowMax'] #邮件主题显示最大长度
        self.mod.finMailDatas(mailDatas,subjShowMax)
        totalPage = int(math.ceil(1.0*mailCount/pagePerNum))
        
        body = {'mailDatas':mailDatas,'page':page,'mailCount':mailCount,'totalpage':totalPage}
        
        return Gcore.out(optId, body = body)
开发者ID:fycheung,项目名称:misc,代码行数:27,代码来源:MailUI_bak.py

示例14: CancelBuilding

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
    def CancelBuilding(self, param={}):
        '''通用:取消建筑建造或升级'''
        optId = 15003

        BuildingId = param["BuildingId"]
        TimeStamp = param['ClientTime']

        BuildingInfo = self.mod.getBuildingById(BuildingId, 
                                                ['BuildingPrice', 
                                                 'BuildingType', 
                                                 'CoinType',
                                                 'LastOptType'], 
                                                TimeStamp=TimeStamp)
        if not BuildingInfo:
            return Gcore.error(optId, -15003003) #用户没有该建筑
        
        #BuildingType < 100 是建筑;大于100是装饰;
        if BuildingInfo['BuildingType'] < 100 and \
        BuildingInfo['BuildingState'] == 0:
            return Gcore.error(optId, -15003004) #建筑已建造或升级完成,不能取消。
        
        BuildingType = BuildingInfo['BuildingType']
        CostValue = BuildingInfo["BuildingPrice"]
        CostType = BuildingInfo["CoinType"]
        
        #返钱
        CancelReturn = Gcore.loadCfg(
            Gcore.defined.CFG_BUILDING)["CancelReturn"] #返还比例
        modCoin = Gcore.getMod('Coin', self.uid)
        classMethod = '%s.%s' % (self.__class__.__name__, 
                                 sys._getframe().f_code.co_name)
        gain = modCoin.GainCoin(optId, CostType, 
                                int(CostValue * CancelReturn), 
                                classMethod, param)
        if gain < 0:
            return Gcore.error(optId, -15003005) #增加货币失败

        #建筑正在建造 :如果是装饰,删掉。
        if BuildingInfo['BuildingType'] > 100 or \
        BuildingInfo['BuildingState'] == 1:
            self.mod.deleteBuildingById(BuildingId)
        else:
            #更新建筑表
            UpInfo = {}
            UpInfo['CompleteTime'] = TimeStamp
            UpInfo['BuildingLevel'] = BuildingInfo['BuildingRealLevel']
            UpInfo['LastOptType'] = 2
            self.mod.updateBuildingById(UpInfo, BuildingId)
        #不同类型的建筑进行不同的操作
        # + todo
        if BuildingType in (6, 7, 8): #校场 兵营 工坊:计算士兵
            modCamp = Gcore.getMod('Building_camp', self.uid)
            modCamp.TouchAllSoldiers(TimeStamp=TimeStamp)
            if BuildingType in (6, 8): #兵营 工坊 回复生产
                update_dic = {'LastChangedTime':TimeStamp, 
                              'BuildingLevel':BuildingInfo['BuildingRealLevel']}
                modCamp.updateProcessById(update_dic, BuildingId)
        return Gcore.out(optId, 
                         {'Coin%s'%CostType:modCoin.getCoinNum(CostType), 
                          "RetValue":int(CostValue * CancelReturn)})
开发者ID:fycheung,项目名称:misc,代码行数:62,代码来源:BuildingUI.py

示例15: GetMyClub

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import loadCfg [as 别名]
 def GetMyClub(self,p={}):
     '''获取我的军团信息
     '''
     optId = 15062
     clubId = self.mod.getUserClubId()
     clubInfo = {'BaseInfo':0,'MemberNum':0,
                 'DevoteValue':0,'LeaderInfo':0,
                 'HasClub':0,'MyInfo':0}
     if not clubId:
         return Gcore.out(optId,clubInfo)#没有军团
     ClubInfo = self.mod.getClubInfo(clubId)#军团基础信息
     
     #by Lizr 前台没有这些值,,抽取
     del ClubInfo['ClubTotalExp']
     del ClubInfo['ClubLevelTotalExp']
     del ClubInfo['CreatDate']
     
     clubInfo['BaseInfo'] = ClubInfo
     clubInfo['MemberNum'] = self.mod.getClubMemberNum(clubId)#军团成员数量
     clubInfo['DevoteValue'] = self.mod.getTodayDevote(clubId,2)#当天贡献值
     clubInfo['LeaderInfo'] = self.mod.getClubLeader(clubId)#团长信息
     clubInfo['MyInfo'] = self.mod.getMemberInfo(clubId,self.uid,['DevoteCurrent','DevoteTotal'])
     clubInfo['HasClub'] = 1
     clubInfo['DevoteLogs'] = com.list2dict(self.mod.getDevoteLogs(clubId), 1)
     clubInfo['DevoteBase'] = Gcore.loadCfg(defined.CFG_BUILDING_CLUB).get('ClubGiveBase')
     
     return Gcore.out(optId,clubInfo)
开发者ID:fycheung,项目名称:misc,代码行数:29,代码来源:Building_clubUI.py


注:本文中的sgLib.core.Gcore.loadCfg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。