Webapp API

GET www.cochar.pl/api/v1/get

200 Success

curl -X GET https://www.cochar.pl/api/v1/get

{
  "year": 1925,
  "country": "US",
  "first_name": "Darryl",
  "last_name": "Delvalle",
  "age": 51,
  "sex": "M",
  "occupation": "musician",
  "strength": 37,
  "condition": 25,
  "size": 81,
  "dexterity": 67,
  "appearance": 25,
  "education": 66,
  "intelligence": 74,
  "power": 62,
  "move_rate": 5,
  "luck": 18,
  "damage_bonus": "0",
  "build": 0,
  "skills": {
      "listen": 89,
      "psychology": 71,
      "art/craft (writer)": 12,
      "acting": 88,
      "drive auto": 46,
      "swim": 83,
      "disguise": 38,
      "dodge": 34,
      "pilot": 7,
      "track": 56,
      "art/craft (cook)": 8,
      "credit rating": 27
  },
  "dodge": 34,
  "sanity_points": 62,
  "magic_points": 12,
  "hit_points": 10
}
            

Parameters


year

Must be a valid integer, default 1925

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?year=invalid

{
  "message": {
      "year": "invalid literal for int() with base 10: 'invalid'. Year mus be an integer number."
  }
}
            

country

Country it's the characters origin. It determines the name

Available countries: US, PL, ES.

In future there might be more countries. Countries names follow alpha 2 code convention.

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?country=invalid

{
  "message": {
      "country": "Bad choice: Invalid is not a valid choice. Country in alpha-2 code format. Available countries: 'US', 'PL', 'ES'"
  }
}
            

first_name

Characters first name. By default random name is drawn. When "first_name" is provided, character with that name is returned.

last_name

Characters first name. By default random name is drawn. When "last_name" is provided, character with that name is returned.

age

It's a characters age. By default its random, between 15 and 90. When used, character with provided age is returned.

According to Call of Cthulhu rules, age affects basic characteristics.

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?age=14

{
  "status": "fail",
  "message": "Age not in range: 14 -> [15, 90]."
}
            
400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?age=invalid

{
"message": {
    "age": "Age must be an integer: invalid literal for int() with base 10: 'invalid'"
  }
}
            

sex

Character's sex, by default its random

Choices to specify gender: "M", "F"

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?sex=invalid

{
  "message": {
      "sex": "Bad choice: invalid is not a valid choice. For random choice omit this parameter"
  }
}
            

random_mode

When random mode is set to True, character's characteristics are completely ignored when choosing occupation.

Omit this parameter if you don't want to generate completely random character.

era

According to Call of Cthulhu rules, game and characters can be placed in 3 different times: 1890, 1920 and modern. Those are just ruth delimiters to distinguish differences between set of skills and occupation that can occur in each era.

Available choices: "classic-1920", "modern"

To select both eras use: "classic-1920,modern"

"classic-1890" is not supported

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?era=invalid

{
  "status": "fail",
  "message": "None occupation meets following criteria: type: None, era: ['invalid'], tags: None"
}
            

occup_type

"occup_type" also known as occupation set, defines from which set/expansion character's occupation are drown.

Available choices: "classic", "expansion", "custom"

Omit this parameter to select all.

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?occup_type=invalid

{
  "message": {
      "occup_type": "invalid is not a valid choice"
  }
}
            

tags

Occupation can hav different tags.

Available choices: "lovecraftian", "criminal".

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?tags=invalid

{
  "message": {
      "tags": "invalid is not a valid choice"
  }
}
            

occupation

Character's occupation. When occupation is provided, character with that occupation is returned

400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?occupation=invalid

{
  "status": "fail",
  "message": "'Invalid' not in available occupations. Check cochar.OCCUPATIONS_LIST"
}
            

available occupations

  • antiquarian
  • artist
  • athlete
  • author
  • bartender
  • butler/valet
  • chauffeur
  • clergy
  • computer programmer/technician
  • criminal
  • deprogrammer
  • dilettante
  • doctor of medicine
  • drifter
  • driver
  • engineer
  • entertainer
  • farmer
  • gangster boss
  • hacker
  • journalist
  • laborer, unskilled
  • lawyer
  • librarian
  • mechanic
  • military officer
  • missionary
  • musician
  • nurse
  • parapsychologist
  • pilot
  • police detective
  • police officer
  • private investigator
  • professor
  • sailor, commercial
  • sailor, naval
  • software tester
  • soldier
  • tribe member
  • waiter
  • zealot

Other errors

None of the occupation meet searching criteria:
400 Bad Request

curl -X GET https://www.cochar.pl/api/v1/get?era=modern&tags=lovecraftian

{
  "status": "fail",
  "message": "None occupation meets following criteria: type: None, era: ['modern'], tags: ['lovecraftian']"
}
          

PyPI version License: GNU AGPL v3 Code style: black Language: Python Author: Walu

Call Of Cthulhu Character Generator

Fast way of creating a random character for Call of Cthulhu RPG 7th ed.

Summary

cochar stands for Call of Cthulhu Character. It's a python package design to create a full characters for Call of Cthulhu RPG 7th ed.

www.cochar.pl demonstrates a power of cochar package.

Table of Contents

Installation

pip3 install cochar

Usage

Basic

Example:

```Python

from cochar import create_character person = create_character(1925, "US") person Character(year=1925, country='US', first_name='Anthem', last_name='Pharr', age=22, sex='M', occupation='doctor of medicine', strength=33, condition=30, size=78, dexterity=40, appearance=23, education=87, intelligence=65, power=50, move_rate=7, luck=38, skills={'first aid': 38, 'language [latin]': 9, 'medicine': 73, 'science [biology]': 48, 'ride': 64, 'anthropology': 6, 'charm': 46, 'intimidate': 32, 'art/craft (sculptor)': 9, 'credit rating': 74, 'dodge': 20}, damage_bonus='0', build=0, dodge=20, sanity_points=50, magic_points=10, hit_points=10) ```

Default settings

Default settings are defined in ./data/settings.json.

json { "min_age": 15, "max_age": 90, "max_skill_level": 90, "year": 1925, "age": null, "sex": null, "first_name": null, "last_name": null, "country": "US", "occupation": null, "weights": true, "database": "", "show_warnings": false, "occupation_type": null, "era": null, "tags": null }

Dependencies

cochar depends on randname module for generating random names.

For more details please see:

Documentation

Detailed documentation of module can by found here: cochar documentation

Contribution

If you want to contribute to cochar project read contribution for more information.

Web Version

Web application is not a part of cochar package.

Web application was design to present the power of cochar package. You can check it out on www.cochar.pl

Author

Adam Walkiewicz

License

Cochar is licensed under the terms of the GNU AGPL v3