David Vallner/Discworld Charms
From BluWiki
Contents |
Charms - Spank (ruby)
- alligator (blue moon) - Blue Moon Park, Bes Pelargic
- barnacle (hillshire) - Hillshire
- basilisk (changer) - Ankh Bridge Money Changer, Ankh-Morpork
- bat (genua) - National Bank, Genua
- boot (doctor) - Doctor, Flintwick Building
- Berilia (ohulan) - Market Stall, Ohulan-Cutash
- cat (jonas)- Jonas' Vault, Ankh
- chimera (sto lat) - Sto Lat Royal Market
- claw shrimp (nico) - Nicolette Leveaux' shop, Thieves' Guild, Morpork
- crab (widdershins) - Widdershins Gate, Morpork
- cupid (tuna walk) - Tuna Walk, Bes Pelargic
- dog (pishe) - Pishe Gardens, Ankh
- duck (blank)
- elephant (lancre) - City Square, Lancre Town
- feather (bop) - Birds of Paradise bank, Morpork
- fish (bandits) - Bandit Camp
- goat (djeli) - Bazaar crossroads, Djelibeybi
- hand (jungle) - Top hat monkey jungle
- horse (sek) - The High Altar of Sek in Morpork
- horse head (sheepridge) - Sheepridge
- Jerakeen (gloomy) - West Signpost, Gloomy Forest
- ox (lanfear) - Warriors' Guild Hall of Heroes, Ankh-Morpork
- pig (blank)
- raven (holy wood) - Holy Wood
- squid (listeners) - Listeners' Valley
- throwing knife (cool) - Temple of Cool
- tiger (drum) - The Mended Drum
Reidentification script
This script creates a string of semicolon-separated commands that will fix your charm identify tags if a bug ate them.
Python source
#!/usr/bin/python
"""Create a charm reidentification macro.
Converts a Textile-formatted list of charms and their corresponding
destination identifiers to create an macro that will restore the identify tags.
"""
__revision__ = 1
import sys
import re
from string import Template
charm_re = re.compile(r'^#([\w\s]+)_\(([\w\s]+)\)_')
charm_alias_line_template = Template(';'.join((
'remove $design charm from bracelets',
'identify $design charm as $destination',
'add $destination to bracelets')))
def make_charm_macro_command(line):
"""Create the commands to reidentify a charm.
Creates commands for the charm reidentification macro for the charm that
line describes.
Returns the commands or None if line isn't a charm description.
"""
stripped_line = line.strip()
if (stripped_line == ''):
return None
match = charm_re.match(stripped_line)
if (match == None):
return None
else:
print >> sys.stderr, 'Found charm description: %s' % stripped_line
return charm_alias_line_template.substitute(
dict(design=match.group(1).strip(),
destination=match.group(2).strip()))
def make_charm_macro(charm_file):
"""Create the charm reidentification macro.
Creates a macro that will reidentify all the charms described in the
in_file stream.
"""
return ';'.join(
(command for command
in (make_charm_macro_command(line) for line in charm_file)
if command != None))
if __name__ == '__main__':
if len(sys.argv) == 1:
print >> sys.stderr, 'Reading charm descriptions from standard input.'
print make_charm_macro(sys.stdin)
else:
print >> sys.stderr, 'Reading charm descriptions from %s.' % (
sys.argv[1])
in_file = file(sys.argv[1])
print make_charm_macro(in_file)
in_file.close()
Example Input
The input is formatted using the Textile language, and generates the list on the start of the page.
# alligator _(blue moon)_ - Blue Moon Park, Bes Pelargic # barnacle _(hillshire)_ - Hillshire # basilisk _(changer)_ - Ankh Bridge Money Changer, Ankh-Morpork # bat _(genua)_ - National Bank, Genua # Berilia _(ohulan)_ - Market Stall, Ohulan-Cutash # boot _(doctor)_ - Doctor, Flintwick Building # broomstick _(blank)_ # cat _(jonas)_ - Jonas' Vault, Ankh # chimera _(sto lat)_ - Sto Lat Royal Market # claw shrimp _(nico)_ - Nicolette Leveaux' shop, Thieves' Guild, Morpork # cobra _(giants)_ - Giantland # crab _(widdershins)_ - Widdershins Gate, Morpork # cupid _(tuna walk)_ - Tuna Walk, Bes Pelargic # dog _(pishe)_ - Pishe Gardens, Ankh # duck _(ctf)_ - Beezing Monastery # elephant _(lancre)_ - City Square, Lancre Town # feather _(bop)_ - Birds of Paradise bank, Morpork # fish _(bandits)_ - Bandit Camp # goat _(djeli)_ - Bazaar crossroads, Djelibeybi # hand _(jungle)_ - Top hat monkey jungle # horse _(sek)_ - The High Altar of Sek in Morpork # horse head _(sheepridge)_ - Sheepridge # Jerakeen _(gloomy)_ - West Signpost, Gloomy Forest # mouse _(razorback)_ - Razorback Village Green # ox _(lanfear)_ - Warriors' Guild Hall of Heroes, Ankh-Morpork # pig _(clubs)_ - Club room, Patrician's Palace # raven _(holy wood)_ - Holy Wood # squid _(listeners)_ - Listeners' Valley # throwing knife _(cool)_ - Temple of Cool # tiger _(drum)_ - The Mended Drum



