mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-21 12:03:08 -04:00
Optimized invasion scripts (not city invasions - just impromptu ones - i.e. Theed imperial presence)
This commit is contained in:
Regular → Executable
+15
-39
@@ -1,45 +1,37 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.chat;
|
||||
import script.library.combat;
|
||||
import script.library.utils;
|
||||
import script.library.pclib;
|
||||
import script.library.pet_lib;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class celeb_respect extends script.base_script
|
||||
{
|
||||
public celeb_respect()
|
||||
{
|
||||
}
|
||||
public static final String EMOTE_DATATABLE = "datatables/npc/stormtrooper_attitude/emote.iff";
|
||||
private static final String EMOTE_DATATABLE = "datatables/npc/stormtrooper_attitude/emote.iff";
|
||||
public static final String STF_FILE = "event/gcw_raids";
|
||||
public int OnSawEmote(obj_id self, obj_id emoteSayer, String emotein) throws InterruptedException
|
||||
{
|
||||
obj_id emotetarget = getLookAtTarget(emoteSayer);
|
||||
int type = getIntObjVar(self, "event.gcwraids.type");
|
||||
dictionary params = new dictionary();
|
||||
if (type == 1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id emotetarget = getLookAtTarget(emoteSayer);
|
||||
if (!isIdValid(emotetarget) || ai_lib.isInCombat(self) || ai_lib.isInCombat(emoteSayer) || isIncapacitated(self) || isDead(self))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (emotetarget == self)
|
||||
{
|
||||
int belligerence = getEmoteBeligerence(emotein);
|
||||
if (type == 0 && belligerence > 0)
|
||||
if (type == 0 && getEmoteBeligerence(emotein) > 0)
|
||||
{
|
||||
dictionary params = new dictionary();
|
||||
params.put("emoteSayer", emoteSayer);
|
||||
messageTo(self, "forceChokeThisGuy", params, 1, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
@@ -53,9 +45,7 @@ public class celeb_respect extends script.base_script
|
||||
faceTo(self, emoteSayer);
|
||||
doAnimationAction(self, "force_choke");
|
||||
doAnimationAction(emoteSayer, "heavy_cough_vomit");
|
||||
int type = getIntObjVar(self, "event.gcwraids.type");
|
||||
int randomLine = rand(0, 9);
|
||||
string_id myLine = new string_id(STF_FILE, "thwap_" + type + "_" + randomLine);
|
||||
string_id myLine = new string_id(STF_FILE, "thwap_" + getIntObjVar(self, "event.gcwraids.type") + "_" + rand(0, 9));
|
||||
chat.chat(self, chat.CHAT_SAY, chat.MOOD_NONE, myLine);
|
||||
params.put("emoteSayer", emoteSayer);
|
||||
messageTo(self, "finishHim", params, 6, false);
|
||||
@@ -69,41 +59,27 @@ public class celeb_respect extends script.base_script
|
||||
setAttrib(emoteSayer, HEALTH, (rand(30, 90) * -1));
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int getEmoteBeligerence(String emote) throws InterruptedException
|
||||
private int getEmoteBeligerence(String emote) throws InterruptedException
|
||||
{
|
||||
int emote_row = dataTableSearchColumnForString(emote, 0, EMOTE_DATATABLE);
|
||||
int st_emote_type = dataTableGetInt(EMOTE_DATATABLE, emote_row, 1);
|
||||
if (st_emote_type == 3)
|
||||
int st_emote_type = dataTableGetInt(EMOTE_DATATABLE, dataTableSearchColumnForString(emote, 0, EMOTE_DATATABLE), 1);
|
||||
if (st_emote_type <= 3 && st_emote_type >= 0)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else if (st_emote_type == 2)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (st_emote_type == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (st_emote_type == 0)
|
||||
{
|
||||
return 0;
|
||||
return st_emote_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public void playKnockdown(obj_id victim, obj_id attacker) throws InterruptedException
|
||||
private void playKnockdown(obj_id victim, obj_id attacker) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(victim) || !isIdValid(attacker))
|
||||
{
|
||||
return;
|
||||
}
|
||||
String strPlaybackScript = "";
|
||||
String strPlaybackScript;
|
||||
obj_id objWeapon = getCurrentWeapon(attacker);
|
||||
int intWeaponType = getWeaponType(objWeapon);
|
||||
int intWeaponCategory = combat.getWeaponCategory(intWeaponType);
|
||||
int intWeaponCategory = combat.getWeaponCategory(getWeaponType(objWeapon));
|
||||
if (intWeaponCategory == combat.RANGED_WEAPON)
|
||||
{
|
||||
strPlaybackScript = "ranged_melee_light";
|
||||
|
||||
Regular → Executable
+71
-100
@@ -1,50 +1,38 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.create;
|
||||
import script.library.locations;
|
||||
import script.library.chat;
|
||||
import java.util.StringTokenizer;
|
||||
import script.library.gcw;
|
||||
import script.library.ai_lib;
|
||||
import script.dictionary;
|
||||
import script.library.*;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class cheerleader extends script.base_script
|
||||
{
|
||||
public cheerleader()
|
||||
{
|
||||
}
|
||||
public static final int NUMSPEECHES = 1;
|
||||
private static final int NUMSPEECHES = 1;
|
||||
public static final String STF_FILE = "event/gcw_raids";
|
||||
public static final float MY_VISIT_TIME = 60 * 15;
|
||||
private static final float MY_VISIT_TIME = 60 * 15;
|
||||
public static final String DATATABLE = "datatables/event/gcwraid/city_data.iff";
|
||||
public static final String[] SHUTTLETYPE =
|
||||
private static final String[] SHUTTLETYPE =
|
||||
{
|
||||
"object/creature/npc/theme_park/lambda_shuttle.iff",
|
||||
"object/creature/npc/theme_park/player_shuttle.iff"
|
||||
};
|
||||
public static final String[] CELEB =
|
||||
private static final String[] CELEB =
|
||||
{
|
||||
"darth_vader",
|
||||
"luke_skywalker"
|
||||
};
|
||||
public static final String[] ESCORT =
|
||||
private static final String[] ESCORT =
|
||||
{
|
||||
"fbase_dark_trooper_extreme",
|
||||
"rebel_commando"
|
||||
};
|
||||
public int startCheerleaderEvent(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
float imp_r = gcw.getImperialRatio(self);
|
||||
float reb_r = gcw.getRebelRatio(self);
|
||||
if (reb_r > imp_r)
|
||||
if (gcw.getRebelRatio(self) > gcw.getImperialRatio(self))
|
||||
{
|
||||
setObjVar(self, "event.gcwraids.cheerleader_type", 1);
|
||||
}
|
||||
@@ -52,8 +40,7 @@ public class cheerleader extends script.base_script
|
||||
{
|
||||
setObjVar(self, "event.gcwraids.cheerleader_type", 0);
|
||||
}
|
||||
location here = getLocation(self);
|
||||
String myCity = locations.getGuardSpawnerRegionName(here);
|
||||
String myCity = locations.getGuardSpawnerRegionName(getLocation(self));
|
||||
if (myCity.equals("@tatooine_region_names:bestine"))
|
||||
{
|
||||
setObjVar(self, "event.gcwraids.cheerleader_type", 0);
|
||||
@@ -69,8 +56,7 @@ public class cheerleader extends script.base_script
|
||||
public int createShuttle(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int type = getIntObjVar(self, "event.gcwraids.cheerleader_type");
|
||||
location here = getLocation(self);
|
||||
obj_id shuttle = create.object(SHUTTLETYPE[type], here);
|
||||
obj_id shuttle = create.object(SHUTTLETYPE[type], getLocation(self));
|
||||
setObjVar(self, "event.gcwraids.shuttle", shuttle);
|
||||
setYaw(shuttle, 178);
|
||||
detachScript(shuttle, "ai.ai");
|
||||
@@ -87,9 +73,8 @@ public class cheerleader extends script.base_script
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 256.0f);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
sendSystemMessage(objPlayers[i], new string_id(STF_FILE, "areabroadcast_" + type));
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
sendSystemMessage(objPlayer, new string_id(STF_FILE, "areabroadcast_" + type));
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
@@ -103,7 +88,7 @@ public class cheerleader extends script.base_script
|
||||
queueCommand(shuttle, (-1465754503), self, "", COMMAND_PRIORITY_FRONT);
|
||||
setPosture(shuttle, POSTURE_UPRIGHT);
|
||||
}
|
||||
if (type == 0)
|
||||
else if (type == 0)
|
||||
{
|
||||
queueCommand(shuttle, (-1114832209), self, "", COMMAND_PRIORITY_FRONT);
|
||||
setPosture(shuttle, POSTURE_PRONE);
|
||||
@@ -130,7 +115,7 @@ public class cheerleader extends script.base_script
|
||||
detachScript(celeb, "theme_park.imperial.quest_convo");
|
||||
detachScript(celeb, "npc.converse.npc_converse_menu");
|
||||
}
|
||||
if (type == 1)
|
||||
else if (type == 1)
|
||||
{
|
||||
detachScript(celeb, "npc.celebrity.luke");
|
||||
detachScript(celeb, "theme_park.rebel.quest_convo");
|
||||
@@ -140,21 +125,19 @@ public class cheerleader extends script.base_script
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 100.0f);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
playMusic(objPlayers[i], "sound/music_emperor_theme_stereo.snd");
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
if (type == 0) {
|
||||
playMusic(objPlayer, "sound/music_emperor_theme_stereo.snd");
|
||||
}
|
||||
if (type == 1)
|
||||
{
|
||||
playMusic(objPlayers[i], "sound/music_ambience_desert_stereo.snd");
|
||||
else if (type == 1) {
|
||||
playMusic(objPlayer, "sound/music_ambience_desert_stereo.snd");
|
||||
}
|
||||
}
|
||||
}
|
||||
obj_id escort;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
obj_id escort = create.object(ESCORT[type], here);
|
||||
escort = create.object(ESCORT[type], here);
|
||||
setObjVar(self, "event.gcwraids.escort" + i, escort);
|
||||
setObjVar(escort, "event.gcwraids.myId", i);
|
||||
setObjVar(escort, "event.gcwraids.mom", self);
|
||||
@@ -170,18 +153,16 @@ public class cheerleader extends script.base_script
|
||||
location there = getLocation(self);
|
||||
there.z += -25;
|
||||
String celebType = getCreatureName(celeb);
|
||||
ai_lib.aiPathTo(celeb, there);
|
||||
if (celebType.equals("darth_vader"))
|
||||
{
|
||||
ai_lib.aiPathTo(celeb, there);
|
||||
setMovementWalk(celeb);
|
||||
}
|
||||
else
|
||||
{
|
||||
ai_lib.aiPathTo(celeb, there);
|
||||
setMovementRun(celeb);
|
||||
}
|
||||
int dialogueSet = rand(1, NUMSPEECHES);
|
||||
utils.setScriptVar(self, "dialogue_set", dialogueSet);
|
||||
utils.setScriptVar(self, "dialogue_set", rand(1, NUMSPEECHES));
|
||||
utils.setScriptVar(self, "dialogue_step", 0);
|
||||
messageTo(self, "engageInJingoisticRhetoric", null, 8, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
@@ -191,48 +172,46 @@ public class cheerleader extends script.base_script
|
||||
obj_id celeb = getObjIdObjVar(self, "event.gcwraids.celeb");
|
||||
int dialogueStep = utils.getIntScriptVar(self, "dialogue_step");
|
||||
int type = getIntObjVar(self, "event.gcwraids.cheerleader_type");
|
||||
int dialogueSet = utils.getIntScriptVar(self, "dialogue_set");
|
||||
if (dialogueStep > 10)
|
||||
{
|
||||
messageTo(self, "celebStartGivingQuests", null, 10, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
string_id myLine = new string_id(STF_FILE, "cheerleader_" + type + "_" + dialogueSet + "_" + dialogueStep);
|
||||
string_id myLine = new string_id(STF_FILE, "cheerleader_" + type + "_" + utils.getIntScriptVar(self, "dialogue_set") + "_" + dialogueStep);
|
||||
chat.chat(celeb, chat.CHAT_SAY, chat.MOOD_NONE, myLine);
|
||||
if (dialogueStep == 3 && type == 0)
|
||||
{
|
||||
doAnimationAction(celeb, "pound_fist_palm");
|
||||
if(type == 0){
|
||||
switch(dialogueStep){
|
||||
case 3:
|
||||
doAnimationAction(celeb, "pound_fist_palm");
|
||||
break;
|
||||
case 5:
|
||||
doAnimationAction(celeb, "force_push");
|
||||
break;
|
||||
case 7:
|
||||
doAnimationAction(celeb, "force_choke");
|
||||
break;
|
||||
case 10:
|
||||
doAnimationAction(celeb, "point_forward");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dialogueStep == 5 && type == 0)
|
||||
{
|
||||
doAnimationAction(celeb, "force_push");
|
||||
else{
|
||||
switch(dialogueStep){
|
||||
case 3:
|
||||
doAnimationAction(celeb, "point_right");
|
||||
break;
|
||||
case 5:
|
||||
doAnimationAction(celeb, "pound_fist_palm");
|
||||
break;
|
||||
case 7:
|
||||
doAnimationAction(celeb, "nod_head_once");
|
||||
break;
|
||||
case 10:
|
||||
doAnimationAction(celeb, "point_forward");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dialogueStep == 7 && type == 0)
|
||||
{
|
||||
doAnimationAction(celeb, "force_choke");
|
||||
}
|
||||
if (dialogueStep == 10 && type == 0)
|
||||
{
|
||||
doAnimationAction(celeb, "point_forward");
|
||||
}
|
||||
if (dialogueStep == 3 && type == 1)
|
||||
{
|
||||
doAnimationAction(celeb, "point_right");
|
||||
}
|
||||
if (dialogueStep == 5 && type == 1)
|
||||
{
|
||||
doAnimationAction(celeb, "pound_fist_palm");
|
||||
}
|
||||
if (dialogueStep == 7 && type == 1)
|
||||
{
|
||||
doAnimationAction(celeb, "nod_head_once");
|
||||
}
|
||||
if (dialogueStep == 10 && type == 1)
|
||||
{
|
||||
doAnimationAction(celeb, "point_forward");
|
||||
}
|
||||
dialogueStep++;
|
||||
utils.setScriptVar(self, "dialogue_step", dialogueStep);
|
||||
utils.setScriptVar(self, "dialogue_step", dialogueStep + 1);
|
||||
messageTo(self, "engageInJingoisticRhetoric", null, 10, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -245,7 +224,7 @@ public class cheerleader extends script.base_script
|
||||
{
|
||||
attachScript(celeb, "conversation.event_cheerleader_vader");
|
||||
}
|
||||
if (type == 1)
|
||||
else if (type == 1)
|
||||
{
|
||||
attachScript(celeb, "conversation.event_cheerleader_luke");
|
||||
}
|
||||
@@ -260,20 +239,20 @@ public class cheerleader extends script.base_script
|
||||
if (isIdValid(celeb))
|
||||
{
|
||||
String celebType = getCreatureName(celeb);
|
||||
ai_lib.aiPathTo(celeb, here);
|
||||
if (celebType.equals("darth_vader"))
|
||||
{
|
||||
ai_lib.aiPathTo(celeb, here);
|
||||
setMovementWalk(celeb);
|
||||
}
|
||||
else
|
||||
{
|
||||
ai_lib.aiPathTo(celeb, here);
|
||||
setMovementRun(celeb);
|
||||
}
|
||||
}
|
||||
obj_id escort;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
obj_id escort = getObjIdObjVar(self, "event.gcwraids.escort" + i);
|
||||
escort = getObjIdObjVar(self, "event.gcwraids.escort" + i);
|
||||
if (isIdValid(escort))
|
||||
{
|
||||
ai_lib.aiPathTo(escort, here);
|
||||
@@ -288,9 +267,10 @@ public class cheerleader extends script.base_script
|
||||
obj_id shuttle = getObjIdObjVar(self, "event.gcwraids.shuttle");
|
||||
obj_id celeb = getObjIdObjVar(self, "event.gcwraids.celeb");
|
||||
destroyObject(celeb);
|
||||
obj_id escort;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
obj_id escort = getObjIdObjVar(self, "event.gcwraids.escort" + i);
|
||||
escort = getObjIdObjVar(self, "event.gcwraids.escort" + i);
|
||||
if (isIdValid(escort))
|
||||
{
|
||||
destroyObject(escort);
|
||||
@@ -301,7 +281,7 @@ public class cheerleader extends script.base_script
|
||||
queueCommand(shuttle, (-1114832209), self, "", COMMAND_PRIORITY_FRONT);
|
||||
setPosture(shuttle, POSTURE_PRONE);
|
||||
}
|
||||
if (type == 0)
|
||||
else if (type == 0)
|
||||
{
|
||||
queueCommand(shuttle, (-1465754503), self, "", COMMAND_PRIORITY_FRONT);
|
||||
setPosture(shuttle, POSTURE_UPRIGHT);
|
||||
@@ -311,9 +291,7 @@ public class cheerleader extends script.base_script
|
||||
}
|
||||
public int cleanupShuttleAndStuff(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int type = getIntObjVar(self, "event.gcwraids.cheerleader_type");
|
||||
obj_id shuttle = getObjIdObjVar(self, "event.gcwraids.shuttle");
|
||||
destroyObject(shuttle);
|
||||
destroyObject(getObjIdObjVar(self, "event.gcwraids.shuttle"));
|
||||
removeObjVar(self, "event.gcwraids.celeb");
|
||||
removeObjVar(self, "event.gcwraids.shuttle");
|
||||
for (int i = 0; i < 12; i++)
|
||||
@@ -323,9 +301,8 @@ public class cheerleader extends script.base_script
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 256.0f);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
sendSystemMessage(objPlayers[i], new string_id(STF_FILE, "closingbroadcast_" + type));
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
sendSystemMessage(objPlayer, new string_id(STF_FILE, "closingbroadcast_" + getIntObjVar(self, "event.gcwraids.cheerleader_type")));
|
||||
}
|
||||
}
|
||||
int referenceNumber = getIntObjVar(self, "auto_invasion.reference_number");
|
||||
@@ -344,21 +321,15 @@ public class cheerleader extends script.base_script
|
||||
}
|
||||
public int escortDied(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int invasionActive = getIntObjVar(self, "auto_invasion.invasion_active");
|
||||
if (invasionActive != 1)
|
||||
if (getIntObjVar(self, "auto_invasion.invasion_active") != 1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
location here = getLocation(self);
|
||||
int type = getIntObjVar(self, "event.gcwraids.cheerleader_type");
|
||||
obj_id deadEscort = params.getObjId("escort");
|
||||
int myId = params.getInt("myId");
|
||||
obj_id celeb = getObjIdObjVar(self, "event.gcwraids.celeb");
|
||||
obj_id verifyEscort = getObjIdObjVar(self, "event.gcwraids.escort" + myId);
|
||||
if (deadEscort == verifyEscort)
|
||||
if (params.getObjId("escort") == getObjIdObjVar(self, "event.gcwraids.escort" + myId))
|
||||
{
|
||||
removeObjVar(self, "event.gcwraids.escort" + myId);
|
||||
obj_id escort = create.object(ESCORT[type], here);
|
||||
obj_id escort = create.object(ESCORT[getIntObjVar(self, "event.gcwraids.cheerleader_type")], getLocation(self));
|
||||
setObjVar(self, "event.gcwraids.escort" + myId, escort);
|
||||
setObjVar(escort, "event.gcwraids.myId", myId);
|
||||
setObjVar(escort, "event.gcwraids.mom", self);
|
||||
|
||||
Regular → Executable
+4
-11
@@ -1,12 +1,7 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class cheerleader_escort extends script.base_script
|
||||
{
|
||||
@@ -15,12 +10,10 @@ public class cheerleader_escort extends script.base_script
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
int myNumber = getIntObjVar(self, "event.gcwraids.myId");
|
||||
dictionary params = new dictionary();
|
||||
params.put("myId", myNumber);
|
||||
params.put("myId", getIntObjVar(self, "event.gcwraids.myId"));
|
||||
params.put("escort", self);
|
||||
obj_id mom = getObjIdObjVar(self, "event.gcwraids.mom");
|
||||
messageTo(mom, "escortDied", params, 1, false);
|
||||
messageTo(getObjIdObjVar(self, "event.gcwraids.mom"), "escortDied", params, 1, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+38
-70
@@ -1,21 +1,13 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.create;
|
||||
import script.library.locations;
|
||||
import script.library.skill;
|
||||
import script.library.chat;
|
||||
import script.dictionary;
|
||||
import script.library.badge;
|
||||
import java.util.StringTokenizer;
|
||||
import script.library.create;
|
||||
import script.library.gcw;
|
||||
import script.library.locations;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class gcwraid extends script.base_script
|
||||
{
|
||||
@@ -27,8 +19,7 @@ public class gcwraid extends script.base_script
|
||||
{
|
||||
if (hasObjVar(self, "event.gcwraids.shuttle"))
|
||||
{
|
||||
obj_id shuttle = getObjIdObjVar(self, "event.gcwraids.shuttle");
|
||||
destroyObject(shuttle);
|
||||
destroyObject(getObjIdObjVar(self, "event.gcwraids.shuttle"));
|
||||
}
|
||||
if (!hasScript(self, "event.gcwraids.cheerleader"))
|
||||
{
|
||||
@@ -43,9 +34,7 @@ public class gcwraid extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
location here = getLocation(self);
|
||||
String myCity = locations.getGuardSpawnerRegionName(here);
|
||||
int numEntries = dataTableGetNumRows(DATATABLE);
|
||||
String myCity = locations.getGuardSpawnerRegionName(getLocation(self));
|
||||
if (myCity == null || myCity.equals(""))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
@@ -56,10 +45,9 @@ public class gcwraid extends script.base_script
|
||||
}
|
||||
if (!hasObjVar(self, "auto_invasion.reference_number"))
|
||||
{
|
||||
for (int i = 0; i < numEntries; i++)
|
||||
for (int i = 0; i < dataTableGetNumRows(DATATABLE); i++)
|
||||
{
|
||||
String thisCity = dataTableGetString(DATATABLE, i, "CITY");
|
||||
if (thisCity.equals(myCity))
|
||||
if (dataTableGetString(DATATABLE, i, "CITY").equals(myCity))
|
||||
{
|
||||
setObjVar(self, "auto_invasion.reference_number", i);
|
||||
}
|
||||
@@ -73,10 +61,9 @@ public class gcwraid extends script.base_script
|
||||
float minInvasionTime = dataTableGetFloat(DATATABLE, referenceNumber, "MINTIME");
|
||||
float timeChunkSize = dataTableGetFloat(DATATABLE, referenceNumber, "TIMECHUNKSIZE");
|
||||
int numTimeChunk = dataTableGetInt(DATATABLE, referenceNumber, "NUMTIMECHUNK");
|
||||
float rightNow = getGameTime();
|
||||
if (!hasObjVar(self, "auto_invasion.next_invasion_time"))
|
||||
{
|
||||
float nextInvasionTime = (rand(1, numTimeChunk) * timeChunkSize) + minInvasionTime + rightNow;
|
||||
float nextInvasionTime = (rand(1, numTimeChunk) * timeChunkSize) + minInvasionTime + getGameTime();
|
||||
setObjVar(self, "auto_invasion.next_invasion_time", nextInvasionTime);
|
||||
}
|
||||
setObjVar(self, "auto_invasion.invasion_active", 0);
|
||||
@@ -91,17 +78,15 @@ public class gcwraid extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
float rightNow = getGameTime();
|
||||
float nextInvasionTime = getFloatObjVar(self, "auto_invasion.next_invasion_time");
|
||||
int invasionActive = getIntObjVar(self, "auto_invasion.invasion_active");
|
||||
if (invasionActive == 1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (rightNow > nextInvasionTime && invasionActive == 0)
|
||||
if (getGameTime() > nextInvasionTime && invasionActive == 0)
|
||||
{
|
||||
int roll = rand(0, 100);
|
||||
if (roll < 66)
|
||||
if (rand(0, 100) < 66)
|
||||
{
|
||||
messageTo(self, "startCheerleaderEvent", null, 1, false);
|
||||
}
|
||||
@@ -126,10 +111,8 @@ public class gcwraid extends script.base_script
|
||||
}
|
||||
removeObjVar(self, "auto_invasion.next_invasion_time");
|
||||
int referenceNumber = getIntObjVar(self, "auto_invasion.reference_number");
|
||||
float imp_r = gcw.getImperialRatio(self);
|
||||
float reb_r = gcw.getRebelRatio(self);
|
||||
String invasionTable = dataTableGetString(DATATABLE, referenceNumber, "INV1");
|
||||
if (reb_r >= imp_r)
|
||||
String invasionTable;
|
||||
if (gcw.getRebelRatio(self) >= gcw.getImperialRatio(self))
|
||||
{
|
||||
invasionTable = dataTableGetString(DATATABLE, referenceNumber, "INV1");
|
||||
}
|
||||
@@ -137,8 +120,7 @@ public class gcwraid extends script.base_script
|
||||
{
|
||||
invasionTable = dataTableGetString(DATATABLE, referenceNumber, "INV2");
|
||||
}
|
||||
location here = getLocation(self);
|
||||
String myCity = locations.getGuardSpawnerRegionName(here);
|
||||
String myCity = locations.getGuardSpawnerRegionName(getLocation(self));
|
||||
if (myCity.equals("@tatooine_region_names:bestine"))
|
||||
{
|
||||
invasionTable = dataTableGetString(DATATABLE, referenceNumber, "INV2");
|
||||
@@ -153,46 +135,41 @@ public class gcwraid extends script.base_script
|
||||
}
|
||||
int difficulty = rand(1, 100);
|
||||
int mobMin = 0;
|
||||
int mobMax = 18;
|
||||
int mobMax = 46;
|
||||
if (difficulty <= 5)
|
||||
{
|
||||
mobMin = 0;
|
||||
mobMax = 8;
|
||||
}
|
||||
if (difficulty >= 6 && difficulty <= 20)
|
||||
else if (difficulty <= 20)
|
||||
{
|
||||
mobMin = 8;
|
||||
mobMax = 18;
|
||||
}
|
||||
if (difficulty >= 21 && difficulty <= 45)
|
||||
else if (difficulty <= 45)
|
||||
{
|
||||
mobMin = 18;
|
||||
mobMax = 33;
|
||||
}
|
||||
if (difficulty >= 46 && difficulty <= 70)
|
||||
else if (difficulty <= 70)
|
||||
{
|
||||
mobMin = 33;
|
||||
mobMax = 45;
|
||||
}
|
||||
if (difficulty >= 71 && difficulty <= 95)
|
||||
else if (difficulty <= 95)
|
||||
{
|
||||
mobMin = 36;
|
||||
mobMax = 46;
|
||||
}
|
||||
if (difficulty >= 96 && difficulty <= 100)
|
||||
{
|
||||
mobMin = 0;
|
||||
mobMax = 46;
|
||||
}
|
||||
String locTable = dataTableGetString(DATATABLE, referenceNumber, "LOCS");
|
||||
String destTable = dataTableGetString(DATATABLE, referenceNumber, "DEST");
|
||||
int locTableLength = dataTableGetNumRows(locTable);
|
||||
int destTableLength = dataTableGetNumRows(destTable);
|
||||
setObjVar(self, "auto_invasion.loc_table_length", locTableLength);
|
||||
setObjVar(self, "auto_invasion.dest_table_length", destTableLength);
|
||||
location loc = getLocation(self);
|
||||
for (int i = 0; i < locTableLength; i++)
|
||||
{
|
||||
location loc = getLocation(self);
|
||||
loc.x = dataTableGetFloat(locTable, i, "SPAWN_X");
|
||||
loc.y = dataTableGetFloat(locTable, i, "SPAWN_Y");
|
||||
loc.z = dataTableGetFloat(locTable, i, "SPAWN_Z");
|
||||
@@ -200,20 +177,16 @@ public class gcwraid extends script.base_script
|
||||
}
|
||||
for (int i = 0; i < destTableLength; i++)
|
||||
{
|
||||
location dest = getLocation(self);
|
||||
dest.x = dataTableGetFloat(destTable, i, "DEST_X");
|
||||
dest.y = dataTableGetFloat(destTable, i, "DEST_Y");
|
||||
dest.z = dataTableGetFloat(destTable, i, "DEST_Z");
|
||||
loc.x = dataTableGetFloat(destTable, i, "DEST_X");
|
||||
loc.y = dataTableGetFloat(destTable, i, "DEST_Y");
|
||||
loc.z = dataTableGetFloat(destTable, i, "DEST_Z");
|
||||
setObjVar(self, "auto_invasion.dest_off_" + i, dataTableGetFloat(destTable, i, "DEST_OFF"));
|
||||
setObjVar(self, "auto_invasion.spawn_dest_" + i, dest);
|
||||
setObjVar(self, "auto_invasion.spawn_dest_" + i, loc);
|
||||
}
|
||||
int maxWaves = dataTableGetInt(invasionTable, 0, "NUMWAVES");
|
||||
int spawnDelay = dataTableGetInt(invasionTable, 0, "SPAWNDELAY");
|
||||
int badgeAwarded = dataTableGetInt(invasionTable, 0, "BADGE");
|
||||
setObjVar(self, "auto_invasion.badge_awarded", badgeAwarded);
|
||||
setObjVar(self, "auto_invasion.spawn_delay", spawnDelay);
|
||||
setObjVar(self, "auto_invasion.badge_awarded", dataTableGetInt(invasionTable, 0, "BADGE"));
|
||||
setObjVar(self, "auto_invasion.spawn_delay", dataTableGetInt(invasionTable, 0, "SPAWNDELAY"));
|
||||
setObjVar(self, "auto_invasion.invasion_table", invasionTable);
|
||||
setObjVar(self, "auto_invasion.max_waves", maxWaves);
|
||||
setObjVar(self, "auto_invasion.max_waves", dataTableGetInt(invasionTable, 0, "NUMWAVES"));
|
||||
setObjVar(self, "auto_invasion.current_wave", 0);
|
||||
setObjVar(self, "auto_invasion.spawn_number", 1);
|
||||
setObjVar(self, "auto_invasion.dest_table", destTable);
|
||||
@@ -240,8 +213,7 @@ public class gcwraid extends script.base_script
|
||||
{
|
||||
announceStatusToPlayers(self, startMessage);
|
||||
}
|
||||
currentWave++;
|
||||
setObjVar(self, "auto_invasion.current_wave", currentWave);
|
||||
setObjVar(self, "auto_invasion.current_wave", currentWave + 1);
|
||||
setObjVar(self, "auto_invasion.spawn_number", 1);
|
||||
setObjVar(self, "auto_invasion.done_spawning", 0);
|
||||
setObjVar(self, "auto_invasion.number_dead", numberDead);
|
||||
@@ -317,7 +289,6 @@ public class gcwraid extends script.base_script
|
||||
}
|
||||
public int invaderDied(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id deadGuy = params.getObjId("deadGuy");
|
||||
int myNumber = params.getInt("myNumber");
|
||||
removeObjVar(self, "auto_invasion.spawn" + myNumber);
|
||||
int spawnNum = getIntObjVar(self, "auto_invasion.spawn_number");
|
||||
@@ -329,8 +300,7 @@ public class gcwraid extends script.base_script
|
||||
{
|
||||
for (int i = 1; i <= spawnNum; i++)
|
||||
{
|
||||
obj_id possibleInvader = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
if (!isIdValid(possibleInvader))
|
||||
if (!isIdValid(getObjIdObjVar(self, "auto_invasion.spawn" + i)))
|
||||
{
|
||||
numberDead++;
|
||||
setObjVar(self, "auto_invasion.number_dead", numberDead);
|
||||
@@ -370,10 +340,10 @@ public class gcwraid extends script.base_script
|
||||
public int endInvasion(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
setObjVar(self, "auto_invasion.invasion_active", 0);
|
||||
int spawnNum = getIntObjVar(self, "auto_invasion.spawn_num");
|
||||
obj_id spawn;
|
||||
for (int i = 1; i <= 20; i++)
|
||||
{
|
||||
obj_id spawn = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
spawn = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
if (isIdValid(spawn))
|
||||
{
|
||||
messageTo(spawn, "goDie", null, 1, false);
|
||||
@@ -387,9 +357,8 @@ public class gcwraid extends script.base_script
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 255);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
badge.grantBadge(objPlayers[i], badgeName);
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
badge.grantBadge(objPlayer, badgeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,14 +384,13 @@ public class gcwraid extends script.base_script
|
||||
messageTo(self, "invasionTimerPing", null, 2700, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void announceStatusToPlayers(obj_id self, String messageId) throws InterruptedException
|
||||
private void announceStatusToPlayers(obj_id self, String messageId) throws InterruptedException
|
||||
{
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 256.0f);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
sendSystemMessage(objPlayers[i], new string_id("auto_invasion", messageId));
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
sendSystemMessage(objPlayer, new string_id("auto_invasion", messageId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+4
-12
@@ -1,17 +1,10 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.utils;
|
||||
import script.ai.ai_combat;
|
||||
import script.library.healing;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class invader extends script.base_script
|
||||
{
|
||||
@@ -27,9 +20,8 @@ public class invader extends script.base_script
|
||||
}
|
||||
public int startAttack(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
location target = getLocationObjVar(self, "auto_invasion.target");
|
||||
float destinationOffset = getFloatObjVar(self, "auto_invasion.dest_offset");
|
||||
location adjustedLoc = utils.getRandomLocationInRing(target, 0, destinationOffset);
|
||||
location adjustedLoc = utils.getRandomLocationInRing(getLocationObjVar(self, "auto_invasion.target"), 0, destinationOffset);
|
||||
ai_lib.aiPathTo(self, adjustedLoc);
|
||||
setMovementRun(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
Regular → Executable
+2
-9
@@ -1,15 +1,8 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.badge;
|
||||
import script.library.groundquests;
|
||||
import script.obj_id;
|
||||
|
||||
public class pve_badge extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+17
-18
@@ -1,18 +1,10 @@
|
||||
package script.event.gcwraids;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.groundquests;
|
||||
import script.library.factions;
|
||||
import script.library.prose;
|
||||
import script.library.badge;
|
||||
import script.library.pvp;
|
||||
import script.dictionary;
|
||||
import script.library.*;
|
||||
import script.obj_id;
|
||||
import script.prose_package;
|
||||
import script.string_id;
|
||||
|
||||
public class spec_force_killer extends script.base_script
|
||||
{
|
||||
@@ -57,7 +49,14 @@ public class spec_force_killer extends script.base_script
|
||||
int killImp10 = questGetQuestId("quest/event_gcwcheerleader_sfimp10");
|
||||
int killImp20 = questGetQuestId("quest/event_gcwcheerleader_sfimp20");
|
||||
int killImp50 = questGetQuestId("quest/event_gcwcheerleader_sfimp50");
|
||||
if (!questIsQuestActive(killReb5, self) && !questIsQuestActive(killReb10, self) && !questIsQuestActive(killReb20, self) && !questIsQuestActive(killReb50, self) && !questIsQuestActive(killImp5, self) && !questIsQuestActive(killImp10, self) && !questIsQuestActive(killImp20, self) && !questIsQuestActive(killImp50, self))
|
||||
if (!questIsQuestActive(killReb5, self) &&
|
||||
!questIsQuestActive(killReb10, self) &&
|
||||
!questIsQuestActive(killReb20, self) &&
|
||||
!questIsQuestActive(killReb50, self) &&
|
||||
!questIsQuestActive(killImp5, self) &&
|
||||
!questIsQuestActive(killImp10, self) &&
|
||||
!questIsQuestActive(killImp20, self) &&
|
||||
!questIsQuestActive(killImp50, self))
|
||||
{
|
||||
detachScript(self, "event.gcwraids.spec_force_killer");
|
||||
}
|
||||
@@ -65,25 +64,25 @@ public class spec_force_killer extends script.base_script
|
||||
}
|
||||
public int handleKillerDeathBlow(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int killReb50 = questGetQuestId("quest/event_gcwcheerleader_sfreb50");
|
||||
int killImp50 = questGetQuestId("quest/event_gcwcheerleader_sfimp50");
|
||||
obj_id victim = params.getObjId("victim");
|
||||
String victimFaction = factions.getFaction(victim);
|
||||
String killerFaction = factions.getFaction(self);
|
||||
if (pvp.hasKilledVictimRecently(self, victim))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String victimFaction = factions.getFaction(victim);
|
||||
if (victimFaction == null)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String killerFaction = factions.getFaction(self);
|
||||
if (victimFaction.equals(killerFaction))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int killsRequired = getIntObjVar(self, "event.event_gcwcheerleader.kills_required");
|
||||
killsRequired--;
|
||||
int killReb50 = questGetQuestId("quest/event_gcwcheerleader_sfreb50");
|
||||
int killImp50 = questGetQuestId("quest/event_gcwcheerleader_sfimp50");
|
||||
if (killsRequired == 0)
|
||||
{
|
||||
if (questIsQuestActive(killReb50, self))
|
||||
|
||||
Regular → Executable
+36
-55
@@ -1,21 +1,12 @@
|
||||
package script.event.generic_raid;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.library.badge;
|
||||
import script.library.create;
|
||||
import script.library.locations;
|
||||
import script.library.skill;
|
||||
import script.library.chat;
|
||||
import script.library.badge;
|
||||
import java.util.StringTokenizer;
|
||||
import script.library.gcw;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class generic_raid extends script.base_script
|
||||
{
|
||||
@@ -30,19 +21,17 @@ public class generic_raid extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
location here = getLocation(self);
|
||||
String myCity = locations.getGuardSpawnerRegionName(here);
|
||||
int numEntries = dataTableGetNumRows(DATATABLE);
|
||||
String myCity = locations.getGuardSpawnerRegionName(getLocation(self));
|
||||
if (myCity == null || myCity.equals(""))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (!hasObjVar(self, "auto_invasion.reference_number"))
|
||||
{
|
||||
int numEntries = dataTableGetNumRows(DATATABLE);
|
||||
for (int i = 0; i < numEntries; i++)
|
||||
{
|
||||
String thisCity = dataTableGetString(DATATABLE, i, "CITY");
|
||||
if (thisCity.equals(myCity))
|
||||
if (dataTableGetString(DATATABLE, i, "CITY").equals(myCity))
|
||||
{
|
||||
setObjVar(self, "auto_invasion.reference_number", i);
|
||||
}
|
||||
@@ -69,17 +58,15 @@ public class generic_raid extends script.base_script
|
||||
}
|
||||
public int invasionTimerPing(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
float rightNow = getGameTime();
|
||||
float nextInvasionTime = getFloatObjVar(self, "auto_invasion.next_invasion_time");
|
||||
int invasionActive = getIntObjVar(self, "auto_invasion.invasion_active");
|
||||
if (invasionActive == 1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (rightNow > nextInvasionTime && invasionActive == 0)
|
||||
float nextInvasionTime = getFloatObjVar(self, "auto_invasion.next_invasion_time");
|
||||
if (getGameTime() > nextInvasionTime && invasionActive == 0)
|
||||
{
|
||||
int roll = rand(0, 100);
|
||||
if (roll < 50)
|
||||
if (rand(0, 100) < 50)
|
||||
{
|
||||
messageTo(self, "startCheerleaderEvent", null, 1, false);
|
||||
}
|
||||
@@ -117,9 +104,9 @@ public class generic_raid extends script.base_script
|
||||
int destTableLength = dataTableGetNumRows(destTable);
|
||||
setObjVar(self, "auto_invasion.loc_table_length", locTableLength);
|
||||
setObjVar(self, "auto_invasion.dest_table_length", destTableLength);
|
||||
location loc = getLocation(self);
|
||||
for (int i = 0; i < locTableLength; i++)
|
||||
{
|
||||
location loc = getLocation(self);
|
||||
loc.x = dataTableGetFloat(locTable, i, "SPAWN_X");
|
||||
loc.y = dataTableGetFloat(locTable, i, "SPAWN_Y");
|
||||
loc.z = dataTableGetFloat(locTable, i, "SPAWN_Z");
|
||||
@@ -127,12 +114,11 @@ public class generic_raid extends script.base_script
|
||||
}
|
||||
for (int i = 0; i < destTableLength; i++)
|
||||
{
|
||||
location dest = getLocation(self);
|
||||
dest.x = dataTableGetFloat(destTable, i, "DEST_X");
|
||||
dest.y = dataTableGetFloat(destTable, i, "DEST_Y");
|
||||
dest.z = dataTableGetFloat(destTable, i, "DEST_Z");
|
||||
loc.x = dataTableGetFloat(destTable, i, "DEST_X");
|
||||
loc.y = dataTableGetFloat(destTable, i, "DEST_Y");
|
||||
loc.z = dataTableGetFloat(destTable, i, "DEST_Z");
|
||||
setObjVar(self, "auto_invasion.dest_off_" + i, dataTableGetFloat(destTable, i, "DEST_OFF"));
|
||||
setObjVar(self, "auto_invasion.spawn_dest_" + i, dest);
|
||||
setObjVar(self, "auto_invasion.spawn_dest_" + i, loc);
|
||||
}
|
||||
int maxWaves = dataTableGetInt(invasionTable, 0, "NUMWAVES");
|
||||
int spawnDelay = dataTableGetInt(invasionTable, 0, "SPAWNDELAY");
|
||||
@@ -149,22 +135,23 @@ public class generic_raid extends script.base_script
|
||||
}
|
||||
public int launchWave(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
String invasionTable = getStringObjVar(self, "auto_invasion.invasion_table");
|
||||
int currentWave = getIntObjVar(self, "auto_invasion.current_wave");
|
||||
int maxWaves = getIntObjVar(self, "auto_invasion.max_waves");
|
||||
int numberDead = 0;
|
||||
String startMessage = dataTableGetString(invasionTable, 0, "SYSMESSTART");
|
||||
String endMessage = dataTableGetString(invasionTable, 0, "SYSMESEND");
|
||||
if (currentWave == maxWaves)
|
||||
{
|
||||
String invasionTable = getStringObjVar(self, "auto_invasion.invasion_table");
|
||||
String endMessage = dataTableGetString(invasionTable, 0, "SYSMESEND");
|
||||
announceStatusToPlayers(self, endMessage);
|
||||
messageTo(self, "endInvasion", null, 1, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (currentWave == 0)
|
||||
else if (currentWave == 0)
|
||||
{
|
||||
String invasionTable = getStringObjVar(self, "auto_invasion.invasion_table");
|
||||
String startMessage = dataTableGetString(invasionTable, 0, "SYSMESSTART");
|
||||
announceStatusToPlayers(self, startMessage);
|
||||
}
|
||||
int numberDead = 0;
|
||||
currentWave++;
|
||||
setObjVar(self, "auto_invasion.current_wave", currentWave);
|
||||
setObjVar(self, "auto_invasion.spawn_number", 1);
|
||||
@@ -181,17 +168,16 @@ public class generic_raid extends script.base_script
|
||||
messageTo(self, "endInvasion", null, 1, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (getIntObjVar(self, "auto_invasion.done_spawning") == 1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int currentWave = getIntObjVar(self, "auto_invasion.current_wave");
|
||||
int spawnNum = getIntObjVar(self, "auto_invasion.spawn_number");
|
||||
int spawnDelay = dataTableGetInt(invasionTable, 0, "SPAWNDELAY");
|
||||
int maxWaveTimeMinutes = dataTableGetInt(invasionTable, 0, "MAXWAVETIME");
|
||||
int maxWaveTime = maxWaveTimeMinutes * 60;
|
||||
int doneSpawning = getIntObjVar(self, "auto_invasion.done_spawning");
|
||||
String script = dataTableGetString(invasionTable, 0, "SCRIPT");
|
||||
if (doneSpawning == 1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int locTableLength = getIntObjVar(self, "auto_invasion.loc_table_length") - 1;
|
||||
int locIndex = rand(0, locTableLength);
|
||||
location spawnLoc = getLocationObjVar(self, "auto_invasion.spawn_loc_" + locIndex);
|
||||
@@ -233,15 +219,11 @@ public class generic_raid extends script.base_script
|
||||
setObjVar(self, "auto_invasion.done_spawning", 1);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageTo(self, "startSpawning", null, spawnDelay, false);
|
||||
}
|
||||
messageTo(self, "startSpawning", null, spawnDelay, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int invaderDied(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id deadGuy = params.getObjId("deadGuy");
|
||||
int myNumber = params.getInt("myNumber");
|
||||
removeObjVar(self, "auto_invasion.spawn" + myNumber);
|
||||
int spawnNum = getIntObjVar(self, "auto_invasion.spawn_number");
|
||||
@@ -275,9 +257,10 @@ public class generic_raid extends script.base_script
|
||||
int invasionActive = getIntObjVar(self, "auto_invasion.invasion_active");
|
||||
if (lastWave == currentWave)
|
||||
{
|
||||
obj_id spawn;
|
||||
for (int i = 1; i <= spawnNum; i++)
|
||||
{
|
||||
obj_id spawn = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
spawn = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
if (isIdValid(spawn))
|
||||
{
|
||||
messageTo(spawn, "goDie", null, 1, false);
|
||||
@@ -294,10 +277,10 @@ public class generic_raid extends script.base_script
|
||||
public int endInvasion(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
setObjVar(self, "auto_invasion.invasion_active", 0);
|
||||
int spawnNum = getIntObjVar(self, "auto_invasion.spawn_num");
|
||||
obj_id spawn;
|
||||
for (int i = 1; i <= 20; i++)
|
||||
{
|
||||
obj_id spawn = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
spawn = getObjIdObjVar(self, "auto_invasion.spawn" + i);
|
||||
if (isIdValid(spawn))
|
||||
{
|
||||
messageTo(spawn, "goDie", null, 1, false);
|
||||
@@ -311,9 +294,8 @@ public class generic_raid extends script.base_script
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 255);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
badge.grantBadge(objPlayers[i], badgeName);
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
badge.grantBadge(objPlayer, badgeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,14 +319,13 @@ public class generic_raid extends script.base_script
|
||||
messageTo(self, "invasionTimerPing", null, 2700, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void announceStatusToPlayers(obj_id self, String messageId) throws InterruptedException
|
||||
private void announceStatusToPlayers(obj_id self, String messageId) throws InterruptedException
|
||||
{
|
||||
obj_id[] objPlayers = getPlayerCreaturesInRange(self, 256.0f);
|
||||
if (objPlayers != null && objPlayers.length > 0)
|
||||
{
|
||||
for (int i = 0; i < objPlayers.length; i++)
|
||||
{
|
||||
sendSystemMessage(objPlayers[i], new string_id("auto_invasion", messageId));
|
||||
for (obj_id objPlayer : objPlayers) {
|
||||
sendSystemMessage(objPlayer, new string_id("auto_invasion", messageId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user