import os
import wx
class CreateAbout(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, title='About',size=(400,400))
self.info = wx.StaticText(self, label="Code", pos=(20,15))
class CreateAdd(wx.Panel):
def __init__(self, parent, main):
wx.Panel.__init__(self, parent)
self.main = main
self.parent = parent
parent.Bind(wx.EVT_CLOSE, self.OnClose, parent)
# Map Id
self.choices = []
for i in range(1, 1000):
self.choices.append('%s' % i)
self.mapid = wx.StaticText(self, label="Map Id", pos=(15,2))
self.mapid_value = wx.ComboBox(self, value="1", pos=(85, 0), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.Map_Id, self.mapid_value)
self.value1 = '1'
# Map Location
self.choices = []
for i in range(0, 501):
self.choices.append('%s' % i)
self.maplocation = wx.StaticText(self, label="Map Location", pos=(15,22))
self.maplocationx_value = wx.ComboBox(self, value="1", pos=(85, 20), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.maplocationy_value = wx.ComboBox(self, value="1", pos=(135, 20), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.Map_LocationX, self.maplocationx_value)
self.Bind(wx.EVT_COMBOBOX, self.Map_LocationY, self.maplocationy_value)
self.value2 = '1'
self.value3 = '1'
# Direction
self.choices = ['2','4','6','8']
self.direction = wx.StaticText(self, label="Direction", pos=(15,42))
self.direction_value = wx.ComboBox(self, value="2", pos=(85, 40), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.Direction, self.direction_value)
self.value4 = '2'
# Confirm Button
self.confirmbutton =wx.Button(self, label="Confirm", pos=(45, 90))
self.Bind(wx.EVT_BUTTON, self.ConfirmButton,self.confirmbutton)
# Create Actions
def Map_Id(self, event):
self.value1 = event.GetString()
def Map_LocationX(self, event):
self.value2 = event.GetString()
def Map_LocationY(self, event):
self.value3 = event.GetString()
def Direction(self, event):
self.value4 = event.GetString()
def ConfirmButton(self, event):
list = [self.value1,self.value2,self.value3,self.value4]
self.main.Add_Terrain(list)
def OnClose(self, event):
self.parent.MakeModal(False)
event.Skip()
class CreateEdit(wx.Panel):
def __init__(self, parent, main , id, default):
wx.Panel.__init__(self, parent)
self.main = main
self.parent = parent
self.id = id
self.default = default
parent.Bind(wx.EVT_CLOSE, self.OnClose, parent)
# Map Id
self.choices = []
for i in range(1, 1000):
self.choices.append('%s' % i)
self.mapid = wx.StaticText(self, label="Map Id", pos=(15,2))
self.mapid_value = wx.ComboBox(self, value=self.default[0], pos=(85, 0), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.Map_Id, self.mapid_value)
self.value1 = self.default[0]
# Map Location
self.choices = []
for i in range(0, 500):
self.choices.append('%s' % i)
self.maplocation = wx.StaticText(self, label="Map Location", pos=(15,22))
self.maplocationx_value = wx.ComboBox(self, value=self.default[2], pos=(85, 20), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.maplocationy_value = wx.ComboBox(self, value=self.default[4], pos=(135, 20), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.Map_LocationX, self.maplocationx_value)
self.Bind(wx.EVT_COMBOBOX, self.Map_LocationY, self.maplocationy_value)
self.value2 = self.default[2]
self.value3 = self.default[4]
# Direction
self.choices = ['2','4','6','8']
self.direction = wx.StaticText(self, label="Direction", pos=(15,42))
self.direction_value = wx.ComboBox(self, value=self.default[6], pos=(85, 40), size=(50, -1), choices=self.choices, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.Direction, self.direction_value)
self.value4 = self.default[6]
# Confirm Button
self.confirmbutton =wx.Button(self, label="Confirm", pos=(45, 90))
self.Bind(wx.EVT_BUTTON, self.ConfirmButton,self.confirmbutton)
# Create Actions
def Map_Id(self, event):
self.value1 = event.GetString()
def Map_LocationX(self, event):
self.value2 = event.GetString()
def Map_LocationY(self, event):
self.value3 = event.GetString()
def Direction(self, event):
self.value4 = event.GetString()
def ConfirmButton(self, event):
list = [self.value1,self.value2,self.value3,self.value4]
self.main.Edit_Terrain(list,self.id)
def OnClose(self, event):
self.parent.MakeModal(False)
event.Skip()
class MainPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
parent.CreateStatusBar()
self.terrain_list = []
self.map_list = []
# self.status.SetStatusText('')
# Create File Items
filemenu= wx.Menu()
MenuHelp = filemenu.Append(wx.ID_HELP, "&Help"," Opens help file")
MenuAbout = filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
MenuExit = filemenu.Append(wx.ID_EXIT, "&Exit"," Closses the program")
# Creating the menubar.
menuBar = wx.MenuBar()
menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
parent.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.
# Set File Items
parent.Bind(wx.EVT_MENU, self.OnHelp, MenuHelp)
parent.Bind(wx.EVT_MENU, self.OnAbout, MenuAbout)
parent.Bind(wx.EVT_MENU, self.OnExit, MenuExit)
# Text
self.code = wx.StaticText(self, label="Generated Code", pos=(600,15))
self.logger = wx.TextCtrl(self, pos=(300,30), size=(700,300), style=wx.TE_MULTILINE | wx.TE_READONLY)
self.logger.SetToolTip(wx.ToolTip("The generated script."))
# The Generate Button
self.generatebutton =wx.Button(self, label="Generate Code", pos=(600, 400))
self.Bind(wx.EVT_BUTTON, self.Generate,self.generatebutton)
# The Battle Config
self.battleconfig = wx.StaticText(self, label="Battle Config", pos=(100,22))
# The Escape Key
self.escapekey = wx.StaticText(self, label="Escape Key :", pos=(20,62))
self.escapekey_value = wx.TextCtrl(self, value="R", pos=(105, 60), size=(150,-1))
self.value1 = 'R'
self.Bind(wx.EVT_TEXT, self.Escape_Key, self.escapekey_value)
self.escapekey_value.SetToolTip(wx.ToolTip("The Key used to escape battles."))
# The Escape Time
self.escapetime = wx.StaticText(self, label="Escape Time :", pos=(20,82))
self.escapetime_value = wx.TextCtrl(self, value="250", pos=(105, 80), size=(150,-1))
self.value2 = '250'
self.Bind(wx.EVT_TEXT, self.Escape_Time, self.escapetime_value)
self.escapetime_value.SetToolTip(wx.ToolTip("How long it will take to escape 40 = 1 sec."))
# The Escape Text
self.escapetext = wx.StaticText(self, label="Escape Text:", pos=(20,102))
self.escapetext_value = wx.TextCtrl(self, value="RUNNING", pos=(105, 100), size=(150,-1))
self.value3 = 'RUNNING'
self.Bind(wx.EVT_TEXT, self.Escape_Text, self.escapetext_value)
self.escapetext_value.SetToolTip(wx.ToolTip("The text displayed over the bar when escaping."))
# The Escape Location
self.escapelocation = wx.StaticText(self, label="Escape Location:", pos=(20,122))
self.escapelocationx_value = wx.TextCtrl(self, value="200", pos=(105, 120), size=(75,-1))
self.escapelocationy_value = wx.TextCtrl(self, value="410", pos=(180, 120), size=(75,-1))
self.value4 = '200'
self.value5 = '410'
self.Bind(wx.EVT_TEXT, self.Escape_LocationX, self.escapelocationx_value)
self.Bind(wx.EVT_TEXT, self.Escape_LocationY, self.escapelocationy_value)
self.escapelocationx_value.SetToolTip(wx.ToolTip("The X location of the escape bar."))
self.escapelocationy_value.SetToolTip(wx.ToolTip("The Y location of the escape bar."))
# The Wait Time
self.waittime = wx.StaticText(self, label="Wait Time:", pos=(20,142))
self.waittime_value = wx.TextCtrl(self, value="5", pos=(105, 140), size=(150,-1))
self.value6 = '5'
self.Bind(wx.EVT_TEXT, self.Wait_Time, self.waittime_value)
self.waittime_value.SetToolTip(wx.ToolTip("How long it will take before the battle result window is disposed"))
# The Battle Menu
self.battlemenu = wx.StaticText(self, label="Battle Menu:", pos=(20,162))
self.battlemenu_value = wx.TextCtrl(self, value="False", pos=(105, 160), size=(150,-1))
self.value8 = 'False'
self.Bind(wx.EVT_TEXT, self.Battle_Menu, self.battlemenu_value)
self.battlemenu_value.SetToolTip(wx.ToolTip("If use menu is not disabled use this to call a menu false for none or example(Scene_Menu)"))
# Tons Check
self.usetons = wx.CheckBox(self, label="Are you using Tons Of Add-ons Bars ?", pos=(20,185))
self.value7 = 'false'
self.Bind(wx.EVT_CHECKBOX, self.Tons_Check, self.usetons)
# Disable Menu Check
self.disablemenucheck = wx.CheckBox(self, label="Disable The menu in battle ?", pos=(20,205))
self.disablemenucheck.SetValue(True)
self.value9 = 'true'
self.Bind(wx.EVT_CHECKBOX, self.Disable_Menu_Check, self.disablemenucheck)
# Transition Pack Config
self.battleconfig = wx.StaticText(self, label="Transition_Pack Config", pos=(100,242))
self.battleconfig = wx.StaticText(self, label="Ignore this if not using Transition Pack by Fantasist", pos=(20,262))
# Using Pack Check
self.usingpackcheck = wx.CheckBox(self, label="Are you using the pack ?", pos=(20,305))
self.value10 = 'false'
self.Bind(wx.EVT_CHECKBOX, self.Using_Pack_Check, self.usingpackcheck)
# The Type
self.choices = []
for i in range(0, 10):
self.choices.append('%s' % i)
self.type = wx.StaticText(self, label="Type:", pos=(20,322))
self.type_value = wx.ComboBox(self, value='0', pos=(105, 320), size=(150, -1), choices=self.choices, style=wx.CB_READONLY)
self.value11 = '0'
self.Bind(wx.EVT_COMBOBOX, self.Type, self.type_value)
self.type_value.SetToolTip(wx.ToolTip("This is defined in the Transition Pack by Fantasist instructions"))
# The Args
self.args = wx.StaticText(self, label="Args:", pos=(20,342))
self.args_value = wx.TextCtrl(self, value="nill", pos=(105, 340), size=(150,-1))
self.value12 = 'nill'
self.Bind(wx.EVT_TEXT, self.Args, self.args_value)
self.args_value.SetToolTip(wx.ToolTip("This is defined in the Transition Pack by Fantasist instructions"))
# Terrains Config
self.battleconfig = wx.StaticText(self, label="Terrains Config", pos=(100,382))
# The Terrains
self.terrainstext = wx.StaticText(self, label="Terrains", pos=(55,402))
self.terrains = wx.ListCtrl(self, pos=(20,420), size=(110,100),style=wx.wx.LC_LIST|wx.LC_SORT_ASCENDING)
self.listid = 0
self.terrains.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnSelect)
self.terrains.SetToolTip(wx.ToolTip("A list of terrains"))
# Terrain Buttons
self.addbutton =wx.Button(self, label="Add Terrain", pos=(37, 540))
self.Bind(wx.EVT_BUTTON, self.Add,self.addbutton)
self.editbutton =wx.Button(self, label="Edit Terrain", pos=(37, 570))
self.Bind(wx.EVT_BUTTON, self.Edit,self.editbutton)
self.Clearbutton =wx.Button(self, label=" Clear ", pos=(37, 600))
self.Bind(wx.EVT_BUTTON, self.Clear,self.Clearbutton)
# The Map Ids
self.mapstext = wx.StaticText(self, label="Maps", pos=(165,402))
self.maps = wx.ListCtrl(self, pos=(130,420), size=(110,100),style=wx.wx.LC_LIST|wx.LC_SORT_ASCENDING)
self.listid2 = 0
#self.maps.Bind(wx.EVT_LIST_ITEM_SELECTED,self.OnSelect2)
self.maps.SetToolTip(wx.ToolTip("A list of maps"))
# Map Buttons
self.addbutton2 =wx.Button(self, label="Add Map", pos=(147, 540))
#self.Bind(wx.EVT_BUTTON, self.Add,self.addbutton)
self.editbutton2 =wx.Button(self, label="Edit Map", pos=(147, 570))
#self.Bind(wx.EVT_BUTTON, self.Edit,self.editbutton)
self.Clearbutton2 =wx.Button(self, label=" Clear ", pos=(147, 600))
#self.Bind(wx.EVT_BUTTON, self.Clear,self.Clearbutton)
# Create the actions
def Add_Terrain(self, list):
self.terrain_list.append('%s,%s,%s,%s' % (list[0],list[1],list[2],list[3]))
id = len(self.terrain_list) - 1
self.terrains.InsertStringItem(self.listid,('Terrain[%s]%s' % (id,self.terrain_list[-1])))
def Edit_Terrain(self, list, id):
self.terrain_list[id] = ('%s,%s,%s,%s' % (list[0],list[1],list[2],list[3]))
self.terrains.SetItemText(id,('Terrain[%s]%s' % (id,self.terrain_list[id])))
def OnSelect(self, event):
self.index = event.m_itemIndex
def OnHelp(self, event):
os.startfile("Battle Dome Help.chm")
def OnAbout(self, event):
CreateAbout(None).Show()
def OnExit(self, event):
self.Close(True)
def Escape_Key(self, event):
self.value1 = event.GetString()
def Escape_Time(self, event):
self.value2 = event.GetString()
def Escape_Text(self, event):
self.value3 = event.GetString()
def Escape_LocationX(self, event):
self.value4 = event.GetString()
def Escape_LocationY(self, event):
self.value5 = event.GetString()
def Wait_Time(self, event):
self.value6 = event.GetString()
def Battle_Menu(self, event):
self.value8 = event.GetString()
def Tons_Check(self, event):
if event.IsChecked(): self.value7 = 'true'
else: self.value7 = 'false'
def Disable_Menu_Check(self, event):
if event.IsChecked(): self.value9 = 'true'
else: self.value9 = 'false'
def Using_Pack_Check(self, event):
if event.IsChecked(): self.value10 = 'true'
else: self.value10 = 'false'
def Type(self, event):
self.value11 = event.GetString()
def Args(self, event):
self.value12 = event.GetString()
def Add(self, event):
window = wx.Frame(self, title='Add Terrain',size=(200,150))
window.MakeModal(True)
CreateAdd(window,self)
window.Show()
def Edit(self, event):
try:
a = self.index
window = wx.Frame(self, title='Edit Terrain',size=(200,150))
window.MakeModal(True)
CreateEdit(window,self,self.index,self.terrain_list[self.index])
window.Show()
except AttributeError:
error = wx.MessageDialog( self, "Select a terrain before selecting edit", "Error", wx.OK)
error.ShowModal()
error.Destroy()
def Clear(self, event):
self.terrain_list = []
self.terrains.ClearAll()
def Generate(self,event):
self.logger.Clear
self.text = [
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# Battle Dome by Nathmatt',
'# Version: 1.19',
'# Type: Add On',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# ',
'# PART 1',
'#',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# ',
'# This work is protected by the following license:',
'# #----------------------------------------------------------------------------',
'# # ',
'# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported',
'# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )',
'# # ',
'# # You are free:',
'# # ',
'# # to Share - to copy, distribute and transmit the work',
'# # to Remix - to adapt the work',
'# # ',
'# # Under the following conditions:',
'# # ',
'# # Attribution. You must attribute the work in the manner specified by the',
'# # author or licensor (but not in any way that suggests that they endorse you',
'# # or your use of the work).',
'# # ',
'# # Noncommercial. You may not use this work for commercial purposes.',
'# # ',
'# # Share alike. If you alter, transform, or build upon this work, you may',
'# # distribute the resulting work only under the same or similar license to',
'# # this one.',
'# # ',
'# # - For any reuse or distribution, you must make clear to others the license',
'# # terms of this work. The best way to do this is with a link to this web',
'# # page.',
'# # ',
'# # - Any of the above conditions can be waived if you get permission from the',
'# # copyright holder.',
'# # ',
'# # - Nothing in this license impairs or restricts the author\'s moral rights.',
'# # ',
'# #-----------------------------------------------------------------------------',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'#==============================================================================',
'# Battle_Dome',
'#------------------------------------------------------------------------------',
'# This is the master control, configuration.',
'# module for Battle_Dome.',
'#==============================================================================',
'module Battle_Dome',
'',
'',
'',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# Battle_Dome::Control.',
'#----------------------------------------------------------------------------',
'# This module provides in-game control configurations.',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'module Control']
for i in range(0, len(self.text)):
self.logger.AppendText('%s\n' % self.text[i])
self.logger.AppendText(' Escape = \'%s\' # The button you press to escape(only in battle).' % self.value1)
self.text = [
'end',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# Battle_Dome::Config',
'#----------------------------------------------------------------------------',
'# This module provides Battle_Dome configurations.',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'module Config',
'# in frames ',]
for i in range(0, len(self.text)):
self.logger.AppendText('%s\n' % self.text[i])
self.logger.AppendText(' Escape_Time = %s # How long it will take to escape.\n' % self.value2)
self.logger.AppendText(' Escape_Text = \'%s\' # The text displayed when escaping.\n' % self.value3)
self.logger.AppendText(' Use_Tons = %s # If you want to use tons bars.\n' % self.value7)
self.logger.AppendText(' Escape_bar_x = %s # The escape bar x co-ordanance.\n' % self.value4)
self.logger.AppendText(' Escape_bar_y = %s # The escape bar y co-ordanance.\n' % self.value5)
self.logger.AppendText(' Wait_Time = %s # How long the result window will be displayed.\n' % self.value6)
self.logger.AppendText(' Disable_menu = %s # Disables the menu during battle.\n' % self.value9)
self.logger.AppendText(' Battle_menu = %s # Allows you to call a battle menu (false or the call example(\'Scene_Menu\')).\n' % self.value9)
self.text = [
'end',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# Battle_Dome::Transition_Pack',
'#----------------------------------------------------------------------------',
'# This module ensures compatibility with Transition Pack by Fantasist.',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'module Transition_Pack']
for i in range(0, len(self.text)):
self.logger.AppendText('%s\n' % self.text[i])
self.logger.AppendText(' Using_Pack = %s # Whether or not you are using the Transition Pack.\n' % self.value10)
self.logger.AppendText(' Type = %s # The type defined in the Transition Pack instructions.\n' % self.value11)
self.logger.AppendText(' Args = %s # The args defined in the Transition Pack instructions.\n' % self.value12)
self.text = [
'end',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# Battle_Dome::Terrains',
'#----------------------------------------------------------------------------',
'# This module provides Battle_Dome terrain information.',
'# Add You\'r Terrains here to change your terrain call ',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'module Terrains',
'Terrain = []',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'#',
'# Terrain[1] = [M,X,Y,D] Terrain[2] = [M,X,Y,D] ect...',
'#',
'# M, # Replace the (M) with the map id you want to go to.',
'# ',
'# X, # Replace the (X) with the X concordances you want go to.',
'#',
'# Y, # Replace the (Y) with the Y concordances you go to.',
'#',
'# D, # Replace the (D) with the direction you want to face',
'# # (8) IS UP (6) IS RIGHT (2) IS DOWN (4) IS LEFT',
'#',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=']
for i in range(0, len(self.text)):
self.logger.AppendText('%s\n' % self.text[i])
for i in range(0, len(self.terrain_list)):
self.logger.AppendText('Terrain[%s] = %s\n' % (i+1,self.terrain_list))
self.text = [
'end',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'# Battle_Dome::Terrain_Maps',
'#----------------------------------------------------------------------------',
'# This module changes the terrain automaticly depending on the map',
'# you are on. ',
'#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=',
'module Terrain_Maps',
'#--------------------------------------------------------------------------',
'# Terrains',
'# (id) - is the terrain id',
'# (return [the map ids]) - is the array of map ids for that terrain',
'# This is where you set up what maps equals what terrains.',
'#--------------------------------------------------------------------------',
'def self.Terrains(id)',
' case id']
for i in range(0, len(self.text)):
self.logger.AppendText('%s\n' % self.text[i])
app = wx.App(False)
frame = wx.Frame(None,title='Battle Done Config',size=(1024,768))
panel = MainPanel(frame)
frame.Show()
app.MainLoop()