Exemple #1
0
def tradecomplete(worldno, targetno, taskid, send, sendamount, trainingchange, freighters):
    world = World.objects.get(worldid=worldno)
    target = World.objects.get(worldid=targetno)
    utilities.resourcecompletion(target, send, sendamount, trainingchange)

    world.freightersinuse = F('freightersinuse') - freighters
    world.save(update_fields=['freightersinuse'])
    utilities.freightermove(world, world.region, freighters)

    resname = utilities.resname(send, sendamount)

    linkworld = reverse('stats_ind', args=(world.worldid,))
    fullworld = '<a href="%(link)s">%(world)s</a>' % {'link':linkworld,'world':world.world_name}

    ResourceLog.objects.create(owner=target, target=world, res=send, amount=sendamount, sent=False, trade=True)

    htmldata = news.tradecompletion(world, resname, sendamount)
    NewsItem.objects.create(target=target, content=htmldata)

    utilities.spyintercept(target, world, resname, sendamount)

    task = Task.objects.get(pk=taskid)
    task.outcome = "We received %(amount)s %(name)s from our trade with %(world)s on %(time)s." \
                % {'amount':sendamount, 'name':resname, 'world':fullworld, 'time':now()}
    task.save()
Exemple #2
0
def tradecomplete(worldno, targetno, taskid, send, sendamount, trainingchange,
                  freighters):
    world = World.objects.get(worldid=worldno)
    target = World.objects.get(worldid=targetno)
    utilities.resourcecompletion(target, send, sendamount, trainingchange)

    world.freightersinuse = F('freightersinuse') - freighters
    world.save(update_fields=['freightersinuse'])
    utilities.freightermove(world, world.region, freighters)

    resname = utilities.resname(send, sendamount)

    linkworld = reverse('stats_ind', args=(world.worldid, ))
    fullworld = '<a href="%(link)s">%(world)s</a>' % {
        'link': linkworld,
        'world': world.world_name
    }

    ResourceLog.objects.create(owner=target,
                               target=world,
                               res=send,
                               amount=sendamount,
                               sent=False,
                               trade=True)

    htmldata = news.tradecompletion(world, resname, sendamount)
    NewsItem.objects.create(target=target, content=htmldata)

    utilities.spyintercept(target, world, resname, sendamount)

    task = Task.objects.get(pk=taskid)
    task.outcome = "We received %(amount)s %(name)s from our trade with %(world)s on %(time)s." \
                % {'amount':sendamount, 'name':resname, 'world':fullworld, 'time':now()}
    task.save()
Exemple #3
0
def buildship(worldno, taskid, shiptype, amount, yards):
    world = World.objects.get(worldid=worldno)

    if world.shipyardsinuse - yards * amount < 0:
        world.shipyardsinuse = 0
    else:
        world.shipyardsinuse = F('shipyardsinuse') - yards * amount
    world.save(update_fields=['shipyardsinuse'])

    if 'prodstaging' in world.shipsortprefs:
        destination = 'staging area'
        utilities.movecomplete(world, shiptype, amount, 'S', 0)
    else:
        destination = 'home fleet'
        utilities.movecomplete(world, shiptype, amount, world.region, 0)

    name = utilities.resname(shiptype + 10, amount, lower=True)

    pluralise = ("%s was" % name if amount == 1 else "%s %s were" %
                 (amount, name))

    task = Task.objects.get(pk=taskid)
    task.outcome = "Your %s completed and delivered to your %s on %s." % (
        pluralise, destination, now())
    task.save()
def mothball(shiptype, amount, direction):

    shipname = utilities.resname(shiptype+10, amount, lower=True)
    pluralise = ('is' if amount == 1 else 'are')

    if direction == 'plus':
        message = 'Your %s %s %s decommissioning, and will enter the orbital hangars in' % (amount, shipname, pluralise)
    elif direction == 'minus':
        message = 'Your %s %s %s preparing to resume service, and will be ready in' % (amount, shipname, pluralise)

    return message, shipname
def moveship(shiptype, amount, regionfrom, regionto):

    shipname = utilities.resname(shiptype+10, amount, lower=True)

    fromname = display.region_display(regionfrom)
    toname = display.region_display(regionto)

    toreturn = 'Your %(amount)s %(ship)s will warp from %(from)s to %(to)s in' \
        % {'amount':amount, 'ship':shipname, 'from':fromname, 'to':toname}

    return toreturn, shipname
def moveship(shiptype, amount, regionfrom, regionto):

    shipname = utilities.resname(shiptype + 10, amount, lower=True)

    fromname = display.region_display(regionfrom)
    toname = display.region_display(regionto)

    toreturn = 'Your %(amount)s %(ship)s will warp from %(from)s to %(to)s in' \
        % {'amount':amount, 'ship':shipname, 'from':fromname, 'to':toname}

    return toreturn, shipname
def mothball(shiptype, amount, direction):

    shipname = utilities.resname(shiptype + 10, amount, lower=True)
    pluralise = ('is' if amount == 1 else 'are')

    if direction == 'plus':
        message = 'Your %s %s %s decommissioning, and will enter the orbital hangars in' % (
            amount, shipname, pluralise)
    elif direction == 'minus':
        message = 'Your %s %s %s preparing to resume service, and will be ready in' % (
            amount, shipname, pluralise)

    return message, shipname
Exemple #8
0
def buildship(worldno, taskid, shiptype, amount, yards):
    world = World.objects.get(worldid=worldno)

    if world.shipyardsinuse - yards*amount < 0:
        world.shipyardsinuse = 0
    else:
        world.shipyardsinuse = F('shipyardsinuse') - yards*amount
    world.save(update_fields=['shipyardsinuse'])

    if 'prodstaging' in world.shipsortprefs:
        destination = 'staging area'
        utilities.movecomplete(world, shiptype, amount, 'S', 0)
    else:
        destination = 'home fleet'
        utilities.movecomplete(world, shiptype, amount, world.region, 0)

    name = utilities.resname(shiptype+10, amount, lower=True)

    pluralise = ("%s was" % name if amount == 1 else "%s %s were" % (amount, name))

    task = Task.objects.get(pk=taskid)
    task.outcome = "Your %s completed and delivered to your %s on %s." % (pluralise, destination, now())
    task.save()
Exemple #9
0
 def _res_display(self):
     from wawmembers.utilities import resname
     return resname(self.res, self.amount, lower=True)
def buildship(shiptype, amount):
    name = utilities.resname(shiptype+10, amount, lower=True)
    return 'Your %s %s will be ready in' % (amount, name)
def startshipbuild(shiptype, amount):
    from wawmembers.utilities import resname
    name = resname(shiptype+10, amount, lower=True)
    return 'You start construction of %s %s.' % (amount, name)
def startshipbuild(shiptype, amount):
    from wawmembers.utilities import resname
    name = resname(shiptype+10, amount, lower=True)
    return 'You start construction of %s %s.' % (amount, name)
Exemple #13
0
 def _res_display(self):
     from wawmembers.utilities import resname
     return resname(self.res, self.amount, lower=True)
Exemple #14
0
 def _resourceoff_display(self):
     from wawmembers.utilities import resname
     return resname(self.resoff, self.amountoff, lower=True)
def buildship(shiptype, amount):
    name = utilities.resname(shiptype + 10, amount, lower=True)
    return 'Your %s %s will be ready in' % (amount, name)