Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Define a dictionary to hold the old and new sections of code, along with nicknames for each section
- sections = {
- 'Section 1': {
- 'name': 'Date 1',
- 'old': ''' let d = new Date(2037, 0, 12);''',
- 'new': ''' let d = new Date(2050, 0, 0);'''
- },
- 'Section 2': {
- 'name': 'Date 2',
- '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>`,''',
- '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>`,'''
- },
- 'Section 3': {
- 'name': 'Demand',
- 'old': ''' // Lower class calculations
- const lowerClassNPCRatio = NPCSexSupply.lowerClass / lowerDemandLeft;
- const lowerClassOptimalRatio = 0.5 + V.sexSubsidies.lowerClass / 10 - V.sexSupplyBarriers.lowerClass / 10;
- const lowerClassOptimal = lowerDemandLeft * lowerClassOptimalRatio;
- if (NPCSexSupply.lowerClass > lowerTotalDemand * (0.3 - V.sexSupplyBarriers.lowerClass / 20)) { // Checking if NPCs are supplying more than the standard minimum share of supply
- 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
- NPCSexSupply.lowerClass -= Math.min(NPCSexSupply.lowerClass - Math.trunc((NPCSexSupply.lowerClass * 4 + lowerClassOptimal) / 5), Math.trunc(NPCSexSupply.lowerClass * 0.1));
- } else if (lowerClassNPCRatio <= lowerClassOptimalRatio - 0.05) { // NPCs see business opportunities and provide more sexual services, minimum increase of 500, max of 10% of previous
- 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
- } else {
- NPCSexSupply.lowerClass = Math.trunc(NPCSexSupply.lowerClass * (1 + normalRandInt(0, 20) / 1000)); // Some random fluxuations whenever the NPC supply is roughly on target.
- }
- } else { // Increase NPC supply if it drops below the standard minimum share of supply
- NPCSexSupply.lowerClass += Math.max(Math.trunc(NPCSexSupply.lowerClass * (normalRandInt(150, 10) / 1000)), 500);
- }
- // Middle class calculations
- const middleClassNPCRatio = NPCSexSupply.middleClass / middleDemandLeft;
- const middleClassOptimalRatio = 0.5 + V.sexSubsidies.middleClass / 10 - V.sexSupplyBarriers.middleClass / 10;
- const middleClassOptimal = middleDemandLeft * middleClassOptimalRatio;
- if (NPCSexSupply.middleClass > middleTotalDemand * (0.3 - V.sexSupplyBarriers.middleClass / 20)) {
- if (middleClassNPCRatio >= middleClassOptimalRatio + 0.05) {
- NPCSexSupply.middleClass -= Math.min(NPCSexSupply.middleClass - Math.trunc((NPCSexSupply.middleClass * 4 + middleClassOptimal) / 5), Math.trunc(NPCSexSupply.middleClass * 0.1));
- } else if (middleClassNPCRatio <= middleClassOptimalRatio - 0.05) {
- NPCSexSupply.middleClass += Math.trunc(Math.clamp((NPCSexSupply.middleClass * 4 + middleClassOptimal) / 5 - NPCSexSupply.middleClass, 500, NPCSexSupply.middleClass * 0.1) * (1 - V.sexSupplyBarriers.middleClass / 5));
- } else {
- NPCSexSupply.middleClass = Math.trunc(NPCSexSupply.middleClass * (1 + normalRandInt(0, 20) / 1000));
- }
- } else {
- NPCSexSupply.middleClass += Math.max(Math.trunc(NPCSexSupply.middleClass * (normalRandInt(150, 10) / 1000)), 500);
- }
- // Upper class Calculations
- const upperClassNPCRatio = NPCSexSupply.upperClass / upperDemandLeft;
- const upperClassOptimalRatio = 0.5 + V.sexSubsidies.upperClass / 10 - V.sexSupplyBarriers.upperClass / 10;
- const upperClassOptimal = upperDemandLeft * upperClassOptimalRatio;
- if (NPCSexSupply.upperClass > upperTotalDemand * (0.3 - V.sexSupplyBarriers.upperClass / 20)) {
- if (upperClassNPCRatio >= upperClassOptimalRatio + 0.05) {
- NPCSexSupply.upperClass -= Math.min(NPCSexSupply.upperClass - Math.trunc((NPCSexSupply.upperClass * 4 + upperClassOptimal) / 5), Math.trunc(NPCSexSupply.upperClass * 0.1));
- } else if (upperClassNPCRatio <= upperClassOptimalRatio - 0.05) {
- NPCSexSupply.upperClass += Math.trunc(Math.clamp((NPCSexSupply.upperClass * 4 + upperClassOptimal) / 5 - NPCSexSupply.upperClass, 500, NPCSexSupply.upperClass * 0.1) * (1 - V.sexSupplyBarriers.upperClass / 5));
- } else {
- NPCSexSupply.upperClass = Math.trunc(NPCSexSupply.upperClass * (1 + normalRandInt(0, 20) / 1000));
- }
- } else {
- NPCSexSupply.upperClass += Math.max(Math.trunc(NPCSexSupply.upperClass * (normalRandInt(150, 10) / 1000)), 500);
- }
- // Top class calculations
- const topClassNPCRatio = NPCSexSupply.topClass / topDemandLeft;
- const topClassOptimalRatio = 0.5 + V.sexSubsidies.topClass / 8 - V.sexSupplyBarriers.topClass / 10;
- const topClassOptimal = topDemandLeft * topClassOptimalRatio;
- if (NPCSexSupply.topClass > topTotalDemand * (0.3 - V.sexSupplyBarriers.topClass / 20)) {
- if (topClassNPCRatio >= topClassOptimalRatio + 0.025) {
- NPCSexSupply.topClass -= Math.min(NPCSexSupply.topClass - Math.trunc((NPCSexSupply.topClass * 4 + topClassOptimal) / 5), Math.trunc(NPCSexSupply.topClass * 0.1));
- } else if (topClassNPCRatio <= topClassOptimalRatio - 0.025) {
- NPCSexSupply.topClass += Math.trunc(Math.clamp((NPCSexSupply.topClass * 4 + topClassOptimal) / 5 - NPCSexSupply.topClass, 500, NPCSexSupply.topClass * 0.1) * (1 - V.sexSupplyBarriers.topClass / 5));
- } else {
- NPCSexSupply.topClass = Math.trunc(NPCSexSupply.topClass * (1 + normalRandInt(0, 20) / 1000));
- }
- } else {
- NPCSexSupply.topClass += Math.max(Math.trunc(NPCSexSupply.topClass * (normalRandInt(150, 10) / 1000)), 500);
- }
- return NPCSexSupply;''',
- 'new': ''' // Lower class calculations
- NPCSexSupply.lowerClass = lowerDemandLeft;
- // Middle class calculations
- NPCSexSupply.middleClass = middleDemandLeft;
- // Upper class Calculations
- NPCSexSupply.upperClass = upperDemandLeft;
- // Top class calculations
- NPCSexSupply.topClass = topDemandLeft;
- return NPCSexSupply;'''
- },
- 'Section 4': {
- 'name': 'BG Gun',
- 'old': ''' w.push(`and, in keeping with ${his} heritage, a PKP Pecheneg GPMG`);''',
- 'new': ''' w.push(`and, in keeping with ${his} heritage, an RPK-16 LMG`);'''
- },
- }
- # Open the file in read mode, specifying the encoding as utf-8
- try:
- with open('FC_pregmod.html', 'r', encoding='utf-8') as file:
- # Read the contents of the file into a string
- content = file.read()
- except FileNotFoundError:
- print("Error: File not found")
- exit()
- # Replace each old section with its corresponding new section in the content string
- for section_name, section_data in sections.items():
- old_section = section_data['old']
- new_section = section_data['new']
- section_nickname = section_data['name']
- print(f"Replacing {section_nickname} ({section_name})")
- try:
- count = content.count(old_section)
- if count == 0:
- print(f"Error: {section_nickname} ({section_name}) not found")
- else:
- content = content.replace(old_section, new_section, count)
- except Exception as e:
- print(f"Error: {e}")
- exit()
- # Open the file in write mode and write the modified content back to the file
- try:
- with open('FC_pregmod.html', 'w', encoding='utf-8') as file:
- file.write(content)
- except Exception as e:
- print(f"Error: {e}")
- exit()
- # Wait for user input before closing the console window
- input("Press Enter to exit...")
Advertisement
Add Comment
Please, Sign In to add comment