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


Python Gcore.out方法代码示例

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


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

示例1: BuyActPoint

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [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: GetMyClub

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [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

示例3: ApplyClub

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def ApplyClub(self,p={}):
     '''
     :申请加入
     '''
     optId = 15064
     clubId = p['ClubId']
     building = self.mod.getClubBuildingInfo()
     if building is None:
         return  Gcore.error(optId,-15064901)#外史院建筑不存在
     clubInfo = self.mod.getClubInfo(clubId)
     if not clubInfo:
         return Gcore.error(optId,-15064920)#军团不存在
     if self.mod.getUserClubId():
         return Gcore.error(optId,-15064001)#只能加入一个军团
     
     if not self.mod.validApplyInterval():
         return Gcore.error(optId,-15064004)#离上次退出军团时间间隔不合法
     
     memberNum = self.mod.getClubMemberNum(clubId)
     if memberNum.get('CurNum')>=memberNum.get('MaxNum'):
         return Gcore.error(optId,-15064002)#军团成员已满
     allowState = clubInfo.get('AllowState')
     if allowState == 1:#需要审核
         self.mod.applyClub(clubId)
         return Gcore.out(optId,{'Passed':0,'ClubId':clubId})#申请成功,审核中
     elif allowState ==2:#不需审核
         self.mod.applyClub(clubId)
         self.mod.agreeApply(optId, clubId, self.uid)
         Gcore.setUserData(self.uid, {'ClubId':clubId})#更新用户缓存
         
         recordData = {'uid':self.uid,'ValType':0,'Val':1}#任务
         return Gcore.out(optId,{'Passed':1,'ClubId':clubId},mission=recordData)#成功加入军团
     else:
         return Gcore.out(optId,{'Passed':2})#不允许加入
开发者ID:fycheung,项目名称:misc,代码行数:36,代码来源:Building_clubUI.py

示例4: GetMyTech

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def GetMyTech(self,p={}):
     '''获取我学习的所有科技'''
     optId = 15051
     buildingId = p['BuildingId']
     building = Gcore.getMod('Building',self.uid).getBuildingById(buildingId)
     if not building:
         return Gcore.out(optId)
     buildingType = building.get('BuildingType')
     
     st = self.mod.getTechs(1)#兵种科技
     soldierTechs = []#书院研究科技
     wallTechs = []#城墙研究科技
     
     for k,v in enumerate(st):
         if v['TechType']>=200:
             wallTechs.append(v)
         else:
             soldierTechs.append(v)
     
     if buildingType==12:#书院
         interTechs = self.mod.getTechs(2)#内政科技     
         reData = {'SoldierTechs':soldierTechs,'InterTechs':interTechs}
     else:
         reData = {'WallTechs':wallTechs}
     return Gcore.out(optId,reData)
开发者ID:fycheung,项目名称:misc,代码行数:27,代码来源:BookUI.py

示例5: SpeedRapidPractise

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def SpeedRapidPractise(self, param={}):
     '''加速突飞训练的冷却时间'''
     optId = 15094
     
     IsSpeed = param.get('IsSpeed')
     TimeStamp = param['ClientTime']
     
     TodayDate = time.strftime('%Y-%m-%d', time.localtime(TimeStamp))
     modGround = Gcore.getMod('Building_ground', self.uid)
     RapidRecord = modGround.getRapidRecord(TodayDate)
     
     if not RapidRecord:
         RapidCount = 0
         IsOverFlow = 0
         
         CDValue = 0
     else:
         RapidCount = RapidRecord['PractiseCount']
         IsOverFlow = RapidRecord['IsOverFlow']
         
         TotalCD = RapidRecord['CDValue']
         SecondsPast = TimeStamp - RapidRecord['LastRapidTime']
         CDValue = max(TotalCD - SecondsPast, 0)
         if CDValue <= 0:
             IsOverFlow = 0
     
     if not IsSpeed: #不是加速
         body = {}
         body['TimeStamp'] = TimeStamp
         body['IsOverFlow'] = IsOverFlow
         body['CDValue'] = CDValue
         body['RapidCout'] = RapidCount
         return Gcore.out(optId, body=body)
     
     #加速冷却时间
     if CDValue <= 0:
         return Gcore.error(optId, -15094001) #冷却时间为0
     
     CoinType = 1
     CoinValue = calSpeedCost(4, CDValue)
     
     #扣钱
     modCoin = Gcore.getMod('Coin', self.uid)
     classMethod = '%s.%s' % (self.__class__.__name__, sys._getframe().f_code.co_name)
     pay = modCoin.PayCoin(optId, CoinType, CoinValue, classMethod, param)
     if pay < 0:
         return Gcore.error(optId, -15094002) #扣钱失败
     
     #更新突飞记录表
     modGround.speedCD()
     
     body = {}
     body['GoldenCost'] = pay
     body['CDValue'] = 0
     body['SpeedTime'] = CDValue
     body['IsOverFlow'] = 0
     body['TimeStamp'] = TimeStamp
     return Gcore.out(optId, body=body)
开发者ID:fycheung,项目名称:misc,代码行数:60,代码来源:Building_groundUI.py

示例6: CheckClubExist

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def CheckClubExist(self,p={}):
     '''检查军团是否存在'''
     optId = 15080
     clubId = self.mod.getUserClubId()
     if clubId:
         curDevote = self.mod.getMemberInfo(clubId,self.uid,['DevoteCurrent']).get('DevoteCurrent',0)
         return Gcore.out(optId,{'IsExisted':1,'DevoteCurrent':curDevote})
     else:
         return Gcore.out(optId,{'IsExisted':0})
开发者ID:fycheung,项目名称:misc,代码行数:11,代码来源:Building_clubUI.py

示例7: OnCacheAll

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def OnCacheAll(self, param={}):
     '''缓存竞技场所需信息'''
     optId = 30001 
     
     modRedis = Gcore.getMod('Redis', self.uid)
     try:
         modRedis.onCacheAll()
     except Exception:
         return Gcore.out(optId, -30001001)
     else:
         return Gcore.out(optId)
开发者ID:fycheung,项目名称:misc,代码行数:13,代码来源:RedisUI.py

示例8: GetInviteUI

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
    def GetInviteUI(self, param={}):
        """招贤馆:招募界面"""
        optId = 15006

        BuildingId = param["BuildingId"]
        RequestTimeStamp = param["ClientTime"]

        InviteInfo = self.mod.getInvite()
        modBuilding = Gcore.getMod("Building", self.uid)
        BuildingInfo = modBuilding.getBuildingById(BuildingId, TimeStamp=RequestTimeStamp)
        if not BuildingInfo:
            return Gcore.error(optId, -15006901)  # 用户没有该建筑
        if BuildingInfo["BuildingState"] == 1:
            return Gcore.error(optId, -15006902)  # 建筑正在建造
        if BuildingInfo["BuildingType"] != 13:
            return Gcore.error(optId, -15006903)  # 该建筑不是招贤馆
        BuildingLevel = BuildingInfo["BuildingRealLevel"]

        if not InviteInfo:
            print "第一次招募"
            ChosenGenerals = self.mod.chooseGenerals(GeneralNum=3, IsFirst=True)
            self.mod.insertInvite(ChosenGenerals, BuildingLevel, RequestTimeStamp)
            RemainedTime = Gcore.getCfg("tb_cfg_building_up", key=(13, BuildingLevel), field="RefreshValue")
            return Gcore.out(
                optId, body={"RemainedTime": RemainedTime, "Generals": ChosenGenerals, "CostValue": 5}
            )  # 系统错误 (招募表中此玩家初始记录)

        print "InviteInfo", InviteInfo

        # SpeedCount = self.mod.cacSpeedCount(InviteInfo['SpeedCount'], InviteInfo['LastSpeedDate'], RequestTimeStamp)
        # SpeedCount += 1
        # CostValue = SpeedCount * 2

        CostValue = 5  # 读配置 - 招贤馆每次刷新所用的黄金数量
        RetDic = {}
        RetDic["CostValue"] = CostValue
        if RequestTimeStamp < InviteInfo["EndTime"]:
            RefreshTimeRemained = InviteInfo["EndTime"] - RequestTimeStamp

            RetDic["RemainedTime"] = RefreshTimeRemained
            RetDic["Generals"] = [InviteInfo["GeneralId1"], InviteInfo["GeneralId2"], InviteInfo["GeneralId3"]]

            return Gcore.out(optId, RetDic)
        else:
            RefreshValue = Gcore.getCfg("tb_cfg_building_up", key=(13, BuildingLevel), field="RefreshValue")
            RefreshTimeRemained = RefreshValue - (RequestTimeStamp - InviteInfo["EndTime"]) % RefreshValue
            RefreshTimeStamp = RequestTimeStamp - (RequestTimeStamp - InviteInfo["EndTime"]) % RefreshValue
            ChosenGenerals = self.mod.chooseGenerals()
            self.mod.updateInvite(ChosenGenerals, BuildingLevel, RefreshTimeStamp)

            RetDic["RemainedTime"] = RefreshTimeRemained
            RetDic["Generals"] = ChosenGenerals
            return Gcore.out(optId, RetDic)
开发者ID:fycheung,项目名称:misc,代码行数:55,代码来源:Building_pubUI.py

示例9: MoveGoods

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
    def MoveGoods(self,p={}):
        '''调整物品'''
        optId = 13062
        pFrom = p['From']
        pTo = p['To']
        bagSize = self.mod.getBagSize()
        if not(0<pFrom<=bagSize) or not(0<pTo<=bagSize):
            return Gcore.error(optId, -13062001)#背包位置不合法
        
        if pFrom == pTo:#会删除道具
            return Gcore.out(optId,{})
        
        gFrom = self.mod.getFromPosition(pFrom)
        gTo = self.mod.getFromPosition(pTo)
        if not gFrom:
            return Gcore.error(optId,-13062002)#当前没有物品
        
        #改变物品位置
        if not gTo:#将物品移动到空格
#             print '移动到',pFrom,pTo
#             print 'F',gFrom
            self.mod.updateBag(gFrom['BagId'],{'Position':pTo})
            
        #相同道具叠加
        elif gFrom['GoodsType']==gTo['GoodsType']==2 and gFrom['GoodsId']==gTo['GoodsId']:
#             print '道具叠加',pFrom,pTo
#             print 'F',gFrom
#             print 'T',gTo
            
            gFromNum = gFrom['GoodsNum']
            gToNum = gTo['GoodsNum']
            gToMax = Gcore.getCfg('tb_cfg_item',gTo['GoodsId'],'OverlayNum')
            if gToNum<gToMax:
                gToNum = gToNum+gFromNum
                if gToNum>gToMax:
                    gFromNum = gToNum-gToMax
                    gToNum = gToMax
                else:
                    gFromNum = 0
                self.mod.updateBag(gTo['BagId'],{'GoodsNum':gToNum})
                self.mod.updateBag(gFrom['BagId'],{'GoodsNum':gFromNum})     
                 
        #两物品交换位置   
        else:
#             print '交换位置',pFrom,pTo
#             print 'F',gFrom
#             print 'T',gTo
            
            self.mod.updateBag(gFrom['BagId'],{'Position':pTo})
            self.mod.updateBag(gTo['BagId'],{'Position':pFrom})
        return Gcore.out(optId,{})
开发者ID:fycheung,项目名称:misc,代码行数:53,代码来源:BagUI.py

示例10: getRecCamp

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def getRecCamp(self,optId):
     '''推荐阵营by zhanggh (将弃 by Lizr)'''
     userNum=self.db.out_field('tb_user','count(1)','1=1')/3
     
     # 推荐阵营算法 add by Yew
     if userNum>=20:
         for uc in range(1,4):
             ucNum=self.db.out_field('tb_user','count(1)','UserCamp=%s'%uc)
             if ucNum<userNum*0.8:
                 return Gcore.out(optId,{'RC':uc,'RCKey':uc})
     import random
     uc = random.randint(1,3) #1:魏,2:蜀,3:吴
     result = {'RC':uc,'RCKey':uc}
     return Gcore.out(optId,result)
开发者ID:fycheung,项目名称:misc,代码行数:16,代码来源:CLogin.py

示例11: GetHireNum

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
    def GetHireNum(self, param={}):
        '''获取当天雇佣数量  '''
        optId = 15035
        
        BuildingId = param['BuildingId']
        TimeStamp = param['ClientTime']
        
        modCamp = Gcore.getMod('Building_camp', self.uid)
        TodayDate = time.strftime('%Y-%m-%d', time.localtime(TimeStamp))
        HireInfo = modCamp.getHireByDate(BuildingId, TodayDate)

        if not HireInfo:
            return Gcore.out(optId, {'TodayHireNum':0})
        return Gcore.out(optId,{'TodayHireNum':sum(HireInfo.values())})
开发者ID:fycheung,项目名称:misc,代码行数:16,代码来源:Building_campUI.py

示例12: Exchange

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
    def Exchange(self, para={}):
        '''货币兑换  by Lizr'''
        optId = 20001
        CoinType =  para['CoinType']
        CoinValue = para['CoinValue']
        if CoinType not in (2, 3):
            return Gcore.error(optId, -20001998) #非法操作
        if type(CoinValue) not in (int, long) or CoinValue <= 0:
            return Gcore.error(optId, -20001998) #非法操作
        
        storageSpace = Gcore.getMod('Building', self.uid).cacStorageSpace(CoinType)
        addPercent = CoinValue / storageSpace
        rateInfos = Gcore.getCfg('tb_cfg_shop_res_sale')
        rateInfoList = filter(lambda dic:dic['AddPercent'] <= addPercent and dic['CoinType'] == CoinType, rateInfos.values())
        rateInfo = max(rateInfoList, key=lambda sale:sale['AddPercent'])

        rate = rateInfo['kPrice1'] * (storageSpace ** rateInfo['kPrice2'])
        GoldValue = int(math.ceil(CoinValue * rate))
#         rate = Gcore.loadCfg(2001).get('exchange').get(str(CoinType))
#         GoldValue = math.ceil(CoinValue/rate)
        modCoin = Gcore.getMod('Coin', self.uid)
        classMethod = '%s.%s' % (self.__class__.__name__, sys._getframe().f_code.co_name)
        pay = modCoin.PayCoin(optId, 1, GoldValue, classMethod, para)
        if pay < 0:
            return Gcore.error(optId, -20001995) #支付失败
        else:
            #GainValue = GoldValue*rate
            #GainValue = int(math.ceil(GoldValue / rate))
            #result = modCoin.GainCoin(optId, CoinType, GainValue, classMethod, para)
            result = modCoin.GainCoin(optId, CoinType, CoinValue, classMethod, para)
            body = {"CoinType": CoinType, "CoinValue": CoinValue, "GoldUsed": pay}
            return Gcore.out(optId, body)    
开发者ID:fycheung,项目名称:misc,代码行数:34,代码来源:ItemUI.py

示例13: checkOpt

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
    def checkOpt(self,ckey,optId,optKey,para):

        if optId == 888888:
            result = Gcore.reload()
            print 'Gcore.reload()'
            msg = '<font color=green>Reload Success!</font>' if result is True else "<font color=red>"+str(result)+"</font>"
            response = Gcore.out(optId,{'Result':msg})
            self.Send(ckey,response)
        elif 10001<=optId<=10005: #帐户相关: 10001登录,10002创建帐号,10003随机姓名,10004推荐阵营,10005检查帐户名是否合法
            self.checkLogin(ckey,optId,optKey,para)
        else:
            if optId == 8888: #测试
                #print 'Gcore.getDB(uid)>',Gcore.getDB(uid)
                self.mqPush(ckey,optId,optKey,para)
            else:
                uid = self.Clients[ckey]['uid']
                if uid==0:
                    response = Gcore.error(optId,-88888888) 
                    self.Send(ckey,response) 
                    print 'Please login first'
                    return
                response = proManager.checkOpt(uid, optId, para)
                if type(response) is not dict:
                    #print 'type(response)',type(response),response
                    response = Gcore.error(optId,-33333333) #协议号未定义 或返回出错
                    
                response['opt_key'] = optKey
                self.Send(ckey,response)
开发者ID:fycheung,项目名称:misc,代码行数:30,代码来源:gateway.bak0801.py

示例14: Say

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def Say(self,para={}):
     '''发送聊天信息
     @para : Channel => int 聊天类型:1,世界。2,势力。3,军团。4,私聊。5,系统。6,喇叭。 
             7, 系统公告(用于GM发布系统公告用)。8,活动。9,广播
     @para : Content => string 消息体
     @para : ToName => int or str 消息接受者(用于私聊)
     @note : 需要注意前玩家在游戏中 改变军团(退出或加入)时要更新Gcore.StorageUser['club']
     '''
     optId = 11001
     #print 'say',para
     channel=para.get('Channel')
     content=para.get('Content')
     toName=para.get('ToName')
     #re=1
     re=self.mod.say(optId, channel,content,toName)
     if re==-1:
         return Gcore.error(optId,-11001001)#聊天间隔限制
     elif re==-2:
         return Gcore.error(optId,-11001002)#消息未通过验证
     elif re==-3:
         return Gcore.error(optId,-11001003)#发送对象不在线
     elif re==-4:
         return Gcore.error(optId,-11001004)#喇叭使用条件不足
     elif re==-5:
         return Gcore.error(optId,-11001999)#聊天类型错误
     elif re==-6:
         return Gcore.error(optId,-11001005)#不能私聊自己
     elif re==-7:
         return Gcore.error(optId,-11001006)#权限不足
     elif re==-8:
         return Gcore.error(optId,-11001007)#被禁言
     else:
         #return Gcore.out(optId,{'Result':re})
         return Gcore.out(optId)
开发者ID:fycheung,项目名称:misc,代码行数:36,代码来源:ChatUI.py

示例15: CheckMissionStatus

# 需要导入模块: from sgLib.core import Gcore [as 别名]
# 或者: from sgLib.core.Gcore import out [as 别名]
 def CheckMissionStatus(self ,p={}):
     '''检查任务状态'''
     optId = 22005
     self.mod.updateAllMissions()
     
     Gcore.getMod('Building_home',self.uid).updateAllAchieves()
     return Gcore.out(optId)
开发者ID:fycheung,项目名称:misc,代码行数:9,代码来源:MissionUI.py


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