Various namegen tweaks
This commit is contained in:
parent
72cd127aa3
commit
04457beb11
4 changed files with 31 additions and 18 deletions
|
@ -14,6 +14,7 @@ Amulet
|
|||
Axe
|
||||
Hammer
|
||||
Shield
|
||||
Greataxe
|
||||
Halberd
|
||||
Scythe
|
||||
Scroll
|
||||
|
@ -39,10 +40,12 @@ Jewel
|
|||
Ruby
|
||||
Hoopak
|
||||
Orb
|
||||
Platemail
|
||||
Needle
|
||||
Pin
|
||||
Token
|
||||
Helm
|
||||
Battleaxe
|
||||
[mid]
|
||||
of
|
||||
[final]
|
||||
|
@ -75,16 +78,22 @@ Devils
|
|||
Speed
|
||||
Flying
|
||||
Seeing
|
||||
Blocking
|
||||
Battle
|
||||
Love
|
||||
Hatred
|
||||
Sorcery
|
||||
Nagash
|
||||
Sauron
|
||||
Regeneration
|
||||
Arthur
|
||||
Ending
|
||||
Torak
|
||||
Aldur
|
||||
Time
|
||||
Evil
|
||||
Notch
|
||||
Destruction
|
||||
Morgoth
|
||||
Lucifer
|
||||
Arkhan
|
||||
|
|
|
@ -1,42 +1,46 @@
|
|||
# Plugin by Lukeroge
|
||||
from util import hook
|
||||
from util import molecular
|
||||
import unicodedata
|
||||
from util.formatting import get_text_list
|
||||
|
||||
|
||||
@hook.command()
|
||||
def namegen(inp, say=None, nick=None, input=None, notice=None):
|
||||
".namegen [modules] -- Generates some names using the chosen modules. '.namegen list' will display a list of all modules."
|
||||
@hook.command(autohelp=False)
|
||||
def namegen(inp, notice=None):
|
||||
".namegen [modules] -- Generates some names using the chosen modules. " \
|
||||
"'.namegen list' will display a list of all modules."
|
||||
|
||||
gen = molecular.Molecule()
|
||||
|
||||
all_modules = gen.list_modules() # get a list of available name files
|
||||
# get a list of available modules
|
||||
all_modules = gen.list_modules()
|
||||
|
||||
# return a list of all available modules
|
||||
# command to return a list of all available modules
|
||||
if inp == "list":
|
||||
message = "Available modules: "
|
||||
message += ', '.join(map(str, all_modules))
|
||||
message += get_text_list(all_modules, 'and')
|
||||
notice(message)
|
||||
return
|
||||
|
||||
modules = []
|
||||
if inp:
|
||||
# split the input into a list of modules
|
||||
selected_modules = inp.split(' ')
|
||||
else:
|
||||
# make some generic fantasy names
|
||||
selected_modules = ["fantasy"]
|
||||
|
||||
selected_modules = inp.split(' ') # split the input into a list of modules
|
||||
|
||||
for module in selected_modules: # loop over the "selected_modules" list, and load any valid modules
|
||||
# loop over the "selected_modules" list, and load any valid modules
|
||||
for module in selected_modules:
|
||||
if module in all_modules:
|
||||
gen.load(module.encode('ascii'))
|
||||
|
||||
if not gen.name(): # lets try making a name to see if any modules actually got loaded
|
||||
# lets try making a name to see if any modules actually got loaded
|
||||
if not gen.name():
|
||||
return "No valid modules specified :("
|
||||
|
||||
# time to generate some names and put them in a list
|
||||
name_list = []
|
||||
for i in xrange(8):
|
||||
for i in xrange(10):
|
||||
name_list.append(gen.name())
|
||||
|
||||
# and finally render the final message :D
|
||||
message = "Here are some names: "
|
||||
message += ', '.join(map(str, name_list))
|
||||
|
||||
return message
|
||||
# and finally return the final message :D
|
||||
return "Some names to ponder: %s." % get_text_list(name_list, 'and')
|
||||
|
|
Reference in a new issue