Guest User

switchscriptv1

a guest
Mar 5th, 2023
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.90 KB | None | 0 0
  1. # Define a dictionary to hold the old and new sections of code, along with nicknames for each section
  2. sections = {
  3.     'Section 1': {
  4.         'name': 'Date 1',
  5.         'old': '''  let d = new Date(2037, 0, 12);''',
  6.         'new': '''  let d = new Date(2050, 0, 0);'''
  7.     },
  8.     'Section 2': {
  9.         'name': 'Date 2',
  10.         'old': '''      `It is the year 2037, and the past 21 years have not been kind. The world is starting to fall apart. The climate is deteriorating, resources are being exhausted, and there are more people to feed every year. Technology is advancing, but not fast enough to save everyone. <span class="intro question"></span>`,''',
  11.         'new': '''      `It is the year 2050, and the past decades have not been kind. The world is starting to fall apart. The climate is deteriorating, resources are being exhausted, and there are more people to feed every year. Technology is advancing, but not fast enough to save everyone. <span class="intro question"></span>`,'''
  12.     },
  13.     'Section 3': {
  14.         'name': 'Demand',
  15.         'old': '''  // Lower class calculations
  16.     const lowerClassNPCRatio = NPCSexSupply.lowerClass / lowerDemandLeft;
  17.     const lowerClassOptimalRatio = 0.5 + V.sexSubsidies.lowerClass / 10 - V.sexSupplyBarriers.lowerClass / 10;
  18.     const lowerClassOptimal = lowerDemandLeft * lowerClassOptimalRatio;
  19.     if (NPCSexSupply.lowerClass > lowerTotalDemand * (0.3 - V.sexSupplyBarriers.lowerClass / 20)) { // Checking if NPCs are supplying more than the standard minimum share of supply
  20.         if (lowerClassNPCRatio >= lowerClassOptimalRatio + 0.05) { // NPCs provide more than they really care to and some wish to stop providing sexual services, max reduction of 10% of previous
  21.             NPCSexSupply.lowerClass -= Math.min(NPCSexSupply.lowerClass - Math.trunc((NPCSexSupply.lowerClass * 4 + lowerClassOptimal) / 5), Math.trunc(NPCSexSupply.lowerClass * 0.1));
  22.         } else if (lowerClassNPCRatio <= lowerClassOptimalRatio - 0.05) { // NPCs see business opportunities and provide more sexual services, minimum increase of 500, max of 10% of previous
  23.             NPCSexSupply.lowerClass += Math.trunc(Math.clamp((NPCSexSupply.lowerClass * 4 + lowerClassOptimal) / 5 - NPCSexSupply.lowerClass, 500, NPCSexSupply.lowerClass * 0.1) * (1 - V.sexSupplyBarriers.lowerClass / 5)); // Slow down NPC growth through bureaucracy
  24.         } else {
  25.             NPCSexSupply.lowerClass = Math.trunc(NPCSexSupply.lowerClass * (1 + normalRandInt(0, 20) / 1000)); // Some random fluxuations whenever the NPC supply is roughly on target.
  26.         }
  27.     } else { // Increase NPC supply if it drops below the standard minimum share of supply
  28.         NPCSexSupply.lowerClass += Math.max(Math.trunc(NPCSexSupply.lowerClass * (normalRandInt(150, 10) / 1000)), 500);
  29.     }
  30.  
  31.     // Middle class calculations
  32.     const middleClassNPCRatio = NPCSexSupply.middleClass / middleDemandLeft;
  33.     const middleClassOptimalRatio = 0.5 + V.sexSubsidies.middleClass / 10 - V.sexSupplyBarriers.middleClass / 10;
  34.     const middleClassOptimal = middleDemandLeft * middleClassOptimalRatio;
  35.     if (NPCSexSupply.middleClass > middleTotalDemand * (0.3 - V.sexSupplyBarriers.middleClass / 20)) {
  36.         if (middleClassNPCRatio >= middleClassOptimalRatio + 0.05) {
  37.             NPCSexSupply.middleClass -= Math.min(NPCSexSupply.middleClass - Math.trunc((NPCSexSupply.middleClass * 4 + middleClassOptimal) / 5), Math.trunc(NPCSexSupply.middleClass * 0.1));
  38.         } else if (middleClassNPCRatio <= middleClassOptimalRatio - 0.05) {
  39.             NPCSexSupply.middleClass += Math.trunc(Math.clamp((NPCSexSupply.middleClass * 4 + middleClassOptimal) / 5 - NPCSexSupply.middleClass, 500, NPCSexSupply.middleClass * 0.1) * (1 - V.sexSupplyBarriers.middleClass / 5));
  40.         } else {
  41.             NPCSexSupply.middleClass = Math.trunc(NPCSexSupply.middleClass * (1 + normalRandInt(0, 20) / 1000));
  42.         }
  43.     } else {
  44.         NPCSexSupply.middleClass += Math.max(Math.trunc(NPCSexSupply.middleClass * (normalRandInt(150, 10) / 1000)), 500);
  45.     }
  46.  
  47.     // Upper class Calculations
  48.     const upperClassNPCRatio = NPCSexSupply.upperClass / upperDemandLeft;
  49.     const upperClassOptimalRatio = 0.5 + V.sexSubsidies.upperClass / 10 - V.sexSupplyBarriers.upperClass / 10;
  50.     const upperClassOptimal = upperDemandLeft * upperClassOptimalRatio;
  51.     if (NPCSexSupply.upperClass > upperTotalDemand * (0.3 - V.sexSupplyBarriers.upperClass / 20)) {
  52.         if (upperClassNPCRatio >= upperClassOptimalRatio + 0.05) {
  53.             NPCSexSupply.upperClass -= Math.min(NPCSexSupply.upperClass - Math.trunc((NPCSexSupply.upperClass * 4 + upperClassOptimal) / 5), Math.trunc(NPCSexSupply.upperClass * 0.1));
  54.         } else if (upperClassNPCRatio <= upperClassOptimalRatio - 0.05) {
  55.             NPCSexSupply.upperClass += Math.trunc(Math.clamp((NPCSexSupply.upperClass * 4 + upperClassOptimal) / 5 - NPCSexSupply.upperClass, 500, NPCSexSupply.upperClass * 0.1) * (1 - V.sexSupplyBarriers.upperClass / 5));
  56.         } else {
  57.             NPCSexSupply.upperClass = Math.trunc(NPCSexSupply.upperClass * (1 + normalRandInt(0, 20) / 1000));
  58.         }
  59.     } else {
  60.         NPCSexSupply.upperClass += Math.max(Math.trunc(NPCSexSupply.upperClass * (normalRandInt(150, 10) / 1000)), 500);
  61.     }
  62.  
  63.     // Top class calculations
  64.     const topClassNPCRatio = NPCSexSupply.topClass / topDemandLeft;
  65.     const topClassOptimalRatio = 0.5 + V.sexSubsidies.topClass / 8 - V.sexSupplyBarriers.topClass / 10;
  66.     const topClassOptimal = topDemandLeft * topClassOptimalRatio;
  67.     if (NPCSexSupply.topClass > topTotalDemand * (0.3 - V.sexSupplyBarriers.topClass / 20)) {
  68.         if (topClassNPCRatio >= topClassOptimalRatio + 0.025) {
  69.             NPCSexSupply.topClass -= Math.min(NPCSexSupply.topClass - Math.trunc((NPCSexSupply.topClass * 4 + topClassOptimal) / 5), Math.trunc(NPCSexSupply.topClass * 0.1));
  70.         } else if (topClassNPCRatio <= topClassOptimalRatio - 0.025) {
  71.             NPCSexSupply.topClass += Math.trunc(Math.clamp((NPCSexSupply.topClass * 4 + topClassOptimal) / 5 - NPCSexSupply.topClass, 500, NPCSexSupply.topClass * 0.1) * (1 - V.sexSupplyBarriers.topClass / 5));
  72.         } else {
  73.             NPCSexSupply.topClass = Math.trunc(NPCSexSupply.topClass * (1 + normalRandInt(0, 20) / 1000));
  74.         }
  75.     } else {
  76.         NPCSexSupply.topClass += Math.max(Math.trunc(NPCSexSupply.topClass * (normalRandInt(150, 10) / 1000)), 500);
  77.     }
  78.  
  79.     return NPCSexSupply;''',
  80.         'new': '''  // Lower class calculations
  81.    
  82.     NPCSexSupply.lowerClass = lowerDemandLeft;
  83.  
  84.     // Middle class calculations
  85.  
  86.     NPCSexSupply.middleClass = middleDemandLeft;
  87.  
  88.     // Upper class Calculations
  89.  
  90.     NPCSexSupply.upperClass = upperDemandLeft;
  91.  
  92.     // Top class calculations
  93.  
  94.     NPCSexSupply.topClass = topDemandLeft;
  95.    
  96.     return NPCSexSupply;'''
  97.     },
  98.     'Section 4': {
  99.         'name': 'BG Gun',
  100.         'old': '''                  w.push(`and, in keeping with ${his} heritage, a PKP Pecheneg GPMG`);''',
  101.         'new': '''                  w.push(`and, in keeping with ${his} heritage, an RPK-16 LMG`);'''
  102.     },
  103. }
  104.  
  105. # Open the file in read mode, specifying the encoding as utf-8
  106. try:
  107.     with open('FC_pregmod.html', 'r', encoding='utf-8') as file:
  108.         # Read the contents of the file into a string
  109.         content = file.read()
  110. except FileNotFoundError:
  111.     print("Error: File not found")
  112.     exit()
  113.  
  114. # Replace each old section with its corresponding new section in the content string
  115. for section_name, section_data in sections.items():
  116.     old_section = section_data['old']
  117.     new_section = section_data['new']
  118.     section_nickname = section_data['name']
  119.     print(f"Replacing {section_nickname} ({section_name})")
  120.     try:
  121.         count = content.count(old_section)
  122.         if count == 0:
  123.             print(f"Error: {section_nickname} ({section_name}) not found")
  124.         else:
  125.             content = content.replace(old_section, new_section, count)
  126.     except Exception as e:
  127.         print(f"Error: {e}")
  128.         exit()
  129.  
  130. # Open the file in write mode and write the modified content back to the file
  131. try:
  132.     with open('FC_pregmod.html', 'w', encoding='utf-8') as file:
  133.         file.write(content)
  134. except Exception as e:
  135.     print(f"Error: {e}")
  136.     exit()
  137.  
  138. # Wait for user input before closing the console window
  139. input("Press Enter to exit...")
Tags: fc
Advertisement
Add Comment
Please, Sign In to add comment