@@ -2,7 +2,7 @@ use std::collections::HashSet;
22
33use super :: Context ;
44use crate :: { handlers:: Handler , util:: is_autocalc} ;
5- use codegen:: get_barter_classes;
5+ use codegen:: { get_barter_classes, get_spell_vendor_classes } ;
66use tes3:: esp:: { AiData , ServiceFlags , TES3Object } ;
77
88const SERVICE_FLAGS_BARTERS_ANY : ServiceFlags = ServiceFlags :: from_bits_truncate (
@@ -32,6 +32,7 @@ fn buy_magic_items(ai_data: &AiData) -> bool {
3232
3333pub struct ServiceValidator {
3434 barter_classes : HashSet < String > ,
35+ spell_vendor_classes : HashSet < String > ,
3536}
3637
3738impl Handler < ' _ > for ServiceValidator {
@@ -68,9 +69,14 @@ impl Handler<'_> for ServiceValidator {
6869 let mut barter_menu = false ;
6970 if is_autocalc ( npc) {
7071 if !npc. class . is_empty ( ) {
71- barter_menu = self
72- . barter_classes
73- . contains ( & npc. class . to_ascii_lowercase ( ) ) ;
72+ let lower = npc. class . to_ascii_lowercase ( ) ;
73+ barter_menu = self . barter_classes . contains ( & lower) ;
74+ if self . spell_vendor_classes . contains ( & lower) {
75+ println ! (
76+ "Npc {} is a spell vendor with auto calculated spells" ,
77+ npc. id
78+ ) ;
79+ }
7480 }
7581 } else {
7682 barter_menu = barters ( & npc. ai_data ) ;
@@ -106,6 +112,7 @@ impl ServiceValidator {
106112 pub fn new ( ) -> Self {
107113 Self {
108114 barter_classes : get_barter_classes ! ( ) ,
115+ spell_vendor_classes : get_spell_vendor_classes ! ( ) ,
109116 }
110117 }
111118}
0 commit comments