@@ -38,6 +38,7 @@ pub struct ScriptValidator {
3838 needs_marker : Regex ,
3939 marker_id : Regex ,
4040 mod_reputation : Regex ,
41+ mod_facrep : Regex ,
4142}
4243
4344struct ScriptInfo {
@@ -184,6 +185,40 @@ impl Handler<'_> for ScriptValidator {
184185 ) ;
185186 }
186187 }
188+ if let Some ( captures) = self . mod_facrep . captures ( code) {
189+ if captures. get ( 3 ) . is_none ( ) {
190+ if let TES3Object :: DialogueInfo ( info) = record {
191+ println ! (
192+ "Info {} in topic {} uses ModPCFacRep without specifying a faction" ,
193+ info. id, topic. id
194+ ) ;
195+ } else if let TES3Object :: Script ( script) = record {
196+ println ! (
197+ "Script {} uses ModReputation without specifying a faction" ,
198+ script. id
199+ ) ;
200+ }
201+ }
202+ let mut garbage = code. contains ( ',' ) ;
203+ if !garbage {
204+ if let Some ( capture) = captures. get ( 1 ) {
205+ garbage = capture. as_str ( ) . contains ( '"' ) ;
206+ }
207+ }
208+ if garbage {
209+ if let TES3Object :: DialogueInfo ( info) = record {
210+ println ! (
211+ "Info {} in topic {} contains superfluous characters in a ModPCFacRep call" ,
212+ info. id, topic. id
213+ ) ;
214+ } else if let TES3Object :: Script ( script) = record {
215+ println ! (
216+ "Script {} contains superfluous characters in a ModPCFacRep call" ,
217+ script. id
218+ ) ;
219+ }
220+ }
221+ }
187222 }
188223
189224 fn on_cellref (
@@ -301,6 +336,7 @@ impl ScriptValidator {
301336 . case_insensitive ( true )
302337 . build ( ) ?;
303338 let mod_reputation = Regex :: new ( r"^[,\s]*modreputation[,\s]" ) ?;
339+ let mod_facrep = Regex :: new ( r#"modpcfacrep[,\s]+([0-9"-]+)([,\s]+([^,\s]+))?[,\s]*$"# ) ?;
304340 Ok ( Self {
305341 unique_heads,
306342 scripts : HashMap :: new ( ) ,
@@ -319,6 +355,7 @@ impl ScriptValidator {
319355 marker_id,
320356 markers : HashMap :: new ( ) ,
321357 mod_reputation,
358+ mod_facrep,
322359 } )
323360 }
324361
0 commit comments