summaryrefslogtreecommitdiff
path: root/wiki/wikigen.py
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-06-18 18:42:11 -0300
committerJesusaves <cpntb1@ymail.com>2018-06-18 18:42:11 -0300
commita1b6db6faa3afb9eea487002af02255552739290 (patch)
treed9a1178e627e5b5514ce3663375b5107f7f0f6a0 /wiki/wikigen.py
parentb7bfa1ce2969dc9e76fc2c2d0a9c6ed5751abc77 (diff)
downloadtools-a1b6db6faa3afb9eea487002af02255552739290.tar.gz
tools-a1b6db6faa3afb9eea487002af02255552739290.tar.bz2
tools-a1b6db6faa3afb9eea487002af02255552739290.tar.xz
tools-a1b6db6faa3afb9eea487002af02255552739290.zip
This is probably final questwiki update.
Diffstat (limited to 'wiki/wikigen.py')
-rwxr-xr-xwiki/wikigen.py66
1 files changed, 49 insertions, 17 deletions
diff --git a/wiki/wikigen.py b/wiki/wikigen.py
index 53e7c26..a68e52f 100755
--- a/wiki/wikigen.py
+++ b/wiki/wikigen.py
@@ -646,7 +646,7 @@ def qnt(string):
return string.replace(' ','').replace('"','').replace("'","").replace('<','').replace('>','')
def qnt2(string):
- return string.replace('"','').replace("'","").replace('<','').replace('>','').replace('##B','**').replace('##b','**').replace('##0','*').replace('##1','*').replace('##2','*').replace('##3','*').replace('##','*')
+ return string.replace('##B','**').replace('##b','**').replace('##0','*').replace('##1','*').replace('##2','*').replace('##3','*').replace('##','*')
def DoQuest():
print("Generating Quest Wiki...")
@@ -658,13 +658,15 @@ def DoQuest():
ig=False
for e in src:
- # Handle Comments
+ # Handle Comments and Ignored lines
if '<!--' in e and '-->' in e:
continue
elif '<!--' in e:
ig=True
elif '-->' in e:
ig=False
+ if '<effect' in e:
+ continue
if ig:
continue
@@ -681,9 +683,9 @@ def DoQuest():
exit(1)
# Handle quest entries
- if '</quest' in e:
+ if '</quest>' in e:
q.ent.append(qe)
- elif '<quest' in e:
+ elif '<quest ' in e:
qe=QuestEntry()
l=e.split('"')
rc=[False, ""]
@@ -712,36 +714,66 @@ def DoQuest():
# Fill stuff in Quest Entry
if '<text' in e:
a=qnt2(e)
- qe.entry.append( a.replace('text','').replace('/','') )
+ qe.entry.append( a.replace('<text>','').replace('</text>','').strip() )
elif '<questgiver' in e:
- a=qnt(e)
- qe.giver=a.replace('questgiver','').replace('/','')
-
+ a=qnt2(e)
+ qe.giver=a.replace('<questgiver>','').replace('</questgiver>','').strip()
+ elif '<reward' in e:
+ a=qnt2(e)
+ qe.reward=a.replace('<reward>','').replace('</reward>','').strip()
+ elif '<coord' in e:
+ a=qnt2(e)
+ b=a.split('>')
+ qe.loc=b[1].replace('</coordinates','').strip()
+ # Done reading file
+ src.close()
+ aktbl={}
print("\033[32;1mTotal quests: %d\033[0m" % len(qlog))
for i in qlog:
- print(i.name)
+ # Total Table
+ #print(str(i.id)+": "+i.name)
+ try:
+ aktbl[i.group].append("[%s](q/%d)" % (i.name, i.id))
+ except:
+ aktbl[i.group]=["[%s](q/%d)" % (i.name, i.id)]
+
+ # Individual file
f=open("../../wiki/q/"+str(i.id)+'.md', "w")
f.write("# %s\n" % i.name)
- f.write('\n\n')
+ f.write('\n')
totalcnt=0
for a in i.ent:
totalcnt+=1
- f.write('### %d Stage\n' % totalcnt)
+ f.write('\n### %d Stage\n\n' % totalcnt)
if a.complete:
- f.write('This completes quest\n')
+ f.write('*This completes quest*\n\n')
+
+ if a.giver != "" or a.reward != "" or a.loc != "":
+ f.write('```\n')
+ if a.giver != "":
+ f.write('Quest Giver: %s\n' % a.giver)
+ if a.reward != "":
+ f.write('Reward: %s\n' % a.reward.replace('@@', 'Cool stuff'))
+ if a.loc != "":
+ f.write('Location: %s\n' % a.loc)
+ f.write('```\n\n')
+
for line in a.entry:
f.write('%s\n' % line)
f.write('\n\n****\nThis file is generated automatically. Editing it will have no effect.\n')
f.close()
- src.close()
-
-
-
-
+ # Write total table
+ f=open("Quests.txt", "w")
+ f.write("***Total quests: %d***\n" % len(qlog))
+ for key in aktbl:
+ f.write('\n## %s\n\n' % key)
+ for a in aktbl[key]:
+ f.write('+ '+a+'\n')
+ f.close()
showHeader()