User:Magill-bot/scripts/user-fixes.py

From Lotro-Wiki.com
Jump to navigation Jump to search
  • user-fixes.py - RTC's version of the user-fixes. It serves as a historical record of bot changes.
  • See: User:Magill-bot for an explanation
# -*- coding: utf-8  -*-

#
# This is only an example. Don't use it. - but do use my fixes below
#

fixes['example'] = {
    'regex': True,
    'msg': {
        '_default':u'no summary specified',
    },
    'replacements': [
        (ur'\bword\b', u'two words'),
    ]
}

# my fixes

fixes['foo1'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: replace test 1',
    },
    'replacements': [
        (ur'\bfoo\b', u'fooray'),
        (ur'\bbar\b', u'barley'),
        (ur'\b(baz)\b', ur'\1ra'),
        (ur'\bram\b', u'rambo'),
    ]
}

fixes['foo2'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: replace test 2',
    },
    'replacements': [
        (ur'\bfooray\b', u'foo'),
        (ur'\bbarley\b', u'bar'),
        (ur'\b(baz)ra\b', ur'\1'),
        (ur'\brambo\b', u'ram'),
    ]
}

# rename icon
# python movepages.py -from:"File:Egg-icon.png" -to:"File:Egg 1 (quest)-icon.png"
# python replace_lotro.py -nopreload -filelinks:"Egg-icon.png" -fix:RenameIcon -pt:2

fixes['RenameIcon'] = {
    'regex': True,
    'msg': {
        '_default':u'Robit: rename icon',
    },
    'replacements': [
        (ur'\[\[\s*[Ff]ile:\s*Basket-icon.png\s*\]\]', u'[[File:Basket 1 (quest)-icon.png]]'),
        (ur'(?P<pre>icon\s*=\s*)Basket-icon', u'\g<pre>Basket 1 (quest)-icon'),
        (ur'\bBasket-icon\b', u'Basket 1 (quest)-icon'),
    ]
}

# fix Gath Forthnir

# python replace_lotro.py -nopreload -fix:patch1 "-ref:Gath Forthnir" -pt:2
fixes['patch1'] = {
    'regex': False,
    'msg': {
        'en':u'Robot: fix Gath Forthnir',
    },
    'replacements': [
        (ur'Gath Forthnir', u'Gath Forthnír'),
    ]
}

# fix Esteldin

# python replace_lotro.py -nopreload -fix:patch2 "-ref:Esteldin" -pt:2
fixes['patch2'] = {
    'regex': False,
    'msg': {
        'en':u'Robot: fix Esteldin',
    },
    'replacements': [
        (ur'Esteldin', u'Esteldín'),
    ]
}

# standarize player name
fixes['PlayerName'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: standardize player name',
    },
    'replacements': [
        (ur'<Class>',               u'<class>'),
        (ur'<Name>',                u'<name>' ),
        (ur'<Race>',                u'<race>' ),
        (ur'<[Pp]layer [Cc]lass>',  u'<class>'),
        (ur'<[Pp]layer [Nn]ame>',   u'<name>' ),
        (ur'<[Pp]layer [Rr]ace>',   u'<race>' ),
        (ur'<[Pp]layer>',           u'<name>' ),
        (ur'\([Yy]our [Nn]ame\)',   u'<name>' ),
        (ur'\([Yy]our [Cc]lass\)',  u'<class>'),
        (ur'\([Yy]our [Rr]ace\)',   u'<race>' ),
        (ur'\[[Pp]layer [Cc]lass]', u'<class>'),
        (ur'\[[Pp]layer [Nn]ame]',  u'<name>' ),
        (ur'\[[Pp]layer [Rr]ace]',  u'<race>' ),
        (ur'\[[Pp]layer]',          u'<name>' ),
        (ur'\[[Yy]our [Nn]ame]',    u'<name>' ),
        (ur'\[[Yy]our [Cc]lass]',   u'<class>'),
        (ur'\[[Yy]our [Rr]ace]',    u'<race>' ),
        (ur'\([Cc]haracter [Nn]ame\)', u'<name>' ),
        (ur'<[Cc]haracter [Nn]ame>', u'<name>' ),
    ]
}

# convert tables to questbox templates

fixes['table2Questbox'] = {
    'regex': True,
    'dotall': True,
    'msg': {
        'en':u'Robot: convert table to Questbox',
    },
    'replacements':
      [
        ( ur'''\{\| class="stocktable collapsible(?P<colsp>(?: )?)(?P<coled>(?:collapsed)?)" width=\d+px *\r?
 !style="[^"]+"\| (?P<title>(?:Walkthrough & Notes)|(?:Rewards)|(?:Quest Text)|(?:Quest Chain)|(?:Daily Base Rewards)|(?:Related Quests)|(?:Quest Arc)) *\r?
\|- *\r?
\|\|?(?P<tocr>(?: \{\{toc-right}})?) *\r?
(?P<body>.*?)
\|}'''
        , u'''{{Questbox| \\g<title> |\\g<colsp>\\g<coled>\\g<colsp>|\\g<tocr>
\\g<body>
}}''')
      ,
    ]
}

# standardize selectable rewards text

fixes['SelectableRewards'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: fix Selectable Rewards',
    },
    'replacements':
      [
        ( ur'^=== ?[Ss]electable [Rr]ewards:? ?=== *\r?$'
        , u"'''Selectable Rewards:'''")
      ,
        ( ur'^[Cc]hoose [Oo]ne:? *\r?$'
        , u"'''Selectable Rewards:'''")
      ,
        ( ur'^[Ss]electable [Rr]ewards:? *\r?$'
        , u"'''Selectable Rewards:'''")
      ,
        ( ur"^'''[Ss]electable [Rr]ewards:?''':? *\r?$"
        , u"'''Selectable Rewards:'''")
      ,
        ( ur"^'''[Cc]hoose [Oo]ne:?''':? *\r?$"
        , u"'''Selectable Rewards:'''")
      ,
    ]
}

# use Template:Reward and Template:IXP

# python replace_lotro.py -nopreload -multiline -fix:Rewards "-catr:Quest by Level" -ns:102
# python replace_lotro.py -nopreload -multiline -fix:Rewards "-ref:Item:Gift Mathom" -ns:102
fixes['Rewards'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: use Template:Reward,Template:IXP',
    },
    'replacements':
      [
        ( ur'^=== *Selectable +[Rr]ewards?:? *===\r?$'
        , u"'''Selectable Rewards:'''")
      ,
        ( ur'^Choose +[Oo]ne: *\r?$'
        , u"'''Selectable Rewards:'''")
      ,
        ( ur'^Selectable +[Rr]ewards?:? *\r?$'
        , u"'''Selectable Rewards:'''")
      ,
        ( ur"^''' *Selectable +[Rr]ewards?:? *''' *\r?$"
        , u"'''Selectable Rewards:'''")
      ,
        ( ur"\{\{IXP *\| *(?P<ixp1>\d+)(?P<ixp2>\d\d\d) *}}"
        , u"{{IXP|\\g<ixp1>,\\g<ixp2>}}")
      ,
        ( ur"\{\{Quest Rep *\| *(?P<faction>[^|]+?) *\| *(?P<rep1>\d+)(?P<rep2>\d\d\d) *}}"
        , u"{{Quest Rep|\\g<faction>|\\g<rep1>,\\g<rep2>}}")
      ,
        ( ur'^\* *\[\[(?:(?:[Ff]ile)|(?:[Ii]mage)):Legendary Item Experience-icon\.png]] Legendary Item Experience *\r?$'
        , u"* {{IXP}}")
      ,
        ( ur'^\*\{\{IXP *}}'
        , u"* {{IXP}}")
      ,
        ( ur'^\* (?P<count>\d+) \[\[[Ii]tem:(?P<item>.+?)\|.+?]]\r?$'
        , u"* {{Reward|\\g<item>|\\g<count>}}")
      ,
        ( ur'^\* *\[\[(?:(?:[Ff]ile)|(?:[Ii]mage)):(?P<icon1>.+?)-icon\.png]] *\[\[[Ii]tem:(?P<item1>.+?)\|[^]]+?]] *\r?$'
        , u"* {{Reward|\\g<item1>}}")
      ,
        ( ur'^\* *\[\[(?:(?:[Ff]ile)|(?:[Ii]mage)):(?P<icon2>.+?)-icon\.png]] +(?P<cnt2>\d+) +\[\[[Ii]tem:(?P<item2>.+?)\|[^]]+?]] *\r?$'
        , u"* {{Reward|\\g<item2>|\\g<cnt2>}}")
      ,
        ( ur'^\* *\[\[(?:(?:[Ff]ile)|(?:[Ii]mage)):(?P<icon3>.+?)-icon\.png]] *\[\[[Ii]tem:(?P<item3>.+?)\|[^]]+?]] *\((?P<cnt3>\d+)x\) *\r?$'
        , u"* {{Reward|\\g<item3>|\\g<cnt3>}}")
      ,
        ( ur'\* *\{\{Item:(?P<item4>[^|]+) *\| *mode *= *imlink *}}'
        , u"* {{Reward|\\g<item4>|c=yes}}")
      ,
        ( ur'\* *\{\{Item:(?P<item5>[^|]+) *\| *mode *= *imlink *\| *arg *= *(?P<cnt5>\d+) +(?P<rename5>.*?) *}}'
        , u"* {{Reward|\\g<item5>|\\g<cnt5>|plural=\\g<rename5>|c=yes}}")
      ,
      #  ( ur'\* *\{\{Reward *\| *Gift Mathom *}}'
      #  , u"* {{Quest Mathom}}")
      #,
        ( ur'\*\{\{Reward *\|'
        , u"* {{Reward|")
      ,
    ]
}

# find references to -icon.png

# search for "-icon.png" string
fixes['IconPng'] = {
    'regex': False,
    'msg': {
        'en':u'Robot: find -icon.png',
    },
    'replacements':
      [
        ( ur'-icon.png'
        , u"XXXXXXXXX")
      ,
    ]
}

# fix elided end of template and heading

# fix "}}=="
fixes['BraceEqual'] = {
    'regex': False,
    'msg': {
        'en':u'Robot: fix brace equal',
    },
    'replacements':
      [
        ( ur'}}=='
        , u"}}\\n==")
      ,
    ]
}

# fix "comment in Template:Infobox Quests parameters"

# python replace_lotro.py -nopreload -fix:QuestComments "-search:Override for infobox title" -ns:102
fixes['QuestComments'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: fix quest comments',
    },
    'replacements':
      [
        ( ur' +<!--Override for infobox title--> *'
        , u" ")
      ,
        ( ur' +<!-- 1-\d+/<blank> --> *'
        , u" ")
      ,
        ( ur' +<!-- Solo/Fellowship/Small Fellowship/Raid/Solo only \(defaults to solo--> *'
        , u" ")
      ,
        ( ur' +<!-- Yes; or blank for No--> *'
        , u" ")
      ,
        ( ur' +<!-- if ender == starter these can be removed --> *'
        , u" ")
      ,
        ( ur' +<!-- quest group name in quest log \(e\.g\., region, class, introduction, prolog, book #\) --> *'
        , u" ")
      ,
        ( ur' +<!-- Class \(lvl 15/30/50(?:/58)? class quests only\) --> *'
        , u" ")
      ,
        ( ur' +<!-- Profession \(crafting  advancement quests only\) --> *'
        , u" ")
      ,
        ( ur' +<!-- Race-specific quests \(Elf, Hobbit, Race of Man or Dwarf\) --> *'
        , u" ")
      ,
        ( ur' +<!-- Name of the quest chain \(usually the name of the last quest of the chain\) --> *'
        , u" ")
      ,
        ( ur'=  +$'
        , u"= ")
      ,
    ]
}


# convert Quest Chain Questbox to questchain parameter

# Quest:Chapter 1: Maintaining the Supply Chain
fixes['QuestChain1'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: Quest Chain to questchain',
    },
    'replacements':
      [
        ( ur'}}[ \r\n]*\{\{Questbox\| *Quest Chain *\| *collapsed *\|[ \r\n]*\{\{:?Category: *(?P<chain>[^}]+?) Quests *}}[ \r\n]*}}[ \r]*'
        , u" | questchain        = \\g<chain>\\n}}")
      ,
    ]
}


# Move prerequisites from walkthrough to Chain

# python replace_lotro.py -nopreload -multiline -fix:PrereqFix -page:Quest:Foul-maw
# python replace_lotro.py -nopreload -multiline -fix:PrereqFix "-page:Quest:A Gift of Warmth in Winter"
# python replace_lotro.py -nopreload -multiline -fix:PrereqFix "-page:Quest:The Story Behind the Death"
# python replace_lotro.py -nopreload -multiline -fix:PrereqFix "-catr:Quest: Level 75"
fixes['PrereqFix'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: move prerequisites to quest chain box',
    },
    'replacements':
      [
        ( ur'\{\{Questbox\| *Walkthrough & Notes *\| *collapsed *\|[ \r]*\n\* Prerequisite(?:(?:[(]s[)])|s)?: None[ \r]*\n\}\}'
        , u"{{Questbox| Walkthrough & Notes | collapsed |\n* (walkthrough and notes pending)\n}}")
      ,
        ( ur'\{\{Questbox\| *Walkthrough & Notes *\| *collapsed *\|[ \r]*\n\* Prerequisite(?:(?:[(]s[)])|s)?: None[ \r]*\n\*'
        , u"{{Questbox| Walkthrough & Notes | collapsed |\n*")
      ,
        ( ur'\{\{Questbox\| *Walkthrough & Notes *\| *collapsed *\|[ \r]*\n\* Prerequisite(?P<prereq1>.*?)[ \r]*\n\}\}'
        , u"{{Questbox| Quest Chain | collapsed |\n* Prerequisite\\g<prereq1>\n}}\n\n{{Questbox| Walkthrough & Notes | collapsed |\n* (walkthrough and notes pending)\n}}")
      ,
        ( ur'\{\{Questbox\| *Walkthrough & Notes *\| *collapsed *\|[ \r]*\n\* Prerequisite(?P<prereq2>.*?)[ \r]*\n\*'
        , u"{{Questbox| Quest Chain | collapsed |\n* Prerequisite\\g<prereq2>\n}}\n\n{{Questbox| Walkthrough & Notes | collapsed |\n*")
      ,
    ]
}


# Find wrongly ordered questboxes

# Quest:Chapter 1: Maintaining the Supply Chain
# python replace_lotro.py -nopreload -multiline -dotall -fix:QuestboxOrder "-catr:Quest by Level"
# python replace_lotro.py -nopreload -multiline -dotall -fix:QuestboxOrder "-catr:Quests: Level 40"
# python replace_lotro.py -nopreload -multiline -dotall -fix:QuestboxOrder "-page:Quest:A Villain Unveiled"
fixes['QuestboxOrder'] = {
    'regex': True,
    'dotall': True,
    'msg': {
        'en':u'Robot: reorder questboxes',
    },
    'replacements':
      [
        ( ur'''[ \r\n]*\n\{\{Questbox *\| *Quest Text *\|(?P<qb_text1>.*)\n\}\}[ \r\n]*\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew1>.*)\n\}\}[ \r\n]*\n\{\{Questbox *\| *Walkthrough & Notes *\|(?P<qb_wt>.*)\n\}\}'''
        , u"\n\n{{Questbox| Walkthrough & Notes |\\g<qb_wt>\n}}\n\n{{Questbox| Rewards |\\g<qb_rew1>\n}}\n\n{{Questbox| Quest Text |\\g<qb_text1>\n}}")
      ,
    ]
}


# Fix reward number

# python replace_lotro.py -nopreload -fix:RewardNum "-catr:Quest by Level"
fixes['RewardNum'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: reward num',
    },
    'replacements':
      [
        ( ur'''{{Reward *\| *(?P<iName>.*?) *\}\} *\((?P<iNum>\d+)x?\)'''
        , u"{{Reward | \\g<iName> | \\g<iNum> }}")
      ,
    ]
}


# Add NOTOC

# python replace_lotro.py -nopreload -multiline -fix:AddNoToc "-page:Dievlig Archer"
fixes['AddNoToc'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: reward num',
    },
    'replacements':
      [
        ( ur'''\}\}\n+== *Location *=='''
        , u"}}\n__NOTOC__\n== Location ==")
      ,
    ]
}


# use Template:Reward

# Quest:Chapter 1: Maintaining the Supply Chain
# python replace_lotro.py -nopreload -multiline -dotall -fix:Item2Reward "-catr:Quest by Level"
# python replace_lotro.py -nopreload -multiline -dotall -allowoverlap -fix:Item2Reward "-page:Quest:Midnight Raid"
fixes['Item2Reward'] = {
    'regex': True,
    'dotall': True,
    'msg': {
        'en':u'Robot: use Template:Reward',
    },
    'replacements':
      [
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew01>.*?)\n\* *\[\[[Ii]tem: *(?P<item0>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew01>\n* {{Reward|\\g<item0>}}\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew11>.*?)\n\* *\[\[[Ii]tem: *(?P<item1>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew12>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew11>\n* {{Reward|\\g<item1>}}\n\\g<qb_rew12>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew21>.*?)\n\* *\[\[[Ii]tem: *(?P<item2>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew22>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew21>\n* {{Reward|\\g<item2>}}\n\\g<qb_rew22>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew31>.*?)\n\* *\[\[[Ii]tem: *(?P<item3>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew32>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew31>\n* {{Reward|\\g<item3>}}\n\\g<qb_rew32>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew41>.*?)\n\* *\[\[[Ii]tem: *(?P<item4>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew42>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew41>\n* {{Reward|\\g<item4>}}\n\\g<qb_rew42>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew51>.*?)\n\* *\[\[[Ii]tem: *(?P<item5>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew52>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew51>\n* {{Reward|\\g<item5>}}\n\\g<qb_rew52>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew61>.*?)\n\* *\[\[[Ii]tem: *(?P<item6>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew62>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew61>\n* {{Reward|\\g<item6>}}\n\\g<qb_rew62>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew71>.*?)\n\* *\[\[[Ii]tem: *(?P<item7>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew72>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew71>\n* {{Reward|\\g<item7>}}\n\\g<qb_rew72>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew81>.*?)\n\* *\[\[[Ii]tem: *(?P<item8>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew82>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew81>\n* {{Reward|\\g<item8>}}\n\\g<qb_rew82>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rew91>.*?)\n\* *\[\[[Ii]tem: *(?P<item9>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rew92>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rew91>\n* {{Reward|\\g<item9>}}\n\\g<qb_rew92>\n}}")
      ,
        ( ur'''\n\{\{Questbox *\| *Rewards *\|(?P<qb_rewA1>.*?)\n\* *\[\[[Ii]tem: *(?P<itemA>[^|]+?) *(?:\|[^]]*)?]][ \r]*\n(?P<qb_rewA2>.*\n)\}\}'''
        , u"\n{{Questbox| Rewards |\\g<qb_rewA1>\n* {{Reward|\\g<itemA>}}\n\\g<qb_rewA2>\n}}")
      ,
    ]
}


# Fix profession/crafting link

# Item:Crafted Buckler
# python replace_lotro.py -nopreload -multiline -fix:CraftLevel -ns:100 -ref:Crafting -pt:2
fixes['CraftLevel'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: link item to recipe index',
    },
    'replacements':
      [
        ( ur'''Profession: \[\[(?P<pname>[^]|]+)\]\]

Crafting Level: \[\[:?Crafting\#Crafting levels\|(?P<tname>[A-za-z]+) \(Tier (?P<tnum>\d+)\)\]\]'''
        , u'''Profession: [[\\g<pname>]]

Crafting Level: [[\\g<pname> \\g<tname> Recipe Index|\\g<tname> (Tier \\g<tnum>)]]''')
      ,
    ]
}


# rename Category:Conjuctions to Category:Fellowship Manoeuvres

# python replace_lotro.py -nopreload -fix:CJ2FM -cat:Conjunctions -pt:2
fixes['CJ2FM'] = {
    'regex': False,
    'msg': {
        'en':u'Robot: rename CJ to FM',
    },
    'replacements':
      [
        ( u'[[Category:Conjunctions]]'
        , u'[[Category:Fellowship Manoeuvres]]')
      ,
    ]
}


# rename Category:Conjuctions to Category:Fellowship Manoeuvres

# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -page:"A Light from the Shadow"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Activity Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Class Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Crafting Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Epic Book Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Explorer Deed Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Family Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Game Event Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Hobby Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Instances Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Kinship Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Lore Deed Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Meta Deed Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Monster Play Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Quest Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Racial Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Regional Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Reputation Deed Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Skirmish Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Slayer Deed Titles‎"
# python replace_lotro.py -nopreload -fix:subTitle -ns:0 -pt:2 -catr:"Social Titles‎"
fixes['subTitle'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: sub-title',
    },
    'replacements':
      [
        ( ur' *\[\[ *Category *: *Titles *\]\] *\r?\n?'
        , u'')
      ,
    ]
}



# reformat says

# python replace_lotro.py -nopreload -pt:2 -fix:says -cat:"Instance Quests"
# python replace_lotro.py -nopreload -pt:2 -fix:says -cat:"Quests: Level 79"
# python replace_lotro.py -nopreload -fix:says "-page:Quest:A Daring Escape (Instance)"

fixes['says'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: reformat says',
    },
    'replacements':
      [
        ( ur""":? *(?P<who2>.*?) +says, +''"(?P<what2>.*)"''"""
        , ur''':''\g<who2> says'', "\g<what2>"''')
      ,
        ( ur""":? *(?P<who4>.*?) +says, +'"(?P<what4>.*)"'"""
        , ur''':''\g<who4> says'', "\g<what4>"''')
      ,
        ( ur''':? *(?P<who5>.*?) +says, +"''(?P<what5>.*)''"'''
        , ur''':''\g<who5> says'', "\g<what5>"''')
      ,
        ( ur''':? *(?P<who6>.*?) +says, +"'(?P<what6>.*)'"'''
        , ur''':''\g<who6> says'', "\g<what6>"''')
      ,
        ( ur""":? *(?P<who1>.*?) +says, +''(?P<what1>.*)''"""
        , ur''':''\g<who1> says'', "\g<what1>"''')
      ,
        ( ur""":? *(?P<who7>.*?) +says, +'(?P<what7>.*)'"""
        , ur''':''\g<who7> says'', "\g<what7>"''')
      ,
        ( ur''':? *(?P<who3>.*?) +says, +"(?P<what3>.*)"'''
        , ur''':''\g<who3> says'', "\g<what3>"''')
      ,
        ( ur''': *'' *'{3}(?P<who8>.*?)'{3} +says'', +"(?P<what8>.*)"'''
        , ur''':''\g<who8> says'', "\g<what8>"''')
      ,
        ( ur''': *''(?P<who9>.*?) says,'' (?P<what8>.*)'''
        , ur''':''\g<who9> says'', "\g<what9>"''')
      ,
    ]
}


# python replace_lotro.py -nopreload -fix:MP_Levelcap -pt:2 -catr:"Monster Play Quests"
# python replace_lotro.py -nopreload -fix:MP_Levelcap -pt:2 -catr:"Ettenmoors NPCs"
# python replace_lotro.py -nopreload -fix:MP_Levelcap -pt:2 -catr:"Ettenmoors Quests"
# python replace_lotro.py -nopreload -fix:MP_Levelcap -pt:2 -catr:"Ettenmoors Creatures"
fixes['MP_Levelcap'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: Level Cap',
    },
    'replacements':
      [
        ( ur'\|(?P<x1>[ \t]*)level(?P<x2>[ \t]*)=(?P<x3>[ \t]*)(?:(75)|(65)|(60)|(50))'
        , u'|\g<x1>level\g<x2>=\g<x3>{{Level Cap}}')
      ,
        ( ur'\[(?:(75)|(65)|(60)|(50))\][ \t]*\[\[[qQ]uest:'
        , u'[{{Level Cap}}] [[Quest:')
      ,
    ]
}

# python replace_lotro.py -nopreload -fix:BarterFix -pt:2 -catr:"Skirmish Items"
fixes['BarterFix1'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: BarterFix',
    },
    'replacements':
      [
        ( ur'\| *(width="150px" *\| *)?\{\{Item:Mark\|mode=imlink_plain\|arg=(?P<marks1>[0-9,]+) +Marks\}\} *\|\| *(width="150px" *\| *)?\{\{Item:Medallion\|mode=imlink_plain\|arg=(?P<medallions1>[0-9,]+) +Medallions\}\} *'
        , u'| {{Barter|Mark|\g<marks1> Marks}} || {{Barter|Medallion|\g<medallions1> Medallions}}')
      ,
        ( ur'\| *(width="150px" *\| *)?\{\{Item:Mark\|mode=imlink_plain\|arg=(?P<marks2>[0-9,]+) +Marks\}\} *\|\| *(width="150px" *\| *)?'
        , u'| {{Barter|Mark|\g<marks2> Marks}} ||')
      ,
        ( ur'\| *(width="150px" *\| *)?\{\{Item:Mark\|mode=imlink_plain\|arg=(?P<marks3>[0-9,]+) +Marks\}\} *\|\| *'
        , u'| {{Barter|Mark|\g<marks3> Marks}} ||')
      ,
    ]
}

# python replace_lotro.py -nopreload -fix:LootboxItems -pt:2 -catr:"Creatures"
# python replace_lotro.py -nopreload -fix:LootboxItems -pt:2 -page:"Southern Raider"
fixes['LootboxItems'] = {
    'regex': True,
    'msg': {
        'en':u'Robot: Convert creature Lootbox to Lootitems',
    },
    'replacements':
      [
        ( ur'\{\{\s*[Ll]ootbox\s*\|'
        , u'{{Lootitems |')
      ,
    ]
}