예제 #1
0
def create_character(request):
    name_form = CharacterNameForm()

    if request.user.character_set.count() == 0:
        text = "Welcome to mercenaries, blabla its time to choose a name for your mercenary"
    else:
        text = "You died! If you want to start over and seek revenge, blabla, enter a new name and start again"

    if request.POST:
        name_form = CharacterNameForm(request.POST)

        if name_form.is_valid():
            name = name_form.cleaned_data['name']
            #create character
            Character.create(request.user, name)
            return HttpResponseRedirect(reverse('index'))

    return render(request, 'create_character.html', {
        "name_form": name_form,
        "text": text
    })
예제 #2
0
파일: data.py 프로젝트: Sult/Mercenaries
            price=car[7],
        )
        new_car.save()


add_ranks()
add_regions()
add_base_values()
add_travel_methods()
add_transports()
add_armors()
add_guns()
add_cars()

user = User.objects.get(username="******")
Character.create(user, name="Marmotte")
new = ExtendUser(user=user, )
new.save()


def add_single_player_jobs():
    #add short jobs
    the_type = SinglePlayerJob.SHORT

    the_jobs = (
        ("Teach self defence to a group of children.", the_type, True, 10, 25,
         500, 25, 30, 95, 35),
        ("Help the local police force maintain their guns.", the_type, True, 8,
         50, 650, 30, 20, 92, 25),
        ("Clean the toilets in the barracks.", the_type, True, 7, 30, 900, 17,
         15, 83, 65),