Pārlūkot izejas kodu

GL cycle testing tool first version

maankamara 1 gadu atpakaļ
revīzija
f2e3d25414

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+pregtest.txt
+pregtest.qsp

+ 5 - 0
locations/mod_pregtest.qsrc

@@ -0,0 +1,5 @@
+# mod_pregtest
+!input mod entry point here. this will be checked on every location, please keep it clean and brief to avoid game lag
+
+--- mod_isample ---------------------------------
+

+ 65 - 0
locations/mod_pregtest_options.qsrc

@@ -0,0 +1,65 @@
+# mod_pregtest_options
+
+mod_pregtestI = 0
+if $ARGS[0] = 'testcycle':
+	if $ARGS[1] = 'day':
+		mod_pregtestN = 24
+	elseif $ARGS[1] = 'week':
+		mod_pregtestN = 168
+	else
+		mod_pregtestN = 1
+	end
+	:loop_testcycle
+	if mod_pregtestI < mod_pregtestN:
+		gs 'femcyc'
+		mod_pregtestI += 1
+		jump 'loop_testcycle'
+	end
+end
+
+*clr&cla
+
+'<b>Children: <<kid>></b>'
+$mod_pregtestPrint = ''
+mod_pregtestN = 0
+:loop_ChildThFath
+if mod_pregtestN < arrsize('$ChildThFath'):
+	$mod_pregtestPrint += '<b><<mod_pregtestN + 1>>. child dad:</b> <<$ChildThFath[mod_pregtestN]>> <b>AKA:</b> <<$npc_usedname[$ChildThFath[mod_pregtestN]]>> '
+	mod_pregtestN += 1
+	jump 'loop_ChildThFath'
+end
+$mod_pregtestPrint
+*nl
+
+'<b>Current pregnancy</b>'
+'Unfertilized eggs: <<UnfertEgg>> Fertilized eggs: <<FertEgg>> Implanted embryos: <<babyembryo>>'
+$mod_pregtestPrint = ''
+mod_pregtestN = 0
+:loop_wombpotfath
+if mod_pregtestN < arrsize('$wombpotfath'):
+	$mod_pregtestPrint += '<b><<mod_pregtestN + 1>>. potential dad:</b> <<$wombpotfath[mod_pregtestN]>> <b>AKA:</b> <<$npc_usedname[$wombpotfath[mod_pregtestN]]>> '
+	mod_pregtestN += 1
+	jump 'loop_wombpotfath'
+end
+$mod_pregtestPrint
+*nl
+
+'<b>Cycle data</b>'
+'0 Menstruation, 1 Follicular, 2 Ovulation, 3 Luteal, 4 Pregnancy recovery, 5 Pregnant, 6 Menopause'
+'Current cycle: <<cycle>>'
+iif(cycle = 0, '<b>', '') + 'Cycle 0 variables: Hours of menstruation: <<mesec>>' + iif(cycle = 0, '</b>', '')
+iif(cycle = 1, '<b>', '') + 'Cycle 1 variables: Hours until ovulation: <<FocH_Max - FocH>> - <<FocH>>/<<FocH_Max>>' + iif(cycle = 1, '</b>', '')
+iif(cycle = 2, '<b>', '') + 'Cycle 2 variables: Egg release hormone: <<EggRH>> Hours of ovulation left: <<ovulate>>' + iif(cycle = 2, '</b>', '')
+iif(cycle = 3, '<b>', '') + 'Cycle 3 variables: Hours until menstruation: <<LutH_Max - LutH>> - <<LutH>>/<<LutH_Max>> Implant lottery: <<imp_rand>>' + iif(cycle = 3, '</b>', '')
+iif(cycle = 4, '<b>', '') + 'Cycle 4 variables: Hours of recovery left: <<RecovH>>' + iif(cycle = 4, '</b>', '')
+iif(cycle = 5, '<b>', '') + 'Cycle 5 variables:' + iif(preg = 1, ' Pregnant!', '') + iif(preg = 2, ' In labor!', '') + ' Fetuses: <<babyembryo>> Pregnancy hours: <<PregChem>> Labor window: <<6573 - (babyembryo-1)*588 - 400>>-<<6573 - (babyembryo-1)*588 + 800>>' + iif(cycle = 5, '</b>', '')
+
+*nl
+
+act 'return': gt 'mod_setting'
+act 'Cycle!': gs 'mod_pregtest_options', 'testcycle'
+act 'Cycle! x24(a day)': gs 'mod_pregtest_options', 'testcycle', 'day'
+act 'Cycle! x168(a week)': gs 'mod_pregtest_options', 'testcycle', 'week'
+
+--- mod_isample_options ---------------------------------
+

+ 44 - 0
locations/mod_pregtest_readme.qsrc

@@ -0,0 +1,44 @@
+# mod_pregtest_readme
+!input your mod detail readme here. you can use msg or detailed structure, just make sure to create act 'return': gt 'mod_setting'
+*clr&cla
+act 'return': gt 'mod_setting'
+
+'<center>Mod <b>isample</b></center>'
+'This is a sample for new mod system, please fill your own mod in this form
+1. Since QSP can not load location with same name, and there are no warning about this during adding new qsp files, please name ALL YOUR LOCATION NAME with <B>mod_name_xxx</B> to avoid duplication bug.
+
+2. please DO NOT use space or non-ascii character in location name. you can use use _ instead. -- this may cause bug on txtsplit function for git
+
+3. The first location MUST be named as "mod_name_setup", this system will call it and load necessary information from it.
+$mod_info[0] = mod name
+$mod_info[1] = mod version
+10203 will be displayed as version 1.2, fix3.
+40500 will be showen as version 4.5
+$mod_info[2] = author name
+$mod_info[3] = short description for this mod
+
+4. please create "mod_name_readme" location for mod detail readme (just like this location)
+  If you really have only one line for this, you can use a simple msg instead a long text.
+  
+5. put all your entry point in location "mod_name"
+You can use lots of condition check there, check this sample file yourself.
+Frequency used condition:'
+'<table>'
+*p "<tr><td>current location"
+"<td>if $curloc = '...'</td></tr>"
+*p "<tr><td>current stage"
+"<td>if $ARGS[0] = '...'</td></tr>"
+*p "<tr><td>variable value"
+"<td>if aaa > 10 </td></tr>"
+'</table>
+Please note that strings are case sensitive, you can use lcase() or ucase() to shft them before check.
+
+
+6. Due to techinque issue, this mod system CAN NOT recognition locations use value in ARGS (luckly, only system functions use this, so you shall not worry about this.)
+for example, gs ''indik'', ''2'', 100
+
+Have a nice day, and Welcome to join this Community!
+
+--- illume, 2018/1/25'
+--- mod_isample_readme ---------------------------------
+

+ 24 - 0
locations/mod_pregtest_setup.qsrc

@@ -0,0 +1,24 @@
+# mod_pregtest_setup
+!input basic mod information here. 
+!this location must be the first one
+
+$mod_info[0] = 'pregtest'
+!0=mod name, saved to $mod_name[i] array 
+
+$mod_info[1] = '10000'
+!1=mod version
+!this will be displayed as version 1.2, fix3.
+!if you input 40500, will be showen as version 4.5
+
+$mod_info[2] = 'maankamara'
+!2=mod author
+
+$mod_info[3] = 'Testing out the cycle'
+!3=mod description, input a short brief here.
+
+$mod_info[4] = 'Options'
+!4=mod options/settings link name.
+
+
+--- mod_isample_setup ---------------------------------
+

+ 11 - 0
pregtest.qproj

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<QGen-project version="4.0.0 beta 1">
+  <Structure>
+    <Folder name="setup">
+      <Location name="mod_pregtest_options"/>
+      <Location name="mod_pregtest_setup"/>
+      <Location name="mod_pregtest_readme"/>
+      <Location name="mod_pregtest"/>
+    </Folder>
+  </Structure>
+</QGen-project>

+ 44 - 0
txtmerge.py

@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# usage: txtmerge.py <input_dir> <output_file_name> 
+# does the exact opposite of txtsplit.py
+
+import os
+import sys
+import re
+import io 
+import xml.etree.ElementTree as ET
+
+assert len(sys.argv) == 3, "usage:\ntxtmerge.py <input_dir> <output_file_name>"
+idir = str(sys.argv[1])
+oname = str(sys.argv[2])
+
+# read the project xml file first
+# let's do this later in order to implement directory structure
+tree = ET.parse('pregtest.qproj')
+root = tree.getroot()
+
+
+ofile = io.open(oname, 'w', encoding='utf-16', newline='\r\n')
+
+for location in root.iter('Location'):
+    iname = location.attrib['name']
+    iname = iname.replace("$","_")
+
+    try:
+        ifile = io.open(os.path.join(idir,iname + '.qsrc'), 'rt', encoding='utf-8')
+        text = ifile.read()
+
+        # make sure there's a line at the end of file
+        # (why wouldn't there be one? WINDOWS!
+        if text[-1] != u'\n':
+            text += u'\n\n'
+
+        ofile.write(text)
+        ifile.close()
+    except IOError:
+        print("WARNING: missing location %s" % iname)
+        pass
+
+ofile.close()
+    
+