77import script .library .utils ;
88import script .location ;
99import script .obj_id ;
10+ import script .library .config_utils ;
1011
1112public class spawner_area extends script .base_script
1213{
@@ -23,7 +24,7 @@ public int OnAttach(obj_id self) throws InterruptedException
2324 {
2425 setName (self , getStringObjVar (self , "strName" ));
2526 }
26- if (canSpawnByConfigSetting ())
27+ if (canSpawnByConfigSetting (self ))
2728 {
2829 messageTo (self , "doSpawnEvent" , null , 20 , false );
2930 }
@@ -39,7 +40,7 @@ public int OnInitialize(obj_id self) throws InterruptedException
3940 {
4041 setName (self , getStringObjVar (self , "strName" ));
4142 }
42- if (canSpawnByConfigSetting ())
43+ if (canSpawnByConfigSetting (self ))
4344 {
4445 messageTo (self , "doSpawnEvent" , null , 20 , false );
4546 }
@@ -224,19 +225,78 @@ public int spawnDestroyed(obj_id self, dictionary params) throws InterruptedExce
224225 messageTo (self , "doSpawnEvent" , null , 2 , false );
225226 return SCRIPT_CONTINUE ;
226227 }
227- public boolean canSpawnByConfigSetting () throws InterruptedException
228- {
229- String disableSpawners = getConfigSetting ("GameServer" , "disableAreaSpawners" );
230- if (disableSpawners == null )
231- {
232- return true ;
233- }
234- if (disableSpawners .equals ("true" ) || disableSpawners .equals ("1" ))
235- {
236- return false ;
237- }
238- return true ;
239- }
228+
229+ public boolean canSpawnByConfigSetting (obj_id self ) throws InterruptedException
230+ {
231+ if (config_utils .getBooleanConfig ("GameServer" , "disableAreaSpawners" , false ))
232+ {
233+ return false ;
234+ }
235+
236+
237+ if (!canSpawnTcgVendorByConfigSetting (self ))
238+ {
239+ return false ;
240+ }
241+
242+ return true ;
243+ }
244+
245+ public boolean canSpawnTcgVendorByConfigSetting (obj_id self ) throws InterruptedException
246+ {
247+ if (!isTcgVendorSpawner (self ))
248+ {
249+ return true ;
250+ }
251+
252+ String location = getCurrentSceneName ();
253+
254+ if (location == null || location .length () <= 0 )
255+ {
256+ return true ;
257+ }
258+
259+ if (location .equals ("tatooine" ))
260+ {
261+ return config_utils .getBooleanConfig ("TCGVendors" , "tatooineEnabled" , true );
262+ }
263+
264+ if (location .equals ("naboo" ))
265+ {
266+ return config_utils .getBooleanConfig ("TCGVendors" , "nabooEnabled" , true );
267+ }
268+
269+ if (location .equals ("corellia" ))
270+ {
271+ return config_utils .getBooleanConfig ("TCGVendors" , "corelliaEnabled" , true );
272+ }
273+
274+ if (location .equals ("dungeon1" ))
275+ {
276+ return config_utils .getBooleanConfig ("TCGVendors" , "novaOrionEnabled" , true );
277+ }
278+
279+ return true ;
280+ }
281+
282+ public boolean isTcgVendorSpawner (obj_id self ) throws InterruptedException
283+ {
284+ if (!hasObjVar (self , "strName" ) || !hasObjVar (self , "strSpawns" ))
285+ {
286+ return false ;
287+ }
288+
289+ String spawnerName = getStringObjVar (self , "strName" );
290+ String spawns = getStringObjVar (self , "strSpawns" );
291+
292+ if (spawnerName == null || spawns == null )
293+ {
294+ return false ;
295+ }
296+
297+ return spawnerName .startsWith ("vendor_tcg_" ) && spawns .startsWith ("vendor_tcg_" );
298+ }
299+
240300 public int OnDestroy (obj_id self ) throws InterruptedException
241301 {
242302 if (utils .hasScriptVar (self , "debugSpawnList" ))
0 commit comments