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


Python PA.getint方法代码示例

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


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

示例1: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
    def execute(self, message, user, params):

        roids, cost, bonus = params.groups()
        roids, cost, bonus = int(roids), self.short2num(cost), int(bonus or 0)
        mining = PA.getint("roids", "mining")

        if roids == 0:
            message.reply("Another NewDawn landing, eh?")
            return

        mining = mining * ((float(bonus) + 100) / 100)

        ticks = (cost * PA.getint("numbers", "ship_value")) / (roids * mining)
        reply = "Capping %s roids at %s value with %s%% bonus will repay in %s ticks (%s days)" % (
            roids,
            self.num2short(cost),
            bonus,
            int(ticks),
            int(ticks / 24),
        )

        for gov in PA.options("govs"):
            bonus = PA.getfloat(gov, "prodcost")
            if bonus == 0:
                continue
            ticks_b = ticks * (1 + bonus)
            reply += " %s: %s ticks (%s days)" % (PA.get(gov, "name"), int(ticks_b), int(ticks_b / 24))

        message.reply(reply)
开发者ID:JDD,项目名称:DLR,代码行数:31,代码来源:roidcost.py

示例2: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, message, user, params):
     
     num, name = params.groups()
     
     ship = Ship.load(name=name)
     if ship is None:
         message.alert("No Ship called: %s" % (name,))
         return
     
     num = self.short2num(num)
     reply="Buying %s %s (%s) will cost %s metal, %s crystal and %s eonium."%(num,ship.name,
             self.num2short(ship.total_cost*num//PA.getint("numbers", "ship_value")),
             self.num2short(ship.metal*num),
             self.num2short(ship.crystal*num),
             self.num2short(ship.eonium*num))
     
     for gov in PA.options("govs"):
         bonus = PA.getfloat(gov, "prodcost")
         if bonus == 0:
             continue
         
         reply += " %s: %s metal, %s crystal and %s eonium."%(
                     PA.get(gov, "name"),
                     self.num2short(floor(ship.metal*(1+bonus))*num),
                     self.num2short(floor(ship.crystal*(1+bonus))*num),
                     self.num2short(floor(ship.eonium*(1+bonus))*num))
     
     reply+=" It will add %s value"%(self.num2short(ship.total_cost*num*(1.0/PA.getint("numbers", "ship_value") - 1.0/PA.getint("numbers", "res_value"))),)
     message.reply(reply)
开发者ID:JDD,项目名称:merlin,代码行数:31,代码来源:cost.py

示例3: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, request, user, x, y, z, h=False, hs=False, ticks=None):
     planet = Planet.load(x,y,z)
     if planet is None:
         return HttpResponseRedirect(reverse("planet_ranks"))
     
     ticks = int(ticks or 0) if (h or hs) else 12
     
     if not hs:
         sizediffvalue = PlanetHistory.rdiff * PA.getint("numbers", "roid_value")
         valuediffwsizevalue = PlanetHistory.vdiff - sizediffvalue
         resvalue = valuediffwsizevalue * PA.getint("numbers", "res_value")
         shipvalue = valuediffwsizevalue * PA.getint("numbers", "ship_value")
         xpvalue = PlanetHistory.xdiff * PA.getint("numbers", "xp_value")
         Q = session.query(PlanetHistory,
                             sizediffvalue,
                             valuediffwsizevalue,
                             resvalue, shipvalue,
                             xpvalue,
                             )
         Q = Q.filter(PlanetHistory.current == planet)
         Q = Q.order_by(desc(PlanetHistory.tick))
         history = Q[:ticks] if ticks else Q.all()
     else:
         history = None
     
     if not (h or hs):
         landings = session.query(PlanetLandings.hour, count()).filter(PlanetLandings.planet==planet).group_by(PlanetLandings.hour).all()
         landed = session.query(PlanetLandedOn.hour, count()).filter(PlanetLandedOn.planet==planet).group_by(PlanetLandedOn.hour).all()
         vdrops = session.query(PlanetValueDrops.hour, count()).filter(PlanetValueDrops.planet==planet).group_by(PlanetValueDrops.hour).all()
         idles = session.query(PlanetIdles.hour, count()).filter(PlanetIdles.planet==planet).group_by(PlanetIdles.hour).all()
         hourstats = {
                         'landings' : dict(landings), 'landingsT' : sum([c for hour,c in landings]),
                         'landed'   : dict(landed),   'landedT'   : sum([c for hour,c in landed]),
                         'vdrops'   : dict(vdrops),   'vdropsT'   : sum([c for hour,c in vdrops]),
                         'idles'    : dict(idles),    'idlesT'    : sum([c for hour,c in idles]),
                         }
     else:
         hourstats = None
     
     if not h:
         Q = session.query(PlanetHistory)
         Q = Q.filter(or_(PlanetHistory.hour == 23, PlanetHistory.tick == Updates.current_tick()))
         Q = Q.filter(PlanetHistory.current == planet)
         Q = Q.order_by(desc(PlanetHistory.tick))
         hsummary = Q.all() if hs else Q[:14]
     else:
         hsummary = None
     
     return render(["planet.tpl",["hplanet.tpl","hsplanet.tpl"][hs]][h or hs],
                     request,
                     planet = planet,
                     history = history,
                     hour = datetime.utcnow().hour, hourstats = hourstats,
                     hsummary = hsummary,
                     ticks = ticks,
                   )
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:58,代码来源:planet.py

示例4: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, request, user, x, y, h=False, hs=False, ticks=None):
     galaxy = Galaxy.load(x,y)
     if galaxy is None:
         return HttpResponseRedirect(reverse("galaxy_ranks"))
     
     ticks = int(ticks or 0) if (h or hs) else 12
     
     if not (h or hs):
         Q = session.query(Planet, Intel.nick, Alliance.name)
         Q = Q.outerjoin(Planet.intel)
         Q = Q.outerjoin(Intel.alliance)
         Q = Q.filter(Planet.active == True)
         Q = Q.filter(Planet.galaxy == galaxy)
         Q = Q.order_by(asc(Planet.z))
         planets = Q.all()
         exiles = galaxy.exiles[:10]
     else:
         planets, exiles = None, None
     
     if not hs:
         sizediffvalue = GalaxyHistory.rdiff * PA.getint("numbers", "roid_value")
         valuediffwsizevalue = GalaxyHistory.vdiff - sizediffvalue
         resvalue = valuediffwsizevalue * PA.getint("numbers", "res_value")
         shipvalue = valuediffwsizevalue * PA.getint("numbers", "ship_value")
         xpvalue = GalaxyHistory.xdiff * PA.getint("numbers", "xp_value")
         Q = session.query(GalaxyHistory,
                             sizediffvalue,
                             valuediffwsizevalue,
                             resvalue, shipvalue,
                             xpvalue,
                             )
         Q = Q.filter(GalaxyHistory.current == galaxy)
         Q = Q.order_by(desc(GalaxyHistory.tick))
         history = Q[:ticks] if ticks else Q.all()
     else:
         history = None
     
     if not h:
         Q = session.query(GalaxyHistory)
         Q = Q.filter(or_(GalaxyHistory.hour == 23, GalaxyHistory.tick == Updates.current_tick()))
         Q = Q.filter(GalaxyHistory.current == galaxy)
         Q = Q.order_by(desc(GalaxyHistory.tick))
         hsummary = Q.all() if hs else Q[:14]
     else:
         hsummary = None
     
     return render(["galaxy.tpl",["hgalaxy.tpl","hsgalaxy.tpl"][hs]][h or hs],
                     request,
                     galaxy = galaxy,
                     planets = planets,
                     exiles = exiles,
                     history = history,
                     hsummary = hsummary,
                     ticks = ticks,
                   )
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:57,代码来源:galaxy.py

示例5: bonus

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
    def bonus(self, message, user, params):

        # Check if tick is provided
        tick = int(params.group(1) or 0)

        if tick > PA.getint("numbers", "last_tick"):
            message.reply("Use your bonus during the round, not after.")
            return

        # If there is no tick provided in the command then check what the current tick is.
        if not tick:
            # Retrieve current tick
            tick = Updates.current_tick()
            if not tick:
                # Game not ticking yet.
                message.reply("Game is not ticking yet!")
                return

        resources = 10000 + tick * 4800
        roids = int(6 + tick * 0.15)
        research = 4000 + tick * 24
        construction = 2000 + tick * 18

        message.reply(
            "Upgrade Bonus calculation for tick {} | Resources: {:,} EACH | Roids: {:,} EACH | Research Points: {:,} | Construction Units: {:,}".format(
                tick, resources, roids, research, construction
            )
        )
开发者ID:liam-wiltshire,项目名称:merlin,代码行数:30,代码来源:bonus.py

示例6: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, request, user, id, x, y, z, when):
     planet = Planet.load(x,y,z)
     if planet is None:
         return self.attack(request, user, id, "No planet with coords %s:%s:%s" %(x,y,z,))
     
     tick = Updates.current_tick()
     when = int(when)
     if when < PA.getint("numbers", "protection"):
         eta = when
         when += tick
     elif when <= tick:
         return self.attack(request, user, id, "Can not book targets in the past. You wanted tick %s, but current tick is %s." % (when, tick,))
     else:
         eta = when - tick
     if when > 32767:
         when = 32767        
     
     if planet.intel and planet.alliance and planet.alliance.name == Config.get("Alliance","name"):
         return self.attack(request, user, id, "%s:%s:%s is %s in %s. Quick, launch before they notice!" % (x,y,z, planet.intel.nick or 'someone', Config.get("Alliance","name"),))
     
     try:
         planet.bookings.append(Target(user=user, tick=when))
         session.commit()
     except IntegrityError:
         session.rollback()
         target = planet.bookings.filter(Target.tick == when).first()
         if target is not None:
             return self.attack(request, user, id, "Target %s:%s:%s is already booked for landing tick %s by user %s" % (x,y,z, when, target.user.name,))
     else:
         return self.attack(request, user, id, "Booked landing on %s:%s:%s tick %s (eta %s) for user %s" % (x,y,z, when, (when-tick), user.name,))
     
     return self.attack(request, user, id)
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:34,代码来源:book.py

示例7: new

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
    def new(self, message, user, params):
        tick = Updates.current_tick()
        comment = params.group(3) or ""
        when = int(params.group(1))
        if when < PA.getint("numbers", "protection"):
            eta = when
            when += tick
        elif when <= tick:
            message.alert(
                "Can not create attacks in the past. You wanted tick %s, but current tick is %s." % (when, tick)
            )
            return
        else:
            eta = when - tick
        if when > 32767:
            when = 32767

        attack = Attack(landtick=when, comment=comment)
        session.add(attack)

        for coord in re.findall(loadable.coord, params.group(2)):
            if not coord[4]:
                galaxy = Galaxy.load(coord[0], coord[2])
                if galaxy:
                    attack.addGalaxy(galaxy)

            else:
                planet = Planet.load(coord[0], coord[2], coord[4])
                if planet:
                    attack.addPlanet(planet)

        session.commit()
        message.reply(str(attack))
开发者ID:ellonweb,项目名称:merlin,代码行数:35,代码来源:attack.py

示例8: land

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def land(self, message, user, params):
     id = int(params.group(1))
     attack = Attack.load(id)
     if attack is None:
         message.alert("No attack exists with id %d" %(id))
         return
     
     tick = Updates.current_tick()
     when = int(params.group(2))
     
     if when == 0:
         session.delete(attack)
         session.commit()
         message.reply("Deleted Attack %d LT: %d | %s" %(attack.id,attack.landtick,attack.comment,))
         return
     
     if when < PA.getint("numbers", "protection"):
         eta = when
         when += tick
     elif when <= tick:
         message.alert("Can not create attacks in the past. You wanted tick %s, but current tick is %s." % (when, tick,))
         return
     else:
         eta = when - tick
     if when > 32767:
         when = 32767
     
     old = attack.landtick
     attack.landtick = when
     
     session.commit()
     message.reply("Changed LT for attack %d from %d to %d"%(id,old,when))
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:34,代码来源:editattack.py

示例9: tick

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
    def tick(self, message, user, params):
        tick = Updates.load(params.group(1)) or Updates.current_tick()
        if tick is None:
            message.reply("Ticks haven't started yet, go back to masturbating.")
        elif isinstance(tick, Updates):
            message.reply(str(tick))
        else:
            diff = int(params.group(1)) - tick
            now = datetime.utcnow()
            tick_length = PA.getint("numbers", "tick_length")
            tdiff = timedelta(seconds=tick_length * diff) - timedelta(minutes=now.minute % (tick_length / 60))
            seconds = 0
            retstr = "%sd " % abs(tdiff.days) if tdiff.days else ""
            retstr += "%sh " % abs(tdiff.seconds / 3600) if tdiff.seconds / 3600 else ""
            retstr += "%sm " % abs(tdiff.seconds % 3600 / 60) if tdiff.seconds % 3600 / 60 else ""

            if diff == 1:
                retstr = "Next tick is %s (in %s" % (params.group(1), retstr)
            elif diff > 1:
                retstr = "Tick %s is expected to happen in %s ticks (in %s" % (params.group(1), diff, retstr)
            elif diff <= 0:
                retstr = "Tick %s was expected to happen %s ticks ago but was not scraped (%s ago" % (
                    params.group(1),
                    -diff,
                    retstr,
                )

            time = now + tdiff
            retstr += " - %s)" % (time.strftime("%a %d/%m %H:%M"),)
            message.reply(retstr)
开发者ID:liam-wiltshire,项目名称:merlin,代码行数:32,代码来源:tick.py

示例10: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, message, user, params):
     
     num, name, target = params.groups()
     target = (target or "t1").lower()
     
     ship = Ship.load(name=name)
     num = self.short2num(num)
     if ship is None:
         message.alert("No Ship called: %s" % (name,))
         return
     efficiency = PA.getfloat("teffs",target.lower())
     target_class = getattr(ship, target)
     if ship.damage:
         total_damage = ship.damage * num
     if ship.t1 == "Roids":
         killed = total_damage/50
         message.reply("%s %s (%s) will capture Asteroid: %s (%s)" % (
             num, ship.name, self.num2short(num*ship.total_cost/100),
             killed, self.num2short(killed*PA.getint("numbers", "roid_value")),))
         return
     if ship.t1 == "Struct":
         killed = total_damage/500
         message.reply("%s %s (%s) will destroy Structure: %s (%s)" % (
             num, ship.name, self.num2short(num*ship.total_cost/100),
             killed, self.num2short(killed*PA.getint("numbers", "cons_value")),))
         return
     targets = session.query(Ship).filter(Ship.class_ == target_class)
     if targets.count() == 0:
         message.reply("%s does not have any targets in that category (%s)" % (ship.name,target))
         return
     reply="%s %s (%s) hitting %s will " % (num, ship.name,self.num2short(num*ship.total_cost/100),target_class)
     if ship.type.lower() == "norm" or ship.type.lower() == 'cloak':
         reply+="destroy "
     elif ship.type.lower() == "emp":
         reply+="hug "
     elif ship.type.lower() == "steal":
         reply+="steal "
     else:
         raise Exception("Erroneous type %s" % (ship.type,))
     for target in targets:
         if ship.type.lower() == "emp" :
             killed=int(efficiency * ship.guns*num*float(100-target.empres)/100)
         else:
             killed=int(efficiency * total_damage/target.armor)
         reply+="%s: %s (%s) " % (target.name,killed,self.num2short(target.total_cost*killed/100))
     message.reply(reply)
开发者ID:munin,项目名称:merlin,代码行数:48,代码来源:eff.py

示例11: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, message, user, params):
     
     alliance = Alliance(name="Unknown") if params.group(1).lower() == "unknown" else Alliance.load(params.group(1))
     if alliance is None:
         message.reply("No alliance matching '%s' found"%(params.group(1),))
         return
     
     tick = Updates.current_tick()
     
     when = int(params.group(2) or 0)
     if when and when < PA.getint("numbers", "protection"):
         when += tick
     elif when and when <= tick:
         message.alert("Can not check status on the past. You wanted tick %s, but current tick is %s." % (when, tick,))
         return
     
     Q = session.query(Planet, User.name, Target.tick)
     Q = Q.join(Target.planet)
     Q = Q.join(Planet.intel) if alliance.id else Q.outerjoin(Planet.intel)
     Q = Q.join(Target.user)
     Q = Q.filter(Planet.active == True)
     Q = Q.filter(Intel.alliance == (alliance if alliance.id else None))
     Q = Q.filter(Target.tick == when) if when else Q.filter(Target.tick > tick)
     Q = Q.order_by(asc(Planet.x))
     Q = Q.order_by(asc(Planet.y))
     Q = Q.order_by(asc(Planet.z))
     result = Q.all()
     
     if len(result) < 1:
         reply="No active bookings matching alliance %s" %(alliance.name)
         if when:
             reply+=" for tick %s."%(when,)
         message.reply(reply)
         return
     
     reply="Target information for %s"%(alliance.name)
     reply+=" landing on tick %s (eta %s): "%(when,when-tick) if when else ": "
     
     ticks={}
     for planet, user, land in result:
         if not ticks.has_key(land):
             ticks[land]=[]
         ticks[land].append((planet, user,))
     sorted_keys=ticks.keys()
     sorted_keys.sort()
     
     replies = []
     for land in sorted_keys:
         prev=[]
         for planet, user in ticks[land]:
             prev.append("(%s:%s:%s %s)" % (planet.x,planet.y,planet.z,user))
         replies.append("Tick %s (eta %s) "%(land,land-tick) +", ".join(prev))
     replies[0] = reply + replies[0]
     
     message.reply("\n".join(replies))
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:57,代码来源:gangbang.py

示例12: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
    def execute(self, message, user, params):
        
        roids=int(params.group(1))
        ticks=int(params.group(2))
        bonus=int(params.group(3) or 0)
        mining = PA.getint("roids","mining")

        mining = mining *(float(bonus+100)/100)

        value = ticks*roids*mining/PA.getint("numbers", "ship_value")
        reply = "In %s ticks (%s days) %s roids with %s%% bonus will mine %s value" % (ticks,ticks//24,roids,bonus,self.num2short(value))
        
        for gov in PA.options("govs"):
            bonus = PA.getfloat(gov, "prodcost")
            if bonus == 0:
                continue
            value_b = value/(1+bonus)
            reply += " %s: %s value" % (PA.get(gov, "name"), self.num2short(value_b))
        
        message.reply(reply)
开发者ID:JDD,项目名称:merlin,代码行数:22,代码来源:roidsave.py

示例13: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, message, user, params, override):
     planet = Planet.load(*params.group(1,3,5))
     if planet is None:
         message.alert("No planet with coords %s:%s:%s" % params.group(1,3,5))
         return
     
     tick = Updates.current_tick()
     when = int(params.group(6) or 0)
     if 0 < when < PA.getint("numbers", "protection"):
         eta = when
         when += tick
     elif 0 < when <= tick:
         message.alert("Can not unbook targets in the past. You wanted tick %s, but current tick is %s." % (when, tick,))
         return
     else:
         eta = when - tick
     if when > 32767:
         when = 32767 
     
     Q = session.query(Target)
     Q = Q.join(Target.user)
     Q = Q.filter(Target.planet == planet)
     Q = Q.filter(Target.user == user) if override is False else Q
     Q = Q.filter(Target.tick == when) if when else Q.filter(Target.tick >= tick)
     Q = Q.order_by(asc(Target.tick))
     result = Q.all()
     for target in result:
         session.delete(target)
     count = len(result)
     session.commit()
     
     if count < 1:
         reply=("You have no " if override is False else "No ") +"bookings matching %s:%s:%s"%(planet.x,planet.y,planet.z,)
         if when:
             reply+=" for landing on tick %s"%(when,)
         reply+=". If you are trying to unbook someone else's target, you must confirm with 'yes'." if override is False else ""
     else:
         reply="You have unbooked %s:%s:%s"%(planet.x,planet.y,planet.z,)
         if when:
             reply+=" for landing pt %s"%(when,)
             if override:
                 reply+=" (previously held by user %s)"%(result[0].user.name)
         else:
             reply+=" for %d booking(s)"%(count,)
             if override:
                 prev=[]
                 for target in result:
                     prev.append("(%s user:%s)" % (target.tick,target.user.name))
                 reply+=": "+", ".join(prev)
                     
         reply+="."
     message.reply(reply)
     return
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:55,代码来源:unbook.py

示例14: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
    def execute(self, message, target, attacker):
        reply="Target "

        reply+="%s:%s:%s (%s|%s) "%(target.x,target.y,target.z,
                                 self.num2short(target.value),self.num2short(target.score))
        reply+="| Attacker %s:%s:%s (%s|%s) "%(attacker.x,attacker.y,attacker.z,
                                            self.num2short(attacker.value),self.num2short(attacker.score))

        reply+="| Bravery: %.2f " % (attacker.bravery(target),)

        cap=target.maxcap(attacker)
        xp=attacker.calc_xp(target)
        reply+="| Roids: %s | XP: %s | Score: %s" % (cap,xp,xp*PA.getint("numbers", "xp_value"))
        message.reply(reply)
开发者ID:d7415,项目名称:merlin,代码行数:16,代码来源:xp.py

示例15: execute

# 需要导入模块: from Core.paconf import PA [as 别名]
# 或者: from Core.paconf.PA import getint [as 别名]
 def execute(self, message, user, params):
     
     tag_count = PA.getint("numbers", "tag_count")
     
     alliance = Alliance.load(params.group(1))
     if alliance is None:
         message.reply("No alliance matching '%s' found"%(params.group(1),))
         return
     
     Q = session.query(sum(Planet.value), sum(Planet.score),
                       sum(Planet.size), sum(Planet.xp),
                       count())
     Q = Q.join(Planet.intel)
     Q = Q.filter(Planet.active == True)
     Q = Q.filter(Intel.alliance==alliance)
     Q = Q.group_by(Intel.alliance_id)
     result = Q.first()
     if result is None:
         message.reply("No planets in intel match alliance %s"%(alliance.name,))
         return
     
     value, score, size, xp, members = result
     if members <= tag_count:
         reply="%s Members: %s/%s, Value: %s, Avg: %s," % (alliance.name,members,alliance.members,value,value//members)
         reply+=" Score: %s, Avg: %s," % (score,score//members) 
         reply+=" Size: %s, Avg: %s, XP: %s, Avg: %s" % (size,size//members,xp,xp//members)
         message.reply(reply)
         return
     
     Q = session.query(Planet.value, Planet.score, 
                       Planet.size, Planet.xp, 
                       Intel.alliance_id)
     Q = Q.join(Planet.intel)
     Q = Q.filter(Planet.active == True)
     Q = Q.filter(Intel.alliance==alliance)
     Q = Q.order_by(desc(Planet.score))
     Q = Q.limit(tag_count)
     Q = Q.from_self(sum(Planet.value), sum(Planet.score),
                     sum(Planet.size), sum(Planet.xp),
                     count())
     Q = Q.group_by(Intel.alliance_id)
     ts_result = Q.first()
     
     ts_value, ts_score, ts_size, ts_xp, ts_members = ts_result
     reply="%s Members: %s/%s (%s)" % (alliance.name,members,alliance.members,ts_members)
     reply+=", Value: %s (%s), Avg: %s (%s)" % (value,ts_value,value//members,ts_value//ts_members)
     reply+=", Score: %s (%s), Avg: %s (%s)" % (score,ts_score,score//members,ts_score//ts_members)
     reply+=", Size: %s (%s), Avg: %s (%s)" % (size,ts_size,size//members,ts_size//ts_members)
     reply+=", XP: %s (%s), Avg: %s (%s)" % (xp,ts_xp,xp//members,ts_xp//ts_members)
     message.reply(reply)
开发者ID:JDD,项目名称:merlin,代码行数:52,代码来源:info.py


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