From 7e428f48743627bddb64755922c07e45864a209e Mon Sep 17 00:00:00 2001
From: =?utf8?q?Joann=20M=C3=B5ndresku?= <joann@cernodile.com>
Date: Sat, 11 May 2024 19:28:44 +0300
Subject: [PATCH] Improve contract creator & add few more leggacy contracts

---
 data/contract-creator.py |  46 +++++++--
 data/contracts.json      | 214 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 249 insertions(+), 11 deletions(-)

diff --git a/data/contract-creator.py b/data/contract-creator.py
index 19993b1..40ec449 100755
--- a/data/contract-creator.py
+++ b/data/contract-creator.py
@@ -4,16 +4,6 @@ import sys
 sys.path.append("..")
 import ei_pb2 as EIProto
 
-#                        [
-#                                {"deliver": 250000000000000000, "reward_type": "SOUL_EGGS", "reward_amt": 250000},
-#                                {"deliver": 500000000000000000, "reward_type": "EGGS_OF_PROPHECY", "reward_amt": 1}
-#                        ],
-#                        [
-#                                {"deliver": 50000000000000, "reward_type": "SOUL_EGGS", "reward_amt": 10000},
-#                                {"deliver": 1000000000000000, "reward_type": "EGGS_OF_PROPHECY", "reward_amt": 1}
-#                        ]
-#                ]
-#        }
 boost_defs = {
 "Supreme tachyon prism": "tachyon_prism_orange_big",
 "Legendary tachyon prism (1000x 10m)": "tachyon_prism_orange",
@@ -46,6 +36,38 @@ def ask_for_float(preprint):
 		except:
 			continue
 
+def parse_time(preprint):
+	while True:
+		print(preprint, end="")
+		x = input()
+		vals = x.split(" ")
+		if len(vals) == 1:
+			try:
+				val = int(x)
+				return val
+			except:
+				continue
+		else:
+			if len(vals) % 2 == 1:
+				print("Write in following format: x d x h x m - or plain amount in minutes.")
+			fail = False
+			total = 0
+			for i in range(0, len(vals), 2):
+				try:
+					intval = int(vals[i])
+					suffix = vals[i + 1]
+					if suffix.upper() == "D":
+						intval *= 1440
+					elif suffix.upper() == "H":
+						intval *= 60
+					total += intval
+				except:
+					fail = True
+					break
+			if fail:
+				continue
+			return total
+
 def ask_for_quantity(preprint):
 	while True:
 		print(preprint, end="")
@@ -137,6 +159,8 @@ def create_goalset(type):
 		goal["reward_type"] = parse_reward_type("Enter reward type - type '?' for reference: ")
 		if goal["reward_type"] == "BOOST":
 			goal["reward_str"] = parse_boost_type("Type in boost type - type '?' for reference: ")
+		elif goal["reward_type"] == "EPIC_RESEARCH_ITEM":
+			goal["reward_str"] = ask_for_string("Type in epic research (check your backup for reference): ")
 		goal["reward_amt"] = ask_for_float("How many rewarded? ")
 		goals.append(goal)
 	return goals
@@ -144,7 +168,7 @@ def create_goalset(type):
 obj["id"] = ask_for_string("Enter contract ID: ")
 obj["name"] = ask_for_string("Enter contract name: ")
 obj["description"] = ask_for_string("Enter contract description: ")
-obj["duration"] = ask_for_float("How many minutes does the contract last: ") * 60.0
+obj["duration"] = parse_time("How many minutes does the contract last: ") * 60.0
 obj["token_interval"] = ask_for_float("How many minutes to wait per reward token: ")
 obj["egg"] = parse_egg_type("Enter egg type - type '?' if need reference: ")
 obj["goalsets"].append(create_goalset("Elite"))
diff --git a/data/contracts.json b/data/contracts.json
index 53e2930..0202e05 100644
--- a/data/contracts.json
+++ b/data/contracts.json
@@ -110,6 +110,220 @@
           }
         ]
       ]
+    },
+    {
+      "id": "space-eggs",
+      "name": "LEGGACY: SpaceEggs",
+      "description": "Spaceflight is booming due to re-usable rockets.\nHelp fill the demand with this contract.",
+      "duration": 604800.0,
+      "token_interval": 120.0,
+      "egg": "ROCKET_FUEL",
+      "goalsets": [
+        [
+          {
+            "deliver": 30000000000000000,
+            "reward_type": "PIGGY_LEVEL_BUMP",
+            "reward_str": "",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 500000000000000000,
+            "reward_type": "GOLD",
+            "reward_str": "",
+            "reward_amt": 50000.0
+          }
+        ],
+        [
+          {
+            "deliver": 25000000000000,
+            "reward_type": "PIGGY_LEVEL_BUMP",
+            "reward_str": "",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 1000000000000000,
+            "reward_type": "GOLD",
+            "reward_str": "",
+            "reward_amt": 5000.0
+          }
+        ]
+      ]
+    },
+    {
+      "id": "anxiety-attack",
+      "name": "LEGGACY: Anxiety Attack",
+      "description": "A new school year and political turmoil have everyone stressed out! A regimen of medical eggs are needed.",
+      "duration": 259200.0,
+      "token_interval": 90.0,
+      "egg": "MEDICAL",
+      "goalsets": [
+        [
+          {
+            "deliver": 25000000000000000,
+            "reward_type": "PIGGY_LEVEL_BUMP",
+            "reward_str": "",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 75000000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ],
+        [
+          {
+            "deliver": 10000000000000,
+            "reward_type": "PIGGY_LEVEL_BUMP",
+            "reward_str": "",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 500000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ]
+      ]
+    },
+    {
+      "id": "terraform-heavy",
+      "name": "LEGGACY: New Civilization",
+      "description": "A group of explorers are setting out to find new worlds, new civilizations.\\nThey are in need of fuel!",
+      "duration": 399960.0,
+      "token_interval": 30.0,
+      "egg": "ANTIMATTER",
+      "goalsets": [
+        [
+          {
+            "deliver": 50000000000000000,
+            "reward_type": "PIGGY_MULTIPLIER",
+            "reward_str": "",
+            "reward_amt": 2.0
+          },
+          {
+            "deliver": 150000000000000000,
+            "reward_type": "EPIC_RESEARCH_ITEM",
+            "reward_str": "comfy_nests",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 300000000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ],
+        [
+          {
+            "deliver": 100000000000000,
+            "reward_type": "PIGGY_MULTIPLIER",
+            "reward_str": "",
+            "reward_amt": 2.0
+          },
+          {
+            "deliver": 750000000000000,
+            "reward_type": "EPIC_RESEARCH_ITEM",
+            "reward_str": "comfy_nests",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 1500000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ]
+      ]
+    },
+    {
+      "id": "tool-time",
+      "name": "LEGGACY: Tool Time!",
+      "description": "It's father's day around the galaxy and power tools are flying off the shelves.\\nHelp restock!",
+      "duration": 345600.0,
+      "token_interval": 120.0,
+      "egg": "SUPER_MATERIAL",
+      "goalsets": [
+        [
+          {
+            "deliver": 50000000000000000,
+            "reward_type": "BOOST",
+            "reward_str": "soul_beacon_orange",
+            "reward_amt": 1.0
+          },
+          {
+            "deliver": 400000000000000000,
+            "reward_type": "PIGGY_FILL",
+            "reward_str": "",
+            "reward_amt": 200000.0
+          },
+          {
+            "deliver": 1000000000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ],
+        [
+          {
+            "deliver": 50000000000000,
+            "reward_type": "SOUL_EGGS",
+            "reward_str": "",
+            "reward_amt": 1000.0
+          },
+          {
+            "deliver": 500000000000000,
+            "reward_type": "PIGGY_FILL",
+            "reward_str": "",
+            "reward_amt": 25000.0
+          },
+          {
+            "deliver": 4000000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ]
+      ]
+    },
+    {
+      "id": "fday-ouch",
+      "name": "LEGGACY: Ouch!",
+      "description": "With all those new power tools out there, there are lots of minor injuries.\\nFirst Aid!",
+      "duration": 259200.0,
+      "token_interval": 60.0,
+      "egg": "MEDICAL",
+      "goalsets": [
+        [
+          {
+            "deliver": 20000000000000000,
+            "reward_type": "BOOST",
+            "reward_str": "tachyon_prism_orange",
+            "reward_amt": 2.0
+          },
+          {
+            "deliver": 80000000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ],
+        [
+          {
+            "deliver": 10000000000000,
+            "reward_type": "GOLD",
+            "reward_str": "",
+            "reward_amt": 1500.0
+          },
+          {
+            "deliver": 400000000000000,
+            "reward_type": "EGGS_OF_PROPHECY",
+            "reward_str": "",
+            "reward_amt": 1.0
+          }
+        ]
+      ]
     }
   ],
   "normal": []
-- 
2.43.0