4bae9953 by Barry

Added lots of help, modified character creation extensively.

1 parent a277bbbb
...@@ -19,7 +19,13 @@ global_aliases = { ...@@ -19,7 +19,13 @@ global_aliases = {
19 'wear': 'equip', 19 'wear': 'equip',
20 'eq': 'equip', 20 'eq': 'equip',
21 'goto': 'go', 21 'goto': 'go',
22 'sc': 'score' 22 'sc': 'score',
23 'str': 'strength',
24 'dex': 'dexterity',
25 'con': 'constitution',
26 'int': 'intelligence',
27 'wis': 'wisdom',
28 'cha': 'charisma'
23 } 29 }
24 30
25 31
...@@ -277,8 +283,11 @@ class Commands(object): ...@@ -277,8 +283,11 @@ class Commands(object):
277 283
278 284
279 def help(self, id, params, players, mud, tokens, command): 285 def help(self, id, params, players, mud, tokens, command):
286 params = params.lower().strip()
287 if params in global_aliases:
288 params = global_aliases[params]
280 if len(tokens) > 0: 289 if len(tokens) > 0:
281 filename = 'help/' + tokens[0] + '.txt' 290 filename = 'help/' + params + '.txt'
282 else: 291 else:
283 filename = 'help/help.txt' 292 filename = 'help/help.txt'
284 try: 293 try:
......
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
2 "name": null, 2 "name": null,
3 "password": null, 3 "password": null,
4 "room": null, 4 "room": null,
5 "abilities": {
6 "str": 10,
7 "dex": 10,
8 "con": 10,
9 "int": 10,
10 "wis": 10,
11 "cha": 10
12 },
5 "equipment": { 13 "equipment": {
6 "finger": [null, null], 14 "finger": [null, null],
7 "hand": [null, null], 15 "hand": [null, null],
......
1 %bold%greenAce Pilot
2
3 %greenSkillful operator of starships and other vehicles who is
4 %greenobsessed with all related knowledge and lore.
5
6 %greenStat Modifiers:
7
8 %green dex: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenAndroid
2
3 %greenAndroids are artificial creatures with both biological and mechanical
4 %greenelements, originally created by humanity as servants and now free to
5 %greenchart their own destiny among the stars.
6
7 %greenStat Modifiers:
8
9 %green dex: %bold2
10 %green int: %bold2
11 %green cha: %bold-2
12 %green base hp: %bold4
13
14 %boldSee Also:
15 races
16 character creation
1 %bold%greenBounty Hunter
2
3 %greenUnstoppable tracker who knows how to stay hot on the trail of those
4 %greenwho flee.
5
6 %greenStat Modifiers:
7
8 %green con: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenCharisma
2
3 %greenCharisma measures a character's personality, personal
4 %greenmagnetism, ability to lead, and appearance. A character with a
5 %greenCharisma score of 0 is unconscious. Your character's Charisma
6 %greenmodifier is factored into the following:
7
8 %green- Bluff, Diplomacy, Disguise, Intimidate, and some Profession
9 %greenskill checks.
10 %green- Checks that represent attempts to influence others, including
11 %greenthe envoy's extraordinary abilities
12
13 %boldSee Also:
14 character creation
1 %bold%greenConstitution
2
3 %greenConstitution represents your character's health. A living
4 %greencreature whose Constitution score reaches 0 dies. Your
5 %greencharacter's Constitution modifier is factored into the following:
6
7 %green- Stamina Points used to perform special actions.
8 %green- Fortitude saves (to resist diseases, poisons, and similar threats)
9
10 %boldSee Also:
11 character creation
1 %bold%greenDamaya Lashuntas
2
3 %greenIdealized by many other humanoid races and gifted with innate psychic
4 %greenabilities, lashuntas are at once consummate scholars and enlightened
5 %greenwarriors, naturally divided into two specialized subraces with
6 %greendifferent abilities and societal roles.
7
8 %greenStat Modifiers:
9
10 %green int: %bold2
11 %green cha: %bold2
12 %green con: %bold-2
13 %green base hp: %bold4
14
15 %boldSee Also:
16 races
17 character creation
1 %bold%greenDexterity
2
3 %greenDexterity measures agility, balance, and reflexes. A character
4 %greenwith a Dexterity score of 0 is unconscious. Your character's
5 %greenDexterity modifier is factored into the following:
6
7 %green- Ranged attack rolls, such as those made with projectile
8 %greenweapons and energy weapons, as well as some spells.
9 %green- Energy Armor Class (EAC) and Kinetic Armor Class (KAC).
10 %green- Reflex saving throws (for leaping out of harm's way).
11 %green- Acrobatics, Piloting, Sleight of Hand, and Stealth skill checks.
12
13 %boldSee Also:
14 character creation
1 %bold%greenEnvoy
2
3 %greenCharismatic people person good at a wide range of skills who inspires
4 %greenallies to accomplish great heroic feats.
5
6 %greenSkills:
7
8 %boldAcrobatics Intimidate
9 %boldAthletics Medicine
10 %boldBluff Perception
11 %boldComputers Piloting
12 %boldCulture Profession
13 %boldDiplomacy Sense Motive
14 %boldDisguise Sleight of Hand
15 %boldEngineering Stealth
16
17 %greenProficiencies:
18
19 %boldLight Armor Basic Melee
20 %boldGrenades Small Arms
21
22 %boldSee Also:
23 classes
24 character creation
1 %bold%greenHuman
2
3 %greenAmbitious, creative, and endlessly curious, humans have shown more drive
4 %greento explore their system and the universe beyond than any of their neighbor
5 %greenraces for better and for worse. They've helped usher in a new era of
6 %greensystem-wide communication and organization and are admired for their
7 %greenpassion and tenacity, but their tendency to shoot first and think about
8 %greenthe consequences later can make them a liability for those races otherwise
9 %greeninclined to work with them.
10
11 %greenStat Modifiers:
12
13 %green base hp: %bold4
14
15 %boldSee Also:
16 races
17 character creation
1 %bold%greenIcon
2
3 %greenPopular and respected celebrity who can leverage the public's
4 %greenadoration for specific needs.
5
6 %greenStat Modifiers:
7
8 %green cha: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenIntelligence
2
3 %greenIntelligence represents how well your character learns and
4 %greenreasons, and is often associated with knowledge and education.
5 %greenAnimals have Intelligence scores of 1 or 2, and any creature
6 %greencapable of understanding a language has a score of at least 3.
7 %greenA character with an Intelligence score of 0 is unconscious. Your
8 %greencharacter's Intelligence modifier is factored into the following:
9
10 %green- The number of bonus languages your character knows at the
11 %greenstart of the game. Even if this modifier is a penalty, your
12 %greencharacter can still use their starting languages unless the
13 %greenIntelligence score is lower than 3.
14 %green- The number of skill ranks gained each level, though your
15 %greencharacter always gets at least 1 skill rank per level.
16 %green- Computers, Culture, Engineering, Life Science, Medicine,
17 %greenPhysical Science, and some Profession skill checks.
18 %green- Bonus technomancer spells. The minimum Intelligence score
19 %greenneeded to cast a technomancer spell is 10 + the spell's level.
20
21 %boldSee Also:
22 character creation
1 %bold%greenKasathas
2
3 %greenOriginally from a planet orbiting a dying star far beyond the Pact Worlds,
4 %greenthe four-armed kasathas maintain a reputation as a noble and mysterious
5 %greenpeople. They are famous for their anachronistic warriors, ancient wisdom,
6 %greenand strange traditions.
7
8 %greenStat Modifiers:
9
10 %green str: %bold2
11 %green wis: %bold2
12 %green int: %bold-2
13 %green base hp: %bold4
14
15 %boldSee Also:
16 races
17 character creation
1 %bold%greenKorasha Lashuntas
2
3 %greenIdealized by many other humanoid races and gifted with innate psychic
4 %greenabilities, lashuntas are at once consummate scholars and enlightened
5 %greenwarriors, naturally divided into two specialized subraces with
6 %greendifferent abilities and societal roles.
7
8 %greenStat Modifiers:
9
10 %green str: %bold2
11 %green cha: %bold2
12 %green wis: %bold-2
13 %green base hp: %bold4
14
15 %boldSee Also:
16 races
17 character creation
1 %bold%greenMechanic
2
3 %greenMaster of machines and technology whose tinkering produces a drone
4 %greencompanion or a powerful brain implant.
5
6 %greenSkills:
7
8 %boldAthletics Perception
9 %boldComputers Physical Science
10 %boldEngineering Piloting
11 %boldMedicine Profession
12
13 %greenProficiencies:
14
15 %boldLight Armor Basic Melee
16 %boldGrenades Small Arms
17
18 %boldSee Also:
19 classes
20 character creation
1 %bold%greenMercenary
2
3 %greenWell-trained soldier of fortune who can work equally well as a
4 %greencombat grunt or a squad leader.
5
6 %greenStat Modifiers:
7
8 %green str: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenMystic
2
3 %greenMagic user whose mysterious connection to a powerful force grants
4 %greenabilities that break the laws of the universe.
5
6 %greenSkills:
7
8 %boldBluff Medicine
9 %boldCulture Mysticism
10 %boldDiplomacy Perception
11 %boldDisguise Profession
12 %boldIntimidate Sense Motive
13 %boldLife Science Survival
14
15 %greenProficiencies:
16
17 %boldLight Armor Basic Melee
18 %boldSmall Arms
19
20 %boldSee Also:
21 classes
22 character creation
1 %bold%greenOperative
2
3 %greenStealthy combatant with wide-ranging know-how who is adept at taking
4 %greenadvantage of unprepared foes.
5
6 %greenSkills:
7
8 %boldAcrobatics Medicine
9 %boldAthletics Perception
10 %boldBluff Piloting
11 %boldComputers Profession
12 %boldCulture Sense Motive
13 %boldDisguise Sleight of Hand
14 %boldEngineering Stealth
15 %boldIntimidate Survival
16
17 %greenProficiencies:
18
19 %boldLight Armor Basic Melee
20 %boldSmall Arms Sniper Weapons
21
22 %boldSee Also:
23 classes
24 character creation
1 %bold%greenOutlaw
2
3 %greenWanted criminal with back-alley connections to black markets and
4 %greenassociates who can fend off legal trouble.
5
6 %greenStat Modifiers:
7
8 %green dex: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenPriest
2
3 %greenDedicated and knowledgeable adherent to a philosophy or religion who
4 %greencommands clout among other followers.
5
6 %greenStat Modifiers:
7
8 %green wis: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenScholar
2
3 %greenSkilled researcher and cutting-edge thinker with a broad base of
4 %greenknowledge and a thirst to expand it.
5
6 %greenStat Modifiers:
7
8 %green int: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenShirrens
2
3 %greenOnce part of a ravenous hive of locust-like predators, the insectile
4 %greenshirrens only recently broke with their hive mind to become a race
5 %greenof telepaths physically addicted to their own individualism, yet
6 %greendedicated to the idea of community and harmony with other races
7
8 %greenStat Modifiers:
9
10 %green con: %bold2
11 %green wis: %bold2
12 %green cha: %bold-2
13 %green base hp: %bold6
14
15 %boldSee Also:
16 races
17 character creation
1 %bold%greenSolarian
2
3 %greenDisciplined warrior whose mastery of the stars grants either a
4 %greenweapon or armor made of stellar power.
5
6 %greenSkills:
7
8 %boldAcrobatics Perception
9 %boldAthletics Physical Science
10 %boldDiplomacy Profession
11 %boldIntimidate Sense Motive
12 %boldMysticism Stealth
13
14 %greenProficiencies:
15
16 %boldLight Armor Basic Melee
17 %boldSmall Arms Advanced Melee
18
19 %boldSee Also:
20 classes
21 character creation
1 %bold%greenSoldier
2
3 %greenExpert with a huge range of armor, guns, and melee weapons who
4 %greenspecializes in certain types of gear.
5
6 %greenSkills:
7
8 %boldAcrobatics Medicine
9 %boldAthletics Piloting
10 %boldEngineering Profession
11 %boldIntimidate Survival
12
13 %greenProficiencies:
14
15 %boldLight Armor Heavy Armor
16 %boldBasic Melee Advanced Melee
17 %boldSmall Arms Long Guns
18 %boldHeavy Weapons Sniper Weapons
19 %boldGrenades
20
21 %boldSee Also:
22 classes
23 character creation
1 %bold%greenSpacefarer
2
3 %greenRestless explorer who has strong intuition and has collected deep
4 %greenknowledge about alien biology and topology.
5
6 %greenStat Modifiers:
7
8 %green con: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenStrength
2
3 %greenStrength measures muscle and physical power. A character with
4 %greena Strength score of 0 is unconscious. Your character's Strength
5 %greenmodifier is factored into the following:
6
7 %green- Melee attack rolls and attack rolls made with thrown
8 %greenweapons (such as grenades).
9 %green- Damage rolls when using melee weapons or thrown weapons
10 %green(but not grenades).
11 %green- Athletics skill checks.
12 %green- Strength checks (for breaking down doors and the like).
13 %green- How much gear your character can carry
14
15 %boldSee Also:
16 character creation
1 %bold%greenTechnomancer
2
3 %greenMagic user who is preternaturally attuned to technology and can use
4 %greenit to unlock powerful effects.
5
6 %greenSkills:
7
8 %boldComputers Physical Science
9 %boldEngineering Piloting
10 %boldLife Science Profession
11 %boldMysticism Sleight of Hand
12
13 %greenProficiencies:
14
15 %boldLight Armor Basic Melee
16 %boldSmall Arms
17
18 %boldSee Also:
19 classes
20 character creation
1 %bold%greenVesk
2
3 %greenHeavily muscled and covered with thick scales and short, sharp horns,
4 %greenthe reptilian vesk are exactly as predatory and warlike as they
5 %greenappear. Originally hailing from a star system near the Pact Worlds,
6 %greenthey sought to conquer and subdue their stellar neighbors, as they
7 %greenhad all the other intelligent races in their own system, until an
8 %greenoverwhelming threat forced them into a grudging alliance with the
9 %greenPact Worlds for now.
10
11 %greenStat Modifiers:
12
13 %green str: %bold2
14 %green con: %bold2
15 %green int: %bold-2
16 %green base hp: %bold6
17
18 %boldSee Also:
19 races
20 character creation
1 %bold%greenWisdom
2
3 %greenWisdom describes a character's common sense, intuition, and
4 %greenwillpower. A character with a Wisdom score of 0 is unconscious.
5 %greenYour character's Wisdom modifier is factored into the following:
6
7 %green- Will saving throws (for defending against things like magical
8 %greenmind control).
9 %green- Mysticism, Perception, Sense Motive, Survival, and some
10 %greenProfession skill checks.
11 %green- Bonus mystic spells. The minimum Wisdom score needed to
12 %greencast a mystic spell is 10 + the spell's level.
13
14 %boldSee Also:
15 character creation
1 %bold%greenXenoseeker
2
3 %greenGuru of alien life-forms who finds that meeting them is one of life's
4 %greenmost rewarding accomplishments.
5
6 %greenStat Modifiers:
7
8 %green cha: %bold1
9
10 %boldSee Also:
11 classes
12 character creation
1 %bold%greenYsoki
2
3 %greenSmall and furtive, the ysoki are often overlooked by larger races.
4 %greenYet through wit and technological prowess, they've spread
5 %greenthroughout the solar system, giving truth to the old adage that
6 %greenevery starship needs a few rats.
7
8 %greenStat Modifiers:
9
10 %green dex: %bold2
11 %green int: %bold2
12 %green str: %bold-2
13 %green base hp: %bold2
14
15 %boldSee Also:
16 races
17 character creation
...@@ -665,6 +665,7 @@ class MudServer(object): ...@@ -665,6 +665,7 @@ class MudServer(object):
665 if option_state == self._READ_NAWS: 665 if option_state == self._READ_NAWS:
666 height = 30 666 height = 30
667 width = 100 667 width = 100
668 try:
668 if 'esp' in sys.platform: 669 if 'esp' in sys.platform:
669 height, width = ustruct.unpack('>hh', option_data) 670 height, width = ustruct.unpack('>hh', option_data)
670 else: 671 else:
...@@ -674,6 +675,8 @@ class MudServer(object): ...@@ -674,6 +675,8 @@ class MudServer(object):
674 if width > 0: 675 if width > 0:
675 client.width = width 676 client.width = width
676 print("Got NAWS Width: %d Height: %d" % (client.width, client.height)) 677 print("Got NAWS Width: %d Height: %d" % (client.width, client.height))
678 except:
679 pass
677 option_state = 0 680 option_state = 0
678 option_data = bytearray() 681 option_data = bytearray()
679 # elif option_state == self._READ_MSDP: 682 # elif option_state == self._READ_MSDP:
......
1 {"name": "test", "password": "6c76899eb15393064b4f4db94805e5862232920b", "room": "town/room001", "equipment": {"finger": [null, null], "hand": [null, null], "arm": [null, null], "leg": [null, null], "foot": [null, null], "head": null, "neck": null, "back": null, "body": null, "waist": null}, "inventory": {"bag": [{"expires": 0, "inventory": {"shirt": [{"expires": 0}]}}]}, "prompt": "hp %hp mp %mp> ", "aliases": {}, "hp": 94, "mp": 10, "maxhp": 100, "maxmp": 10, "maxsta": 10, "sta": 0.8000000000000004, "aa": "1d2", "mpr": 0.25, "star": 0.4, "weapon": null, "sp": {}, "at": {"kick": {"cost": 5, "dmg": "2d4", "desc": "You unleash a powerful kick"}}}
...\ No newline at end of file ...\ No newline at end of file
1 {"name": "test", "password": "6c76899eb15393064b4f4db94805e5862232920b", "room": "town/tavern", "abilities": {"str": 10, "dex": 23, "con": 10, "int": 12, "wis": 10, "cha": 8}, "equipment": {"finger": [null, null], "hand": [null, null], "arm": [null, null], "leg": [null, null], "foot": [null, null], "head": null, "neck": null, "back": null, "body": null, "waist": null}, "inventory": {"bag": [{"expires": 0, "inventory": {"shirt": [{"expires": 0}]}}]}, "prompt": "hp %hp mp %mp> ", "aliases": {}, "hp": 100, "mp": 10, "maxhp": 100, "maxmp": 10, "maxsta": 10, "sta": 10, "aa": "1d2", "mpr": 0.25, "star": 0.4, "weapon": null, "sp": {}, "at": {"kick": {"cost": 5, "dmg": "2d4", "desc": "You unleash a powerful kick"}}, "createstep": 7, "color_enabled": true, "over_13": true, "race": "Android", "theme": "Ace Pilot", "class": "Envoy", "abilitypoints": 0}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -36,35 +36,43 @@ globals()['mud'] = MudServer() ...@@ -36,35 +36,43 @@ globals()['mud'] = MudServer()
36 races = { 36 races = {
37 "Android": { 37 "Android": {
38 "desc":"Androids are artificial creatures with both biological and mechanical elements, originally created by humanity as servants and now free to chart their own destiny among the stars.", 38 "desc":"Androids are artificial creatures with both biological and mechanical elements, originally created by humanity as servants and now free to chart their own destiny among the stars.",
39 "mods": {"dex": 2, "int": 2, "cha": -2, "hp": 4} 39 "mods": {"dex": 2, "int": 2, "cha": -2},
40 "hp": 4
40 }, 41 },
41 "Human": { 42 "Human": {
42 "desc":"Ambitious, creative, and endlessly curious, humans have shown more drive to explore their system and the universe beyond than any of their neighbor races for better and for worse. They've helped usher in a new era of system-wide communication and organization and are admired for their passion and tenacity, but their tendency to shoot first and think about the consequences later can make them a liability for those races otherwise inclined to work with them.", 43 "desc":"Ambitious, creative, and endlessly curious, humans have shown more drive to explore their system and the universe beyond than any of their neighbor races for better and for worse. They've helped usher in a new era of system-wide communication and organization and are admired for their passion and tenacity, but their tendency to shoot first and think about the consequences later can make them a liability for those races otherwise inclined to work with them.",
43 "mods": {"hp": 4} 44 "mods": {},
45 "hp": 4
44 }, 46 },
45 "Kasathas": { 47 "Kasathas": {
46 "desc":"Originally from a planet orbiting a dying star far beyond the Pact Worlds, the four-armed kasathas maintain a reputation as a noble and mysterious people. They are famous for their anachronistic warriors, ancient wisdom, and strange traditions.", 48 "desc":"Originally from a planet orbiting a dying star far beyond the Pact Worlds, the four-armed kasathas maintain a reputation as a noble and mysterious people. They are famous for their anachronistic warriors, ancient wisdom, and strange traditions.",
47 "mods": {"str": 2, "wis": 2, "int": -2, "hp": 4} 49 "mods": {"str": 2, "wis": 2, "int": -2},
50 "hp": 4
48 }, 51 },
49 "Korasha Lashuntas": { 52 "Korasha Lashuntas": {
50 "desc":"Idealized by many other humanoid races and gifted with innate psychic abilities, lashuntas are at once consummate scholars and enlightened warriors, naturally divided into two specialized subraces with different abilities and societal roles.", 53 "desc":"Idealized by many other humanoid races and gifted with innate psychic abilities, lashuntas are at once consummate scholars and enlightened warriors, naturally divided into two specialized subraces with different abilities and societal roles.",
51 "mods": {"str": 2, "cha": 2, "wis": -2, "hp": 4} 54 "mods": {"str": 2, "cha": 2, "wis": -2},
55 "hp": 4
52 }, 56 },
53 "Damaya Lashuntas": { 57 "Damaya Lashuntas": {
54 "desc":"Idealized by many other humanoid races and gifted with innate psychic abilities, lashuntas are at once consummate scholars and enlightened warriors, naturally divided into two specialized subraces with different abilities and societal roles.", 58 "desc":"Idealized by many other humanoid races and gifted with innate psychic abilities, lashuntas are at once consummate scholars and enlightened warriors, naturally divided into two specialized subraces with different abilities and societal roles.",
55 "mods": {"int": 2, "cha": 2, "con": -2, "hp": 4} 59 "mods": {"int": 2, "cha": 2, "con": -2},
60 "hp": 4
56 }, 61 },
57 "Shirrens": { 62 "Shirrens": {
58 "desc":"Once part of a ravenous hive of locust-like predators, the insectile shirrens only recently broke with their hive mind to become a race of telepaths physically addicted to their own individualism, yet dedicated to the idea of community and harmony with other races", 63 "desc":"Once part of a ravenous hive of locust-like predators, the insectile shirrens only recently broke with their hive mind to become a race of telepaths physically addicted to their own individualism, yet dedicated to the idea of community and harmony with other races",
59 "mods": {"con": 2, "wis": 2, "cha": -2, "hp": 6} 64 "mods": {"con": 2, "wis": 2, "cha": -2},
65 "hp": 6
60 }, 66 },
61 "Vesk": { 67 "Vesk": {
62 "desc":"Heavily muscled and covered with thick scales and short, sharp horns, the reptilian vesk are exactly as predatory and warlike as they appear. Originally hailing from a star system near the Pact Worlds, they sought to conquer and subdue their stellar neighbors, as they had all the other intelligent races in their own system, until an overwhelming threat forced them into a grudging alliance with the Pact Worlds for now.", 68 "desc":"Heavily muscled and covered with thick scales and short, sharp horns, the reptilian vesk are exactly as predatory and warlike as they appear. Originally hailing from a star system near the Pact Worlds, they sought to conquer and subdue their stellar neighbors, as they had all the other intelligent races in their own system, until an overwhelming threat forced them into a grudging alliance with the Pact Worlds for now.",
63 "mods": {"str": 2, "con": 2, "int": -2, "hp": 6} 69 "mods": {"str": 2, "con": 2, "int": -2},
70 "hp": 6
64 }, 71 },
65 "Ysoki": { 72 "Ysoki": {
66 "desc":"Small and furtive, the ysoki are often overlooked by larger races. Yet through wit and technological prowess, they've spread throughout the solar system, giving truth to the old adage that every starship needs a few rats.", 73 "desc":"Small and furtive, the ysoki are often overlooked by larger races. Yet through wit and technological prowess, they've spread throughout the solar system, giving truth to the old adage that every starship needs a few rats.",
67 "mods": {"dex": 2, "int": 2, "str": -2, "hp": 2} 74 "mods": {"dex": 2, "int": 2, "str": -2},
75 "hp": 2
68 } 76 }
69 } 77 }
70 78
...@@ -274,6 +282,34 @@ def isalnum(c): ...@@ -274,6 +282,34 @@ def isalnum(c):
274 return False 282 return False
275 return True 283 return True
276 284
285 def show_list(id, title, singular_title, subject_list, instructions='Please choose a {} from the list by number: '):
286 mud.send_message(id, " %green+------------={}=------------+".format(title), nowrap=True)
287 for idx, subject in enumerate(subject_list):
288 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<28}'.format(idx, subject),), nowrap=True)
289 mud.send_message(id, " %green+-------------------------------+", nowrap=True)
290
291 mud.send_message(id, ' (Type %boldhelp [{}]%reset for details)\r\n'.format(singular_title))
292 mud.send_message(id, instructions.format(singular_title))
293
294 def get_base_abilities(id):
295 base = {"str": 10, "dex": 10, "con": 10, "int": 10, "wis": 10, "cha": 10}
296 for name, value in races[players[id]["race"]]["mods"].items():
297 base[name] += value
298 for name, value in themes[players[id]["theme"]]["mods"].items():
299 base[name] += value
300 return base
301
302 def show_abilities(id):
303 mud.send_message(id, "%greenEnter the number of the ability you wish to modify 1 point will be added to that ability. You may not exceed the available ability points.")
304 mud.send_message(id, '%greenYou can reset to the base values by typing %boldreset')
305 mud.send_message(id, " %green+-----=Abilities=-----+", nowrap=True)
306 for idx, ability in enumerate(players[id]["abilities"]):
307 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<13} {:^4}'.format(idx, ability, players[id]["abilities"][ability]),), nowrap=True)
308 mud.send_message(id, " %green+- Points: %bold{:<2}%reset%green --------+".format(players[id]["abilitypoints"]), nowrap=True)
309
310 mud.send_message(id, ' (Type %boldhelp [ability]%reset for details)\r\n')
311 mud.send_message(id, '%greenWhen finished type %bolddone')
312
277 def handle_character_create(id, command, params): 313 def handle_character_create(id, command, params):
278 if players[id]["createstep"] == 1: 314 if players[id]["createstep"] == 1:
279 players[id]["color_enabled"] = command[0] in ['y', 'Y'] 315 players[id]["color_enabled"] = command[0] in ['y', 'Y']
...@@ -298,97 +334,76 @@ def handle_character_create(id, command, params): ...@@ -298,97 +334,76 @@ def handle_character_create(id, command, params):
298 pass 334 pass
299 return 335 return
300 else: 336 else:
301 mud.send_message(id, " %green+------------=Races=------------+", nowrap=True) 337 show_list(id, "Races", "race", races)
302 for idx, race in enumerate(races):
303 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<28}'.format(idx, race),), nowrap=True)
304 mud.send_message(id, " %green+-------------------------------+", nowrap=True)
305
306 mud.send_message(id, 'Please choose a race from the list by number: ')
307 players[id]["createstep"] = 3 338 players[id]["createstep"] = 3
308 339
309 elif players[id]["createstep"] == 3: 340 elif players[id]["createstep"] == 3:
310 if command.lower().startswith("help"): 341 if command.lower().startswith("help"):
311 races_lower = {k.lower():v for k,v in races.items()} 342 cmd_handler.parse(id, command, params.lower().strip(), mud, players)
312 race = races_lower.get(params.lower().strip()) 343 if not command.isdigit() or int(command) + 1 > len(races) or int(command) < 0:
313 if race: 344 show_list(id, "Races", "race", races)
314 mods = '\r\n'.join(" %green{!s: <4} %bold{!r}%reset".format(key,val) for (key,val) in race.get("mods").items())
315
316 mud.send_message(id, "\r\n%green{}\r\n%bold{}\r\n\n%resetStat Modifiers:".format(params.strip(), race.get("desc")))
317 mud.send_message(id, mods + "\r\n", nowrap=True)
318 else:
319 mud.send_message(id, "Please type the name of the race you want to learn about.", color='cyan')
320 if not command.isdigit():
321 mud.send_message(id, " %green+------------=Races=-----------+", nowrap=True)
322 for idx, race in enumerate(races):
323 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, race),), nowrap=True)
324 mud.send_message(id, " %green+------------------------------+", nowrap=True)
325
326 mud.send_message(id, ' (Type %boldhelp [race]%reset for details)\r\n')
327 mud.send_message(id, 'Please choose a race from the list by number: ')
328 else: 345 else:
329 race = list(races)[int(command)] 346 race = list(races)[int(command)]
330 mud.send_message(id, 'Race selected: {}'.format(race)) 347 mud.send_message(id, 'Race selected: {}'.format(race))
331 348
332 players[id]["race"] = race 349 players[id]["race"] = race
333 players[id]["createstep"] = 4 350 players[id]["createstep"] = 4
334 mud.send_message(id, " %green+------------=Themes=-----------+", nowrap=True) 351 show_list(id, "Themes", "theme", themes)
335 for idx, theme in enumerate(themes):
336 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, theme),), nowrap=True)
337 mud.send_message(id, " %green+------------------------------+", nowrap=True)
338
339 mud.send_message(id, ' (Type %boldhelp [theme]%reset for details)\r\n')
340 mud.send_message(id, 'Please choose a theme from the list by number: ')
341 elif players[id]["createstep"] == 4: 352 elif players[id]["createstep"] == 4:
342 if command.lower().startswith("help"): 353 if command.lower().startswith("help"):
343 themes_lower = {k.lower():v for k,v in themes.items()} 354 cmd_handler.parse(id, command, params.lower().strip(), mud, players)
344 theme = themes_lower.get(params.lower().strip()) 355 if not command.isdigit() or int(command) + 1 > len(themes) or int(command) < 0:
345 if theme: 356 show_list(id, "Themes", "theme", themes)
346 mods = '\r\n'.join(" %green{!s: <4} %bold{!r}%reset".format(key,val) for (key,val) in theme.get("mods").items())
347
348 mud.send_message(id, "\r\n%green{}\r\n%bold{}\r\n\n%resetStat Modifiers:".format(params.strip(), theme.get("desc")))
349 mud.send_message(id, mods + "\r\n", nowrap=True)
350 else:
351 mud.send_message(id, "Please type the name of the theme you want to learn about.", color='cyan')
352 if not command.isdigit():
353 mud.send_message(id, " %green+------------=Themes=-----------+", nowrap=True)
354 for idx, theme in enumerate(themes):
355 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, theme),), nowrap=True)
356 mud.send_message(id, " %green+------------------------------+", nowrap=True)
357
358 mud.send_message(id, ' (Type %boldhelp [theme]%reset for details)\r\n')
359 mud.send_message(id, 'Please choose a theme from the list by number: ')
360 else: 357 else:
361 theme = list(themes)[int(command)] 358 theme = list(themes)[int(command)]
362 mud.send_message(id, 'Theme selected: {}'.format(theme)) 359 mud.send_message(id, 'Theme selected: {}'.format(theme))
363 360
364 players[id]["theme"] = theme 361 players[id]["theme"] = theme
365 players[id]["createstep"] = 5 362 players[id]["createstep"] = 5
363 show_list(id, "Classes", "class", classes)
364
366 elif players[id]["createstep"] == 5: 365 elif players[id]["createstep"] == 5:
367 if command.lower().startswith("help"): 366 if command.lower().startswith("help"):
368 themes_lower = {k.lower():v for k,v in themes.items()} 367 cmd_handler.parse(id, command, params.lower().strip(), mud, players)
369 theme = themes_lower.get(params.lower().strip()) 368 if not command.isdigit() or int(command) + 1 > len(classes) or int(command) < 0:
370 if theme: 369 show_list(id, "Classes", "class", classes)
371 mods = '\r\n'.join(" %green{!s: <4} %bold{!r}%reset".format(key,val) for (key,val) in theme.get("mods").items()) 370 else:
371 selected_class = list(classes)[int(command)]
372 mud.send_message(id, 'Class selected: {}'.format(selected_class))
372 373
373 mud.send_message(id, "\r\n%green{}\r\n%bold{}\r\n\n%resetStat Modifiers:".format(params.strip(), theme.get("desc"))) 374 players[id]["class"] = selected_class
374 mud.send_message(id, mods + "\r\n", nowrap=True) 375 players[id]["createstep"] = 6
376 if players[id]["race"] == "Human":
377 players[id]["abilitypoints"] = 12
375 else: 378 else:
376 mud.send_message(id, "Please type the name of the theme you want to learn about.", color='cyan') 379 players[id]["abilitypoints"] = 10
377 if not command.isdigit(): 380 players[id]["abilities"] = get_base_abilities(id)
378 mud.send_message(id, " %green+------------=Themes=-----------+", nowrap=True) 381 show_abilities(id)
379 for idx, theme in enumerate(themes): 382 elif players[id]["createstep"] == 6:
380 mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, theme),), nowrap=True) 383 if command.lower().startswith("help"):
381 mud.send_message(id, " %green+------------------------------+", nowrap=True) 384 cmd_handler.parse(id, command, params.lower().strip(), mud, players)
382 385 elif command.lower().startswith("reset"):
383 mud.send_message(id, ' (Type %boldhelp [theme]%reset for details)\r\n') 386 players[id]["abilities"] = get_base_abilities(id)
384 mud.send_message(id, 'Please choose a theme from the list by number: ') 387 if players[id]["race"] == "Human":
388 players[id]["abilitypoints"] = 12
385 else: 389 else:
386 theme = list(themes)[int(command)] 390 players[id]["abilitypoints"] = 10
387 mud.send_message(id, 'Theme selected: {}'.format(theme)) 391 show_abilities(id)
388 392 elif command.lower().startswith("done"):
389 players[id]["theme"] = theme 393 if players[id]["abilitypoints"] > 0:
390 players[id]["createstep"] = 5 394 mud.send_message(id, '%cyanPlease spend all available ability points.')
395 show_abilities(id)
396 else:
397 players[id]["createstep"] = 7
398 elif not command.isdigit() or int(command) + 1 > len(players[id]["abilities"]) or int(command) < 0:
399 show_abilities(id)
400 else:
401 ability_name = list(players[id]["abilities"])[int(command)]
391 402
403 if players[id]["abilitypoints"] > 0:
404 players[id]["abilities"][ability_name] += 1
405 players[id]["abilitypoints"] -= 1
406 show_abilities(id)
392 save_object_to_file(players[id], "players/{}.json".format(players[id]["name"])) 407 save_object_to_file(players[id], "players/{}.json".format(players[id]["name"]))
393 408
394 # main game loop. We loop forever (i.e. until the program is terminated) 409 # main game loop. We loop forever (i.e. until the program is terminated)
......