Exemplo n.º 1
0
def movefreighter(amount, regionfrom, regionto):

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

    return 'Your %(amount)s %(pl)s will warp from %(from)s to %(to)s in' \
        % {'amount':amount, 'pl':pl('freighter', amount), 'from':fromname, 'to':toname}
Exemplo n.º 2
0
def movepersonalship(worldno, taskid, regionfrom, regionto):
    world = World.objects.get(worldid=worldno)
    try:
        task = Task.objects.get(pk=taskid)
    except:
        pass
    else:
        fromname = display.region_display(regionfrom)
        toname = display.region_display(regionto)
        check = (True if world.flagshiptype != 0 else False)
        if not check:
            htmldata = "Your personal ship was destroyed before it could warp from %s to %s!" % (fromname, toname)
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "Your personal ship was destroyed before it could warp from %s to %s!" % (fromname, toname)
        elif world.warpfuel < 5:
            htmldata = news.notenoughpersonal(amount, shiptext, fromname, toname, 'fuel')
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough fuel to warp your personal ship from %s to %s!" % (fromname, toname)
        else:
            attloss = ''
            world.warpfuel = F('warpfuel') - 5
            world.flagshiplocation = regionto
            if world.wardefender.count() > 0 and regionfrom == world.region:
                utilities.contentmentchange(world, -10)
                utilities.stabilitychange(world, -5)
                attloss = 'You were in a defensive war, and you lost perception and stability by sending ships away from your home!'
            world.save(update_fields=['warpfuel','flagshiplocation'])

            task.outcome = "Your personal ship warped from %(from)s to %(to)s on %(time)s. %(att)s" \
                        % {'from':fromname, 'to':toname, 'time':now(), 'att':attloss}

        task.save()
Exemplo n.º 3
0
def movefreighter(amount, regionfrom, regionto):

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

    return 'Your %(amount)s %(pl)s will warp from %(from)s to %(to)s in' \
        % {'amount':amount, 'pl':pl('freighter', amount), 'from':fromname, 'to':toname}
Exemplo n.º 4
0
def movepersonalship(regionfrom, regionto):

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

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

    return toreturn
Exemplo n.º 5
0
def movepersonalship(regionfrom, regionto):

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

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

    return toreturn
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
def moveship(worldno, taskid, amount, shiptype, shiptext, regionfrom, regionto,
             fuelcost, trainingchange):
    world = World.objects.get(worldid=worldno)
    try:
        task = Task.objects.get(pk=taskid)
    except:
        pass  # revoked
    else:
        fromname = display.region_display(regionfrom)
        toname = display.region_display(regionto)
        movecheck = utilities.movecheck(world, shiptype, amount, regionfrom)
        if not movecheck:
            htmldata = "Your attempt to warp %s %s from %s to %s failed as you did not have enough ships." \
                        % (amount, shiptext, regionfrom, regionto)
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough ships to warp %(amount)s %(ship)s from %(from)s to %(to)s!" \
                        % {'amount':amount, 'ship':shiptext, 'from':fromname, 'to':toname}
        elif world.warpfuel < fuelcost:
            htmldata = "Your attempt to warp %s %s from %s to %s failed as you did not have enough fuel." \
                        % (amount, shiptext, regionfrom, regionto)
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough fuel to warp %(amount)s %(ship)s from %(from)s to %(to)s!" \
                        % {'amount':amount, 'ship':shiptext, 'from':fromname, 'to':toname}
        else:
            attloss = ''
            world.warpfuel = F('warpfuel') - fuelcost
            if world.wardefender.count() > 0 and regionfrom == world.region:
                utilities.contentmentchange(world, -10)
                utilities.stabilitychange(world, -5)
                attloss = 'You were in a defensive war, and you lost perception and stability by sending ships away from your home!'
            world.save(update_fields=['warpfuel'])
            utilities.movecomplete(world, shiptype, -amount, regionfrom,
                                   -trainingchange)
            utilities.movecomplete(world, shiptype, amount, regionto,
                                   trainingchange)

            task.outcome = "Your %(amount)s %(ship)s warped from %(from)s to %(to)s on %(time)s. %(att)s" \
                        % {'amount':amount, 'ship':shiptext, 'from':fromname, 'to':toname, 'time':now(), 'att':attloss}

        task.save()
Exemplo n.º 9
0
def movefreighter(worldno, taskid, amount, regionfrom, regionto):
    world = World.objects.get(worldid=worldno)
    try:
        task = Task.objects.get(pk=taskid)
    except:
        pass
    else:
        fromname = display.region_display(regionfrom)
        toname = display.region_display(regionto)
        movecheck = utilities.freightercheck(world, regionfrom, amount)
        if not movecheck:
            htmldata = news.notenough(amount, 'freighters', fromname, toname, 'of them')
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough freighters to warp %(amount)s of them from %(from)s to %(to)s!" \
                        % {'amount':amount, 'from':fromname, 'to':toname}
        else:
            utilities.freightermove(world, regionfrom, -amount)
            utilities.freightermove(world, regionto, amount)

            task.outcome = "Your %(amount)s freighters warped from %(from)s to %(to)s on %(time)s." \
                        % {'amount':amount, 'from':fromname, 'to':toname, 'time':now()}

        task.save()
Exemplo n.º 10
0
def moveship(worldno, taskid, amount, shiptype, shiptext, regionfrom, regionto, fuelcost, trainingchange):
    world = World.objects.get(worldid=worldno)
    try:
        task = Task.objects.get(pk=taskid)
    except:
        pass # revoked
    else:
        fromname = display.region_display(regionfrom)
        toname = display.region_display(regionto)
        movecheck = utilities.movecheck(world, shiptype, amount, regionfrom)
        if not movecheck:
            htmldata = "Your attempt to warp %s %s from %s to %s failed as you did not have enough ships." \
                        % (amount, shiptext, regionfrom, regionto)
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough ships to warp %(amount)s %(ship)s from %(from)s to %(to)s!" \
                        % {'amount':amount, 'ship':shiptext, 'from':fromname, 'to':toname}
        elif world.warpfuel < fuelcost:
            htmldata = "Your attempt to warp %s %s from %s to %s failed as you did not have enough fuel." \
                        % (amount, shiptext, regionfrom, regionto)
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough fuel to warp %(amount)s %(ship)s from %(from)s to %(to)s!" \
                        % {'amount':amount, 'ship':shiptext, 'from':fromname, 'to':toname}
        else:
            attloss = ''
            world.warpfuel = F('warpfuel') - fuelcost
            if world.wardefender.count() > 0 and regionfrom == world.region:
                utilities.contentmentchange(world, -10)
                utilities.stabilitychange(world, -5)
                attloss = 'You were in a defensive war, and you lost perception and stability by sending ships away from your home!'
            world.save(update_fields=['warpfuel'])
            utilities.movecomplete(world,shiptype,-amount,regionfrom,-trainingchange)
            utilities.movecomplete(world,shiptype,amount,regionto,trainingchange)

            task.outcome = "Your %(amount)s %(ship)s warped from %(from)s to %(to)s on %(time)s. %(att)s" \
                        % {'amount':amount, 'ship':shiptext, 'from':fromname, 'to':toname, 'time':now(), 'att':attloss}

        task.save()
Exemplo n.º 11
0
def movefreighter(worldno, taskid, amount, regionfrom, regionto):
    world = World.objects.get(worldid=worldno)
    try:
        task = Task.objects.get(pk=taskid)
    except:
        pass
    else:
        fromname = display.region_display(regionfrom)
        toname = display.region_display(regionto)
        movecheck = utilities.freightercheck(world, regionfrom, amount)
        if not movecheck:
            htmldata = news.notenough(amount, 'freighters', fromname, toname,
                                      'of them')
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough freighters to warp %(amount)s of them from %(from)s to %(to)s!" \
                        % {'amount':amount, 'from':fromname, 'to':toname}
        else:
            utilities.freightermove(world, regionfrom, -amount)
            utilities.freightermove(world, regionto, amount)

            task.outcome = "Your %(amount)s freighters warped from %(from)s to %(to)s on %(time)s." \
                        % {'amount':amount, 'from':fromname, 'to':toname, 'time':now()}

        task.save()
Exemplo n.º 12
0
def movepersonalship(worldno, taskid, regionfrom, regionto):
    world = World.objects.get(worldid=worldno)
    try:
        task = Task.objects.get(pk=taskid)
    except:
        pass
    else:
        fromname = display.region_display(regionfrom)
        toname = display.region_display(regionto)
        check = (True if world.flagshiptype != 0 else False)
        if not check:
            htmldata = "Your personal ship was destroyed before it could warp from %s to %s!" % (
                fromname, toname)
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "Your personal ship was destroyed before it could warp from %s to %s!" % (
                fromname, toname)
        elif world.warpfuel < 5:
            htmldata = news.notenoughpersonal(amount, shiptext, fromname,
                                              toname, 'fuel')
            NewsItem.objects.create(target=world, content=htmldata)
            task.outcome = "You did not have enough fuel to warp your personal ship from %s to %s!" % (
                fromname, toname)
        else:
            attloss = ''
            world.warpfuel = F('warpfuel') - 5
            world.flagshiplocation = regionto
            if world.wardefender.count() > 0 and regionfrom == world.region:
                utilities.contentmentchange(world, -10)
                utilities.stabilitychange(world, -5)
                attloss = 'You were in a defensive war, and you lost perception and stability by sending ships away from your home!'
            world.save(update_fields=['warpfuel', 'flagshiplocation'])

            task.outcome = "Your personal ship warped from %(from)s to %(to)s on %(time)s. %(att)s" \
                        % {'from':fromname, 'to':toname, 'time':now(), 'att':attloss}

        task.save()