Skrublordism

This commit is contained in:
DenialMC 2015-05-10 16:06:43 +03:00
parent 1dc5bdbf55
commit 4be52eb5aa
2 changed files with 0 additions and 41 deletions

View file

@ -4914,19 +4914,6 @@ def dna(part, value):
invoker.b_setDNAString(dna.makeNetString())
return 'Laughing Man set to: ' + str(dna.laughingMan)
if part == 'save':
backup = simbase.backups.load('toon', (invoker.doId,), default={})
backup.setdefault('dna', {})[value] = invoker.getDNAString()
simbase.backups.save('toon', (invoker.doId,), backup)
return 'Saved a DNA backup for %s under the name: %s' % (invoker.getName(), value)
if part == 'restore':
backup = simbase.backups.load('toon', (invoker.doId,), default={})
if value not in backup.get('dna', {}):
return "Couldn't find a DNA backup for %s under the name: %s" % (invoker.getName(), value)
invoker.b_setDNAString(backup['dna'][value])
return 'Restored a DNA backup for %s under the name: %s' % (invoker.getName(), value)
if part == 'show':
return dna.asTuple()
return 'Invalid part: ' + part

View file

@ -70,15 +70,12 @@ NPC_SMART = 13
NPC_GLOVE = 14
CLERK_COUNTDOWN_TIME = 120
TAILOR_COUNTDOWN_TIME = 300
RTDNAFile = '/RTDNAFile.txt'
saveDNA = False
def getRandomDNA(seed, gender):
randomDNA = ToonDNA.ToonDNA()
randomDNA.newToonRandom(seed, gender, 1)
return randomDNA.asTuple()
def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
import DistributedNPCToonAI
import DistributedNPCClerkAI
@ -130,31 +127,6 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
dnaList = getRandomDNA(npcId, gender)
else:
dnaList = dnaType
if saveDNA:
strList = []
strList.append('\n\nNPC Id: ')
strList.append(str(npcId))
strList.append('\nDNA: ')
count = 0
strList.append('(')
for item in dnaList:
if count < 4:
strList.append('"' + str(item) + '"')
else:
strList.append(str(item))
count += 1
strList.append(' ,')
strList.append(')')
rtDNA = ''.join(strList)
if os.path.isfile(RTDNAFile):
rtDnaFile = open(RTDNAFile, 'r+')
rtDnaFile.seek(0, 2)
rtDnaFile.writelines(rtDNA)
else:
rtDnaFile = open(RTDNAFile, 'w')
rtDnaFile.writelines(rtDNA)
rtDnaFile.close()
dna.newToonFromProperties(*dnaList)
npc.setDNAString(dna.makeNetString())
npc.setHp(15)