aoe2_probe/prebuilt/ver1_46/
effect.rs1use std::sync::Arc;
2
3use crate::{
4 parse::Token,
5 utils::{map::*, DynString},
6};
7
8pub struct Effect;
9
10impl Effect {
11 pub fn template() -> Token {
12 let mut root = PatchedMap::with_capacity(58);
13 root.push_back("effect_type", 0_i32);
14 root.push_back("static_value_46", 53_i32);
15 root.push_back("ai_script_goal", -1_i32);
16 root.push_back("quantity", -1_i16);
17 root.push_back("class", -1_i16);
18 root.push_back("tribute_list", -1_i32);
19 root.push_back("diplomacy", -1_i32);
20 root.push_back("number_of_units_selected", -1_i32);
21 root.push_back("legacy_location_object_reference", -1_i32);
22 root.push_back("object_list_unit_id", -1_i32);
23 root.push_back("source_player", -1_i32);
24 root.push_back("target_player", -1_i32);
25 root.push_back("technology", -1_i32);
26 root.push_back("string_id", -1_i32);
27 root.push_back("unknown_2", -1_i32);
28 root.push_back("display_time", -1_i32);
29 root.push_back("trigger_id", -1_i32);
30 root.push_back("location_x", -1_i32);
31 root.push_back("location_y", -1_i32);
32 root.push_back("area_x1", -1_i32);
33 root.push_back("area_y1", -1_i32);
34 root.push_back("area_x2", -1_i32);
35 root.push_back("area_y2", -1_i32);
36 root.push_back("object_group", -1_i32);
37 root.push_back("object_type", -1_i32);
38 root.push_back("instruction_panel_position", -1_i32);
39 root.push_back("attack_stance", -1_i32);
40 root.push_back("time_unit", -1_i32);
41 root.push_back("enabled", -1_i32);
42 root.push_back("food", -1_i32);
43 root.push_back("wood", -1_i32);
44 root.push_back("stone", -1_i32);
45 root.push_back("gold", -1_i32);
46 root.push_back("item_id", -1_i32);
47 root.push_back("flash_object", -1_i32);
48 root.push_back("force_research_technology", -1_i32);
49 root.push_back("visibility_state", -1_i32);
50 root.push_back("scroll", -1_i32);
51 root.push_back("operation", -1_i32);
52 root.push_back("object_list_unit_id_2", -1_i32);
53 root.push_back("button_location", -1_i32);
54 root.push_back("ai_signal_value", -1_i32);
55 root.push_back("unknown_3", -1_i32);
56 root.push_back("object_attributes", -1_i32);
57 root.push_back("variable", -1_i32);
58 root.push_back("timer", -1_i32);
59 root.push_back("facet", -1_i32);
60 root.push_back("location_object_reference", -1_i32);
61 root.push_back("play_sound", -1_i32);
62 root.push_back("player_color", -1_i32);
63 root.push_back("unknown_4", -1_i32);
64 root.push_back("color_mood", -1_i32);
65 root.push_back("reset_timer", -1_i32);
66 root.push_back("object_state", -1_i32);
67 root.push_back("action_type", -1_i32);
68 root.push_back("message", DynString::with_capacity(0_u32, ""));
69 root.push_back("sound_name", DynString::with_capacity(0_u32, ""));
70 root.push_back("selected_object_ids", vec![0_i32.into()]);
71
72 root.patches.insert(
73 "selected_object_ids".to_string(),
74 Arc::new(|map: &mut PatchedMap, template: &mut Token| {
75 if map.contains("number_of_units_selected") {
76 let count = *map["number_of_units_selected"].try_i32();
77 let unit = template.try_vec()[0].clone();
78 let vec = template.try_mut_vec();
79 vec.clear();
80
81 for _ in 0..count {
82 vec.push(unit.clone());
83 }
84 }
85 }),
86 );
87
88 root.into()
89 }
90 pub fn default() -> Token {
91 let mut root = PatchedMap::with_capacity(58);
92 root.push_back("effect_type", 0_i32);
93 root.push_back("static_value_46", 53_i32);
94 root.push_back("ai_script_goal", -1_i32);
95 root.push_back("quantity", -1_i32);
96 root.push_back("tribute_list", -1_i32);
97 root.push_back("diplomacy", -1_i32);
98 root.push_back("number_of_units_selected", -1_i32);
99 root.push_back("legacy_location_object_reference", -1_i32);
100 root.push_back("object_list_unit_id", -1_i32);
101 root.push_back("source_player", -1_i32);
102 root.push_back("target_player", -1_i32);
103 root.push_back("technology", -1_i32);
104 root.push_back("string_id", -1_i32);
105 root.push_back("unknown_2", -1_i32);
106 root.push_back("display_time", -1_i32);
107 root.push_back("trigger_id", -1_i32);
108 root.push_back("location_x", -1_i32);
109 root.push_back("location_y", -1_i32);
110 root.push_back("area_x1", -1_i32);
111 root.push_back("area_y1", -1_i32);
112 root.push_back("area_x2", -1_i32);
113 root.push_back("area_y2", -1_i32);
114 root.push_back("object_group", -1_i32);
115 root.push_back("object_type", -1_i32);
116 root.push_back("instruction_panel_position", -1_i32);
117 root.push_back("attack_stance", -1_i32);
118 root.push_back("time_unit", -1_i32);
119 root.push_back("enabled", -1_i32);
120 root.push_back("food", -1_i32);
121 root.push_back("wood", -1_i32);
122 root.push_back("stone", -1_i32);
123 root.push_back("gold", -1_i32);
124 root.push_back("item_id", -1_i32);
125 root.push_back("flash_object", -1_i32);
126 root.push_back("force_research_technology", -1_i32);
127 root.push_back("visibility_state", -1_i32);
128 root.push_back("scroll", -1_i32);
129 root.push_back("operation", -1_i32);
130 root.push_back("object_list_unit_id_2", -1_i32);
131 root.push_back("button_location", -1_i32);
132 root.push_back("ai_signal_value", -1_i32);
133 root.push_back("unknown_3", -1_i32);
134 root.push_back("object_attributes", -1_i32);
135 root.push_back("variable", -1_i32);
136 root.push_back("timer", -1_i32);
137 root.push_back("facet", -1_i32);
138 root.push_back("location_object_reference", -1_i32);
139 root.push_back("play_sound", -1_i32);
140 root.push_back("player_color", -1_i32);
141 root.push_back("unknown_4", -1_i32);
142 root.push_back("color_mood", -1_i32);
143 root.push_back("reset_timer", -1_i32);
144 root.push_back("object_state", -1_i32);
145 root.push_back("action_type", -1_i32);
146 root.push_back("message", DynString::with_capacity(0_u32, ""));
147 root.push_back("sound_name", DynString::with_capacity(0_u32, ""));
148 root.push_back("selected_object_ids", vec![]);
149
150 root.into()
151 }
152}