1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
| #=====================================================
# Debug_Help
#=====================================================
# - Crée par Crystal le 15/05/09
# - Version 1.0
#=====================================================
module DH_Info
Limit = 10 # Nombre de changements affichés simultanément
Common_Events = false # Contrôle l'affichage des événements communs
Cx = 0 # Position de la fenêtre en x
Cy = 0 # Position de la fenêtre en y
Opacity = 25 # Opacité de la fenêtre
Windowskin = "001-Blue01"
Font_Face = "Lucida Console" # Police
Font_Size = 10 # Taille de la police
Width = 450 # Largeur de la fenêtre
Map_Exceptions = [] # ID des maps où le script n'agit pas
Var_Exceptions = [] # ID des variables qui sont ignorées par le script
Sw_Exceptions = [] # ID des interrupteurs qui sont ignorés par le script
# =====================
# Les deux groupes suivants sont liés, n'oubliez pas de remplir les deux en même temps.
Ev_Exceptions = [] # ID des événements ignorés par le script.
EvMap_Exceptions = [] # ID de la map associé à l'ID de l'ev. ignoré correspondant.
# =====================
Cev_Exceptions = [] # ID des événements communs ignorés par le script
end
class Debug_Help < Window_Base
#===================================================
# Fonction de création de la fenêtre
#===================================================
def initialize()
super(DH_Info::Cx, DH_Info::Cy, DH_Info::Width, (DH_Info::Limit *
DH_Info::Font_Size) + 50)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = DH_Info::Opacity
self.contents.font.name = DH_Info::Font_Face
self.contents.font.size = DH_Info::Font_Size
self.windowskin = RPG::Cache.windowskin(DH_Info::Windowskin)
self.z = 1000
refresh
end
def refresh
self.contents.clear
$debugger_list = Array.new if $debugger_list.nil?
deb = $debugger_list
a = deb.size - DH_Info::Limit
a = 0 if a < 0
b = deb.size - 1
if b > -1
d = 0
for i in a..b
self.contents.font.color = Color.new(255, 255, 255, 255)
if ! deb[i][2].is_a?(Numeric)
self.contents.font.color = Color.new(255, 210, 210, 255) if deb[i][5] == 1
self.contents.font.color = Color.new(255, 150, 150, 255) if deb[i][5] == 2
self.contents.font.color = Color.new(255, 90, 90, 255) if deb[i][5] >= 3
self.contents.draw_text(10, (d * DH_Info::Font_Size) - 15, DH_Info::Width, 62,
deb[i][0].to_s + " : " + deb[i][1] + " = " +
(deb[i][2] ? "Activé" : "Désactivé") + " (Map: #{deb[i][4]}, Ev.: #{deb[i][3]})")
else
self.contents.font.color = Color.new(255, 210, 210, 255) if deb[i][7] == 1
self.contents.font.color = Color.new(255, 150, 150, 255) if deb[i][7] == 2
self.contents.font.color = Color.new(255, 90, 90, 255) if deb[i][7] >= 3
case deb[i][5]
when 0; c = "="; when 1; c = "+"; when 2; c = "-"; when 3; c = "*"; when 4; c = "/"
when 5; c = "%"
end
self.contents.draw_text(10, (d * DH_Info::Font_Size) - 15, DH_Info::Width, 62,
deb[i][0].to_s + " : " + deb[i][1] + " (#{c} #{deb[i][6]}) = " + deb[i][2].to_s +
" (Map: #{deb[i][4]}, Ev.: #{deb[i][3]})")
end
d += 1
end
end
end
end
#===================================================
# Compléments de fonctions nécessaires
#===================================================
class Game_CommonEvent
def refresh
if self.trigger == 2 and $game_switches[self.switch_id] == true
if @interpreter == nil
@interpreter = Interpreter.new(0, false, true, @common_event_id)
end
else
@interpreter = nil
end
end
end
class Interpreter
def initialize(depth = 0, main = false, c_event_identifier = false, c_event_id = 0)
@depth = depth
@main = main
@c_event = c_event_identifier
@c_event_id = c_event_id
if depth > 100
print("The common event call exceeded the upper boundary.")
exit
end
clear
end
def command_121
for i in @parameters[0] .. @parameters[1]
$debugger_list = Array.new if $debugger_list.nil?
$mem_list_dh = Array.new if $mem_list_dh.nil?
ev_id = @event_id
error = 0
valid = ([i, $data_system.switches[i], $game_switches[i], ev_id,
$game_map.map_id] != $mem_list_dh)
valid = false if DH_Info::Map_Exceptions.include?($game_map.map_id)
if ! @c_event && DH_Info::Ev_Exceptions.include?(ev_id)
valid = false if DH_Info::EvMap_Exceptions[DH_Info::Ev_Exceptions.index(ev_id)] == $game_map.map_id
end
valid = false if @c_event && DH_Info::Cev_Exceptions.include?(@c_event_id)
valid = false if DH_Info::Sw_Exceptions.include?(i)
valid = false if ev_id == 0 && ! DH_Info::Common_Events
if valid
if @c_event && DH_Info::Common_Events
ev_id = "Ev. com. #{@c_event_id} : " +
"#{$data_common_events[@c_event_id].name}"
end
if ! @c_event || (@c_event && DH_Info::Common_Events)
if $debugger_list[$debugger_list.size - 2] == [i, $data_system.switches[i],
$game_switches[i], ev_id, $game_map.map_id, 0] ||
$debugger_list[$debugger_list.size - 2] == [i, $data_system.switches[i],
$game_switches[i], ev_id, $game_map.map_id, 1] ||
$debugger_list[$debugger_list.size - 2] == [i, $data_system.switches[i],
$game_switches[i], ev_id, $game_map.map_id, 2]
error += 1
end
$debugger_list.push([i, $data_system.switches[i], $game_switches[i], ev_id,
$game_map.map_id, error])
$mem_list_dh = [i, $data_system.switches[i], $game_switches[i], ev_id,
$game_map.map_id]
end
end
$game_switches[i] = (@parameters[2] == 0)
end
$game_map.need_refresh = true
return true
end
def command_122
value = 0
case @parameters[3]
when 0; value = @parameters[4]; when 1; value = $game_variables[@parameters[4]]
when 2; value = @parameters[4] + rand(@parameters[5] - @parameters[4] + 1)
when 3; value = $game_party.item_number(@parameters[4])
when 4; actor = $game_actors[@parameters[4]]
if actor != nil
case @parameters[5]
when 0; value = actor.level; when 1; value = actor.exp; when 2; value = actor.hp
when 3; value = actor.sp; when 4; value = actor.maxhp; when 5; value = actor.maxsp
when 6; value = actor.str; when 7; value = actor.dex; when 8; value = actor.agi
when 9; value = actor.int; when 10; value = actor.atk; when 11; value = actor.pdef
when 12; value = actor.mdef; when 13; value = actor.eva
end
end
when 5; enemy = $game_troop.enemies[@parameters[4]]
if enemy != nil
case @parameters[5]
when 0; value = enemy.hp; when 1; value = enemy.sp; when 2; value = enemy.maxhp
when 3; value = enemy.maxsp; when 4; value = enemy.str; when 5; value = enemy.dex
when 6; value = enemy.agi; when 7; value = enemy.int; when 8; value = enemy.atk
when 9; value = enemy.pdef; when 10; value = enemy.mdef; when 11; value = enemy.eva
end
end
when 6; character = get_character(@parameters[4])
if character != nil
case @parameters[5]
when 0; value = character.x; when 1; value = character.y
when 2; value = character.direction; when 3; value = character.screen_x
when 4; value = character.screen_y; when 5; value = character.terrain_tag
end
end
when 7
case @parameters[4]
when 0; value = $game_map.map_id; when 1; value = $game_party.actors.size
when 2; value = $game_party.gold; when 3; value = $game_party.steps
when 4; value = Graphics.frame_count / Graphics.frame_rate
when 5; value = $game_system.timer / Graphics.frame_rate
when 6; value = $game_system.save_count
end
end
for i in @parameters[0] .. @parameters[1]
mem_var = $game_variables[i]
case @parameters[2]
when 0; $game_variables[i] = value; when 1; $game_variables[i] += value
when 2; $game_variables[i] -= value; when 3; $game_variables[i] *= value
when 4; if value != 0; $game_variables[i] /= value; end
when 5; if value != 0; $game_variables[i] %= value; end
end
if $game_variables[i] > 0b101111101011110000011111111
$game_variables[i] = 0b101111101011110000011111111
end
if $game_variables[i] < -0b101111101011110000011111111
$game_variables[i] = -0b101111101011110000011111111
end
$debugger_list = Array.new if $debugger_list.nil?
$mem_list_dh = Array.new if $mem_list_dh.nil?
ev_id = @event_id
error = 0
valid = ([i, $data_system.variables[i], $game_variables[i], ev_id,
$game_map.map_id, @parameters[2], value] != $mem_list_dh)
valid = false if DH_Info::Map_Exceptions.include?($game_map.map_id)
if ! @c_event && DH_Info::Ev_Exceptions.include?(ev_id)
valid = false if DH_Info::EvMap_Exceptions[DH_Info::Ev_Exceptions.index(ev_id)] == $game_map.map_id
end
valid = false if @c_event && DH_Info::Cev_Exceptions.include?(@c_event_id)
valid = false if DH_Info::Var_Exceptions.include?(i)
valid = false if ev_id == 0 && ! DH_Info::Common_Events
if valid
if @c_event && DH_Info::Common_Events
ev_id = "Ev. com. #{@c_event_id} : " +
"#{$data_common_events[@c_event_id].name}"
end
if ! @c_event || (@c_event && DH_Info::Common_Events)
if $debugger_list[$debugger_list.size - 2] == [i, $data_system.variables[i],
$game_variables[i], ev_id, $game_map.map_id, @parameters[2], value, 0] ||
$debugger_list[$debugger_list.size - 2] == [i, $data_system.variables[i],
$game_variables[i], ev_id, $game_map.map_id, @parameters[2], value, 1] ||
$debugger_list[$debugger_list.size - 2] == [i, $data_system.variables[i],
$game_variables[i], ev_id, $game_map.map_id, @parameters[2], value, 2]
error += 1
end
if (($game_variables[i] > (((mem_var + 1) ^ 2) * 20)) ||
($game_variables[i] < (((mem_var + 1) ^ 2) * -20))) && mem_var != 0
error += 1
end
error += 1 if value == 0 && (@parameters[2] == 4 || @parameters[2] == 5)
$debugger_list.push([i, $data_system.variables[i], $game_variables[i], ev_id,
$game_map.map_id, @parameters[2], value, error])
$mem_list_dh = [i, $data_system.variables[i], $game_variables[i], ev_id,
$game_map.map_id, @parameters[2], value]
end
end
end
$game_map.need_refresh = true
return true
end
end |