Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/env python
- import random
- import sys
- vowels = ['a', 'e', 'i', 'o', 'u']
- consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']
- hexchar = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
- surfaceblocks = ['1', '2', '3', '4', '5', '12', '13', '17', '19', '20', '24', '35', '43', '45', '47', '48', '79', '80', '86', '87', '88', '89', '97', '98', '103', '110', '112']
- groundblocks = ['1', '2', '3', '4', '5', '12', '13', '17', '19', '20', '24', '35', '43', '45', '47', '48', '79', '80', '86', '87', '88', '89', '97', '98', '103', '110', '112']
- oreblocks = ['CLAY', 'GRAVEL', '3', '14', '15', '16', '21', '46', '56', '73', '14', '15', '16', '21', '56', '73', '4', '19', '30', '73', '87', '88', '89']
- uw_oreblocks = ['CLAY', 'COAL_ORE', 'GOLD_ORE', 'SAND', '79', '49']
- plantblocks = ['RED_ROSE', 'YELLOW_FLOWER', 'LONG_GRASS', '104', '105', '89']
- liquidblocks = ['Water', 'Lava']
- isleborders = ['Ocean', 'Desert', 'Forest', 'Plains', 'Taiga']
- treetypes = ['Tree', 'BigTree', 'Foreset', 'HugeMushroom', 'SwampTree', 'Taiga1', 'Taiga2', 'JungleTree', 'GroundBush']
- def _vowel():
- return random.choice(vowels)
- def _consonant():
- return random.choice(consonants)
- def _cv():
- return _consonant() + _vowel()
- def _cvc():
- return _cv() + _consonant()
- def _syllable():
- return random.choice([_vowel, _cv, _cvc])()
- def create_fake_word():
- syllables = []
- for x in range(random.randint(2,3)):
- syllables.append(_syllable())
- return ''.join(syllables)
- def _hexchar():
- return random.choice(hexchar)
- def _colorval():
- colorvalues = []
- for x in range(0,6):
- colorvalues.append(_hexchar())
- return ''.join(colorvalues)
- def _minsize():
- return abs(int(round(random.randint(1,50),0)))
- def _maxsize():
- return abs(int(round(random.randint(51,128),0)))
- def _minalt():
- return abs(int(round(random.randint(1,50),0)))
- def _maxalt():
- return abs(int(round(random.randint(51,128),0)))
- def _frequency():
- return abs(int(round(random.randint(1,25),0)))
- def _rarity():
- return abs(int(round(random.randint(1,25),0)))
- def _oresize():
- return abs(int(round(random.randint(4,64),0)))
- def _dungeonfreq():
- return abs(int(round(random.gauss(4, 16),0)))
- if __name__ == '__main__':
- isisle = []
- filename = 'WG-'
- if random.randint(0,10) > 6 :
- isisle = 1
- filename += 'Isle-'
- filename += str.capitalize(create_fake_word())
- filename += 'BiomeConfig.ini'
- fo = open(filename, 'wb')
- biomesize = 'BiomeSize:'
- biomesize += str(int(round(random.gauss(5,0.5),1)))
- fo.write(biomesize)
- fo.write('\n')
- biomerarity = 'BiomeRarity:'
- biomerarity += str(int(abs(round(100-(random.lognormvariate(1,2))))))
- fo.write(biomerarity)
- fo.write('\n')
- islebiome = ''
- if isisle == 1 :
- islebiome += random.choice(isleborders)
- fo.write('IsleInBiome:')
- fo.write (islebiome)
- fo.write ('\n')
- fo.write('BiomeIsBorder:')
- fo.write('\n')
- fo.write('NotBorderNear:')
- notbordernear = ''
- if isisle == 0 :
- fo.write('Ocean')
- for ia in range (0, random.randint(1,3)) :
- notbordernear = random.choice(isleborders)
- fo.write(',')
- fo.write(notbordernear)
- fo.write('\n')
- biometemperature = 'BiomeTemperature:'
- biometemperature += str(round(random.uniform(0.0, 1.1), 1))
- fo.write(biometemperature)
- fo.write('\n')
- biomewetness = 'BiomeWetness:'
- biomewetness += str(round(random.uniform(0.0, 1.1), 1))
- fo.write(biomewetness)
- fo.write('\n')
- biomeheight = 'BiomeHeight:'
- biomeheight += str(round(random.gauss(-2.1,0.4),1))
- fo.write(biomeheight)
- fo.write('\n')
- biomevolatility = 'BiomeVolatility:'
- biomevolatility += str(abs(round(random.gauss(0.0,0.3),1)))
- fo.write(biomevolatility)
- fo.write('\n')
- maxaverageheight = 'MaxAverageHeight:'
- maxaverageheight += str(abs(round(random.gauss(0.0,0.3), 1)))
- fo.write(maxaverageheight)
- fo.write('\n')
- maxaveragedepth = 'MaxAverageDepth:'
- maxaveragedepth += str(abs(round(random.gauss(0.0,0.3), 1)))
- fo.write(maxaveragedepth)
- fo.write('\n')
- volatility1 = 'Volatility1:'
- volatility1 += str(abs(round(random.gauss(0.0,1.0), 1)))
- fo.write(volatility1)
- fo.write('\n')
- volatility2 = 'Volatility2:'
- volatility2 += str(abs(round(random.gauss(0.0,1.0), 1)))
- fo.write(volatility2)
- fo.write('\n')
- fo.write('DisableBiomeHeight:false')
- fo.write('\n')
- fo.write('CustomHeightControl:0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0')
- fo.write('\n')
- surfchance = random.randint(0,10)
- surfaceblock = 'SurfaceBlock:'
- if surfchance > 6 :
- thissurfaceblock = random.choice(surfaceblocks)
- elif surfchance < 3 :
- thissurfaceblock = '87'
- else :
- thissurfaceblock = '2'
- surfaceblock += thissurfaceblock
- fo.write(surfaceblock)
- fo.write('\n')
- groundblock = 'GroundBlock:'
- thisgroundblock = random.choice(groundblocks)
- groundblock += thisgroundblock
- fo.write(groundblock)
- fo.write('\n')
- fo.write('ReplacedBlocks:None')
- fo.write('\n')
- fo.write('disableNotchPonds:false')
- fo.write('\n')
- skycolor = ('SkyColor:0x')
- skycolor += str(_colorval())
- fo.write(skycolor)
- fo.write('\n')
- skycolor = ('SkyColor:0x')
- skycolor += str(_colorval())
- fo.write(skycolor)
- fo.write('\n')
- watercolor = ('WaterColor:0x')
- watercolor += str(_colorval())
- fo.write(watercolor)
- fo.write('\n')
- grasscolor = ('GrassColor:0x')
- grasscolor += str(_colorval())
- fo.write(grasscolor)
- fo.write('\n')
- foliagecolor = ('FoliageColor:0x')
- foliagecolor+= str(_colorval())
- fo.write(foliagecolor)
- fo.write('\n')
- dungeon = ('Dungeon(')
- dungeon += str(_dungeonfreq())
- dungeon += ',100,0,128)'
- if random.randint(0,10) > 2 :
- fo.write(dungeon)
- fo.write('\n')
- uglake = ('UnderGroundLake(')
- uglake += str(_minsize())
- uglake += (',')
- uglake += str(_maxsize())
- uglake += (',')
- uglake += str(_frequency())
- uglake += (',')
- uglake += str(_rarity())
- uglake += (',')
- uglake += str(_minalt())
- uglake += (',')
- uglake += str(_maxalt())
- uglake += (')')
- if random.randint(0,10) > 2 :
- fo.write(uglake)
- fo.write('\n')
- for i in range (0, random.randint(3,15)) :
- ore = 'Ore('
- ore += random.choice(oreblocks)
- ore += ','
- ore += str(_oresize())
- ore += ','
- ore += str(_frequency())
- ore += ','
- ore += str(_rarity())
- ore += ','
- ore += str(_minalt())
- ore += ','
- ore += str(_maxalt())
- ore += ','
- ore += thisgroundblock
- ore += ')'
- fo.write(ore)
- fo.write('\n')
- fo.write('UnderWaterOre(SAND,7,4,100,DIRT,GRASS)')
- fo.write('\n')
- fo.write('UnderWaterOre(CLAY,4,1,100,DIRT,CLAY)')
- fo.write('\n')
- fo.write('CustomObject()')
- fo.write('\n')
- treevar = ('Tree(')
- treevar += str(random.randint(1,7))
- treevar += ('0,')
- treevar += random.choice(treetypes)
- treevar += (',')
- treevar += str(random.randint(1,7))
- treevar += ('0,')
- treevar += random.choice(treetypes)
- treevar += (',')
- treevar += str(random.randint(1,7))
- treevar += ('0,Tree,100)')
- if thissurfaceblock == '2' :
- if random.randint(0,10) > 3 :
- fo.write(treevar)
- fo.write('\n')
- for ip in range (0, random.randint(0,4)) :
- plantvar = ('Plant(')
- plantvar += random.choice(plantblocks)
- plantvar += (',2,100,0,128,GRASS,DIRT,SOIL)')
- fo.write(plantvar)
- fo.write('\n')
- if random.randint(0,10) > 6 :
- fo.write ('Grass(LONG_GRASS,1,10,100,GRASS,DIRT)')
- fo.write ('\n')
- if random.randint(0,10) > 6 :
- fo.write ('Plant(PUMPKIN,1,3,0,128,GRASS)')
- fo.write ('\n')
- if random.randint(0,10) > 6 :
- fo.write ('Plant(MELON,1,3,0,128,GRASS)')
- fo.write ('\n')
- if random.randint(0,10) > 6 :
- fo.write ('Grass(LONG_GRASS,1,10,100,GRASS,DIRT)')
- fo.write ('\n')
- if random.randint(0,10) > 6 :
- fo.write ('Liquid(WATER,20,100,8,128,STONE)')
- fo.write ('\n')
- if random.randint(0,10) > 6 :
- fo.write ('Liquid(LAVA,10,100,8,128,STONE)')
- fo.write ('\n')
- fo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement