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
|
Axe
|
||||||
Hammer
|
Hammer
|
||||||
Shield
|
Shield
|
||||||
|
Greataxe
|
||||||
Halberd
|
Halberd
|
||||||
Scythe
|
Scythe
|
||||||
Scroll
|
Scroll
|
||||||
|
@ -39,10 +40,12 @@ Jewel
|
||||||
Ruby
|
Ruby
|
||||||
Hoopak
|
Hoopak
|
||||||
Orb
|
Orb
|
||||||
|
Platemail
|
||||||
Needle
|
Needle
|
||||||
Pin
|
Pin
|
||||||
Token
|
Token
|
||||||
Helm
|
Helm
|
||||||
|
Battleaxe
|
||||||
[mid]
|
[mid]
|
||||||
of
|
of
|
||||||
[final]
|
[final]
|
||||||
|
@ -75,16 +78,22 @@ Devils
|
||||||
Speed
|
Speed
|
||||||
Flying
|
Flying
|
||||||
Seeing
|
Seeing
|
||||||
|
Blocking
|
||||||
|
Battle
|
||||||
Love
|
Love
|
||||||
Hatred
|
Hatred
|
||||||
|
Sorcery
|
||||||
Nagash
|
Nagash
|
||||||
Sauron
|
Sauron
|
||||||
|
Regeneration
|
||||||
Arthur
|
Arthur
|
||||||
Ending
|
Ending
|
||||||
Torak
|
Torak
|
||||||
Aldur
|
Aldur
|
||||||
Time
|
Time
|
||||||
Evil
|
Evil
|
||||||
|
Notch
|
||||||
|
Destruction
|
||||||
Morgoth
|
Morgoth
|
||||||
Lucifer
|
Lucifer
|
||||||
Arkhan
|
Arkhan
|
||||||
|
|
|
@ -1,42 +1,46 @@
|
||||||
# Plugin by Lukeroge
|
# Plugin by Lukeroge
|
||||||
from util import hook
|
from util import hook
|
||||||
from util import molecular
|
from util import molecular
|
||||||
import unicodedata
|
from util.formatting import get_text_list
|
||||||
|
|
||||||
|
|
||||||
@hook.command()
|
@hook.command(autohelp=False)
|
||||||
def namegen(inp, say=None, nick=None, input=None, notice=None):
|
def namegen(inp, notice=None):
|
||||||
".namegen [modules] -- Generates some names using the chosen modules. '.namegen list' will display a list of all modules."
|
".namegen [modules] -- Generates some names using the chosen modules. " \
|
||||||
|
"'.namegen list' will display a list of all modules."
|
||||||
|
|
||||||
gen = molecular.Molecule()
|
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":
|
if inp == "list":
|
||||||
message = "Available modules: "
|
message = "Available modules: "
|
||||||
message += ', '.join(map(str, all_modules))
|
message += get_text_list(all_modules, 'and')
|
||||||
notice(message)
|
notice(message)
|
||||||
return
|
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
|
# loop over the "selected_modules" list, and load any valid modules
|
||||||
|
for module in selected_modules:
|
||||||
for module in selected_modules: # loop over the "selected_modules" list, and load any valid modules
|
|
||||||
if module in all_modules:
|
if module in all_modules:
|
||||||
gen.load(module.encode('ascii'))
|
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 :("
|
return "No valid modules specified :("
|
||||||
|
|
||||||
# time to generate some names and put them in a list
|
# time to generate some names and put them in a list
|
||||||
name_list = []
|
name_list = []
|
||||||
for i in xrange(8):
|
for i in xrange(10):
|
||||||
name_list.append(gen.name())
|
name_list.append(gen.name())
|
||||||
|
|
||||||
# and finally render the final message :D
|
# and finally return the final message :D
|
||||||
message = "Here are some names: "
|
return "Some names to ponder: %s." % get_text_list(name_list, 'and')
|
||||||
message += ', '.join(map(str, name_list))
|
|
||||||
|
|
||||||
return message
|
|
||||||
|
|
Reference in a new issue