# -*- coding: utf-8 -*-
"""
Created on Sun Jun 09 21:54:14 2013
@author: Andrew Tharp
"""
import wx
class WarframeDefenseDrops(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent)
raceBox = wx.SingleChoiceDialog(None, 'What race are you fighting?', 'Select Race', ['Corpus', 'Grineer', 'Infested'])
if raceBox.ShowModal() == wx.ID_OK:
race = raceBox.GetStringSelection()
else:
return(None)
if race == 'Corpus':
waveFiveBox = wx.SingleChoiceDialog(None, 'What mod dropped in wave 5?', 'Select Mod', ['Convulsion', 'Shocking Touch', 'Stormbringer', 'Split Chamber', 'Stretch', 'Continuity', 'Banshee Chassis Blueprint', 'Tower 3 Exterminate', 'Master Thief', 'Tower 2 Exterminate', 'Tower 2 Raid', 'Uncommon Fusion Core', 'Rare Fusion Core'])
if waveFiveBox.ShowModal() == wx.ID_OK:
firstWaveDrop = waveFiveBox.GetStringSelection()
else:
return(None)
waveTenBox = wx.SingleChoiceDialog(None, 'What mod dropped in wave 10?', 'Select Mod', ['Convulsion', 'Shocking Touch', 'Stormbringer', 'Split Chamber', 'Stretch', 'Continuity', 'Banshee Chassis Blueprint', 'Tower 3 Exterminate', 'Master Thief', 'Tower 2 Exterminate', 'Tower 2 Raid', 'Uncommon Fusion Core', 'Rare Fusion Core'])
if waveTenBox.ShowModal() == wx.ID_OK:
secondWaveDrop = waveTenBox.GetStringSelection()
else:
return(None)
drops = ['Convulsion', 0.0, .1518,
'Shocking Touch', .1518, .3035,
'Stormbringer', .3035, .3351,
'Split Chamber', .3351, .3667,
'Stretch', .3667, .3983,
'Continuity', .3983, .4299,
'Banshee Chassis Blueprint', .4299, .4615,
'Tower 3 Exterminate', .4615, .4930,
'Master Thief', .4930, .5131,
'Tower 2 Exterminate', .5131, .6649,
'Tower 2 Raid', .6649, .8167,
'Uncommon Fusion Core', .8167, .9684,
'Rare Fusion Core', .9684, 1]
elif race == 'Grineer':
waveFiveBox = wx.SingleChoiceDialog(None, 'What mod dropped in wave 5?', 'Select Mod', ['Deep Freeze', 'North Wind', 'Cryo Rounds', 'Hells Chamber', 'Stretch', 'Streamline', 'Banshee Systems Blueprint', 'Tower 3 Exterminate', 'Handspring', 'Tower 2 Exterminate', 'Tower 2 Raid', 'Uncommon Fusion Core', 'Rare Fusion Core'])
if waveFiveBox.ShowModal() == wx.ID_OK:
firstWaveDrop = waveFiveBox.GetStringSelection()
else:
return(None)
waveTenBox = wx.SingleChoiceDialog(None, 'What mod dropped in wave 10?', 'Select Mod', ['Deep Freeze', 'North Wind', 'Cryo Rounds', 'Hells Chamber', 'Stretch', 'Streamline', 'Banshee Systems Blueprint', 'Tower 3 Exterminate', 'Handspring', 'Tower 2 Exterminate', 'Tower 2 Raid', 'Uncommon Fusion Core', 'Rare Fusion Core'])
if waveTenBox.ShowModal() == wx.ID_OK:
secondWaveDrop = waveTenBox.GetStringSelection()
else:
return(None)
drops = ['Deep Freeze', 0.0, .1518,
'North Wind', .1518, .3035,
'Cryo Rounds', .3035, .3351,
'Hells Chamber', .3351, .3667,
'Stretch', .3667, .3983,
'Streamline', .3983, .4299,
'Banshee Systems Blueprint', .4299, .4615,
'Tower 3 Exterminate', .4615, .4930,
'Handspring', .4930, .5131,
'Tower 2 Exterminate', .5131, .6649,
'Tower 2 Raid', .6649, .8167,
'Uncommon Fusion Core', .8167, .9684,
'Rare Fusion Core', .9684, 1]
else:
waveFiveBox = wx.SingleChoiceDialog(None, 'What mod dropped in wave 5?', 'Select Mod', ['Hellfire', 'Heated Charge', 'Molten Impact', 'Barrel Diffusion', 'Streamline', 'Focus', 'Banshee Helmet Blueprint', 'Tower 3 Exterminate', 'Thunderbolt', 'Uncommon Fusion Core', 'Rare Fusion Core', 'Tower 2 Exterminate', 'Tower 2 Raid'])
if waveFiveBox.ShowModal() == wx.ID_OK:
firstWaveDrop = waveFiveBox.GetStringSelection()
else:
return(None)
waveTenBox = wx.SingleChoiceDialog(None, 'What mod dropped in wave 10?', 'Select Mod', ['Hellfire', 'Heated Charge', 'Molten Impact', 'Barrel Diffusion', 'Streamline', 'Focus', 'Banshee Helmet Blueprint', 'Tower 3 Exterminate', 'Thunderbolt', 'Uncommon Fusion Core', 'Rare Fusion Core', 'Tower 2 Exterminate', 'Tower 2 Raid'])
if waveTenBox.ShowModal() == wx.ID_OK:
secondWaveDrop = waveTenBox.GetStringSelection()
else:
return(None)
drops = ['Hellfire', 0.0, .1518,
'Heated Charge', .1518, .3035,
'Molten Impact', .3035, .3351,
'Barrel Diffusion', .3351, .3667,
'Streamline', .3667, .3983,
'Focus', .3983, .4299,
'Banshee Helmet Blueprint', .4299, .4615,
'Tower 3 Exterminate', .4615, .4930,
'Thunderbolt', .4930, .5131,
'Uncommon Fusion Core', .5131, .6649,
'Rare Fusion Core', .6649, .6965,
'Tower 2 Exterminate', .6965, .8482,
'Tower 2 Raid', .8482, 1.0]
predictedDrops = DropPredictor(firstWaveDrop, secondWaveDrop, drops)
fiveWaveOutBox = wx.SingleChoiceDialog(None, 'The following mods can drop in five waves', 'Drops For Five Waves Out', predictedDrops.getWaveFiveDrops(), style = wx.OK)
fiveWaveOutBox.ShowModal()
tenWaveOutBox = wx.SingleChoiceDialog(None, 'The following mods can drop in ten waves', 'Drops For Ten Waves Out', predictedDrops.getWaveTenDrops(), style = wx.OK)
tenWaveOutBox.ShowModal()
proceedBox = wx.MessageDialog(None, 'Do you want to continue?', 'Continue?', wx.YES_NO)
proceed = proceedBox.ShowModal()
while proceed == wx.ID_YES:
firstWaveDrop = secondWaveDrop
waveBox = wx.SingleChoiceDialog(None, 'What mod dropped?', 'Select Mod', predictedDrops.getWaveFiveDrops())
if waveBox.ShowModal() == wx.ID_OK:
secondWaveDrop = waveBox.GetStringSelection()
else:
return(None)
predictedDrops = DropPredictor(firstWaveDrop, secondWaveDrop, drops, lowerIncrement = predictedDrops.getLowerIncrement(), upperIncrement = predictedDrops.getUpperIncrement())
fiveWaveOutBox = wx.SingleChoiceDialog(None, 'The following mods can drop in five waves', 'Drops For Five Waves Out', predictedDrops.getWaveFiveDrops(), style = wx.OK)
fiveWaveOutBox.ShowModal()
tenWaveOutBox = wx.SingleChoiceDialog(None, 'The following mods can drop in ten waves', 'Drops For Ten Waves Out', predictedDrops.getWaveTenDrops(), style = wx.OK)
tenWaveOutBox.ShowModal()
proceedBox = wx.MessageDialog(None, 'Do you want to continue?', 'Continue?', wx.YES_NO)
proceed = proceedBox.ShowModal()
class DropPredictor:
def __init__(self, firstDrop, secondDrop, dropList, lowerIncrement=0, upperIncrement=1):
self.lowerIncrement = lowerIncrement
self.upperIncrement = upperIncrement
self.potentialDrops = []
self.nextPotentialDrops = []
i = dropList.index(firstDrop)
j = dropList.index(secondDrop)
firstLowerSeed = dropList[i+1]
firstUpperSeed = dropList[i+2]
secondLowerSeed = dropList[j+1]
secondUpperSeed = dropList[j+2]
if secondUpperSeed > firstLowerSeed: #finds the lower and upper bounds for the first increment
if secondLowerSeed - firstUpperSeed > 0:
newLowerIncrement = secondLowerSeed - firstUpperSeed
else:
newLowerIncrement = secondLowerSeed - firstUpperSeed
newUpperIncrement = secondUpperSeed - firstLowerSeed
else:
newLowerIncrement = 1 - firstUpperSeed + secondLowerSeed
newUpperIncrement = 1 - firstLowerSeed + secondUpperSeed
if self.lowerIncrement < newLowerIncrement and newLowerIncrement >= 0:
self.lowerIncrement = newLowerIncrement
elif newLowerIncrement < 0 and self.upperIncrement == 1:
self.lowerIncrement = newLowerIncrement
if self.upperIncrement > newUpperIncrement:
self.upperIncrement = newUpperIncrement
if self.upperIncrement < self.lowerIncrement:
self.upperIncrement = 1
minNextSeed = (secondLowerSeed + self.lowerIncrement) % 1
maxNextSeed = (secondUpperSeed + self.upperIncrement) % 1
if minNextSeed < maxNextSeed:
for x in range(2,39,3): #increments over the indexs for the lower seed of drops
if dropList[x] > minNextSeed:
self.potentialDrops.append(dropList[x-2])
if dropList[x] > maxNextSeed:
break
else:
for x in range(2,39,3):
if dropList[x] > minNextSeed:
self.potentialDrops.append(dropList[x-2])
elif dropList[x-1] < maxNextSeed:
self.potentialDrops.append(dropList[x-2])
minNextNextSeed = (minNextSeed + self.lowerIncrement) % 1
maxNextNextSeed = (maxNextSeed + self.upperIncrement) % 1
if minNextNextSeed < maxNextNextSeed:
for x in range(2,39,3): #increments over the indexs for the lower seed of drops
if dropList[x] > minNextNextSeed:
self.nextPotentialDrops.append(dropList[x-2])
if dropList[x] > maxNextNextSeed:
break
else:
for x in range(2,39,3):
if dropList[x] > minNextNextSeed:
self.nextPotentialDrops.append(dropList[x-2])
elif dropList[x-1] < maxNextNextSeed:
self.nextPotentialDrops.append(dropList[x-2])
def getLowerIncrement(self): #returns the lower bound for the low end of the mission's increment
return(self.lowerIncrement)
def getUpperIncrement(self): #returns the upper bound for the high end of the mission' increment
return(self.upperIncrement)
def getWaveFiveDrops(self): #returns the drop list for five waves out
return(self.potentialDrops)
def getWaveTenDrops(self): #returns the drop list for ten waves out
return(self.nextPotentialDrops)
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = WarframeDefenseDrops(parent=None,id=-1)