| import random |
| import yaml |
|
|
| |
| tradeable_items = [ |
| {"name": "Alien Liquor", "description": "Exotic drink from a distant planet", "base_price": 50, "rarity": "Common", "image_filename": "alien_liquor.png"}, |
| {"name": "Alien Herbs", "description": "Rare herbs with medicinal properties", "base_price": 100, "rarity": "Rare", "image_filename": "alien_herbs.png"}, |
| |
| ] |
|
|
| |
| for item in tradeable_items: |
| item["price"] = item["base_price"] + random.randint(-20, 20) |
|
|
| |
| with open("tradeable_items.yml", "w") as file: |
| yaml.dump(tradeable_items, file) |
|
|
| print("Tradeable items generated and saved to 'tradeable_items.yml'.") |
|
|
| |
| planet_names = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] |
| planet_distances = {planet: random.randint(50, 200) for planet in planet_names} |
|
|
| |
| with open("planet_data.yml", "w") as file: |
| yaml.dump(planet_distances, file) |
|
|
| print("Planet data generated and saved to 'planet_data.yml'.") |
|
|
| |
| planet_events = [ |
| {"name": "Alien Encounter", "description": "You meet a friendly alien trader who offers to sell you rare technology at a discount."}, |
| {"name": "Pirate Attack", "description": "Pirates ambush your spaceship, and you lose a portion of your inventory."}, |
| |
| ] |
|
|
| travel_events = [ |
| {"name": "Space Anomaly", "description": "You encounter a mysterious space anomaly that grants you a valuable item."}, |
| {"name": "Fuel Leak", "description": "Your spaceship experiences a fuel leak, causing you to spend extra credits on repairs."}, |
| |
| ] |
|
|
| |
| def generate_event(): |
| event = random.choice(planet_events + travel_events) |
| event["outcome"] = random.choice(["positive", "negative"]) |
| event["impact"] = random.randint(1, 5) if event["outcome"] == "negative" else random.randint(1, 3) |
| return event |
|
|
| |
| random_events = [generate_event() for _ in range(10)] |
|
|
| |
| with open("random_events.yml", "w") as file: |
| yaml.dump(random_events, file) |
|
|
| print("Random events generated and saved to 'random_events.yml'.") |
|
|