4bae9953 by Barry

Added lots of help, modified character creation extensively.

1 parent a277bbbb
......@@ -19,7 +19,13 @@ global_aliases = {
'wear': 'equip',
'eq': 'equip',
'goto': 'go',
'sc': 'score'
'sc': 'score',
'str': 'strength',
'dex': 'dexterity',
'con': 'constitution',
'int': 'intelligence',
'wis': 'wisdom',
'cha': 'charisma'
}
......@@ -277,8 +283,11 @@ class Commands(object):
def help(self, id, params, players, mud, tokens, command):
params = params.lower().strip()
if params in global_aliases:
params = global_aliases[params]
if len(tokens) > 0:
filename = 'help/' + tokens[0] + '.txt'
filename = 'help/' + params + '.txt'
else:
filename = 'help/help.txt'
try:
......
......@@ -2,6 +2,14 @@
"name": null,
"password": null,
"room": null,
"abilities": {
"str": 10,
"dex": 10,
"con": 10,
"int": 10,
"wis": 10,
"cha": 10
},
"equipment": {
"finger": [null, null],
"hand": [null, null],
......
%bold%greenAce Pilot
%greenSkillful operator of starships and other vehicles who is
%greenobsessed with all related knowledge and lore.
%greenStat Modifiers:
%green dex: %bold1
%boldSee Also:
classes
character creation
%bold%greenAndroid
%greenAndroids are artificial creatures with both biological and mechanical
%greenelements, originally created by humanity as servants and now free to
%greenchart their own destiny among the stars.
%greenStat Modifiers:
%green dex: %bold2
%green int: %bold2
%green cha: %bold-2
%green base hp: %bold4
%boldSee Also:
races
character creation
%bold%greenBounty Hunter
%greenUnstoppable tracker who knows how to stay hot on the trail of those
%greenwho flee.
%greenStat Modifiers:
%green con: %bold1
%boldSee Also:
classes
character creation
%bold%greenCharisma
%greenCharisma measures a character's personality, personal
%greenmagnetism, ability to lead, and appearance. A character with a
%greenCharisma score of 0 is unconscious. Your character's Charisma
%greenmodifier is factored into the following:
%green- Bluff, Diplomacy, Disguise, Intimidate, and some Profession
%greenskill checks.
%green- Checks that represent attempts to influence others, including
%greenthe envoy's extraordinary abilities
%boldSee Also:
character creation
%bold%greenConstitution
%greenConstitution represents your character's health. A living
%greencreature whose Constitution score reaches 0 dies. Your
%greencharacter's Constitution modifier is factored into the following:
%green- Stamina Points used to perform special actions.
%green- Fortitude saves (to resist diseases, poisons, and similar threats)
%boldSee Also:
character creation
%bold%greenDamaya Lashuntas
%greenIdealized by many other humanoid races and gifted with innate psychic
%greenabilities, lashuntas are at once consummate scholars and enlightened
%greenwarriors, naturally divided into two specialized subraces with
%greendifferent abilities and societal roles.
%greenStat Modifiers:
%green int: %bold2
%green cha: %bold2
%green con: %bold-2
%green base hp: %bold4
%boldSee Also:
races
character creation
%bold%greenDexterity
%greenDexterity measures agility, balance, and reflexes. A character
%greenwith a Dexterity score of 0 is unconscious. Your character's
%greenDexterity modifier is factored into the following:
%green- Ranged attack rolls, such as those made with projectile
%greenweapons and energy weapons, as well as some spells.
%green- Energy Armor Class (EAC) and Kinetic Armor Class (KAC).
%green- Reflex saving throws (for leaping out of harm's way).
%green- Acrobatics, Piloting, Sleight of Hand, and Stealth skill checks.
%boldSee Also:
character creation
%bold%greenEnvoy
%greenCharismatic people person good at a wide range of skills who inspires
%greenallies to accomplish great heroic feats.
%greenSkills:
%boldAcrobatics Intimidate
%boldAthletics Medicine
%boldBluff Perception
%boldComputers Piloting
%boldCulture Profession
%boldDiplomacy Sense Motive
%boldDisguise Sleight of Hand
%boldEngineering Stealth
%greenProficiencies:
%boldLight Armor Basic Melee
%boldGrenades Small Arms
%boldSee Also:
classes
character creation
%bold%greenHuman
%greenAmbitious, creative, and endlessly curious, humans have shown more drive
%greento explore their system and the universe beyond than any of their neighbor
%greenraces for better and for worse. They've helped usher in a new era of
%greensystem-wide communication and organization and are admired for their
%greenpassion and tenacity, but their tendency to shoot first and think about
%greenthe consequences later can make them a liability for those races otherwise
%greeninclined to work with them.
%greenStat Modifiers:
%green base hp: %bold4
%boldSee Also:
races
character creation
%bold%greenIcon
%greenPopular and respected celebrity who can leverage the public's
%greenadoration for specific needs.
%greenStat Modifiers:
%green cha: %bold1
%boldSee Also:
classes
character creation
%bold%greenIntelligence
%greenIntelligence represents how well your character learns and
%greenreasons, and is often associated with knowledge and education.
%greenAnimals have Intelligence scores of 1 or 2, and any creature
%greencapable of understanding a language has a score of at least 3.
%greenA character with an Intelligence score of 0 is unconscious. Your
%greencharacter's Intelligence modifier is factored into the following:
%green- The number of bonus languages your character knows at the
%greenstart of the game. Even if this modifier is a penalty, your
%greencharacter can still use their starting languages unless the
%greenIntelligence score is lower than 3.
%green- The number of skill ranks gained each level, though your
%greencharacter always gets at least 1 skill rank per level.
%green- Computers, Culture, Engineering, Life Science, Medicine,
%greenPhysical Science, and some Profession skill checks.
%green- Bonus technomancer spells. The minimum Intelligence score
%greenneeded to cast a technomancer spell is 10 + the spell's level.
%boldSee Also:
character creation
%bold%greenKasathas
%greenOriginally from a planet orbiting a dying star far beyond the Pact Worlds,
%greenthe four-armed kasathas maintain a reputation as a noble and mysterious
%greenpeople. They are famous for their anachronistic warriors, ancient wisdom,
%greenand strange traditions.
%greenStat Modifiers:
%green str: %bold2
%green wis: %bold2
%green int: %bold-2
%green base hp: %bold4
%boldSee Also:
races
character creation
%bold%greenKorasha Lashuntas
%greenIdealized by many other humanoid races and gifted with innate psychic
%greenabilities, lashuntas are at once consummate scholars and enlightened
%greenwarriors, naturally divided into two specialized subraces with
%greendifferent abilities and societal roles.
%greenStat Modifiers:
%green str: %bold2
%green cha: %bold2
%green wis: %bold-2
%green base hp: %bold4
%boldSee Also:
races
character creation
%bold%greenMechanic
%greenMaster of machines and technology whose tinkering produces a drone
%greencompanion or a powerful brain implant.
%greenSkills:
%boldAthletics Perception
%boldComputers Physical Science
%boldEngineering Piloting
%boldMedicine Profession
%greenProficiencies:
%boldLight Armor Basic Melee
%boldGrenades Small Arms
%boldSee Also:
classes
character creation
%bold%greenMercenary
%greenWell-trained soldier of fortune who can work equally well as a
%greencombat grunt or a squad leader.
%greenStat Modifiers:
%green str: %bold1
%boldSee Also:
classes
character creation
%bold%greenMystic
%greenMagic user whose mysterious connection to a powerful force grants
%greenabilities that break the laws of the universe.
%greenSkills:
%boldBluff Medicine
%boldCulture Mysticism
%boldDiplomacy Perception
%boldDisguise Profession
%boldIntimidate Sense Motive
%boldLife Science Survival
%greenProficiencies:
%boldLight Armor Basic Melee
%boldSmall Arms
%boldSee Also:
classes
character creation
%bold%greenOperative
%greenStealthy combatant with wide-ranging know-how who is adept at taking
%greenadvantage of unprepared foes.
%greenSkills:
%boldAcrobatics Medicine
%boldAthletics Perception
%boldBluff Piloting
%boldComputers Profession
%boldCulture Sense Motive
%boldDisguise Sleight of Hand
%boldEngineering Stealth
%boldIntimidate Survival
%greenProficiencies:
%boldLight Armor Basic Melee
%boldSmall Arms Sniper Weapons
%boldSee Also:
classes
character creation
%bold%greenOutlaw
%greenWanted criminal with back-alley connections to black markets and
%greenassociates who can fend off legal trouble.
%greenStat Modifiers:
%green dex: %bold1
%boldSee Also:
classes
character creation
%bold%greenPriest
%greenDedicated and knowledgeable adherent to a philosophy or religion who
%greencommands clout among other followers.
%greenStat Modifiers:
%green wis: %bold1
%boldSee Also:
classes
character creation
%bold%greenScholar
%greenSkilled researcher and cutting-edge thinker with a broad base of
%greenknowledge and a thirst to expand it.
%greenStat Modifiers:
%green int: %bold1
%boldSee Also:
classes
character creation
%bold%greenShirrens
%greenOnce part of a ravenous hive of locust-like predators, the insectile
%greenshirrens only recently broke with their hive mind to become a race
%greenof telepaths physically addicted to their own individualism, yet
%greendedicated to the idea of community and harmony with other races
%greenStat Modifiers:
%green con: %bold2
%green wis: %bold2
%green cha: %bold-2
%green base hp: %bold6
%boldSee Also:
races
character creation
%bold%greenSolarian
%greenDisciplined warrior whose mastery of the stars grants either a
%greenweapon or armor made of stellar power.
%greenSkills:
%boldAcrobatics Perception
%boldAthletics Physical Science
%boldDiplomacy Profession
%boldIntimidate Sense Motive
%boldMysticism Stealth
%greenProficiencies:
%boldLight Armor Basic Melee
%boldSmall Arms Advanced Melee
%boldSee Also:
classes
character creation
%bold%greenSoldier
%greenExpert with a huge range of armor, guns, and melee weapons who
%greenspecializes in certain types of gear.
%greenSkills:
%boldAcrobatics Medicine
%boldAthletics Piloting
%boldEngineering Profession
%boldIntimidate Survival
%greenProficiencies:
%boldLight Armor Heavy Armor
%boldBasic Melee Advanced Melee
%boldSmall Arms Long Guns
%boldHeavy Weapons Sniper Weapons
%boldGrenades
%boldSee Also:
classes
character creation
%bold%greenSpacefarer
%greenRestless explorer who has strong intuition and has collected deep
%greenknowledge about alien biology and topology.
%greenStat Modifiers:
%green con: %bold1
%boldSee Also:
classes
character creation
%bold%greenStrength
%greenStrength measures muscle and physical power. A character with
%greena Strength score of 0 is unconscious. Your character's Strength
%greenmodifier is factored into the following:
%green- Melee attack rolls and attack rolls made with thrown
%greenweapons (such as grenades).
%green- Damage rolls when using melee weapons or thrown weapons
%green(but not grenades).
%green- Athletics skill checks.
%green- Strength checks (for breaking down doors and the like).
%green- How much gear your character can carry
%boldSee Also:
character creation
%bold%greenTechnomancer
%greenMagic user who is preternaturally attuned to technology and can use
%greenit to unlock powerful effects.
%greenSkills:
%boldComputers Physical Science
%boldEngineering Piloting
%boldLife Science Profession
%boldMysticism Sleight of Hand
%greenProficiencies:
%boldLight Armor Basic Melee
%boldSmall Arms
%boldSee Also:
classes
character creation
%bold%greenVesk
%greenHeavily muscled and covered with thick scales and short, sharp horns,
%greenthe reptilian vesk are exactly as predatory and warlike as they
%greenappear. Originally hailing from a star system near the Pact Worlds,
%greenthey sought to conquer and subdue their stellar neighbors, as they
%greenhad all the other intelligent races in their own system, until an
%greenoverwhelming threat forced them into a grudging alliance with the
%greenPact Worlds for now.
%greenStat Modifiers:
%green str: %bold2
%green con: %bold2
%green int: %bold-2
%green base hp: %bold6
%boldSee Also:
races
character creation
%bold%greenWisdom
%greenWisdom describes a character's common sense, intuition, and
%greenwillpower. A character with a Wisdom score of 0 is unconscious.
%greenYour character's Wisdom modifier is factored into the following:
%green- Will saving throws (for defending against things like magical
%greenmind control).
%green- Mysticism, Perception, Sense Motive, Survival, and some
%greenProfession skill checks.
%green- Bonus mystic spells. The minimum Wisdom score needed to
%greencast a mystic spell is 10 + the spell's level.
%boldSee Also:
character creation
%bold%greenXenoseeker
%greenGuru of alien life-forms who finds that meeting them is one of life's
%greenmost rewarding accomplishments.
%greenStat Modifiers:
%green cha: %bold1
%boldSee Also:
classes
character creation
%bold%greenYsoki
%greenSmall and furtive, the ysoki are often overlooked by larger races.
%greenYet through wit and technological prowess, they've spread
%greenthroughout the solar system, giving truth to the old adage that
%greenevery starship needs a few rats.
%greenStat Modifiers:
%green dex: %bold2
%green int: %bold2
%green str: %bold-2
%green base hp: %bold2
%boldSee Also:
races
character creation
......@@ -665,15 +665,18 @@ class MudServer(object):
if option_state == self._READ_NAWS:
height = 30
width = 100
if 'esp' in sys.platform:
height, width = ustruct.unpack('>hh', option_data)
else:
height, width = struct.unpack('>hh', option_data)
if height > 0:
client.height = height
if width > 0:
client.width = width
print("Got NAWS Width: %d Height: %d" % (client.width, client.height))
try:
if 'esp' in sys.platform:
height, width = ustruct.unpack('>hh', option_data)
else:
height, width = struct.unpack('>hh', option_data)
if height > 0:
client.height = height
if width > 0:
client.width = width
print("Got NAWS Width: %d Height: %d" % (client.width, client.height))
except:
pass
option_state = 0
option_data = bytearray()
# elif option_state == self._READ_MSDP:
......
{"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
{"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
......
......@@ -36,35 +36,43 @@ globals()['mud'] = MudServer()
races = {
"Android": {
"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.",
"mods": {"dex": 2, "int": 2, "cha": -2, "hp": 4}
"mods": {"dex": 2, "int": 2, "cha": -2},
"hp": 4
},
"Human": {
"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.",
"mods": {"hp": 4}
"mods": {},
"hp": 4
},
"Kasathas": {
"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.",
"mods": {"str": 2, "wis": 2, "int": -2, "hp": 4}
"mods": {"str": 2, "wis": 2, "int": -2},
"hp": 4
},
"Korasha Lashuntas": {
"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.",
"mods": {"str": 2, "cha": 2, "wis": -2, "hp": 4}
"mods": {"str": 2, "cha": 2, "wis": -2},
"hp": 4
},
"Damaya Lashuntas": {
"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.",
"mods": {"int": 2, "cha": 2, "con": -2, "hp": 4}
"mods": {"int": 2, "cha": 2, "con": -2},
"hp": 4
},
"Shirrens": {
"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",
"mods": {"con": 2, "wis": 2, "cha": -2, "hp": 6}
"mods": {"con": 2, "wis": 2, "cha": -2},
"hp": 6
},
"Vesk": {
"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.",
"mods": {"str": 2, "con": 2, "int": -2, "hp": 6}
"mods": {"str": 2, "con": 2, "int": -2},
"hp": 6
},
"Ysoki": {
"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.",
"mods": {"dex": 2, "int": 2, "str": -2, "hp": 2}
"mods": {"dex": 2, "int": 2, "str": -2},
"hp": 2
}
}
......@@ -274,6 +282,34 @@ def isalnum(c):
return False
return True
def show_list(id, title, singular_title, subject_list, instructions='Please choose a {} from the list by number: '):
mud.send_message(id, " %green+------------={}=------------+".format(title), nowrap=True)
for idx, subject in enumerate(subject_list):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<28}'.format(idx, subject),), nowrap=True)
mud.send_message(id, " %green+-------------------------------+", nowrap=True)
mud.send_message(id, ' (Type %boldhelp [{}]%reset for details)\r\n'.format(singular_title))
mud.send_message(id, instructions.format(singular_title))
def get_base_abilities(id):
base = {"str": 10, "dex": 10, "con": 10, "int": 10, "wis": 10, "cha": 10}
for name, value in races[players[id]["race"]]["mods"].items():
base[name] += value
for name, value in themes[players[id]["theme"]]["mods"].items():
base[name] += value
return base
def show_abilities(id):
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.")
mud.send_message(id, '%greenYou can reset to the base values by typing %boldreset')
mud.send_message(id, " %green+-----=Abilities=-----+", nowrap=True)
for idx, ability in enumerate(players[id]["abilities"]):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<13} {:^4}'.format(idx, ability, players[id]["abilities"][ability]),), nowrap=True)
mud.send_message(id, " %green+- Points: %bold{:<2}%reset%green --------+".format(players[id]["abilitypoints"]), nowrap=True)
mud.send_message(id, ' (Type %boldhelp [ability]%reset for details)\r\n')
mud.send_message(id, '%greenWhen finished type %bolddone')
def handle_character_create(id, command, params):
if players[id]["createstep"] == 1:
players[id]["color_enabled"] = command[0] in ['y', 'Y']
......@@ -298,97 +334,76 @@ def handle_character_create(id, command, params):
pass
return
else:
mud.send_message(id, " %green+------------=Races=------------+", nowrap=True)
for idx, race in enumerate(races):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<28}'.format(idx, race),), nowrap=True)
mud.send_message(id, " %green+-------------------------------+", nowrap=True)
mud.send_message(id, 'Please choose a race from the list by number: ')
show_list(id, "Races", "race", races)
players[id]["createstep"] = 3
elif players[id]["createstep"] == 3:
if command.lower().startswith("help"):
races_lower = {k.lower():v for k,v in races.items()}
race = races_lower.get(params.lower().strip())
if race:
mods = '\r\n'.join(" %green{!s: <4} %bold{!r}%reset".format(key,val) for (key,val) in race.get("mods").items())
mud.send_message(id, "\r\n%green{}\r\n%bold{}\r\n\n%resetStat Modifiers:".format(params.strip(), race.get("desc")))
mud.send_message(id, mods + "\r\n", nowrap=True)
else:
mud.send_message(id, "Please type the name of the race you want to learn about.", color='cyan')
if not command.isdigit():
mud.send_message(id, " %green+------------=Races=-----------+", nowrap=True)
for idx, race in enumerate(races):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, race),), nowrap=True)
mud.send_message(id, " %green+------------------------------+", nowrap=True)
mud.send_message(id, ' (Type %boldhelp [race]%reset for details)\r\n')
mud.send_message(id, 'Please choose a race from the list by number: ')
cmd_handler.parse(id, command, params.lower().strip(), mud, players)
if not command.isdigit() or int(command) + 1 > len(races) or int(command) < 0:
show_list(id, "Races", "race", races)
else:
race = list(races)[int(command)]
mud.send_message(id, 'Race selected: {}'.format(race))
players[id]["race"] = race
players[id]["createstep"] = 4
mud.send_message(id, " %green+------------=Themes=-----------+", nowrap=True)
for idx, theme in enumerate(themes):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, theme),), nowrap=True)
mud.send_message(id, " %green+------------------------------+", nowrap=True)
mud.send_message(id, ' (Type %boldhelp [theme]%reset for details)\r\n')
mud.send_message(id, 'Please choose a theme from the list by number: ')
show_list(id, "Themes", "theme", themes)
elif players[id]["createstep"] == 4:
if command.lower().startswith("help"):
themes_lower = {k.lower():v for k,v in themes.items()}
theme = themes_lower.get(params.lower().strip())
if theme:
mods = '\r\n'.join(" %green{!s: <4} %bold{!r}%reset".format(key,val) for (key,val) in theme.get("mods").items())
mud.send_message(id, "\r\n%green{}\r\n%bold{}\r\n\n%resetStat Modifiers:".format(params.strip(), theme.get("desc")))
mud.send_message(id, mods + "\r\n", nowrap=True)
else:
mud.send_message(id, "Please type the name of the theme you want to learn about.", color='cyan')
if not command.isdigit():
mud.send_message(id, " %green+------------=Themes=-----------+", nowrap=True)
for idx, theme in enumerate(themes):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, theme),), nowrap=True)
mud.send_message(id, " %green+------------------------------+", nowrap=True)
mud.send_message(id, ' (Type %boldhelp [theme]%reset for details)\r\n')
mud.send_message(id, 'Please choose a theme from the list by number: ')
cmd_handler.parse(id, command, params.lower().strip(), mud, players)
if not command.isdigit() or int(command) + 1 > len(themes) or int(command) < 0:
show_list(id, "Themes", "theme", themes)
else:
theme = list(themes)[int(command)]
mud.send_message(id, 'Theme selected: {}'.format(theme))
players[id]["theme"] = theme
players[id]["createstep"] = 5
show_list(id, "Classes", "class", classes)
elif players[id]["createstep"] == 5:
if command.lower().startswith("help"):
themes_lower = {k.lower():v for k,v in themes.items()}
theme = themes_lower.get(params.lower().strip())
if theme:
mods = '\r\n'.join(" %green{!s: <4} %bold{!r}%reset".format(key,val) for (key,val) in theme.get("mods").items())
cmd_handler.parse(id, command, params.lower().strip(), mud, players)
if not command.isdigit() or int(command) + 1 > len(classes) or int(command) < 0:
show_list(id, "Classes", "class", classes)
else:
selected_class = list(classes)[int(command)]
mud.send_message(id, 'Class selected: {}'.format(selected_class))
mud.send_message(id, "\r\n%green{}\r\n%bold{}\r\n\n%resetStat Modifiers:".format(params.strip(), theme.get("desc")))
mud.send_message(id, mods + "\r\n", nowrap=True)
players[id]["class"] = selected_class
players[id]["createstep"] = 6
if players[id]["race"] == "Human":
players[id]["abilitypoints"] = 12
else:
mud.send_message(id, "Please type the name of the theme you want to learn about.", color='cyan')
if not command.isdigit():
mud.send_message(id, " %green+------------=Themes=-----------+", nowrap=True)
for idx, theme in enumerate(themes):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<27}'.format(idx, theme),), nowrap=True)
mud.send_message(id, " %green+------------------------------+", nowrap=True)
mud.send_message(id, ' (Type %boldhelp [theme]%reset for details)\r\n')
mud.send_message(id, 'Please choose a theme from the list by number: ')
players[id]["abilitypoints"] = 10
players[id]["abilities"] = get_base_abilities(id)
show_abilities(id)
elif players[id]["createstep"] == 6:
if command.lower().startswith("help"):
cmd_handler.parse(id, command, params.lower().strip(), mud, players)
elif command.lower().startswith("reset"):
players[id]["abilities"] = get_base_abilities(id)
if players[id]["race"] == "Human":
players[id]["abilitypoints"] = 12
else:
players[id]["abilitypoints"] = 10
show_abilities(id)
elif command.lower().startswith("done"):
if players[id]["abilitypoints"] > 0:
mud.send_message(id, '%cyanPlease spend all available ability points.')
show_abilities(id)
else:
players[id]["createstep"] = 7
elif not command.isdigit() or int(command) + 1 > len(players[id]["abilities"]) or int(command) < 0:
show_abilities(id)
else:
theme = list(themes)[int(command)]
mud.send_message(id, 'Theme selected: {}'.format(theme))
players[id]["theme"] = theme
players[id]["createstep"] = 5
ability_name = list(players[id]["abilities"])[int(command)]
if players[id]["abilitypoints"] > 0:
players[id]["abilities"][ability_name] += 1
players[id]["abilitypoints"] -= 1
show_abilities(id)
save_object_to_file(players[id], "players/{}.json".format(players[id]["name"]))
# main game loop. We loop forever (i.e. until the program is terminated)
......