Skip to content

Commit 355796d

Browse files
committed
3.1 Config Refactor
1 parent 694a499 commit 355796d

File tree

148 files changed

+895
-6272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+895
-6272
lines changed

sku.0/sys.server/compiled/game/script/ai/ai.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public ai()
3030
public static final string_id SID_GAVE_RECRUIT_ITEM = new string_id("collection", "gave_recruit_item");
3131
public static final string_id SID_NPC_MEATLUMP_SPEAK = new string_id("collection", "npc_meatlump_speak");
3232
public static final string_id SID_NO_RECRUIT_REB_IMP = new string_id("collection", "no_recruit_reb_imp");
33+
public static final boolean AI_TRIGGER_VOLUMES_DISABLED = utils.checkConfigFlag("GameServer", "disableAITriggerVolumes");
34+
public static final boolean AI_COMBAT_DISABLED = utils.checkConfigFlag("GameServer", "disableAICombat");
35+
public static final boolean AI_LOITER_DISABLED = utils.checkConfigFlag("GameServer", "disableAILoitering");
36+
public static final boolean AI_SCRIPTS_DISABLED = utils.checkConfigFlag("GameServer", "disableAI");
37+
3338
public void initializeScript() throws InterruptedException
3439
{
3540
obj_id self = getSelf();
@@ -211,7 +216,7 @@ public void doDefaultCalmBehavior(obj_id npc) throws InterruptedException
211216
pathTo(npc, pathWaypoint);
212217
return;
213218
}
214-
if (utils.checkConfigFlag("GameServer", "disableAILoitering"))
219+
if (AI_LOITER_DISABLED)
215220
{
216221
LOGC(aiLoggingEnabled(npc), "debug_ai", "ai::doDefaultCalmBehavior() npc(" + npc + ") disableAILoitering");
217222
return;

sku.0/sys.server/compiled/game/script/ai/hunter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public int OnAttach(obj_id self) throws InterruptedException
1414
{
1515
setAttributeInterested(self, attrib.HERBIVORE);
1616
setAttributeInterested(self, attrib.CARNIVORE);
17-
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
17+
if (!ai.AI_TRIGGER_VOLUMES_DISABLED)
1818
{
1919
createTriggerVolume(ALERT_VOLUME_NAME, ai_lib.aiGetApproachTriggerRange(self), true);
2020
}

sku.0/sys.server/compiled/game/script/ai/monster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public monster()
1313
public int OnAttach(obj_id self) throws InterruptedException
1414
{
1515
setAttributeInterested(self, attrib.NPC);
16-
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
16+
if (!ai.AI_TRIGGER_VOLUMES_DISABLED)
1717
{
1818
createTriggerVolume(ALERT_VOLUME_NAME, ai_lib.aiGetApproachTriggerRange(self), true);
1919
}

sku.0/sys.server/compiled/game/script/ai/soldier.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public int OnAttach(obj_id self) throws InterruptedException
2222
setAttributeInterested(self, attrib.THUG);
2323
setAttributeInterested(self, attrib.HERBIVORE);
2424
setAttributeInterested(self, attrib.CARNIVORE);
25-
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
25+
if (!ai.AI_TRIGGER_VOLUMES_DISABLED)
2626
{
2727
createTriggerVolume(ai_lib.ALERT_VOLUME_NAME, ai_lib.aiGetApproachTriggerRange(self), true);
2828
}
@@ -142,7 +142,7 @@ public void doAgitateBehavior(obj_id npc, int behavior) throws InterruptedExcept
142142
{
143143
return;
144144
}
145-
if (getConfigSetting("GameServer", "disableAICombat") != null)
145+
if (ai.AI_COMBAT_DISABLED)
146146
{
147147
return;
148148
}

sku.0/sys.server/compiled/game/script/ai/townperson.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public townperson()
1919
public static final String CREATURE_TABLE = "datatables/mob/creatures.iff";
2020
public int OnAttach(obj_id self) throws InterruptedException
2121
{
22-
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
22+
if (!ai.AI_TRIGGER_VOLUMES_DISABLED)
2323
{
2424
createTriggerVolume(SOCIAL_VOLUME, SOCIAL_RANGE, false);
2525
}
@@ -53,7 +53,7 @@ public int OnAttach(obj_id self) throws InterruptedException
5353
public int OnAddedToWorld(obj_id self) throws InterruptedException
5454
{
5555
utils.removeScriptVar(self, "ai.speaking");
56-
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
56+
if (!ai.AI_TRIGGER_VOLUMES_DISABLED)
5757
{
5858
createTriggerVolume(SOCIAL_VOLUME, SOCIAL_RANGE, false);
5959
}
@@ -321,7 +321,7 @@ public int resumeDefaultCalmBehavior(obj_id self, dictionary params) throws Inte
321321
}
322322
public int OnSawAttack(obj_id self, obj_id defender, obj_id[] attackers) throws InterruptedException
323323
{
324-
if (getConfigSetting("GameServer", "disableAICombat") != null)
324+
if (ai.AI_COMBAT_DISABLED)
325325
{
326326
setWantSawAttackTriggers(self, false);
327327
return SCRIPT_OVERRIDE;

sku.0/sys.server/compiled/game/script/ai/tusken_raider.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public int OnAiTetherStart(obj_id self) throws InterruptedException
4949
public int OnAiTetherComplete(obj_id self) throws InterruptedException
5050
{
5151
LOGC(aiLoggingEnabled(self), "debug_ai", "tusken_raider::OnAiTetherComplete() self(" + self + ":" + getName(self) + ")");
52-
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
52+
if (!ai.AI_TRIGGER_VOLUMES_DISABLED)
5353
{
5454
createTriggerVolume(SOCIAL_VOLUME, SOCIAL_RANGE, false);
5555
}
@@ -273,7 +273,6 @@ public int OnBehaviorChange(obj_id self, int newBehavior, int oldBehavior, int[]
273273
}
274274
if (newBehavior >= BEHAVIOR_ALERT && newBehavior < BEHAVIOR_ATTACK)
275275
{
276-
doAgitateBehavior(self, newBehavior);
277276
return SCRIPT_OVERRIDE;
278277
}
279278
return SCRIPT_CONTINUE;
@@ -289,18 +288,6 @@ public int OnBehaviorChange(obj_id self, int newBehavior, int oldBehavior, int[]
289288
}
290289
return SCRIPT_CONTINUE;
291290
}
292-
public void doAgitateBehavior(obj_id npc, int behavior) throws InterruptedException
293-
{
294-
if (isInvulnerable(npc))
295-
{
296-
return;
297-
}
298-
if (getConfigSetting("GameServer", "disableAICombat") != null)
299-
{
300-
return;
301-
}
302-
return;
303-
}
304291
public void followTusken(obj_id npc, obj_id target) throws InterruptedException
305292
{
306293
if (!isIncapacitated(npc))

sku.0/sys.server/compiled/game/script/city/bestine/museum_event_master.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ public int OnAttach(obj_id self) throws InterruptedException
2121

2222
public int getMuseumEventDuration() throws InterruptedException
2323
{
24-
String durationConfigSetting = getConfigSetting("BestineEvents", "MuseumEventDuration");
25-
int museumEventDuration = utils.stringToInt(durationConfigSetting);
26-
if (museumEventDuration == 0 || museumEventDuration == -1)
27-
{
28-
museumEventDuration = 1209600;
29-
}
30-
return museumEventDuration;
24+
return utils.getIntConfigSetting("BestineEvents", "museumEventDuration", 1209600);
3125
}
3226
public int beginBestineMuseumEvent(obj_id self, dictionary params) throws InterruptedException
3327
{
28+
if(utils.checkConfigFlag("BestineEvents", "disableMuseumEvent")) {
29+
return SCRIPT_CONTINUE;
30+
}
3431
int museumEventNum = 1;
3532
if (hasObjVar(self, "bestine.museumEventEnded"))
3633
{

sku.0/sys.server/compiled/game/script/city/bestine/politician_event_master.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@ public int OnAttach(obj_id self) throws InterruptedException
1616
}
1717
public int getElectionDuration() throws InterruptedException
1818
{
19-
String durationConfigSetting = getConfigSetting("BestineEvents", "PoliticianEventDuration");
20-
int electionDuration = utils.stringToInt(durationConfigSetting);
21-
if (electionDuration == 0 || electionDuration == -1)
22-
{
23-
electionDuration = 2592000;
24-
}
25-
return electionDuration;
19+
return utils.getIntConfigSetting("BestineEvents", "politicianEventDuration", 2592000);
2620
}
2721
public int beginBestineElection(obj_id self, dictionary params) throws InterruptedException
2822
{
23+
if(utils.checkConfigFlag("BestineEvents", "disablePoliticianEvent")) {
24+
return SCRIPT_CONTINUE;
25+
}
2926
int electionNum = 1;
3027
if (hasObjVar(self, "bestine.electionEnded"))
3128
{

sku.0/sys.server/compiled/game/script/city/guard_spawner.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public guard_spawner()
1313
{
1414
}
1515
public static final String guardTable = "datatables/npc/guard_spawner/guard.iff";
16+
public static final boolean EMPIRE_DAY_RUNNING = utils.checkConfigFlag("GameServer", "empireday_ceremony");
17+
1618
public int OnAttach(obj_id self) throws InterruptedException
1719
{
1820
messageTo(self, "checkForStart", null, 3, false);
@@ -33,8 +35,7 @@ public int OnInitialize(obj_id self) throws InterruptedException
3335
}
3436
else if (city.equals("theed"))
3537
{
36-
String empiredayRunning = getConfigSetting("GameServer", "empireday_ceremony");
37-
if (empiredayRunning != null && (empiredayRunning.equals("true") || empiredayRunning.equals("1")))
38+
if (EMPIRE_DAY_RUNNING)
3839
{
3940
utils.setScriptVar(self, "OFF", "DUE TO EMPIRE DAY");
4041
return SCRIPT_CONTINUE;
@@ -294,19 +295,15 @@ public String getGuardArea(obj_id self) throws InterruptedException
294295
String test_city = city;
295296
if (planet.equals("naboo") || planet.equals("corellia"))
296297
{
297-
String empiredayRunning = getConfigSetting("GameServer", "empireday_ceremony");
298-
if (empiredayRunning != null)
298+
if (EMPIRE_DAY_RUNNING)
299299
{
300-
if (empiredayRunning.equals("true") || empiredayRunning.equals("1"))
300+
if (city.equals("coronet"))
301+
{
302+
return test_city + "_rebel_hard";
303+
}
304+
else if (city.equals("theed"))
301305
{
302-
if (city.equals("coronet"))
303-
{
304-
return test_city + "_rebel_hard";
305-
}
306-
else if (city.equals("theed"))
307-
{
308-
return test_city + "_imperial_hard";
309-
}
306+
return test_city + "_imperial_hard";
310307
}
311308
}
312309
}

sku.0/sys.server/compiled/game/script/city/imperial_crackdown/crackdown_cantina.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,19 @@ public int doTroubleCheck(obj_id self, dictionary params) throws InterruptedExce
5353
}
5454
else
5555
{
56-
String trouble = getConfigSetting("Imperial Crackdown", "troubleChance");
57-
int chanceOfTrouble = utils.stringToInt(trouble);
58-
if (chanceOfTrouble == 0 || chanceOfTrouble == -1)
59-
{
60-
chanceOfTrouble = 20;
61-
}
62-
int rollForTrouble = rand(1, 100);
63-
if (rollForTrouble < chanceOfTrouble)
56+
int chanceOfTrouble = utils.getIntConfigSetting("EventTeam", "crackdownTroubleChance", 20);
57+
if (rand(1, 100) < chanceOfTrouble)
6458
{
6559
messageTo(self, "createTrouble", null, 15, false);
66-
return SCRIPT_CONTINUE;
6760
}
6861
else
6962
{
7063
if (hasObjVar(self, "checkingForTrouble"))
7164
{
7265
removeObjVar(self, "checkingForTrouble");
7366
}
74-
return SCRIPT_CONTINUE;
7567
}
68+
return SCRIPT_CONTINUE;
7669
}
7770
}
7871
public int createTrouble(obj_id self, dictionary params) throws InterruptedException

0 commit comments

Comments
 (0)