do the bashing via the BashDoor action
[gemrb.git] / gemrb / GUIScripts / iwd2 / AutoPause.py
blob853aad5b80e69686e23d5d3fa4dc369f4f21c6a0
1 # -*-python-*-
2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # autopause options using GUIOPT
22 import GemRB
23 from GUIDefines import *
25 def OnLoad ():
26 global AutoPauseWindow, TextAreaControl
28 GemRB.LoadWindowPack ("GUIOPT", 800, 600)
30 AutoPauseWindow = GemRB.LoadWindow (10)
31 AutoPauseWindow.SetFrame ( )
33 TextAreaControl = AutoPauseWindow.GetControl (15)
35 ChHitButton = AutoPauseWindow.GetControl (17)
36 ChHitButtonB = AutoPauseWindow.GetControl (1)
37 ChHitButtonB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
39 ChInjured = AutoPauseWindow.GetControl (18)
40 ChInjuredB = AutoPauseWindow.GetControl (2)
41 ChInjuredB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
43 ChDeath = AutoPauseWindow.GetControl (19)
44 ChDeathB = AutoPauseWindow.GetControl (3)
45 ChDeathB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
47 ChAttacked = AutoPauseWindow.GetControl (20)
48 ChAttackedB = AutoPauseWindow.GetControl (4)
49 ChAttackedB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
51 WeaponUnusable = AutoPauseWindow.GetControl (21)
52 WeaponUnusableB = AutoPauseWindow.GetControl (5)
53 WeaponUnusableB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
55 TargetDestroyed = AutoPauseWindow.GetControl (22)
56 TargetDestroyedB = AutoPauseWindow.GetControl (13)
57 TargetDestroyedB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
59 EndOfRound = AutoPauseWindow.GetControl (24)
60 EndOfRoundB = AutoPauseWindow.GetControl (25)
61 EndOfRoundB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
63 EnemySighted = AutoPauseWindow.GetControl (31)
64 EnemySightedB = AutoPauseWindow.GetControl (30)
65 EnemySightedB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
67 SpellCast = AutoPauseWindow.GetControl (37)
68 SpellCastB = AutoPauseWindow.GetControl (36)
69 SpellCastB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
71 TrapFound = AutoPauseWindow.GetControl (28)
72 TrapFoundB = AutoPauseWindow.GetControl (26)
73 TrapFoundB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
75 AutopauseCenter = AutoPauseWindow.GetControl (34)
76 AutopauseCenterB = AutoPauseWindow.GetControl (33)
77 AutopauseCenterB.SetSprites ("GBTNOPT4", 0, 0, 1, 2, 3)
79 OkButton = AutoPauseWindow.GetControl (11)
80 CancelButton = AutoPauseWindow.GetControl (14)
82 TextAreaControl.SetText (18044)
83 OkButton.SetText (11973)
84 OkButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
86 CancelButton.SetText (13727)
87 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
89 ChHitButton.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChHitButtonPress)
90 ChHitButtonB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
91 ChHitButtonB.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChHitButtonPress)
93 ChInjured.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChInjuredPress)
94 ChInjuredB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
95 ChInjuredB.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChInjuredPress)
97 ChDeath.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChDeathPress)
98 ChDeathB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
99 ChDeathB.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChDeathPress)
101 ChAttacked.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChAttackedPress)
102 ChAttackedB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
103 ChAttackedB.SetEvent (IE_GUI_BUTTON_ON_PRESS, ChAttackedPress)
105 WeaponUnusable.SetEvent (IE_GUI_BUTTON_ON_PRESS, WeaponUnusablePress)
106 WeaponUnusableB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
107 WeaponUnusableB.SetEvent (IE_GUI_BUTTON_ON_PRESS, WeaponUnusablePress)
109 TargetDestroyed.SetEvent (IE_GUI_BUTTON_ON_PRESS, TargetDestroyedPress)
110 TargetDestroyedB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
111 TargetDestroyedB.SetEvent (IE_GUI_BUTTON_ON_PRESS, TargetDestroyedPress)
113 EndOfRound.SetEvent (IE_GUI_BUTTON_ON_PRESS, EndOfRoundPress)
114 EndOfRoundB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
115 EndOfRoundB.SetEvent (IE_GUI_BUTTON_ON_PRESS, EndOfRoundPress)
117 EnemySighted.SetEvent (IE_GUI_BUTTON_ON_PRESS, EnemySightedPress)
118 EnemySightedB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
119 EnemySightedB.SetEvent (IE_GUI_BUTTON_ON_PRESS, EnemySightedPress)
121 SpellCast.SetEvent (IE_GUI_BUTTON_ON_PRESS, SpellCastPress)
122 SpellCastB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
123 SpellCastB.SetEvent (IE_GUI_BUTTON_ON_PRESS, SpellCastPress)
125 TrapFound.SetEvent (IE_GUI_BUTTON_ON_PRESS, TrapFoundPress)
126 TrapFoundB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
127 TrapFoundB.SetEvent (IE_GUI_BUTTON_ON_PRESS, TrapFoundPress)
129 AutopauseCenter.SetEvent (IE_GUI_BUTTON_ON_PRESS, AutopauseCenterPress)
130 AutopauseCenterB.SetFlags (IE_GUI_BUTTON_CHECKBOX, OP_OR)
131 AutopauseCenterB.SetEvent (IE_GUI_BUTTON_ON_PRESS, AutopauseCenterPress)
133 OkButton.SetEvent (IE_GUI_BUTTON_ON_PRESS, OkPress)
134 CancelButton.SetEvent (IE_GUI_BUTTON_ON_PRESS, CancelPress)
136 AutopauseCenterB.SetVarAssoc ("Auto Pause Center",1)
138 ChHitButtonB.SetVarAssoc ("Auto Pause State",1)
139 ChInjuredB.SetVarAssoc ("Auto Pause State",2)
140 ChDeathB.SetVarAssoc ("Auto Pause State",4)
141 ChAttackedB.SetVarAssoc ("Auto Pause State",8)
142 WeaponUnusableB.SetVarAssoc ("Auto Pause State",16)
143 TargetDestroyedB.SetVarAssoc ("Auto Pause State",32)
144 EndOfRoundB.SetVarAssoc ("Auto Pause State",64)
145 EnemySightedB.SetVarAssoc ("Auto Pause State",128)
146 SpellCastB.SetVarAssoc ("Auto Pause State",256)
147 TrapFoundB.SetVarAssoc ("Auto Pause State",512)
149 AutoPauseWindow.SetVisible (WINDOW_VISIBLE)
150 return
152 def ChHitButtonPress ():
153 TextAreaControl.SetText (18032)
154 return
156 def ChInjuredPress ():
157 TextAreaControl.SetText (18033)
158 return
160 def ChDeathPress ():
161 TextAreaControl.SetText (18034)
162 return
164 def ChAttackedPress ():
165 TextAreaControl.SetText (18035)
166 return
168 def WeaponUnusablePress ():
169 TextAreaControl.SetText (18036)
170 return
172 def TargetDestroyedPress ():
173 TextAreaControl.SetText (18037)
174 return
176 def EndOfRoundPress ():
177 TextAreaControl.SetText (10640)
178 return
180 def EnemySightedPress ():
181 TextAreaControl.SetText (23514)
182 return
184 def SpellCastPress ():
185 TextAreaControl.SetText (26311)
186 return
188 def TrapFoundPress ():
189 TextAreaControl.SetText (18560) #iwd2 has it here
190 return
192 def AutopauseCenterPress ():
193 TextAreaControl.SetText (24888) #iwd2 has it here
194 return
196 def OkPress ():
197 if AutoPauseWindow:
198 AutoPauseWindow.Unload ()
199 GemRB.SetNextScript ("GamePlay")
200 return
202 def CancelPress ():
203 if AutoPauseWindow:
204 AutoPauseWindow.Unload ()
205 GemRB.SetNextScript ("GamePlay")
206 return