who isn't sick of converting the freaking scripts? this negates the need

This commit is contained in:
DarthArgus
2015-11-24 09:27:45 -06:00
parent 2e64106bc8
commit bbee2d328c
11077 changed files with 2604347 additions and 3425075 deletions
@@ -0,0 +1,55 @@
package script.test;
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 java.lang.Math;
import java.util.Random;
import script.vector;
import script.library.ship_ai;
import script.library.space_create;
import script.library.static_item;
import script.library.utils;
import script.library.skill;
public class ai_rsitton extends script.base_script
{
public ai_rsitton()
{
}
public static final String s_logLabel = "ai_rsitton";
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(text);
if (tokenizer.hasMoreTokens())
{
String command = tokenizer.nextToken();
LOG(s_logLabel, "fnord: " + command + "--------------");
if (command.equalsIgnoreCase("fnord_waypoint"))
{
location here = getWorldLocation(self);
createWaypointInDatapadInternal(self, here, "shared_starport_tatooine.iff", "arrivals1");
}
else if (command.equalsIgnoreCase("fnord_client_path"))
{
obj_id target = getLookAtTarget(self);
createClientPathAdvanced(self, getLocation(self), getLocation(target), "default");
}
else if (command.equalsIgnoreCase("fnord_static_weapon"))
{
obj_id objInventory = utils.getInventoryContainer(self);
obj_id lootItem = static_item.createNewItemFunction("weapon_carbine_02_03", objInventory);
sendSystemMessageTestingOnly(self, "made " + lootItem);
}
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,50 +0,0 @@
include java.lang.Math;
include java.util.Random;
include vector;
include library.ship_ai;
include library.space_create;
include library.static_item;
include library.utils;
include library.skill;
const string s_logLabel = "ai_rsitton";
trigger OnSpeaking(String text)
{
if (isGod(self))
{
java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(text);
if (tokenizer.hasMoreTokens())
{
String command = tokenizer.nextToken();
LOG(s_logLabel, "fnord: " + command + "--------------");
if (command.equalsIgnoreCase("fnord_waypoint"))
{
location here = getWorldLocation(self);
createWaypointInDatapadInternal(self, here, "shared_starport_tatooine.iff", "arrivals1");
}
else if (command.equalsIgnoreCase("fnord_client_path"))
{
obj_id target = getLookAtTarget(self);
createClientPathAdvanced(self, getLocation(self), getLocation(target), "default");
}
else if (command.equalsIgnoreCase("fnord_static_weapon"))
{
obj_id objInventory = utils.getInventoryContainer(self);
obj_id lootItem = static_item.createNewItemFunction("weapon_carbine_02_03", objInventory);
//obj_id lootItem = static_item.createNewItemFunction("item_force_sensitive_ring_01_02", objInventory);
//obj_id lootItem = static_item.createNewItemFunction("weapon_pistol_02_03", objInventory);
//lootItem = static_item.createNewItemFunction("weapon_npe_carbine_spy_03_01", objInventory);
//obj_id lootItem = static_item.createNewItemFunction("weapon_grenade_fragmentation_01_01", objInventory);
sendSystemMessageTestingOnly(self, "made "+lootItem);
}
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,434 @@
package script.test;
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.healing;
public class ai_test extends script.base_script
{
public ai_test()
{
}
public void end(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "testPet"))
{
obj_id mob = getObjIdObjVar(self, "testPet");
destroyObject(mob);
removeObjVar(self, "testPet");
}
}
public void start(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "testPet"))
{
end(self);
}
debugSpeakMsg(self, "--Noodle has begun");
createTriggerVolume("blah", 3, true);
String creatureType = getStringObjVar(self, "testPetType");
location blah = getLocation(self);
blah.x = blah.x + 1.25f;
obj_id newmob = create.object(creatureType, blah);
if (newmob == null)
{
debugSpeakMsg(self, "--Could not spawn pet");
return;
}
detachAllScripts(newmob);
attachScript(newmob, "test.report_behavior");
attachScript(newmob, "test.ai_test2");
setObjVar(self, "testPet", newmob);
location loc = getLocation(self);
setHomeLocation(newmob, loc);
stop(newmob);
stopFloating(newmob);
}
public void gimme_skills(obj_id speaker) throws InterruptedException
{
grantSkill(speaker, "outdoors_creaturehandler_novice");
grantSkill(speaker, "outdoors_creaturehandler_taming_01");
grantSkill(speaker, "outdoors_creaturehandler_taming_02");
grantSkill(speaker, "outdoors_creaturehandler_taming_03");
grantSkill(speaker, "outdoors_creaturehandler_taming_04");
grantSkill(speaker, "outdoors_creaturehandler_training_01");
grantSkill(speaker, "outdoors_creaturehandler_training_02");
grantSkill(speaker, "outdoors_creaturehandler_training_03");
grantSkill(speaker, "outdoors_creaturehandler_training_04");
grantSkill(speaker, "outdoors_creaturehandler_healing_01");
grantSkill(speaker, "outdoors_creaturehandler_healing_02");
grantSkill(speaker, "outdoors_creaturehandler_healing_03");
grantSkill(speaker, "outdoors_creaturehandler_healing_04");
grantSkill(speaker, "outdoors_creaturehandler_support_01");
grantSkill(speaker, "outdoors_creaturehandler_support_02");
grantSkill(speaker, "outdoors_creaturehandler_support_03");
grantSkill(speaker, "outdoors_creaturehandler_support_04");
grantSkill(speaker, "outdoors_creaturehandler_master");
setObjVar(speaker, "fasttame", 1);
}
public void start2(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "testPet"))
{
end(self);
}
debugSpeakMsg(self, "--Testing has begun");
String creatureType = getStringObjVar(self, "testPetType");
location blah = getLocation(self);
obj_id newmob = create.object(creatureType, blah);
if (newmob == null)
{
debugSpeakMsg(self, "--Could not spawn pet");
return;
}
location loc = getLocation(self);
setHomeLocation(newmob, loc);
}
public void startMounts(obj_id self, obj_id speaker) throws InterruptedException
{
if (hasObjVar(self, "testPet"))
{
end(self);
}
debugSpeakMsg(self, "--Testing has begun");
String creatureType = getStringObjVar(self, "testPetType");
location blah = getLocation(self);
obj_id newmob = create.object(creatureType, blah);
if (newmob == null)
{
debugSpeakMsg(self, "--Could not spawn pet");
return;
}
location loc = getLocation(self);
setHomeLocation(newmob, loc);
attachScript(newmob, "ai.pet_advance");
gimme_skills(speaker);
}
public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id whoTriggeredMe) throws InterruptedException
{
debugSpeakMsg(self, "Trigger Volume Enter");
return SCRIPT_CONTINUE;
}
public int OnTriggerVolumeExited(obj_id self, String volumeName, obj_id whoTriggeredMe) throws InterruptedException
{
debugSpeakMsg(self, "Trigger Volume Exit");
return SCRIPT_CONTINUE;
}
public int OnObjectDamaged(obj_id self, obj_id attacker, obj_id weapon, int damage) throws InterruptedException
{
healing.fullHeal(self);
return SCRIPT_CONTINUE;
}
public int OnCreatureDamaged(obj_id self, obj_id attacker, obj_id weapon, int[] damage) throws InterruptedException
{
healing.fullHeal(self);
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
setObjVar(self, "blahblah", 1);
start(self);
return SCRIPT_CONTINUE;
}
public int OnDetach(obj_id self) throws InterruptedException
{
end(self);
return SCRIPT_CONTINUE;
}
public int OnHearSpeech(obj_id self, obj_id speaker, String text) throws InterruptedException
{
String[] words = split(text, ' ');
if (words[0].equals("cone"))
{
debugSpeakMsg(self, "happy cone cone");
float fltConeLength = 64f;
float fltConeWidth = 15f;
obj_id objTarget = getLookAtTarget(self);
obj_id objPlayer = self;
obj_id[] objDefenders = getCreaturesInCone(objPlayer, objTarget, fltConeLength, fltConeWidth);
for (int intI = 0; intI < objDefenders.length; intI++)
{
debugSpeakMsg(objDefenders[intI], "I am targetsd");
}
objDefenders = pvpGetTargetsInCone(objPlayer, objPlayer, objTarget, fltConeLength, fltConeWidth);
for (int intI = 0; intI < objDefenders.length; intI++)
{
debugSpeakMsg(objDefenders[intI], "I am PVP targetsd");
}
}
if (speaker == self)
{
return SCRIPT_CONTINUE;
}
if (words[0].equals("spawn"))
{
String toCreate = words[1];
location here = getLocation(self);
obj_id newMob = create.object(toCreate, here);
stopFloating(newMob);
debugSpeakMsg(newMob, "i am a spatula");
return SCRIPT_CONTINUE;
}
if (words[0].equals("start"))
{
start(self);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("start2"))
{
start2(self);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("startMounts"))
{
startMounts(self, speaker);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("setPetType"))
{
setObjVar(self, "testPetType", words[1]);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("spawnCreatures"))
{
String creatureType = getStringObjVar(self, "testPetType");
for (int i = 0; i < 10; i++)
{
location loc = getLocation(self);
create.object(creatureType, loc);
}
}
else if (words[0].equals("spawnRandom300"))
{
String creatureType = getStringObjVar(self, "testPetType");
for (int i = 0; i < 300; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType, loc);
loiterTarget(mob, self, 10, 30, 1, 2);
}
}
else if (words[0].equals("reload"))
{
debugSpeakMsg(self, "Reloading node " + words[1]);
obj_id idToReload = utils.stringToObjId(words[1]);
obj_id[] ids = new obj_id[1];
ids[0] = idToReload;
reloadPathNodes(ids);
}
else if (words[0].equals("testSwarm"))
{
String creatureType = getStringObjVar(self, "testPetType");
for (int i = 0; i < 1; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType, loc);
swarm(mob, speaker);
setMovementRun(mob);
}
}
else if (words[0].equals("testSwarm2"))
{
String creatureType = getStringObjVar(self, "testPetType");
for (int i = 0; i < 1; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType, loc);
swarm(mob, speaker, 8.0f);
setMovementRun(mob);
}
}
else if (words[0].equals("testSwarm3"))
{
String creatureType = getStringObjVar(self, "testPetType");
for (int i = 0; i < 1; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType, loc);
swarm(mob, speaker, 16.0f);
setMovementRun(mob);
}
}
if (!hasObjVar(self, "testPet"))
{
return SCRIPT_CONTINUE;
}
obj_id mob = getObjIdObjVar(self, "testPet");
if (words[0].equals("follow"))
{
debugSpeakMsg(self, "--Now following");
follow(mob, speaker, 2f, 5f);
}
else if (words[0].equals("followOffset"))
{
debugSpeakMsg(self, "--Now following");
follow(mob, speaker, new location(2, 0, 0, ""));
}
else if (words[0].equals("swarm"))
{
debugSpeakMsg(self, "--Swarm");
swarm(mob, speaker);
}
else if (words[0].equals("swarmit"))
{
obj_id target = utils.stringToObjId(words[1]);
debugSpeakMsg(self, "--Swarming target");
swarm(mob, target);
}
else if (words[0].equals("wander"))
{
debugSpeakMsg(self, "--Wandering");
wander(mob);
}
else if (words[0].equals("loiter"))
{
debugSpeakMsg(self, "--Loitering");
final location home = getLocation(mob);
loiterLocation(mob, home, 15f, 20f, 1f, 2f);
}
else if (words[0].equals("loiterNear"))
{
debugSpeakMsg(self, "--Loitering");
loiterTarget(mob, self, 0, 5, 0, 0);
}
else if (words[0].equals("stop"))
{
debugSpeakMsg(self, "--Stop");
stop(mob);
}
else if (words[0].equals("pathHome"))
{
debugSpeakMsg(self, "--Going home");
location loc = getLocation(self);
pathTo(mob, loc);
}
else if (words[0].equals("pathAway"))
{
debugSpeakMsg(self, "--Going to speaker");
location loc = getLocation(speaker);
pathTo(mob, loc);
}
else if (words[0].equals("moveX"))
{
debugSpeakMsg(self, "--Going to speaker");
location loc = getLocation(mob);
loc.x += 1;
pathTo(mob, loc);
}
else if (words[0].equals("flee"))
{
debugSpeakMsg(self, "--Fleeing");
flee(mob, speaker, 5, 10);
}
else if (words[0].equals("face"))
{
debugSpeakMsg(self, "--Facing target");
faceToBehavior(mob, speaker);
}
else if (words[0].equals("faceBehavior"))
{
debugSpeakMsg(self, "--Facing behavior");
faceToBehavior(mob, speaker);
}
else if (words[0].equals("end"))
{
debugSpeakMsg(self, "--Done with testing");
end(self);
}
else if (words[0].equals("anger"))
{
debugSpeakMsg(self, "--Angry at speaker");
addToMentalStateToward(mob, speaker, ANGER, 40);
}
else if (words[0].equals("frenzy"))
{
debugSpeakMsg(self, "--Frenzying toward speaker");
addToMentalStateToward(mob, speaker, ANGER, 100);
}
else if (words[0].equals("attack"))
{
debugSpeakMsg(self, "--Attacking speaker");
addToMentalStateToward(mob, speaker, ANGER, 100, BEHAVIOR_ATTACK);
}
else if (words[0].equals("attack"))
{
debugSpeakMsg(self, "--Attacking speaker");
addToMentalStateToward(mob, speaker, ANGER, 100, BEHAVIOR_ATTACK);
}
else if (words[0].equals("upright"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_UPRIGHT)");
setPosture(mob, POSTURE_UPRIGHT);
}
else if (words[0].equals("crouch"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_CROUCHED)");
setPosture(mob, POSTURE_CROUCHED);
}
else if (words[0].equals("prone"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_PRONE)");
setPosture(mob, POSTURE_PRONE);
}
else if (words[0].equals("lie"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_LYING_DOWN)");
setPosture(mob, POSTURE_LYING_DOWN);
}
else if (words[0].equals("drive"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_DRIVING_VEHICLE)");
setPosture(mob, POSTURE_DRIVING_VEHICLE);
}
else if (words[0].equals("stand"))
{
debugSpeakMsg(self, "--setLocomotion(self, LOCOMOTION_STANDING");
setLocomotion(mob, LOCOMOTION_STANDING);
}
else if (words[0].equals("walk"))
{
debugSpeakMsg(self, "--setLocomotion(self, LOCOMOTION_WALKING");
setLocomotion(mob, LOCOMOTION_WALKING);
}
else if (words[0].equals("run"))
{
debugSpeakMsg(self, "--setLocomotion(self, LOCOMOTION_RUNNING");
setLocomotion(mob, LOCOMOTION_RUNNING);
}
else if (words[0].equals("fast"))
{
debugSpeakMsg(self, "--setMovementRun(self)");
setMovementRun(mob);
}
else if (words[0].equals("slow"))
{
debugSpeakMsg(self, "--setMovementWalk(self)");
setMovementWalk(mob);
}
else if (words[0].equals("pathToName"))
{
debugSpeakMsg(self, "--Going to waypoint " + words[1]);
pathTo(mob, words[1]);
}
else if (words[0].equals("canSee"))
{
if (canSee(mob, speaker))
{
debugSpeakMsg(mob, "Can see you");
}
else
{
debugSpeakMsg(mob, "Can NOT see you");
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,500 +0,0 @@
include library.utils;
include library.create;
include library.healing;
void end(obj_id self)
{
if ( hasObjVar(self, "testPet") )
{
obj_id mob = getObjIdObjVar(self, "testPet");
destroyObject(mob);
removeObjVar(self, "testPet");
}
}
void start(obj_id self)
{
if ( hasObjVar(self, "testPet") )
end(self);
debugSpeakMsg(self, "--Noodle has begun");
createTriggerVolume( "blah", 3, true );
String creatureType = getStringObjVar(self,"testPetType");
location blah = getLocation(self);
blah.x = blah.x + 1.25f;
obj_id newmob = create.object(creatureType,blah);
if ( newmob == null )
{
debugSpeakMsg(self, "--Could not spawn pet");
return;
}
detachAllScripts(newmob);
attachScript(newmob, "test.report_behavior");
attachScript(newmob, "test.ai_test2");
setObjVar(self, "testPet", newmob);
location loc = getLocation(self);
setHomeLocation(newmob, loc);
stop(newmob);
stopFloating(newmob);
}
void gimme_skills(obj_id speaker)
{
grantSkill(speaker, "outdoors_creaturehandler_novice");
grantSkill(speaker, "outdoors_creaturehandler_taming_01");
grantSkill(speaker, "outdoors_creaturehandler_taming_02");
grantSkill(speaker, "outdoors_creaturehandler_taming_03");
grantSkill(speaker, "outdoors_creaturehandler_taming_04");
grantSkill(speaker, "outdoors_creaturehandler_training_01");
grantSkill(speaker, "outdoors_creaturehandler_training_02");
grantSkill(speaker, "outdoors_creaturehandler_training_03");
grantSkill(speaker, "outdoors_creaturehandler_training_04");
grantSkill(speaker, "outdoors_creaturehandler_healing_01");
grantSkill(speaker, "outdoors_creaturehandler_healing_02");
grantSkill(speaker, "outdoors_creaturehandler_healing_03");
grantSkill(speaker, "outdoors_creaturehandler_healing_04");
grantSkill(speaker, "outdoors_creaturehandler_support_01");
grantSkill(speaker, "outdoors_creaturehandler_support_02");
grantSkill(speaker, "outdoors_creaturehandler_support_03");
grantSkill(speaker, "outdoors_creaturehandler_support_04");
grantSkill(speaker, "outdoors_creaturehandler_master");
setObjVar(speaker,"fasttame",1);
}
void start2(obj_id self)
{
if ( hasObjVar(self, "testPet") )
end(self);
debugSpeakMsg(self, "--Testing has begun");
String creatureType = getStringObjVar(self,"testPetType");
location blah = getLocation(self);
obj_id newmob = create.object(creatureType,blah);
if ( newmob == null )
{
debugSpeakMsg(self, "--Could not spawn pet");
return;
}
location loc = getLocation(self);
setHomeLocation(newmob, loc);
}
void startMounts(obj_id self, obj_id speaker)
{
if ( hasObjVar(self, "testPet") )
end(self);
debugSpeakMsg(self, "--Testing has begun");
String creatureType = getStringObjVar(self,"testPetType");
location blah = getLocation(self);
obj_id newmob = create.object(creatureType,blah);
if ( newmob == null )
{
debugSpeakMsg(self, "--Could not spawn pet");
return;
}
location loc = getLocation(self);
setHomeLocation(newmob, loc);
attachScript(newmob, "ai.pet_advance");
gimme_skills(speaker);
}
trigger OnTriggerVolumeEntered(string volumeName, obj_id whoTriggeredMe)
{
debugSpeakMsg(self,"Trigger Volume Enter");
return SCRIPT_CONTINUE;
}
trigger OnTriggerVolumeExited(string volumeName, obj_id whoTriggeredMe)
{
debugSpeakMsg(self,"Trigger Volume Exit");
return SCRIPT_CONTINUE;
}
trigger OnObjectDamaged( obj_id attacker, obj_id weapon, int damage )
{
healing.fullHeal(self);
return SCRIPT_CONTINUE;
}
trigger OnCreatureDamaged(obj_id attacker, obj_id weapon, int[] damage)
{
healing.fullHeal(self);
return SCRIPT_CONTINUE;
}
trigger OnAttach()
{
setObjVar(self, "blahblah", 1);
start(self);
return SCRIPT_CONTINUE;
}
trigger OnDetach()
{
end(self);
return SCRIPT_CONTINUE;
}
trigger OnHearSpeech(obj_id speaker, string text)
{
string[] words = split( text, ' ' );
if(words[0].equals("cone"))
{
debugSpeakMsg(self, "happy cone cone");
float fltConeLength = 64f;
float fltConeWidth = 15f;
obj_id objTarget = getLookAtTarget(self);
obj_id objPlayer = self;
obj_id[] objDefenders = getCreaturesInCone(objPlayer, objTarget, fltConeLength, fltConeWidth);
for(int intI = 0; intI<objDefenders.length; intI++)
{
debugSpeakMsg(objDefenders[intI], "I am targetsd");
}
objDefenders = pvpGetTargetsInCone(objPlayer, objPlayer, objTarget, fltConeLength, fltConeWidth);
for(int intI = 0; intI<objDefenders.length; intI++)
{
debugSpeakMsg(objDefenders[intI], "I am PVP targetsd");
}
}
if ( speaker == self )
{
return SCRIPT_CONTINUE;
}
if ( words[0].equals("spawn"))
{
string toCreate = words[1];
location here = getLocation(self);
// here.x = here.x + 3.25f;
obj_id newMob = create.object (toCreate, here);
stopFloating(newMob);
debugSpeakMsg(newMob, "i am a spatula");
return SCRIPT_CONTINUE;
}
if ( words[0].equals("start" ))
{
start(self);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("start2"))
{
start2(self);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("startMounts"))
{
startMounts(self,speaker);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("setPetType"))
{
setObjVar(self,"testPetType",words[1]);
return SCRIPT_CONTINUE;
}
else if (words[0].equals("spawnCreatures"))
{
String creatureType = getStringObjVar(self,"testPetType");
for(int i = 0; i < 10; i++)
{
location loc = getLocation(self);
create.object(creatureType,loc);
}
}
else if (words[0].equals("spawnRandom300"))
{
String creatureType = getStringObjVar(self,"testPetType");
for(int i = 0; i < 300; i++)
{
// int x = rand(1,2000);
// int z = rand(1,2000);
location loc = getLocation(self);
// loc.x += (x - 1000);
// loc.z += (z - 1000);
obj_id mob = create.object(creatureType,loc);
loiterTarget(mob,self,10,30,1,2);
}
}
else if (words[0].equals("reload"))
{
debugSpeakMsg(self, "Reloading node " + words[1]);
obj_id idToReload = utils.stringToObjId(words[1]);
obj_id[] ids = new obj_id[1];
ids[0] = idToReload;
reloadPathNodes(ids);
}
else if (words[0].equals("testSwarm"))
{
String creatureType = getStringObjVar(self,"testPetType");
for(int i = 0; i < 1; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType,loc);
swarm(mob,speaker);
setMovementRun(mob);
}
}
else if (words[0].equals("testSwarm2"))
{
String creatureType = getStringObjVar(self,"testPetType");
for(int i = 0; i < 1; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType,loc);
swarm(mob,speaker,8.0f);
setMovementRun(mob);
}
}
else if (words[0].equals("testSwarm3"))
{
String creatureType = getStringObjVar(self,"testPetType");
for(int i = 0; i < 1; i++)
{
location loc = getLocation(self);
obj_id mob = create.object(creatureType,loc);
swarm(mob,speaker,16.0f);
setMovementRun(mob);
}
}
if ( !hasObjVar(self, "testPet") )
{
// debugSpeakMsg(self, "--I have not been setup to test");
return SCRIPT_CONTINUE;
}
obj_id mob = getObjIdObjVar(self, "testPet");
if ( words[0].equals("follow" ))
{
debugSpeakMsg(self, "--Now following");
follow(mob, speaker, 2f, 5f);
}
else if ( words[0].equals("followOffset" ))
{
debugSpeakMsg(self, "--Now following");
follow(mob, speaker, new location(2,0,0,""));
}
else if ( words[0].equals("swarm"))
{
debugSpeakMsg(self,"--Swarm");
swarm(mob,speaker);
}
else if ( words[0].equals("swarmit"))
{
obj_id target = utils.stringToObjId(words[1]);
debugSpeakMsg(self,"--Swarming target");
swarm(mob,target);
}
else if (words[0].equals("wander"))
{
debugSpeakMsg(self, "--Wandering");
wander(mob);
}
else if (words[0].equals("loiter"))
{
debugSpeakMsg(self, "--Loitering");
const location home = getLocation(mob);
loiterLocation(mob, home, 15f, 20f, 1f, 2f);
}
else if (words[0].equals("loiterNear"))
{
debugSpeakMsg(self, "--Loitering");
loiterTarget(mob, self, 0, 5, 0, 0);
}
else if (words[0].equals("stop"))
{
debugSpeakMsg(self, "--Stop");
stop(mob);
}
else if (words[0].equals("pathHome"))
{
debugSpeakMsg(self, "--Going home");
location loc = getLocation(self);
pathTo(mob, loc);
}
else if (words[0].equals("pathAway"))
{
debugSpeakMsg(self, "--Going to speaker");
location loc = getLocation(speaker);
pathTo(mob, loc);
}
else if (words[0].equals("moveX"))
{
debugSpeakMsg(self, "--Going to speaker");
location loc = getLocation(mob);
loc.x += 1;
pathTo(mob, loc);
}
else if (words[0].equals("flee"))
{
debugSpeakMsg(self, "--Fleeing");
flee(mob, speaker, 5, 10);
}
else if (words[0].equals("face"))
{
debugSpeakMsg(self, "--Facing target");
faceToBehavior(mob,speaker);
}
else if (words[0].equals("faceBehavior"))
{
debugSpeakMsg(self, "--Facing behavior");
faceToBehavior(mob,speaker);
}
else if (words[0].equals("end"))
{
debugSpeakMsg(self, "--Done with testing");
end(self);
}
else if (words[0].equals("anger"))
{
debugSpeakMsg(self, "--Angry at speaker");
addToMentalStateToward(mob, speaker, ANGER, 40);
}
else if (words[0].equals("frenzy"))
{
debugSpeakMsg(self, "--Frenzying toward speaker");
addToMentalStateToward(mob, speaker, ANGER, 100);
}
else if (words[0].equals("attack"))
{
debugSpeakMsg(self, "--Attacking speaker");
addToMentalStateToward(mob, speaker, ANGER, 100, BEHAVIOR_ATTACK);
}
else if (words[0].equals("attack"))
{
debugSpeakMsg(self, "--Attacking speaker");
addToMentalStateToward(mob, speaker, ANGER, 100, BEHAVIOR_ATTACK);
}
else if (words[0].equals("upright"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_UPRIGHT)");
setPosture(mob, POSTURE_UPRIGHT);
}
else if (words[0].equals("crouch"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_CROUCHED)");
setPosture(mob, POSTURE_CROUCHED);
}
else if (words[0].equals("prone"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_PRONE)");
setPosture(mob, POSTURE_PRONE);
}
else if (words[0].equals("lie"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_LYING_DOWN)");
setPosture(mob, POSTURE_LYING_DOWN);
}
else if (words[0].equals("drive"))
{
debugSpeakMsg(self, "--setPosture(self, POSTURE_DRIVING_VEHICLE)");
setPosture(mob, POSTURE_DRIVING_VEHICLE);
}
else if (words[0].equals("stand"))
{
debugSpeakMsg(self, "--setLocomotion(self, LOCOMOTION_STANDING");
setLocomotion(mob, LOCOMOTION_STANDING);
}
else if (words[0].equals("walk"))
{
debugSpeakMsg(self, "--setLocomotion(self, LOCOMOTION_WALKING");
setLocomotion(mob, LOCOMOTION_WALKING);
}
else if (words[0].equals("run"))
{
debugSpeakMsg(self, "--setLocomotion(self, LOCOMOTION_RUNNING");
setLocomotion(mob, LOCOMOTION_RUNNING);
}
else if (words[0].equals("fast"))
{
debugSpeakMsg(self, "--setMovementRun(self)");
setMovementRun(mob);
}
else if (words[0].equals("slow"))
{
debugSpeakMsg(self, "--setMovementWalk(self)");
setMovementWalk(mob);
}
else if (words[0].equals("pathToName"))
{
debugSpeakMsg(self, "--Going to waypoint " + words[1]);
pathTo(mob,words[1]);
}
else if (words[0].equals("canSee"))
{
if(canSee(mob,speaker))
{
debugSpeakMsg(mob,"Can see you");
}
else
{
debugSpeakMsg(mob,"Can NOT see you");
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,39 @@
package script.test;
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;
public class buy_box extends script.base_script
{
public buy_box()
{
}
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
{
LOG("tony_test", "player " + player + " item " + item);
if (item == menu_info_types.ITEM_PUBLIC_CONTAINER_USE1)
{
debugSpeakMsg(player, "You just purchased " + self + "!");
}
return SCRIPT_CONTINUE;
}
public int OnGetAttributes(obj_id self, obj_id player, String[] names, String[] attribs) throws InterruptedException
{
if (names == null || attribs == null || names.length != attribs.length)
{
return SCRIPT_CONTINUE;
}
final int firstFreeIndex = getFirstFreeIndex(names);
if (firstFreeIndex >= 0 && firstFreeIndex < names.length)
{
names[firstFreeIndex] = "cost";
attribs[firstFreeIndex] = "42";
}
return SCRIPT_CONTINUE;
}
}
@@ -1,26 +0,0 @@
trigger OnObjectMenuSelect(obj_id player, int item)
{
LOG("tony_test", "player " + player + " item " + item);
if (item == menu_info_types.ITEM_PUBLIC_CONTAINER_USE1)
debugSpeakMsg(player, "You just purchased " + self + "!");
return SCRIPT_CONTINUE;
}
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
{
if (names == null || attribs == null || names.length != attribs.length)
return SCRIPT_CONTINUE;
const int firstFreeIndex = getFirstFreeIndex(names);
if (firstFreeIndex >= 0 && firstFreeIndex < names.length)
{
names[firstFreeIndex] = "cost";
attribs[firstFreeIndex] = "42";
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,30 @@
package script.test;
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;
public class cannot_die_healing_test extends script.base_script
{
public cannot_die_healing_test()
{
}
public int OnCreatureDamaged(obj_id self, obj_id attacker, obj_id weapon, int[] damage) throws InterruptedException
{
setAttrib(self, HEALTH, 100);
return SCRIPT_CONTINUE;
}
public int OnObjectDamaged(obj_id self, obj_id attacker, obj_id weapon, int damage) throws InterruptedException
{
setHitpoints(self, 100);
return SCRIPT_CONTINUE;
}
public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException
{
return SCRIPT_OVERRIDE;
}
}
@@ -1,18 +0,0 @@
trigger OnCreatureDamaged( obj_id attacker, obj_id weapon, int[] damage )
{
setAttrib(self, HEALTH, 100);
return SCRIPT_CONTINUE;
}
trigger OnObjectDamaged(obj_id attacker, obj_id weapon, int damage)
{
setHitpoints(self, 100);
return SCRIPT_CONTINUE;
}
trigger OnIncapacitated (obj_id killer)
{
return SCRIPT_OVERRIDE;
}
@@ -0,0 +1,75 @@
package script.test;
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.ai_lib;
import script.library.create;
import script.library.pclib;
import script.library.skill;
import script.library.sui;
import script.library.utils;
import script.library.weapons;
public class char_transfer extends script.base.remote_object_requester
{
public char_transfer()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equalsIgnoreCase("ct_totarget"))
{
debugConsoleMsg(self, "hit ct_totarget");
obj_id target = getLookAtTarget(self);
debugSpeakMsg(self, command + ": target=" + target);
dictionary params = new dictionary();
params.put("withItems", true);
params.put("allowOverride", true);
Object[] triggerParams = new Object[2];
triggerParams[0] = self;
triggerParams[1] = params;
int err = script_entry.runScripts("OnUploadCharacter", triggerParams);
if (err == SCRIPT_CONTINUE)
{
byte[] packedData = params.pack();
triggerParams = new Object[2];
triggerParams[0] = target;
triggerParams[1] = packedData;
err = script_entry.runScripts("OnDownloadCharacter", triggerParams);
removeObjVar(target, "hasTransferred");
debugSpeakMsg(self, command + ": err=" + err);
}
}
}
}
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
debugConsoleMsg(self, "char_transfer attached!");
return SCRIPT_CONTINUE;
}
public int OnDetach(obj_id self) throws InterruptedException
{
debugSpeakMsg(self, "char_transfer detached!");
return SCRIPT_CONTINUE;
}
public int OnInitialize(obj_id self) throws InterruptedException
{
debugServerConsoleMsg(self, "char_transfer initialized!");
return SCRIPT_CONTINUE;
}
}
@@ -1,93 +0,0 @@
include library.ai_lib;
include library.create;
include library.pclib;
include library.skill;
include library.sui;
include library.utils;
include library.weapons;
inherits base.remote_object_requester;
//Character Transfer Test Harness
//This will transfer your character to the character you have targeted.
trigger OnSpeaking(String text)
{
if(isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
if (tok.hasMoreTokens ())
{
String command = tok.nextToken ();
debugConsoleMsg( self, "command is: " + command);
// ----------------------------------------------------------------------
//character transfer to target character
if (command.equalsIgnoreCase ("ct_totarget"))
{
debugConsoleMsg(self, "hit ct_totarget");
obj_id target = getLookAtTarget(self);
debugSpeakMsg(self, command + ": target=" + target);
dictionary params = new dictionary();
params.put("withItems", true);
params.put("allowOverride", true);
Object[] triggerParams = new Object[2];
triggerParams[0] = self;
triggerParams[1] = params;
int err = script_entry.runScripts("OnUploadCharacter", triggerParams);
if(err == SCRIPT_CONTINUE)
{
byte[] packedData = params.pack();
triggerParams = new Object[2];
triggerParams[0] = target;
triggerParams[1] = packedData;
err = script_entry.runScripts("OnDownloadCharacter", triggerParams);
removeObjVar(target, "hasTransferred");
debugSpeakMsg(self, command + ": err=" + err);
}
}
}
}
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnAttach()
{
debugConsoleMsg(self, "char_transfer attached!");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnDetach()
{
debugSpeakMsg(self, "char_transfer detached!");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnInitialize()
{
debugServerConsoleMsg(self, "char_transfer initialized!");
return SCRIPT_CONTINUE;
}
// ======================================================================
@@ -0,0 +1,60 @@
package script.test;
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.craftinglib;
import script.library.weapons;
public class create_weapon extends script.base_script
{
public create_weapon()
{
}
public void makeResource(obj_id self, String rclass) throws InterruptedException
{
obj_id[] rtypes = getResourceTypes(rclass);
sendSystemMessageTestingOnly(self, "Types are..." + rtypes[0].toString());
obj_id rtype = rtypes[0];
if (!isIdValid(rtype))
{
sendSystemMessageTestingOnly(self, "No id found");
sendSystemMessageTestingOnly(self, "Type was " + rclass);
return;
}
String crateTemplate = getResourceContainerForType(rtype);
if (!crateTemplate.equals(""))
{
obj_id pInv = utils.getInventoryContainer(self);
if (isIdValid(pInv))
{
obj_id crate = createObject(crateTemplate, pInv, "");
if (addResourceToContainer(crate, rtype, 100000, self))
{
sendSystemMessageTestingOnly(self, "Resource of class " + rclass + " added");
}
}
}
}
public int OnSpeaking(obj_id self, String strText) throws InterruptedException
{
String[] strCommands = split(strText, ' ');
if (strCommands[0].equals("cwep"))
{
obj_id pInv = utils.getInventoryContainer(self);
String type = "all";
if (strCommands.length > 1)
{
type = strCommands[1];
}
weapons.createOneOfEach(type, pInv, weapons.VIA_TEMPLATE, 1.0f);
}
return SCRIPT_CONTINUE;
}
}
@@ -1,55 +0,0 @@
/*
Title: test_crafting_base_weapon.script
Description: base crafting script used by all weapons
*/
include library.utils;
include library.craftinglib;
include library.weapons;
void makeResource(obj_id self, string rclass)
{
obj_id[] rtypes = getResourceTypes(rclass);
sendSystemMessageTestingOnly(self, "Types are..." + rtypes[0].toString());
obj_id rtype = rtypes[0];
if(!isIdValid(rtype))
{
sendSystemMessageTestingOnly(self, "No id found");
sendSystemMessageTestingOnly(self, "Type was "+rclass);
return;
}
string crateTemplate = getResourceContainerForType(rtype);
if ( !crateTemplate.equals("") )
{
obj_id pInv = utils.getInventoryContainer(self);
if ( isIdValid(pInv) )
{
obj_id crate = createObject(crateTemplate, pInv, "");
if ( addResourceToContainer (crate, rtype, 100000, self) )
{
sendSystemMessageTestingOnly(self, "Resource of class "+rclass+" added");
}
}
}
}
trigger OnSpeaking(string strText)
{
string[] strCommands = split(strText, ' ' );
if (strCommands[0]=="cwep")
{
obj_id pInv = utils.getInventoryContainer(self);
string type = "all";
if(strCommands.length > 1)
{
type = strCommands[1];
}
weapons.createOneOfEach(type, pInv, weapons.VIA_TEMPLATE, 1.0f);
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,810 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
import script.library.chat;
import script.library.pclib;
import script.library.vehicle;
import script.library.ship_ai;
import script.library.space_crafting;
import script.library.space_transition;
import script.library.space_dungeon;
import java.lang.Long;
public class dmellencamp_test extends script.base_script
{
public dmellencamp_test()
{
}
public void colorize(obj_id player, obj_id target, String customizationVar) throws InterruptedException
{
int pId = createSUIPage("Script.ColorPicker", player, player, "ColorizeCallback");
setSUIProperty(pId, "ColorPicker", "TargetNetworkId", target.toString());
setSUIProperty(pId, "ColorPicker", "TargetVariable", customizationVar);
setSUIProperty(pId, "ColorPicker", "TargetRange", "500");
subscribeToSUIProperty(pId, "ColorPicker", "SelectedIndex");
setSUIAssociatedObject(pId, target);
showSUIPage(pId);
}
public void maxStats(obj_id objPlayer) throws InterruptedException
{
addAttribModifier(objPlayer, HEALTH, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, ACTION, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, MIND, 2000, 0, 0, MOD_POOL);
}
public boolean sendStartingLocations(obj_id player) throws InterruptedException
{
newbieTutorialSendStartingLocationsToPlayer(player, null);
return true;
}
public int newbieRequestStartingLocations(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
sendStartingLocations(self);
return SCRIPT_CONTINUE;
}
public int newbieSelectStartingLocation(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
String name = params;
boolean available = isStartingLocationAvailable(name);
newbieTutorialSendStartingLocationSelectionResult(self, name, available);
if (available)
{
location loc = getStartingLocationInfo(name);
if (loc != null)
{
if (loc.cell != null && loc.cell != obj_id.NULL_ID)
{
warpPlayer(self, loc.area, 0.0f, 0.0f, 0.0f, loc.cell, loc.x, loc.y, loc.z);
}
else
{
warpPlayer(self, loc.area, loc.x, loc.y, loc.z, null, 0.0f, 0.0f, 0.0f);
}
}
}
return SCRIPT_CONTINUE;
}
public int OnApplyPowerup(obj_id self, obj_id playerId, obj_id targetId) throws InterruptedException
{
chat.chat(playerId, "OnApplyPowerup " + self.toString() + " -> " + targetId.toString());
return SCRIPT_CONTINUE;
}
public int OnGetAttributes(obj_id self, obj_id playerId, String[] names, String[] attribs) throws InterruptedException
{
names[0] = "jwatson_test";
attribs[0] = "What's up my homies?\nYeah";
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equals("dm_colorize"))
{
if (tok.countTokens() < 2)
{
debugSpeakMsg(self, "Not enough arguments: colorize <obj_id> <customization var>");
}
else
{
tok.nextToken();
String idString = tok.nextToken();
String customizationVar = tok.nextToken();
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(idString));
colorize(self, id, customizationVar);
}
}
else if (command.equals("dm_scale"))
{
if (tok.countTokens() < 1)
{
debugSpeakMsg(self, "Not enough arguments: scale <factor> [obj_id]");
}
else
{
float scaleFactor = Float.parseFloat(tok.nextToken());
obj_id id = null;
if (tok.countTokens() > 0)
{
String idString = tok.nextToken();
id = obj_id.getObjId(java.lang.Long.parseLong(idString));
}
else
{
id = self;
}
setScale(id, scaleFactor);
}
}
else if (command.equals("dm_systemMessage"))
{
debugSpeakMsg(self, "jwatson_test dm_systemMessage: " + text);
if (tok.countTokens() < 2)
{
debugSpeakMsg(self, "Not enough arguments: dm_systemMessage <id> <msg>");
}
else
{
obj_id id = null;
String idString = tok.nextToken();
if (!idString.equals("0"))
{
id = obj_id.getObjId(java.lang.Long.parseLong(idString));
}
else
{
id = self;
}
sendSystemMessageTestingOnly(id, text);
}
}
else if (command.equals("dm_systemMessagePlanet"))
{
sendSystemMessagePlanetTestingOnly(text);
}
else if (command.equals("dm_systemMessageGalaxy"))
{
LOG("jw", "dm_systemMessageGalaxy");
prose_package pp = new prose_package();
LOG("jw", "dm_systemMessageGalaxy prose created");
pp.stringId = new string_id("ui", "test_pp");
LOG("jw", "dm_systemMessageGalaxy stringId set");
pp.actor.set(self);
LOG("jw", "dm_systemMessageGalaxy actor set");
pp.target.set(getLookAtTarget(self));
LOG("jw", "dm_systemMessageGalaxy target set");
pp.other.set("other_here");
LOG("jw", "dm_systemMessageGalaxy other set");
pp.digitInteger = 666;
pp.digitFloat = 0.333f;
LOG("jw", "dm_systemMessageGalaxy sending");
String oob = packOutOfBandProsePackage(null, pp);
sendSystemMessageGalaxyOob(oob);
LOG("jw", "dm_systemMessageGalaxy oob size=" + oob.length());
sendSystemMessageGalaxyProse(pp);
}
else if (command.equals("dm_maxStats"))
{
maxStats(self);
}
else if (command.equals("dm_pm1"))
{
prose_package bodyProse = new prose_package();
prose_package subjectProse = new prose_package();
bodyProse.stringId = new string_id("pm", "body_id");
String oob = chatMakePersistentMessageOutOfBandBody(null, bodyProse);
String subject_str = "@" + (new string_id("pm", "subject_id")).toString();
String sender_str = "@" + (new string_id("pm", "sender_id")).toString();
LOG("jw", "dm_pm1 oob size = " + oob.length());
chatSendPersistentMessage(self, subject_str, "Here is the body", oob);
}
else if (command.equals("dm_pm2"))
{
chatSendPersistentMessage(self, "This is a message (2)", "Here is the body (2)", null);
}
else if (command.equals("dm_pm3"))
{
String oob = chatAppendPersistentMessageWaypoint(null, self);
LOG("jw", "dm_pm3 oob size = " + oob.length());
chatSendPersistentMessage(self, "This is a message (waypoint)", "Here is the body", oob);
oob = chatAppendPersistentMessageWaypointData(null, null, -666.0f, 999.0f, null, "dummytext");
chatSendPersistentMessage(self, "This is a message (object)", "Here is the body", oob);
}
else if (command.equals("dm_pm4"))
{
String from = "default_from";
String subj = "default_subj";
String body = "default_body";
if (tok.hasMoreTokens())
{
from = tok.nextToken();
if (tok.hasMoreTokens())
{
subj = tok.nextToken();
if (tok.hasMoreTokens())
{
body = tok.nextToken();
}
}
}
chatSendPersistentMessage(from, getChatName(self), subj, body, null);
}
else if (command.equals("dm_setMaster"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
setMaster(target, self);
}
}
else if (command.equals("dm_joinMe"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
queueCommand(target, (-1449236473), null, "", COMMAND_PRIORITY_DEFAULT);
}
}
else if (command.equals("dm_inviteMe"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
queueCommand(target, (-2007999144), self, "", COMMAND_PRIORITY_DEFAULT);
}
}
else if (command.equals("dm_speak"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
StringBuffer output = new StringBuffer();
while (tok.hasMoreTokens())output.append(tok.nextToken());
queueCommand(target, (-296481545), null, output.toString(), COMMAND_PRIORITY_DEFAULT);
}
}
else if (command.equals("dm_speakProse"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
prose_package pp = new prose_package();
pp.stringId = new string_id("ui", "test_pp");
pp.actor.set(self);
pp.target.set(getLookAtTarget(self));
pp.other.set("other_here");
pp.digitInteger = 666;
pp.digitFloat = 0.333f;
chat.publicChat(target, null, null, null, pp);
chat.chat(target, chat.CHAT_PARROT, chat.MOOD_PLAYFUL, new string_id("ui", "test_pp_2"));
chat.chat(target, "This is the third message");
}
}
else if (command.equals("dm_testSui"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
int pid = createSUIPage(sui.SUI_MSGBOX, self, target, "");
setSUIAssociatedObject(pid, target);
setSUIProperty(pid, "bg.caption.lbltitle", "Text", "MY TITLE");
setSUIProperty(pid, "%text%", "Text", "WTF2");
showSUIPage(pid);
}
}
else if (command.equals("dm_money"))
{
StringBuffer output = new StringBuffer();
if (tok.hasMoreTokens())
{
String amountStr = tok.nextToken();
int amount = Integer.parseInt(amountStr);
if (amount > 0)
{
money.bankTo(money.ACCT_CHARACTER_CREATION, self, amount);
}
else
{
money.bankTo(self, money.ACCT_CHARACTER_CREATION, -amount);
}
}
}
else if (command.equals("dm_kill"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
hit_result cbtHitData = new hit_result();
cbtHitData.success = true;
cbtHitData.baseRoll = 1000;
cbtHitData.finalRoll = 100000;
cbtHitData.canSee = true;
cbtHitData.hitLocation = 0;
cbtHitData.damage = 100000000;
doDamage(self, target, getCurrentWeapon(self), cbtHitData);
pclib.coupDeGrace(self, target, false);
}
}
else if (command.equals("dm_ownVendor"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
createVendorMarket(self, target, 0);
}
}
else if (command.equals("dm_putMeInCell"))
{
if (tok.countTokens() < 3)
{
debugSpeakMsg(self, "Not enough arguments: dm_putMeInCell <planet> <obj_id> <cell name>");
}
else
{
String arg1 = tok.nextToken();
String arg2 = tok.nextToken();
String arg3 = tok.nextToken();
String planet = arg1;
obj_id building = obj_id.getObjId(Long.valueOf(arg2));
obj_id cellId = getCellId(building, arg3);
debugSpeakMsg(self, "Warping to " + building + ", " + cellId);
warpPlayer(self, planet, 0, 0, 0, cellId, 0, 0, 0);
}
}
else if (command.equals("dm_planetmap"))
{
addPlanetaryMapLocation(obj_id.getObjId(1), "city 1", -4000, -3000, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(2), "city 2", -2500, 3500, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(3), "city 3", 3000, 7000, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(4), "city 4", 1000, -6000, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(5), "vendor 1", 100, -4300, "cantina", "", MLT_PERSIST, 0);
addPlanetaryMapLocation(obj_id.getObjId(6), "vendor 2", 2100, 6300, "cantina", "", MLT_PERSIST, 0);
addPlanetaryMapLocation(obj_id.getObjId(7), "vendor 3", -3100, -6300, "cantina", "", MLT_PERSIST, 0);
addPlanetaryMapLocation(obj_id.getObjId(8), "vendor 4", -3400, -6500, "cantina", "hospital", MLT_DYNAMIC, MLF_INACTIVE);
addPlanetaryMapLocation(obj_id.getObjId(9), "vendor 5", 4400, -2600, "cantina", "hospital", MLT_DYNAMIC, MLF_ACTIVE);
}
else if (command.equals("dm_mapget"))
{
String arg1 = tok.nextToken();
obj_id id = obj_id.getObjId(Long.valueOf(arg1));
map_location loc = getPlanetaryMapLocation(id);
debugSpeakMsg(self, "got [" + loc + "]");
}
else if (command.equals("dm_mapRegisterSelf"))
{
String arg1 = tok.nextToken();
String arg2 = tok.nextToken();
String arg3 = null;
if (tok.hasMoreTokens())
{
arg3 = tok.nextToken();
}
addPlanetaryMapLocation(self, arg1, -4000, -3000, arg2, arg3 != null ? arg3 : "", MLT_DYNAMIC, 0);
}
else if (command.equals("dm_vset"))
{
int index = Integer.parseInt(tok.nextToken());
float value = Float.parseFloat(tok.nextToken());
int ivalue = vehicle.setValue(getLookAtTarget(self), value, index);
debugSpeakMsg(self, "set value to " + ivalue);
}
else if (command.equals("dm_vget"))
{
int index = Integer.parseInt(tok.nextToken());
float value = vehicle.getValue(getLookAtTarget(self), index);
debugSpeakMsg(self, "value is " + value);
}
else if (command.equals("dm_dirtyAttributes"))
{
String idString = tok.nextToken();
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(idString));
sendDirtyAttributesNotification(id);
debugSpeakMsg(self, "dirty attrs");
}
else if (command.equals("dm_dirtyMenu"))
{
String idString = tok.nextToken();
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(idString));
sendDirtyObjectMenuNotification(id);
debugSpeakMsg(self, "dirty attrs");
}
else if (command.equals("dm_suiTest"))
{
}
else if (command.equals("dm_shipInstall"))
{
String idString = tok.nextToken();
int index = Integer.parseInt(tok.nextToken());
obj_id componentId = obj_id.getObjId(java.lang.Long.parseLong(idString));
boolean result = shipInstallComponent(self, getLookAtTarget(self), index, componentId);
debugSpeakMsg(self, "installed result:" + result);
}
else if (command.equals("dm_shipUninstall"))
{
int index = Integer.parseInt(tok.nextToken());
obj_id componentId = shipUninstallComponent(self, getLookAtTarget(self), index, getObjectInSlot(self, "inventory"));
debugSpeakMsg(self, "uninstalled component:" + componentId);
}
else if (command.equals("dm_shipPurge"))
{
int index = Integer.parseInt(tok.nextToken());
obj_id componentId = shipUninstallComponent(null, getLookAtTarget(self), index, null);
debugSpeakMsg(self, "uninstalled component:" + componentId);
}
else if (command.equals("dm_shipGetSlots"))
{
debugSpeakMsg(self, "... getting slots ...");
obj_id shipId = getLookAtTarget(self);
int[] shipChassisSlots = getShipChassisSlots(shipId);
if (shipChassisSlots != null)
{
for (int i = 0; i < shipChassisSlots.length; ++i)
{
boolean installed = isShipSlotInstalled(shipId, shipChassisSlots[i]);
debugSpeakMsg(self, "slot " + shipChassisSlots[i] + ", installed:" + installed);
}
}
}
else if (command.equals("dm_shipSetEnergyRequirement"))
{
int index = Integer.parseInt(tok.nextToken());
float requirement = Float.parseFloat(tok.nextToken());
setShipComponentEnergyMaintenanceRequirement(getLookAtTarget(self), index, requirement);
}
else if (command.equals("dm_shipSetEfficiencyGeneral"))
{
int index = Integer.parseInt(tok.nextToken());
float requirement = Float.parseFloat(tok.nextToken());
setShipComponentEfficiencyGeneral(getLookAtTarget(self), index, requirement);
}
else if (command.equals("dm_shipSetEfficiencyEnergy"))
{
int index = Integer.parseInt(tok.nextToken());
float requirement = Float.parseFloat(tok.nextToken());
setShipComponentEfficiencyEnergy(getLookAtTarget(self), index, requirement);
}
else if (command.equals("dm_shipSetArmor"))
{
int index = Integer.parseInt(tok.nextToken());
float cur = Float.parseFloat(tok.nextToken());
float max = Float.parseFloat(tok.nextToken());
setShipComponentArmorHitpointsMaximum(getLookAtTarget(self), index, max);
setShipComponentArmorHitpointsCurrent(getLookAtTarget(self), index, cur);
}
else if (command.equals("dm_shipSetHp"))
{
int index = Integer.parseInt(tok.nextToken());
float cur = Float.parseFloat(tok.nextToken());
float max = Float.parseFloat(tok.nextToken());
setShipComponentHitpointsMaximum(getLookAtTarget(self), index, max);
setShipComponentHitpointsCurrent(getLookAtTarget(self), index, cur);
}
else if (command.equals("dm_shipSetFlags"))
{
int index = Integer.parseInt(tok.nextToken());
int flags = Integer.parseInt(tok.nextToken());
setShipComponentFlags(getLookAtTarget(self), index, flags);
}
else if (command.equals("dm_shipSetShipHp"))
{
float cur = Float.parseFloat(tok.nextToken());
float max = Float.parseFloat(tok.nextToken());
setShipMaximumChassisHitPoints(getLookAtTarget(self), max);
setShipCurrentChassisHitPoints(getLookAtTarget(self), cur);
}
else if (command.equals("dm_shipSetReactorGeneration"))
{
float val = Float.parseFloat(tok.nextToken());
setShipReactorEnergyGenerationRate(getLookAtTarget(self), val);
}
else if (command.equals("dm_shipSetShieldHpFrontCurrent"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsFrontCurrent(getLookAtTarget(self), val);
}
else if (command.equals("dm_shipSetShieldHpFrontMax"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsFrontMaximum(getLookAtTarget(self), val);
}
else if (command.equals("dm_shipSetShieldHpBackCurrent"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsBackCurrent(getLookAtTarget(self), val);
}
else if (command.equals("dm_shipSetShieldHpBackMax"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsBackMaximum(getLookAtTarget(self), val);
}
else if (command.equals("dm_shipSetShieldRechargeRate"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldRechargeRate(getLookAtTarget(self), val);
}
else if (command.equals("dm_terminalSet"))
{
debugSpeakMsg(self, "terminal setting");
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(tok.nextToken()));
setObjVar(id, "space.destination", getWorldLocation(id));
}
else if (command.equals("dm_weaponComponentSetup"))
{
debugSpeakMsg(self, "component setup");
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(tok.nextToken()));
setObjVar(id, "ship_comp.weapon.refire_rate", 20.0f);
setObjVar(id, "ship_comp.weapon.projectile_speed", 150.0f);
setObjVar(id, "ship_comp.weapon.energy_per_shot", 50.0f);
setObjVar(id, "ship_comp.weapon.damage_maximum", 10.0f);
}
else if (command.equals("dm_shipComponentName"))
{
int index = Integer.parseInt(tok.nextToken());
String name = tok.nextToken();
setShipComponentName(getLookAtTarget(self), index, name);
}
else if (command.equals("dm_shipDestroy"))
{
float val = Float.parseFloat(tok.nextToken());
handleShipDestruction(getLookAtTarget(self), val);
}
else if (command.equals("dm_shipDestroyComponent"))
{
int index = Integer.parseInt(tok.nextToken());
float val = Float.parseFloat(tok.nextToken());
handleShipComponentDestruction(getLookAtTarget(self), index, val);
}
else if (command.equals("dm_shipHitMe"))
{
obj_id objTarget = getLookAtTarget(self);
obj_id objShip = getPilotedShip(self);
sendSystemMessageTestingOnly(self, "objTarget of " + objTarget + " is attacking " + objShip);
ship_ai.spaceAttack(objTarget, objShip);
}
else if (command.equals("dm_shipSetWeaponEfficiencyRefireRate"))
{
int index = Integer.parseInt(tok.nextToken());
float eff = Float.parseFloat(tok.nextToken());
setShipWeaponEfficiencyRefireRate(getLookAtTarget(self), index, eff);
}
else if (command.equals("dm_shipSetWeaponDamage"))
{
int index = Integer.parseInt(tok.nextToken());
sendSystemMessageTestingOnly(self, "index=" + index);
setShipWeaponDamageMaximum(getLookAtTarget(self), ship_chassis_slot_type.SCST_weapon_0 + index, 500.0f);
}
else if (command.equals("dm_leet"))
{
obj_id objTarget = getLookAtTarget(self);
if (objTarget == null)
{
objTarget = getPilotedShip(self);
}
for (int i = 0; i < ship_chassis_slot_type.SCST_num_types; ++i)
{
if (isShipSlotInstalled(objTarget, i))
{
setShipComponentEfficiencyEnergy(objTarget, i, 10.0f);
setShipComponentEfficiencyGeneral(objTarget, i, 2.0f);
}
}
for (int i = ship_chassis_slot_type.SCST_weapon_first; i < ship_chassis_slot_type.SCST_weapon_last; ++i)
{
if (isShipSlotInstalled(objTarget, i))
{
setShipWeaponEfficiencyRefireRate(objTarget, i, 10.0f);
setShipComponentEfficiencyEnergy(objTarget, i, 10.0f);
setShipComponentEfficiencyGeneral(objTarget, i, 10.0f);
setShipWeaponAmmoCurrent(objTarget, i, getShipWeaponAmmoMaximum(objTarget, i));
}
}
}
else if (command.equals("dm_fullAmmo"))
{
obj_id objTarget = getLookAtTarget(self);
if (objTarget == null)
{
objTarget = getPilotedShip(self);
}
for (int i = ship_chassis_slot_type.SCST_weapon_first; i < ship_chassis_slot_type.SCST_weapon_last; ++i)
{
if (isShipSlotInstalled(objTarget, i))
{
sendSystemMessageTestingOnly(self, "up ammo");
setShipWeaponAmmoCurrent(objTarget, i, getShipWeaponAmmoMaximum(objTarget, i));
}
}
}
else if (command.equals("dm_clientEffect"))
{
String cef = "clienteffect/space_scram_spark.cef";
if (tok.hasMoreTokens())
{
cef = tok.nextToken();
}
transform t = new transform();
t = t.move_p(new vector(10.0f, 0.0f, 0.0f));
playClientEffectObj(self, cef, getLookAtTarget(self), null, t);
}
else if (command.equals("dm_powerDebug"))
{
obj_id[] objPcds = space_transition.findShipControlDevicesForPlayer(self);
obj_id objShip = space_transition.getShipFromShipControlDevice(objPcds[0]);
objShip = space_transition.getContainingShip(self);
setShipReactorEnergyGenerationRate(objShip, 500);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.SHIELD_GENERATOR, 200);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.ENGINE, 100);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.WEAPON_0, 100);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.WEAPON_1, 100);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.CAPACITOR, 100);
sendSystemMessageTestingOnly(self, "whacked ");
}
else if (command.equals("dm_sprTest"))
{
obj_id[] objPcds = space_transition.findShipControlDevicesForPlayer(self);
obj_id objShip = space_transition.getShipFromShipControlDevice(objPcds[0]);
objShip = space_transition.getContainingShip(self);
setShipEngineSpeedRotationFactorMaximum(objShip, 3.88f);
setShipEngineSpeedRotationFactorMinimum(objShip, 6.33f);
setShipEngineSpeedRotationFactorOptimal(objShip, 0.75f);
}
else if (command.equals("dm_chassisMod"))
{
obj_id[] objPcds = space_transition.findShipControlDevicesForPlayer(self);
obj_id objShip = space_transition.getShipFromShipControlDevice(objPcds[0]);
objShip = space_transition.getContainingShip(self);
float val = Float.parseFloat(tok.nextToken());
setShipChassisSpeedMaximumModifier(objShip, val);
}
else if (command.equals("dm_maDynVel"))
{
obj_id objTarget = getLookAtTarget(self);
float x = Float.parseFloat(tok.nextToken());
float y = Float.parseFloat(tok.nextToken());
float z = Float.parseFloat(tok.nextToken());
setDynamicMiningAsteroidVelocity(objTarget, new vector(x, y, z));
}
else if (command.equals("dm_maDynVel"))
{
obj_id objTarget = getLookAtTarget(self);
float x = Float.parseFloat(tok.nextToken());
float y = Float.parseFloat(tok.nextToken());
float z = Float.parseFloat(tok.nextToken());
setDynamicMiningAsteroidVelocity(objTarget, new vector(x, y, z));
}
else if (command.equals("dm_maSpawnStatic"))
{
}
else if (command.equals("dm_maSpawnDynamic"))
{
location selfLocation = getLocation(self);
obj_id spawnDynamicAsteroid = createObject("object/ship/asteroid/mining_asteroid_dynamic_default.iff", selfLocation);
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, new vector(0.0f, 40.0f, 0.0f));
}
else if (command.equals("dm_dt"))
{
obj_id ticket = space_dungeon.createTicket(self, "tatooine", "tatooine", "npe_space");
}
else if (command.equals("dm_dt_curr"))
{
String planet = getCurrentSceneName();
obj_id ticket = space_dungeon.createTicket(self, planet, planet, "npe_space");
}
else if (command.equals("dm_spaceTicket"))
{
obj_id objTarget = getLookAtTarget(self);
space_dungeon.selectDungeonTicket(objTarget, self);
}
else if (command.equals("dm_spaceEject"))
{
sendSystemMessageTestingOnly(self, "now ejecting... ");
space_dungeon.ejectPlayerFromDungeon(self);
}
else if (command.equals("dm_dungeon_yt1300"))
{
location selfLocation = getLocation(self);
selfLocation.x += 100.0f;
obj_id platform1 = createObject("object/ship/dungeon/dungeon_yt1300.iff", selfLocation);
sendSystemMessageTestingOnly(self, "dungeon id is " + platform1);
}
else if (command.equals("dm_fill_dungeon_yt1300"))
{
location createLocation = getLocation(self);
int objCreated = 0;
for (int x = -6000; x <= 6000; x = x + 3000)
{
for (int y = -6000; y <= 6000; y = y + 3000)
{
for (int z = -6000; z <= 6000; z = z + 3000)
{
createLocation.x = x;
createLocation.y = y;
createLocation.z = z;
obj_id platform1 = createObject("object/ship/dungeon/dungeon_yt1300.iff", createLocation);
sendSystemMessageTestingOnly(self, "Created dungeon " + platform1 + " at " + x + "," + y + "," + z);
objCreated++;
sendSystemMessageTestingOnly(self, "Dungeons created " + objCreated);
}
}
}
}
else if (command.equals("dm_spaceDungeonInit"))
{
long id = Long.parseLong(tok.nextToken());
obj_id dungeon = obj_id.getObjId(id);
messageTo(dungeon, "msgManualDungeonReset", new dictionary(), 0.0f, false);
}
else if (command.equals("dm_ticketCollector"))
{
location selfLocation = getLocation(self);
obj_id collector = createObject("object/tangible/travel/ticket_collector/ticket_collector.iff", selfLocation);
attachScript(collector, "item.travel_ticket.travel_space_dungeon");
setObjVar(collector, "space_dungeon.ticket.dungeon", "npe_space");
setObjVar(collector, "space_dungeon.ticket.point", getCurrentSceneName());
}
else if (command.equals("dm_dungeonLandTicketless"))
{
obj_id npc = getLookAtTarget(self);
String planet = getCurrentSceneName();
space_dungeon.sendGroupToDungeonWithoutTicket(self, "npe_space", planet, planet, "quest_type", npc);
}
else if (command.equals("dm_shipCargoDump"))
{
obj_id ship = getPilotedShip(self);
obj_id[] resources = getShipCargoHoldContentsResourceTypes(ship);
for (int i = 0; i < resources.length; ++i)
{
setShipCargoHoldContent(ship, resources[i], 0);
}
}
else if (command.equals("dm_spaceMiningSale"))
{
obj_id ship = getPilotedShip(self);
openSpaceMiningUi(self, self, "tatooine");
}
else if (command.equals("dm_shipTestCargo"))
{
obj_id ship = getPilotedShip(self);
setShipCargoHoldContentsMaximum(ship, 100);
setShipCargoHoldContent(ship, "space_gem_diamond", 44);
setShipCargoHoldContent(ship, "space_metal_carbonaceous", 22);
int cd = getShipCargoHoldContent(ship, "space_gem_diamond");
int cc = getShipCargoHoldContent(ship, "space_metal_carbonaceous");
sendSystemMessageTestingOnly(self, "1) cargo " + getShipCargoHoldContentsCurrent(ship) + "/" + getShipCargoHoldContentsMaximum(ship) + ", contains=" + cd + "," + cc);
modifyShipCargoHoldContent(ship, "space_gem_diamond", 4);
modifyShipCargoHoldContent(ship, "space_metal_carbonaceous", 2);
cd = getShipCargoHoldContent(ship, "space_gem_diamond");
cc = getShipCargoHoldContent(ship, "space_metal_carbonaceous");
sendSystemMessageTestingOnly(self, "2) cargo " + getShipCargoHoldContentsCurrent(ship) + "/" + getShipCargoHoldContentsMaximum(ship) + ", contains=" + cd + "," + cc);
modifyShipCargoHoldContent(ship, "space_gem_diamond", -8);
modifyShipCargoHoldContent(ship, "space_metal_carbonaceous", -4);
cd = getShipCargoHoldContent(ship, "space_gem_diamond");
cc = getShipCargoHoldContent(ship, "space_metal_carbonaceous");
sendSystemMessageTestingOnly(self, "3) cargo " + getShipCargoHoldContentsCurrent(ship) + "/" + getShipCargoHoldContentsMaximum(ship) + ", contains=" + cd + "," + cc);
}
}
return SCRIPT_CONTINUE;
}
public int TestSUICallback(obj_id self, dictionary params) throws InterruptedException
{
debugServerConsoleMsg(self, "callback started");
obj_id player = params.getObjId("player");
int pageId = -5;
pageId = params.getInt("pageId");
debugSpeakMsg(player, Integer.toString(pageId));
String[] props = params.getStringArray("propertyStrings");
for (int i = 0; i < props.length; ++i)
{
debugSpeakMsg(player, props[i]);
}
return SCRIPT_CONTINUE;
}
public int ColorizeCallback(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnSpaceMiningSellResource(obj_id self, obj_id player, obj_id ship, obj_id station, obj_id resourceId, int amount) throws InterruptedException
{
int amountDeducted = -modifyShipCargoHoldContent(ship, resourceId, -amount);
sendSystemMessageTestingOnly(player, "Sold Resources: " + amountDeducted + "units");
return SCRIPT_CONTINUE;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,566 @@
package script.test;
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.badge;
import script.library.resource;
import script.library.create;
import script.library.bio_engineer;
import script.library.features;
import script.ai.ai_combat;
import script.library.jedi;
import script.library.skill_template;
import script.library.pclib;
import script.library.sui;
import script.library.cloninglib;
public class dwhite_test extends script.base_script
{
public dwhite_test()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
location loc = getLocation(self);
if (text.startsWith("getWorkingSkill"))
{
sendSystemMessageTestingOnly(self, "Working Skill = " + getWorkingSkill(self));
}
if (text.startsWith("getSkillTemplate"))
{
sendSystemMessageTestingOnly(self, "Skill Template = " + getSkillTemplate(self));
}
if (text.startsWith("setWorkingSkill"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String cmd = st.nextToken();
String arg = "";
if (st.hasMoreTokens())
{
arg = st.nextToken();
}
setWorkingSkill(self, arg);
sendSystemMessageTestingOnly(self, "Working Skill set to: " + arg);
}
if (text.startsWith("setSkillTemplate"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String cmd = st.nextToken();
String arg = "";
if (st.hasMoreTokens())
{
arg = st.nextToken();
}
String templateSkills = dataTableGetString(skill_template.TEMPLATE_TABLE, arg, "template");
if (!arg.equals("") && (templateSkills == null || templateSkills.equals("")))
{
sendSystemMessageTestingOnly(self, "Not a Valid Skill Template");
}
else
{
setSkillTemplate(self, arg);
sendSystemMessageTestingOnly(self, "Skill Template set to: " + arg);
}
}
if (text.startsWith("killme"))
{
obj_id target = self;
int dam = -(getAttrib(target, HEALTH) + 50);
addAttribModifier(target, HEALTH, dam, 0f, 0f, MOD_POOL);
if (getPosture(target) != POSTURE_DEAD)
{
setPosture(target, POSTURE_DEAD);
}
if (!hasObjVar(target, pclib.VAR_BEEN_COUPDEGRACED))
{
setObjVar(target, pclib.VAR_DEATHBLOW_KILLER, target);
setObjVar(target, pclib.VAR_DEATHBLOW_STAMP, getGameTime());
}
pclib.playerDeath(target, target, false);
}
if (text.equals("clonewarp"))
{
createCloneWarpSui(self);
}
if (text.startsWith("createResource"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
if (st.countTokens() != 2)
{
sendSystemMessageTestingOnly(self, "[debugger] SYNTAX: createResource <resource> <amt>");
return SCRIPT_CONTINUE;
}
String type = st.nextToken();
String sAmt = st.nextToken();
int amt = utils.stringToInt(sAmt);
if (amt < 1)
{
sendSystemMessageTestingOnly(self, "[debugger] SYNTAX: createResource <resource> <amt>");
return SCRIPT_CONTINUE;
}
obj_id pInv = utils.getInventoryContainer(self);
obj_id[] crates = resource.createRandom(type, amt, loc, pInv, self, 1);
}
if (text.startsWith("createDNA"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
if (st.countTokens() != 1)
{
sendSystemMessageTestingOnly(self, "[debugger] SYNTAX: createDNA <creature>");
return SCRIPT_CONTINUE;
}
String creature = st.nextToken();
bio_engineer.quickHarvest(self, creature);
}
if (text.equals("attack"))
{
obj_id target = getLookAtTarget(self);
if (target != null && target != self)
{
startCombat(target, self);
}
}
if (text.equals("frenzy"))
{
obj_id target = getLookAtTarget(self);
if (target != null && target != self)
{
addToMentalStateToward(target, self, FEAR, 45.0f);
}
}
if (text.startsWith("checkBadge"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String badgeName = st.nextToken();
obj_id target = getLookAtTarget(self);
sendSystemMessageTestingOnly(self, "[Badge] Has Badge " + badgeName + " = " + badge.hasBadge(target, badgeName));
}
if (text.equals("enableJedi"))
{
addJediSlot(self);
}
if (text.equals("runTest"))
{
sendSystemMessageTestingOnly(self, "[test] Analyzing creatures level/stats...");
checkCreatures();
}
if (text.equals("resetPower"))
{
jedi.recalculateForcePower(self);
}
if (text.startsWith("setScale"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
float scale = utils.stringToFloat(st.nextToken());
obj_id target = getLookAtTarget(self);
float baseScale = 1.0f;
if (utils.hasScriptVar(target, "ai.baseScale"))
{
baseScale = utils.getFloatScriptVar(target, "ai.baseScale");
}
float finalScale = baseScale * scale;
setScale(target, finalScale);
sendSystemMessageTestingOnly(self, "[test] Creature scale set to " + scale);
}
if (text.startsWith("getScriptVars"))
{
obj_id target = getLookAtTarget(self);
if (!isIdValid(target))
{
target = self;
}
deltadictionary dctScriptVars = target.getScriptVars();
sendSystemMessageTestingOnly(self, "Scriptvars are " + dctScriptVars.toString());
}
if (text.startsWith("getPlanetScriptVars"))
{
String planetName = getCurrentSceneName();
obj_id planet = getPlanetByName(planetName);
deltadictionary dctScriptVars = planet.getScriptVars();
sendSystemMessageTestingOnly(self, "Scriptvars are " + dctScriptVars.toString());
}
if (text.startsWith("getResourceId"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String resource = st.nextToken();
obj_id resId = getResourceTypeByName(resource);
sendSystemMessageTestingOnly(self, "[test] " + resource + " = " + resId);
}
if (text.startsWith("testGoggles"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id goggle = obj_id.getObjId(temp.longValue());
boolean validGoggles = true;
obj_id owner = getOwner(goggle);
LOG("seGoggles", "Owner = " + owner);
if (!isIdValid(owner))
{
validGoggles = false;
}
else
{
obj_id inv = utils.getInventoryContainer(owner);
obj_id bank = utils.getPlayerBank(owner);
obj_id eyes = getObjectInSlot(owner, "eyes");
LOG("seGoggles", "Inv = " + inv);
LOG("seGoggles", "Bank = " + bank);
LOG("seGoggles", "Eyes = " + eyes);
if (!isIdValid(inv) || !isIdValid(bank))
{
validGoggles = false;
}
if (!features.isCollectorEdition(owner))
{
validGoggles = false;
}
else
{
obj_id container = getContainedBy(goggle);
LOG("seGoggles", "Container = " + container);
if (container == owner)
{
if (goggle != eyes)
{
validGoggles = false;
}
}
else if (!(container == inv || container == bank))
{
validGoggles = false;
}
}
}
if (!validGoggles)
{
if (isIdValid(owner))
{
sendSystemMessage(owner, new string_id("error_message", "destroy_goggle"));
}
destroyObject(goggle);
return SCRIPT_CONTINUE;
}
}
if (text.startsWith("saberStats"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id saber = obj_id.getObjId(temp.longValue());
int minDmg = getWeaponMinDamage(saber);
int maxDmg = getWeaponMaxDamage(saber);
float speed = getWeaponAttackSpeed(saber);
range_info ri = getWeaponRangeInfo(saber);
float wound = getWeaponWoundChance(saber);
float radius = getWeaponDamageRadius(saber);
}
if (text.startsWith("decaySaber"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id item = obj_id.getObjId(temp.longValue());
dictionary data = new dictionary();
data.put("amount", 100);
data.put("owner", self);
messageTo(item, "decaySaberCrystal", data, 0, false);
}
if (text.startsWith("decay "))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id item = obj_id.getObjId(temp.longValue());
int hp = getHitpoints(item);
if (hp > 0)
{
hp -= rand(25, 75);
setInvulnerableHitpoints(item, hp);
}
}
if (text.startsWith("jediState"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String token = st.nextToken();
int state = Integer.parseInt(token);
switch (state)
{
case 0:
state = JEDI_STATE_NONE;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_NONE");
break;
case 1:
state = JEDI_STATE_FORCE_SENSITIVE;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_FORCE_SENSITIVE");
break;
case 2:
state = JEDI_STATE_JEDI;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_JEDI");
break;
case 3:
state = JEDI_STATE_FORCE_RANKED_LIGHT;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_FORCE_RANKED_LIGHT");
break;
case 4:
state = JEDI_STATE_FORCE_RANKED_DARK;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_FORCE_RANKED_DARK");
break;
}
setJediState(self, state);
}
if (text.startsWith("test"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String arg = st.nextToken();
String lvlString = st.nextToken();
int level = Integer.parseInt(lvlString);
int count = 1;
if (st.hasMoreTokens())
{
String countString = st.nextToken();
count = Integer.parseInt(countString);
}
for (int i = 0; i < count; i++)
{
testTune(level);
}
}
if (text.startsWith("fullTest"))
{
String output = "\tlevel\tdamage\tspeed\twound\tforce\t";
LOG("saber_test", output);
for (int i = 0; i < 65000; i++)
{
testTune(0);
}
}
if (text.startsWith("crystalTest"))
{
obj_id inv = utils.getInventoryContainer(self);
for (int i = 0; i < 32; i++)
{
obj_id crystal = createObject("object/tangible/component/weapon/lightsaber/lightsaber_module_force_crystal.iff", inv, "");
custom_var myVar = getCustomVarByName(crystal, "private/index_color_1");
if (myVar.isPalColor())
{
palcolor_custom_var pcVar = (palcolor_custom_var)myVar;
pcVar.setValue(i);
}
setObjVar(crystal, jedi.VAR_CRYSTAL_STATS + "." + jedi.VAR_COLOR, i);
setObjVar(crystal, jedi.VAR_CRYSTAL_OWNER_ID, self);
setObjVar(crystal, jedi.VAR_CRYSTAL_OWNER_NAME, getName(self));
}
}
if (text.equals("fuck"))
{
utils.removeScriptVar(self, "armor_count");
}
return SCRIPT_CONTINUE;
}
public int createCloneWarpSui(obj_id player) throws InterruptedException
{
location playerLoc = getLocation(player);
String planetName = playerLoc.area;
if (planetName == null)
{
return -1;
}
obj_id planet = getPlanetByName(planetName);
if (!isIdValid(planet))
{
return -1;
}
Vector nameList = utils.getResizeableStringArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_NAME);
Vector areaList = utils.getResizeableStringArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_AREA);
Vector locList = utils.getResizeableLocationArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_LOC);
Vector list = new Vector();
list.setSize(0);
for (int i = 0; i < nameList.size(); i++)
{
String entry = ((String)nameList.get(i));
entry += " \\>200 ";
entry += ((String)areaList.get(i));
entry += " (" + ((location)locList.get(i)).x + "," + ((location)locList.get(i)).z + ")";
list = utils.addElement(list, entry);
}
String title = "Clone Warp";
String prompt = "Choose a Clone Location";
int pid = createSUIPage(sui.SUI_LISTBOX, player, player, "handleCloneWarp");
setSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT, title);
setSUIProperty(pid, sui.LISTBOX_PROMPT, sui.PROP_TEXT, prompt);
sui.listboxButtonSetup(pid, sui.OK_CANCEL);
clearSUIDataSource(pid, sui.LISTBOX_DATASOURCE);
for (int i = 0; i < list.size(); i++)
{
addSUIDataItem(pid, sui.LISTBOX_DATASOURCE, "" + i);
setSUIProperty(pid, sui.LISTBOX_DATASOURCE + "." + i, sui.PROP_TEXT, ((String)list.get(i)));
}
subscribeToSUIProperty(pid, sui.LISTBOX_LIST, sui.PROP_SELECTEDROW);
subscribeToSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT);
showSUIPage(pid);
flushSUIPage(pid);
return pid;
}
public int handleCloneWarp(obj_id self, dictionary params) throws InterruptedException
{
if (params == null)
{
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL || idx == -1)
{
return SCRIPT_CONTINUE;
}
location playerLoc = getLocation(self);
String planetName = playerLoc.area;
if (planetName == null)
{
return SCRIPT_CONTINUE;
}
obj_id planet = getPlanetByName(planetName);
if (!isIdValid(planet))
{
return SCRIPT_CONTINUE;
}
Vector locList = utils.getResizeableLocationArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_LOC);
Vector respawnList = utils.getResizeableLocationArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_RESPAWN);
boolean warped = pclib.sendToAnyLocation(self, ((location)locList.get(idx)), ((location)respawnList.get(idx)));
return SCRIPT_CONTINUE;
}
public void testTune(int level) throws InterruptedException
{
final String COMPONENT_DATATABLE = "datatables/jedi/saber_component_ranges.iff";
obj_id player = getSelf();
int quality = jedi.getCrystalQuality(level);
dictionary dctWeaponInfo = dataTableGetRow(COMPONENT_DATATABLE, 2);
int minDamage = (int)dctWeaponInfo.getFloat("fltMinDamage");
int maxDamage = (int)dctWeaponInfo.getFloat("fltMaxDamage");
float minSpeed = dctWeaponInfo.getFloat("fltMinSpeed");
float maxSpeed = dctWeaponInfo.getFloat("fltMaxSpeed");
float minForce = dctWeaponInfo.getFloat("fltMinForcePower");
float maxForce = dctWeaponInfo.getFloat("fltMaxForcePower");
float minWound = dctWeaponInfo.getFloat("fltMinWoundChance");
float maxWound = dctWeaponInfo.getFloat("fltMaxWoundChance");
String output = "";
for (level = 10; level < 350; level += 10)
{
int damage = distributedRand(minDamage, maxDamage, level);
float wound = distributedRand(minWound, maxWound, level);
float force = distributedRand(minForce, maxForce, level);
float speed = distributedRand(minSpeed, maxSpeed, level);
output += "\t" + level + "\t" + damage + "\t" + speed + "\t" + wound + "\t" + force + "\t";
}
LOG("saber_test", output);
}
public int distributedRand(int min, int max, int level) throws InterruptedException
{
final int levelMin = 60;
final int levelMax = 280;
float rank = (float)(level - levelMin) / (float)(levelMax - levelMin);
float mid = min + ((max - min) * rank);
if (mid < min)
{
max += (mid - min);
mid = min;
}
if (mid > max)
{
min += (mid - max);
mid = max;
}
int minRand = rand(min, (int)(mid + 0.5f));
int maxRand = rand((int)(mid + 0.5f), max);
int randNum = rand(minRand, maxRand);
return randNum;
}
public float distributedRand(float min, float max, int level) throws InterruptedException
{
final int levelMin = 60;
final int levelMax = 280;
float rank = (float)(level - levelMin) / (float)(levelMax - levelMin);
float mid = min + ((max - min) * rank);
if (mid < min)
{
max += (mid - min);
mid = min;
}
if (mid > max)
{
min += (mid - max);
mid = max;
}
float minRand = rand(min, mid);
float maxRand = rand(mid, max);
float randNum = rand(minRand, maxRand);
return randNum;
}
public float round(float num, int decimal) throws InterruptedException
{
return ((int)(num * (10 ^ decimal))) / (float)(10 ^ decimal);
}
public void checkCreatures() throws InterruptedException
{
String[] creatureList = dataTableGetStringColumn(create.CREATURE_TABLE, "creatureName");
for (int i = 0; i < creatureList.length; i++)
{
dictionary creatureDict = dataTableGetRow(create.CREATURE_TABLE, creatureList[i]);
int level = creatureDict.getInt("BaseLevel");
int statLevel = creatureDict.getInt("StatLevelModifier");
int dmgLevel = creatureDict.getInt("Damagelevelmodifier");
int newStatLevel = bio_engineer.calcStatLevel(creatureDict);
int newDmgLevel = bio_engineer.calcDmgLevel(creatureDict);
int newToHitLevel = bio_engineer.calcToHitLevel(creatureDict);
int newArmorLevel = bio_engineer.calcArmorLevel(creatureDict);
int oldToHitLevel = bio_engineer.calcOldToHitLevel(creatureDict);
int oldArmorLevel = bio_engineer.calcOldArmorLevel(creatureDict);
int newLevel = (int)((((newStatLevel * 2) + (newDmgLevel * 2) + (newToHitLevel * 2) + (newArmorLevel * 4)) / 10) + 0.5f);
int newLevelOldArmor = (int)((((newStatLevel * 2) + (newDmgLevel * 2) + (newToHitLevel * 2) + (oldArmorLevel * 4)) / 10) + 0.5f);
int levelDiff = newLevel - level;
String output = "";
if (levelDiff > 5 || levelDiff < -5)
{
output = "**\t" + creatureList[i] + " - \t";
}
else
{
output = "\t" + creatureList[i] + " - \t";
}
output += "newLevel(newArmor) = " + newLevel + "; \t";
output += "newLevel(oldArmor) = " + newLevelOldArmor + "; \t";
output += "oldLevel = " + level + "; \t";
output += "newStatLevel = " + newStatLevel + "; \t";
output += "oldStatLevel = " + (level + statLevel) + "; \t";
output += "newDmgLevel = " + newDmgLevel + "; \t";
output += "oldDmgLevel = " + (level + dmgLevel) + "; \t";
output += "newToHit = " + newToHitLevel + "; \t";
output += "oldToHit = " + oldToHitLevel + "; \t";
output += "newArmor = " + newArmorLevel + "; \t";
output += "oldArmor = " + oldArmorLevel + "; \t";
LOG("creature_balance", output);
}
}
}
@@ -1,695 +0,0 @@
/*
Title: player_test_utility.script
Description: Test script that does various useful stuff
*/
/***** INCLUDES ********************************************************/
include library.utils;
include library.badge;
include library.resource;
include library.create;
include library.bio_engineer;
include library.features;
include ai.ai_combat;
include library.jedi;
include library.skill_template;
include library.pclib;
include library.sui;
include library.cloninglib;
/***** TRIGGERS ********************************************************/
trigger OnAttach()
{
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
location loc = getLocation(self);
if (text.startsWith("getWorkingSkill"))
{
sendSystemMessageTestingOnly(self, "Working Skill = "+getWorkingSkill(self));
}
if (text.startsWith("getSkillTemplate"))
{
sendSystemMessageTestingOnly(self, "Skill Template = "+getSkillTemplate(self));
}
if (text.startsWith("setWorkingSkill"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string cmd = st.nextToken();
string arg = "";
if (st.hasMoreTokens())
arg = st.nextToken();
setWorkingSkill(self, arg);
sendSystemMessageTestingOnly(self, "Working Skill set to: "+arg);
}
if (text.startsWith("setSkillTemplate"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string cmd = st.nextToken();
string arg = "";
if (st.hasMoreTokens())
arg = st.nextToken();
string templateSkills = dataTableGetString(skill_template.TEMPLATE_TABLE, arg, "template");
if (arg != "" && (templateSkills == null || templateSkills.equals("")))
{
sendSystemMessageTestingOnly(self, "Not a Valid Skill Template");
}
else
{
setSkillTemplate(self, arg);
sendSystemMessageTestingOnly(self, "Skill Template set to: "+arg);
}
}
if (text.startsWith("killme"))
{
obj_id target = self;
int dam = -(getAttrib(target, HEALTH) + 50);
addAttribModifier(target, HEALTH, dam, 0f, 0f, MOD_POOL);
if (getPosture(target) != POSTURE_DEAD)
{
setPosture(target, POSTURE_DEAD);
}
if (!hasObjVar(target, pclib.VAR_BEEN_COUPDEGRACED))
{
setObjVar(target, pclib.VAR_DEATHBLOW_KILLER, target);
setObjVar(target, pclib.VAR_DEATHBLOW_STAMP, getGameTime());
}
pclib.playerDeath(target, target, false);
}
if (text.equals("clonewarp"))
{
createCloneWarpSui(self);
}
if (text.startsWith("createResource"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
if ( st.countTokens() != 2 )
{
sendSystemMessageTestingOnly(self, "[debugger] SYNTAX: createResource <resource> <amt>");
return SCRIPT_CONTINUE;
}
string type = st.nextToken();
string sAmt = st.nextToken();
int amt = utils.stringToInt(sAmt);
if ( amt < 1 )
{
sendSystemMessageTestingOnly(self, "[debugger] SYNTAX: createResource <resource> <amt>");
return SCRIPT_CONTINUE;
}
obj_id pInv = utils.getInventoryContainer(self);
obj_id[] crates = resource.createRandom( type, amt, loc, pInv, self, 1 );
}
if (text.startsWith("createDNA"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
if ( st.countTokens() != 1 )
{
sendSystemMessageTestingOnly(self, "[debugger] SYNTAX: createDNA <creature>");
return SCRIPT_CONTINUE;
}
string creature = st.nextToken();
bio_engineer.quickHarvest(self, creature);
}
if (text.equals("attack"))
{
obj_id target = getLookAtTarget(self);
if (target != null && target != self)
{
startCombat (target, self);
}
}
if (text.equals("frenzy"))
{
obj_id target = getLookAtTarget(self);
if (target != null && target != self)
{
addToMentalStateToward(target, self, FEAR, 45.0f);
}
}
if ( text.startsWith("checkBadge") )
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string badgeName = st.nextToken();
obj_id target = getLookAtTarget(self);
sendSystemMessageTestingOnly(self, "[Badge] Has Badge " + badgeName + " = " + badge.hasBadge(target, badgeName));
}
if (text.equals("enableJedi"))
{
addJediSlot(self);
}
if (text.equals("runTest"))
{
sendSystemMessageTestingOnly(self, "[test] Analyzing creatures level/stats...");
checkCreatures();
}
if (text.equals("resetPower"))
{
jedi.recalculateForcePower(self);
}
if ( text.startsWith("setScale") )
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
float scale = utils.stringToFloat(st.nextToken());
obj_id target = getLookAtTarget(self);
float baseScale = 1.0f;
if (utils.hasScriptVar( target, "ai.baseScale" ) )
baseScale = utils.getFloatScriptVar( target, "ai.baseScale" );
float finalScale = baseScale * scale;
setScale(target, finalScale);
sendSystemMessageTestingOnly(self, "[test] Creature scale set to " + scale);
}
if(text.startsWith("getScriptVars"))
{
obj_id target = getLookAtTarget(self);
if (!isIdValid(target))
target = self;
deltadictionary dctScriptVars = target.getScriptVars();
sendSystemMessageTestingOnly(self, "Scriptvars are "+dctScriptVars.toString());
}
if(text.startsWith("getPlanetScriptVars"))
{
string planetName = getCurrentSceneName();
obj_id planet = getPlanetByName(planetName);
deltadictionary dctScriptVars = planet.getScriptVars();
sendSystemMessageTestingOnly(self, "Scriptvars are "+dctScriptVars.toString());
}
if (text.startsWith("getResourceId"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string resource = st.nextToken();
obj_id resId = getResourceTypeByName(resource);
sendSystemMessageTestingOnly(self, "[test] " + resource + " = " + resId);
}
if (text.startsWith("testGoggles"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id goggle = obj_id.getObjId(temp.longValue());
boolean validGoggles = true;
obj_id owner = getOwner(goggle);
LOG ("seGoggles", "Owner = " + owner);
if (!isIdValid(owner))
validGoggles = false;
else
{
obj_id inv = utils.getInventoryContainer(owner);
obj_id bank = utils.getPlayerBank(owner);
obj_id eyes = getObjectInSlot(owner, "eyes");
LOG ("seGoggles", "Inv = " + inv);
LOG ("seGoggles", "Bank = " + bank);
LOG ("seGoggles", "Eyes = " + eyes);
if ( !isIdValid(inv) || !isIdValid(bank) )
validGoggles = false;
if (!features.isCollectorEdition(owner))
validGoggles = false;
else
{
obj_id container = getContainedBy(goggle);
LOG ("seGoggles", "Container = " + container);
if (container == owner)
{
if (goggle != eyes)
validGoggles = false;
}
else if (!( container == inv || container == bank ))
validGoggles = false;
}
}
if (!validGoggles)
{
if (isIdValid(owner))
sendSystemMessage (owner, new string_id ("error_message", "destroy_goggle"));
destroyObject(goggle);
return SCRIPT_CONTINUE;
}
}
if (text.startsWith("saberStats"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id saber = obj_id.getObjId(temp.longValue());
int minDmg = getWeaponMinDamage(saber);
int maxDmg = getWeaponMaxDamage(saber);
float speed = getWeaponAttackSpeed(saber);
range_info ri = getWeaponRangeInfo(saber);
float wound = getWeaponWoundChance(saber);
float radius = getWeaponDamageRadius(saber);
//int[] ham = getWeaponAttribCost(saber);
//sendSystemMessageTestingOnly(self, "Saber Stats: Dam:"+minDmg+"-"+maxDmg+
// ", Spd:"+speed+
// ", Rng:0(+"+ri.minRangeMod+")/"+ri.midRange+"(+"+ri.midRangeMod+")/"+ri.maxRange+"(+"+ri.maxRangeMod+
// "), Wnd:"+wound+
// ", HAM:"+ham[0]+"/"+ham[1]+"/"+ham[2]);
}
if (text.startsWith("decaySaber"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id item = obj_id.getObjId(temp.longValue());
dictionary data = new dictionary();
data.put("amount", 100);
data.put("owner", self);
messageTo(item, "decaySaberCrystal", data, 0, false);
}
if (text.startsWith("decay "))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string oidString = st.nextToken();
Long temp = new Long(Long.parseLong(oidString));
obj_id item = obj_id.getObjId(temp.longValue());
int hp = getHitpoints(item);
if (hp > 0)
{
hp -= rand(25, 75);
setInvulnerableHitpoints(item, hp);
}
}
if (text.startsWith("jediState"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string token = st.nextToken();
int state = Integer.parseInt(token);
switch (state)
{
case 0:
state = JEDI_STATE_NONE;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_NONE");
break;
case 1:
state = JEDI_STATE_FORCE_SENSITIVE;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_FORCE_SENSITIVE");
break;
case 2:
state = JEDI_STATE_JEDI;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_JEDI");
break;
case 3:
state = JEDI_STATE_FORCE_RANKED_LIGHT;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_FORCE_RANKED_LIGHT");
break;
case 4:
state = JEDI_STATE_FORCE_RANKED_DARK;
sendSystemMessageTestingOnly(self, "Setting Jedi State to JEDI_STATE_FORCE_RANKED_DARK");
break;
}
setJediState(self, state);
}
if (text.startsWith("test"))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string arg = st.nextToken();
string lvlString = st.nextToken();
int level = Integer.parseInt(lvlString);
int count = 1;
if (st.hasMoreTokens())
{
string countString = st.nextToken();
count = Integer.parseInt(countString);
}
for (int i = 0; i < count; i++)
testTune(level);
}
if (text.startsWith("fullTest"))
{
string output = "\tlevel\tdamage\tspeed\twound\tforce\t";
LOG ("saber_test", output);
//for (int level = 10; level < 350; level += 10)
for (int i = 0; i < 65000; i++)
testTune(0);
}
if (text.startsWith("crystalTest"))
{
obj_id inv = utils.getInventoryContainer(self);
for (int i = 0; i < 32; i ++)
{
obj_id crystal = createObject("object/tangible/component/weapon/lightsaber/lightsaber_module_force_crystal.iff", inv, "");
custom_var myVar = getCustomVarByName(crystal, "private/index_color_1");
if (myVar.isPalColor())
{
palcolor_custom_var pcVar = (palcolor_custom_var)myVar;
pcVar.setValue(i);
}
setObjVar(crystal, jedi.VAR_CRYSTAL_STATS + "." + jedi.VAR_COLOR, i);
setObjVar(crystal, jedi.VAR_CRYSTAL_OWNER_ID, self);
setObjVar(crystal, jedi.VAR_CRYSTAL_OWNER_NAME, getName(self));
}
}
if (text.equals("fuck"))
{
utils.removeScriptVar(self, "armor_count");
}
return SCRIPT_CONTINUE;
}
int createCloneWarpSui(obj_id player)
{
location playerLoc = getLocation(player);
string planetName = playerLoc.area;
if ( planetName == null )
return -1;
obj_id planet = getPlanetByName(planetName);
if ( !isIdValid(planet) )
return -1;
resizeable string[] nameList = utils.getResizeableStringArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_NAME);
resizeable string[] areaList = utils.getResizeableStringArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_AREA);
resizeable location[] locList = utils.getResizeableLocationArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_LOC);
resizeable string[] list = new string[0];
for (int i = 0; i < nameList.length; i++)
{
string entry = nameList[i];
entry += " \\>200 ";
entry += areaList[i];
entry += " ("+locList[i].x+","+locList[i].z+")";
list = utils.addElement(list, entry);
}
string title = "Clone Warp";
string prompt = "Choose a Clone Location";
int pid = createSUIPage(sui.SUI_LISTBOX, player, player, "handleCloneWarp");
setSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT, title);
setSUIProperty(pid, sui.LISTBOX_PROMPT, sui.PROP_TEXT, prompt);
// Add buttons.
sui.listboxButtonSetup(pid, sui.OK_CANCEL);
clearSUIDataSource(pid, sui.LISTBOX_DATASOURCE);
for (int i = 0; i < list.length; i++)
{
addSUIDataItem(pid, sui.LISTBOX_DATASOURCE, "" + i);
setSUIProperty(pid, sui.LISTBOX_DATASOURCE + "." + i, sui.PROP_TEXT, list[i]);
}
subscribeToSUIProperty(pid, sui.LISTBOX_LIST, sui.PROP_SELECTEDROW);
subscribeToSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT);
showSUIPage(pid);
flushSUIPage(pid);
return pid;
}
messageHandler handleCloneWarp()
{
if (params == null)
return SCRIPT_CONTINUE;
int idx = sui.getListboxSelectedRow( params );
int btn = sui.getIntButtonPressed( params );
if ( btn == sui.BP_CANCEL || idx == -1)
{
return SCRIPT_CONTINUE;
}
location playerLoc = getLocation(self);
string planetName = playerLoc.area;
if ( planetName == null )
return SCRIPT_CONTINUE;
obj_id planet = getPlanetByName(planetName);
if ( !isIdValid(planet) )
return SCRIPT_CONTINUE;
resizeable location[] locList = utils.getResizeableLocationArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_LOC);
resizeable location[] respawnList = utils.getResizeableLocationArrayScriptVar(planet, cloninglib.VAR_PLANET_CLONE_RESPAWN);
boolean warped = pclib.sendToAnyLocation(self, locList[idx], respawnList[idx]);
return SCRIPT_CONTINUE;
}
void testTune(int level)
{
const string COMPONENT_DATATABLE = "datatables/jedi/saber_component_ranges.iff";
obj_id player = getSelf();
int quality = jedi.getCrystalQuality(level);
dictionary dctWeaponInfo = dataTableGetRow(COMPONENT_DATATABLE, 2);
int minDamage = (int)dctWeaponInfo.getFloat("fltMinDamage");
int maxDamage = (int)dctWeaponInfo.getFloat("fltMaxDamage");
float minSpeed = dctWeaponInfo.getFloat("fltMinSpeed");
float maxSpeed = dctWeaponInfo.getFloat("fltMaxSpeed");
float minForce = dctWeaponInfo.getFloat("fltMinForcePower");
float maxForce = dctWeaponInfo.getFloat("fltMaxForcePower");
float minWound = dctWeaponInfo.getFloat("fltMinWoundChance");
float maxWound = dctWeaponInfo.getFloat("fltMaxWoundChance");
string output = "";
for (level = 10; level < 350; level += 10)
{
int damage = distributedRand(minDamage, maxDamage, level);
float wound = distributedRand(minWound, maxWound, level);
float force = distributedRand(minForce, maxForce, level);
float speed = distributedRand(minSpeed, maxSpeed, level);
output += "\t"+level+
"\t"+damage+
"\t"+speed+
"\t"+wound+
"\t"+force+"\t";
}
//sendSystemMessageTestingOnly(player, output);
LOG ("saber_test", output);
}
int distributedRand(int min, int max, int level)
{
const int levelMin = 60;
const int levelMax = 280;
//if (level < levelMin) level = levelMin;
//if (level > levelMax) level = levelMax;
float rank = (float)(level - levelMin) / (float)(levelMax - levelMin);
float mid = min + ((max - min) * rank);
if (mid < min) { max += (mid-min); mid = min; }
if (mid > max) { min += (mid-max); mid = max; }
int minRand = rand(min, (int)(mid+0.5f));
int maxRand = rand((int)(mid+0.5f), max);
int randNum = rand(minRand, maxRand);
/* LOG ("saber_test", "lvl = "+level+
"; \trank = "+round(rank, 2)+
"; \tdist = ("+round(min, 2)+", "+round(mid, 2)+", "+round(max, 2)+")"+
"; \trand ("+round(minRand, 2)+", "+round(maxRand, 2)+
") ; \tnum = "+round(randNum, 2)+"\t");
*/
return randNum;
}
float distributedRand(float min, float max, int level)
{
const int levelMin = 60;
const int levelMax = 280;
//if (level < levelMin) level = levelMin;
//if (level > levelMax) level = levelMax;
float rank = (float)(level - levelMin) / (float)(levelMax - levelMin);
float mid = min + ((max - min) * rank);
if (mid < min) { max += (mid-min); mid = min; }
if (mid > max) { min += (mid-max); mid = max; }
float minRand = rand(min, mid);
float maxRand = rand(mid, max);
float randNum = rand(minRand, maxRand);
/* LOG ("saber_test", "lvl = "+level+
"; \trank = "+round(rank, 2)+
"; \tdist = ("+round(min, 2)+", "+round(mid, 2)+", "+round(max, 2)+")"+
"; \trand ("+round(minRand, 2)+", "+round(maxRand, 2)+
") ; \tnum = "+round(randNum, 2)+"\t");
*/
return randNum;
}
float round(float num, int decimal)
{
return ((int)(num*(10^decimal)))/(float)(10^decimal);
}
void checkCreatures()
{
string[] creatureList = dataTableGetStringColumn(create.CREATURE_TABLE, "creatureName");
for (int i = 0; i < creatureList.length; i++)
{
dictionary creatureDict = dataTableGetRow(create.CREATURE_TABLE, creatureList[i]);
int level = creatureDict.getInt("BaseLevel");
int statLevel = creatureDict.getInt("StatLevelModifier");
int dmgLevel = creatureDict.getInt("Damagelevelmodifier");
int newStatLevel = bio_engineer.calcStatLevel(creatureDict);
int newDmgLevel = bio_engineer.calcDmgLevel(creatureDict);
int newToHitLevel = bio_engineer.calcToHitLevel(creatureDict);
int newArmorLevel = bio_engineer.calcArmorLevel(creatureDict);
int oldToHitLevel = bio_engineer.calcOldToHitLevel(creatureDict);
int oldArmorLevel = bio_engineer.calcOldArmorLevel(creatureDict);
int newLevel = (int) ((((newStatLevel*2) + (newDmgLevel*2) + (newToHitLevel*2) + (newArmorLevel*4)) / 10) + 0.5f);
int newLevelOldArmor = (int) ((((newStatLevel*2) + (newDmgLevel*2) + (newToHitLevel*2) + (oldArmorLevel*4)) / 10) + 0.5f);
int levelDiff = newLevel - level;
string output = "";
// Creature Name
if (levelDiff > 5 || levelDiff < -5)
output = "**\t" + creatureList[i] + " - \t";
else
output = "\t" + creatureList[i] + " - \t";
// Balanced Level
output += "newLevel(newArmor) = " + newLevel + "; \t";
output += "newLevel(oldArmor) = " + newLevelOldArmor + "; \t";
// Defined Level
output += "oldLevel = " + level + "; \t";
// Stat Level
output += "newStatLevel = " + newStatLevel + "; \t";
output += "oldStatLevel = " + (level + statLevel) + "; \t";
// Dmg Level
output += "newDmgLevel = " + newDmgLevel + "; \t";
output += "oldDmgLevel = " + (level + dmgLevel) + "; \t";
// ToHit Level
output += "newToHit = " + newToHitLevel + "; \t";
output += "oldToHit = " + oldToHitLevel + "; \t";
// Armor Level
output += "newArmor = " + newArmorLevel + "; \t";
output += "oldArmor = " + oldArmorLevel + "; \t";
LOG ("creature_balance", output);
}
}
@@ -0,0 +1,553 @@
package script.test;
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.badge;
import script.library.colors;
import script.library.combat;
import script.library.create;
import script.library.groundquests;
import script.library.hue;
import script.library.money;
import script.library.pet_lib;
import script.library.prose;
import script.library.quests;
import script.library.sui;
import script.library.utils;
public class esebesta_test extends script.base_script
{
public esebesta_test()
{
}
public static final String PROP_TEXT = "Text";
public static final String SUI_TRANSFER = "Script.transfer";
public static final String TRANSFER_PAGE_PROMPT = "Prompt";
public static final String TRANSFER_PAGE_CAPTION = "bg.caption";
public static final String TRANSFER_PAGE_TRANSACTION = "transaction";
public static final String TRANSFER_BTN_OK = "btnOk";
public static final String TRANSFER_BTN_CANCEL = "btnCancel";
public static final String TRANSFER_BTN_REVERT = "btnRevert";
public static final String TRANSFER_TITLE = TRANSFER_PAGE_CAPTION + ".lblTitle";
public static final String TRANSFER_PROMPT = TRANSFER_PAGE_PROMPT + ".lblPrompt";
public static final String TRANSFER_INPUT_FROM = TRANSFER_PAGE_TRANSACTION + ".txtInputFrom";
public static final String TRANSFER_INPUT_TO = TRANSFER_PAGE_TRANSACTION + ".txtInputTo";
public static final String TRANSFER_FROM = TRANSFER_PAGE_TRANSACTION + ".lblStartingFrom";
public static final String TRANSFER_TO = TRANSFER_PAGE_TRANSACTION + ".lblStartingTo";
public static final String TRANSFER_FROM_TEXT = TRANSFER_PAGE_TRANSACTION + ".lblFrom";
public static final String TRANSFER_TO_TEXT = TRANSFER_PAGE_TRANSACTION + ".lblTo";
public static final String TRANSFER_SLIDER = TRANSFER_PAGE_TRANSACTION + ".slider";
public static final String TRANSFER_INPUT_FROM_TEXT = TRANSFER_INPUT_FROM + "." + PROP_TEXT;
public static final String TRANSFER_INPUT_TO_TEXT = TRANSFER_INPUT_TO + "." + PROP_TEXT;
public void colorize(obj_id player, obj_id target, String customizationVar) throws InterruptedException
{
int pId = createSUIPage("Script.ColorPicker", player, player, "ColorizeCallback");
setSUIProperty(pId, "ColorPicker", "TargetNetworkId", target.toString());
setSUIProperty(pId, "ColorPicker", "TargetVariable", customizationVar);
setSUIProperty(pId, "ColorPicker", "TargetRangeMin", "0");
setSUIProperty(pId, "ColorPicker", "TargetRangeMax", "500");
subscribeToSUIProperty(pId, "ColorPicker", "SelectedIndex");
setSUIAssociatedObject(pId, target);
showSUIPage(pId);
}
public void transfer(obj_id player, int from, int to, float conversionRatio) throws InterruptedException
{
int pid = createSUIPage("Script.Transfer", player, player, "TransferCallback");
setSUIProperty(pid, "Transaction", "ConversionRatio", Float.toString(conversionRatio));
setSUIProperty(pid, TRANSFER_FROM, PROP_TEXT, Integer.toString(from));
setSUIProperty(pid, TRANSFER_TO, PROP_TEXT, Integer.toString(to));
setSUIProperty(pid, TRANSFER_INPUT_FROM, PROP_TEXT, Integer.toString(from));
setSUIProperty(pid, TRANSFER_INPUT_TO, PROP_TEXT, Integer.toString(to));
subscribeToSUIProperty(pid, TRANSFER_INPUT_FROM, PROP_TEXT);
subscribeToSUIProperty(pid, TRANSFER_INPUT_TO, PROP_TEXT);
showSUIPage(pid);
}
public void keypad(obj_id player) throws InterruptedException
{
int pid = createSUIPage("Script.Keypad", player, player, "KeypadCallback");
subscribeToSUIProperty(pid, "result.numberBox", "localtext");
subscribeToSUIProperty(pid, "buttonEnter", "ButtonPressed");
setSUIProperty(pid, "buttonSlice", "enabled", "false");
showSUIPage(pid);
}
public int progressBar(obj_id player) throws InterruptedException
{
int pid = createSUIPage("Script.ProgressBar", player, player, "ProgressBarCallback");
setSUIProperty(pid, "comp.pText.text", PROP_TEXT, "Doing something...");
showSUIPage(pid);
return pid;
}
public int OnHearSpeech(obj_id self, obj_id speaker, String text) throws InterruptedException
{
if (speaker == self)
{
return SCRIPT_CONTINUE;
}
if (text.equals("tauntme"))
{
prose_package pp = new prose_package();
pp.stringId = new string_id("ui", "test_pp");
pp.actor.set(self);
pp.target.set(self);
pp.other.set("other_here");
pp.digitInteger = 666;
pp.digitFloat = 0.333f;
commPlayer(self, speaker, pp, "object/mobile/dressed_imperial_trainer_space_01.iff");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
debugConsoleMsg(self, "esebesta_test OnSpeaking: " + text);
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equals("eas_harvest"))
{
if (tok.hasMoreTokens())
{
String harvesterIdString = tok.nextToken();
obj_id harvester = obj_id.getObjId(java.lang.Long.parseLong(harvesterIdString));
activateHarvesterExtractionPage(self, harvester);
}
else
{
debugSpeakMsg(self, "Not enough arguments: eas_harvest <harvester_id>");
}
}
else if (command.equals("eas_wphere"))
{
debugConsoleMsg(self, "hit eas_wphere");
obj_id wp = createWaypointInDatapad(self, getLocation(self));
_setWaypointColorNative(wp, "space");
}
else if (command.equals("eas_setShipWingName"))
{
debugConsoleMsg(self, "hit eas_setShipWingName");
obj_id ship = getLookAtTarget(self);
setShipWingName(ship, "test_wing");
}
else if (command.equals("eas_giveTestQuest"))
{
debugConsoleMsg(self, "hit eas_giveTestQuest");
int questId = questGetQuestId("quest/kill_3_womprats");
questActivateQuest(questId, self, self);
}
else if (command.equals("eas_clearTestQuest"))
{
debugConsoleMsg(self, "hit eas_clearTestQuest");
int questId = questGetQuestId("quest/kill_3_womprats");
questClearQuest(questId, self);
}
else if (command.equals("eas_giveTestQuest2"))
{
debugConsoleMsg(self, "hit eas_giveTestQuest2");
int questId = questGetQuestId("quest/kill_3_valarian_assassins");
questActivateQuest(questId, self, self);
}
else if (command.equals("eas_clearTestQuest2"))
{
debugConsoleMsg(self, "hit eas_clearTestQuest2");
int questId = questGetQuestId("quest/kill_3_valarian_assassins");
questClearQuest(questId, self);
}
else if (command.equals("eas_giveQuest"))
{
debugConsoleMsg(self, "hit eas_giveQuest");
if (tok.hasMoreTokens())
{
String questName = tok.nextToken();
int questId = questGetQuestId(questName);
int result = questActivateQuest(questId, self, self);
if (result == 1)
{
String s = "Error: Quest already active.";
debugSpeakMsg(self, s);
}
else if (result == 2)
{
String s = "Error: No such quest.";
debugSpeakMsg(self, s);
}
else if (result == 3)
{
String s = "Error: No such task.";
debugSpeakMsg(self, s);
}
else if (result == 4)
{
String s = "Error: Quest already completed, and not repeatable.";
debugSpeakMsg(self, s);
}
else if (result == 5)
{
String s = "Error: Failed prerequisites.";
debugSpeakMsg(self, s);
}
else if (result == 6)
{
String s = "Error: Failed exclusions.";
debugSpeakMsg(self, s);
}
else if (result == 7)
{
String s = "Error: Quest Not active.";
debugSpeakMsg(self, s);
}
else if (result == 8)
{
String s = "Error: Task not active.";
debugSpeakMsg(self, s);
}
else if (result == 9)
{
String s = "Error: No such player.";
debugSpeakMsg(self, s);
}
}
else
{
debugConsoleMsg(self, "Usage: eas_giveQuest <questname>. i.e. \"eas_giveQuest quest/loot_5_widgets\"");
debugSpeakMsg(self, "Usage: eas_giveQuest <questname>. i.e. \"eas_giveQuest quest/loot_5_widgets\"");
}
}
else if (command.equals("eas_clearQuest"))
{
debugConsoleMsg(self, "hit eas_clearQuest");
if (tok.hasMoreTokens())
{
String questName = tok.nextToken();
int questId = questGetQuestId(questName);
questClearQuest(questId, self);
}
else
{
debugConsoleMsg(self, "Usage: eas_clearQuest <questname>. i.e. \"eas_giveQuest quest/loot_5_widgets\"");
debugSpeakMsg(self, "Usage: eas_clearQuest <questname>. i.e. \"eas_giveQuest quest/loot_5_widgets\"");
}
}
else if (command.equals("eas_completeTask"))
{
debugConsoleMsg(self, "hit eas_completeTask");
if (tok.hasMoreTokens())
{
String questName = tok.nextToken();
int questId = questGetQuestId(questName);
int taskId = utils.stringToInt(tok.nextToken());
questCompleteTask(questId, taskId, self);
}
else
{
debugConsoleMsg(self, "Usage: eas_completeTask <questname> <taskid>. i.e. \"eas_completeTask quest/loot_5_widgets 0\"");
debugSpeakMsg(self, "Usage: eas_completeTask <questname> <taskid>. i.e. \"eas_completeTask quest/loot_5_widgets 0\"");
}
}
else if (command.equals("eas_emitSignal"))
{
if (tok.hasMoreTokens())
{
String signal = tok.nextToken();
groundquests.sendSignal(self, signal);
}
}
else if (command.equals("eas_testWaitForSignal"))
{
debugConsoleMsg(self, "hit eas_testWaitForSignal");
groundquests.sendSignal(self, "testsignal");
}
else if (command.equals("eas_testTaskNames"))
{
debugConsoleMsg(self, "hit eas_testTaskNames");
String questName = "quest/test_encounter";
if (groundquests.isValidQuestName(questName))
{
debugConsoleMsg(self, "valid quest name");
}
int questCrc = questGetQuestId(questName);
int taskId = groundquests.getTaskId(questCrc, "killed_them_rats");
debugConsoleMsg(self, "questCrc=[" + questCrc + "] taskId=[" + taskId + "]");
if (questIsTaskComplete(questCrc, taskId, self))
{
groundquests.sendSignal(self, "testSignal");
debugConsoleMsg(self, "sending signal");
}
else
{
debugConsoleMsg(self, "not sending signal");
}
}
else if (command.equals("eas_testRandomLocation"))
{
for (int i = 0; i < 50; ++i)
{
location l = groundquests.getRandom2DLocationAroundPlayer(self, 3, 5);
obj_id object = create.object("object/tangible/gravestone/gravestone01.iff", l);
}
}
else if (command.equals("eas_setPendingEscortTarget"))
{
if (tok.hasMoreTokens())
{
String targetString = tok.nextToken();
obj_id target = obj_id.getObjId(java.lang.Long.parseLong(targetString));
if (!groundquests.isEscortTargetReadyForStaticEscortTask(target))
{
debugConsoleMsg(self, "target busy");
}
else
{
groundquests.setPendingStaticEscortTarget(self, target);
debugConsoleMsg(self, "target target set");
}
}
else
{
debugSpeakMsg(self, "Usage: eas_setPendingEscortTarget <targetid>");
}
}
else if (command.equals("eas_prose1"))
{
debugSpeakMsg(self, "hit eas_prose1");
obj_id target = getLookAtTarget(self);
prose_package pp = prose.getPackage(pet_lib.SID_SYS_CANT_CALL_YET, 5);
showFlyText(target, pp, 1.0f, 255, 0, 0);
prose_package pp2 = prose.getPackage(pet_lib.SID_SYS_CANT_CALL_YET, 10);
showCombatText(target, self, pp2, 1.0f, 0, 0, 255);
}
else if (command.equals("eas_requestActivateQuest"))
{
debugSpeakMsg(self, "hit eas_requestActivateQuest");
int questId = questGetQuestId("quest/ep3_gursan_slay_hsskas");
requestActivateQuest(questId, self, self);
}
else if (command.equals("eas_requestCompleteQuest"))
{
debugSpeakMsg(self, "hit eas_requestCompleteQuest");
int questId = questGetQuestId("quest/ep3_gursan_slay_hsskas");
requestCompleteQuest(questId, self);
}
else if (command.equals("eas_cancelQuest"))
{
debugSpeakMsg(self, "hit eas_cancelQuest");
int questId = questGetQuestId("quest/ep3_gursan_slay_hsskas");
questClearQuest(questId, self);
}
else if (command.equals("eas_showroadmap"))
{
debugSpeakMsg(self, "hit eas_showroadmap");
newbieTutorialHighlightUIElement(self, "/GroundHUD.RoadMap", 7.0f);
}
}
}
return SCRIPT_CONTINUE;
}
public int OnPermissionListModify(obj_id self, obj_id actor, String playerName, String list, String action) throws InterruptedException
{
if (isGod(self))
{
debugConsoleMsg(self, "OnPermissionListModify called with: " + playerName + ", " + list + ", " + action);
}
return SCRIPT_CONTINUE;
}
public int OnQuestCompleted(obj_id self, int questCrc) throws InterruptedException
{
if (isGod(self))
{
debugSpeakMsg(self, "OnQuestCompleted called with: " + questCrc);
}
return SCRIPT_CONTINUE;
}
public int OnQuestActivated(obj_id self, int questCrc) throws InterruptedException
{
if (isGod(self))
{
debugSpeakMsg(self, "OnQuestActivated called with: " + questCrc);
}
return SCRIPT_CONTINUE;
}
public int OnSurveyDataReceived(obj_id self, float[] xVals, float[] zVals, float[] efficiencies) throws InterruptedException
{
if (isGod(self))
{
if (xVals == null)
{
debugConsoleMsg(self, "xVals NULL");
return SCRIPT_CONTINUE;
}
if (zVals == null)
{
debugConsoleMsg(self, "zVals NULL");
return SCRIPT_CONTINUE;
}
if (efficiencies == null)
{
debugConsoleMsg(self, "efficiencies NULL");
return SCRIPT_CONTINUE;
}
if (xVals.length != zVals.length || zVals.length != efficiencies.length)
{
debugConsoleMsg(self, "vectors vary in size, bad");
return SCRIPT_CONTINUE;
}
for (int i = 0; i < xVals.length; ++i)
{
debugConsoleMsg(self, "point:" + i + " x: " + xVals[i] + " z: " + zVals[i] + " eff: " + efficiencies[i]);
}
}
return SCRIPT_CONTINUE;
}
public int TestMessage(obj_id self, dictionary params) throws InterruptedException
{
debugSpeakMsg(self, "TestMessage messageHandler hit");
return SCRIPT_CONTINUE;
}
public int ColorizeCallback(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int TransferCallback(obj_id self, dictionary params) throws InterruptedException
{
final int to = utils.stringToInt(params.getString(TRANSFER_INPUT_TO + "." + PROP_TEXT));
final int from = utils.stringToInt(params.getString(TRANSFER_INPUT_FROM + "." + PROP_TEXT));
debugSpeakMsg(self, "Transfer result: from:" + from + ", to:" + to);
return SCRIPT_CONTINUE;
}
public int KeypadCallback(obj_id self, dictionary params) throws InterruptedException
{
final int result = utils.stringToInt(params.getString("result.numberBox" + "." + "localtext"));
final String button = params.getString("buttonEnter.ButtonPressed");
debugSpeakMsg(self, "Keypad result: " + result + "\nButton Pressed: " + button);
return SCRIPT_CONTINUE;
}
public int ProgressBarCallback(obj_id self, dictionary params) throws InterruptedException
{
debugSpeakMsg(self, "ProgressBarCallback");
return SCRIPT_CONTINUE;
}
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int componentSlot, boolean fromPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
{
string_id strFlyTextTarget = new string_id("ship_test", "washit_target");
color colFlyText = colors.VIOLET;
showFlyText(self, strFlyTextTarget, 1.0f, colFlyText);
LOG("esebesta-debug", self + " WAS HIT by " + attacker + " in slot [" + ship_chassis_slot_type.getNameByType(componentSlot) + "]");
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnFormCreateObject(obj_id self, String templateName, float xLoc, float yLoc, float zLoc, obj_id cell, String[] keys, String[] values) throws InterruptedException
{
debugConsoleMsg(self, "OnFormCreateObject hit");
debugConsoleMsg(self, "Template: " + templateName + " Loc: (" + xLoc + "," + yLoc + "," + zLoc + ")");
debugConsoleMsg(self, "Form data:");
for (int i = 0; i < keys.length && i < values.length; ++i)
{
String key = keys[i];
String value = values[i];
debugConsoleMsg(self, "[" + key + "]" + value);
}
location loc = new location(xLoc, yLoc, zLoc, "tatooine");
obj_id object = createObject(templateName, loc);
debugConsoleMsg(self, "New object is ID:" + object);
return SCRIPT_CONTINUE;
}
public int OnFormEditObject(obj_id self, obj_id editObject, String[] keys, String[] values) throws InterruptedException
{
debugConsoleMsg(self, "OnFormEditObject hit");
debugConsoleMsg(self, "Object: " + editObject);
debugConsoleMsg(self, "Form data:");
for (int i = 0; i < keys.length && i < values.length; ++i)
{
String key = keys[i];
String value = values[i];
debugConsoleMsg(self, "[" + key + "]" + value);
}
return SCRIPT_CONTINUE;
}
public int OnFormRequestEditObject(obj_id self, obj_id objectToEdit, String[] keys) throws InterruptedException
{
debugConsoleMsg(self, "OnFormRequestEditObject hit");
String[] ourKeys =
{
"spawns",
"minSpawnDistance",
"maxSpawnDistance",
"minSpawnTime",
"maxSpawnTime",
"spawnCount",
"minLoiterDistance",
"maxLoiterDistance"
};
String[] ourValues =
{
"xwing,ywing,bwing",
"0",
"50",
"1",
"5",
"8",
"5",
"15"
};
boolean result = editFormData(self, objectToEdit, ourKeys, ourValues);
if (result)
{
debugConsoleMsg(self, "edit success");
}
else
{
debugConsoleMsg(self, "edit failure");
}
return SCRIPT_CONTINUE;
}
public int OnDroppedItemOntoShipComponent(obj_id self, int slot, obj_id droppedItem, obj_id dropper) throws InterruptedException
{
debugServerConsoleMsg(self, "OnDroppedItemOntoShipComponent hit");
debugServerConsoleMsg(self, "params: slot[" + slot + "] droppedItem[" + droppedItem + "] dropper[" + dropper + "]");
debugSpeakMsg(self, "OnDroppedItemOntoShipComponent hit");
debugSpeakMsg(self, "params: slot[" + slot + "] droppedItem[" + droppedItem + "] dropper[" + dropper + "]");
return SCRIPT_CONTINUE;
}
public int OnTryToEquipDroidControlDeviceInShip(obj_id self, obj_id actor, obj_id droidControlDevice) throws InterruptedException
{
associateDroidControlDeviceWithShip(self, droidControlDevice);
return SCRIPT_CONTINUE;
}
public int OnCommitDroidProgramCommands(obj_id self, obj_id droidControlDevice, String[] commands, obj_id[] chipsToAdd, obj_id[] chipsToRemove) throws InterruptedException
{
debugSpeakMsg(self, "OnCommitDroidProgramCommands hit");
debugSpeakMsg(self, "params: droidControlDevice[" + droidControlDevice + "]\n");
obj_id objDataPad = utils.getDatapad(droidControlDevice);
debugSpeakMsg(self, "commands:");
for (int i = 0; i < commands.length; ++i)
{
String command = commands[i];
debugSpeakMsg(self, "[" + command + "]");
}
debugSpeakMsg(self, "\nchipsToAdd:");
for (int i = 0; i < chipsToAdd.length; ++i)
{
obj_id chip = chipsToAdd[i];
debugSpeakMsg(self, "[" + chip + "]");
}
debugSpeakMsg(self, "\nchipsToRemove:");
for (int i = 0; i < chipsToRemove.length; ++i)
{
obj_id chip = chipsToRemove[i];
debugSpeakMsg(self, "[" + chip + "]");
}
return SCRIPT_CONTINUE;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,22 @@
package script.test;
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.fs_quests;
public class fs_quest_test extends script.base_script
{
public fs_quest_test()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
}
@@ -1,6 +0,0 @@
include library.fs_quests;
trigger OnSpeaking(string text)
{
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,97 @@
package script.test;
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;
public class getgoodlocation_test extends script.base_script
{
public getgoodlocation_test()
{
}
public void end(obj_id self) throws InterruptedException
{
debugSpeakMsg(self, "Testing of GetGoodLocation has begun");
}
public void start(obj_id self) throws InterruptedException
{
debugSpeakMsg(self, "Testing of GetGoodLocation has begun");
}
public int OnAttach(obj_id self) throws InterruptedException
{
start(self);
return SCRIPT_CONTINUE;
}
public int OnDetach(obj_id self) throws InterruptedException
{
end(self);
return SCRIPT_CONTINUE;
}
public int OnHearSpeech(obj_id self, obj_id speaker, String text) throws InterruptedException
{
String[] words = split(text, ' ');
if (words[0].equals("getgoodloc"))
{
getGoodLoc(self);
}
if (words[0].equals("getheight"))
{
getHeight(self);
}
if (words[0].equals("dropobjectstest"))
{
dropTestObjects(self, 100);
}
return SCRIPT_CONTINUE;
}
public void getGoodLoc(obj_id self) throws InterruptedException
{
location sll = new location(getLocation(self));
sll.x -= 8;
sll.z -= 8;
location sur = new location(getLocation(self));
sur.x += 8;
sur.z += 8;
location goodLocation = getGoodLocation(8, 8, sll, sur, false, true);
if (goodLocation != null)
{
debugSpeakMsg(self, goodLocation.x + ", " + goodLocation.y + ", " + goodLocation.z + " is a good location.");
}
else
{
debugSpeakMsg(self, "Failed");
}
}
public void dropTestObjects(obj_id self, int numObjects) throws InterruptedException
{
int areaSizeX = 8;
int areaSizeY = 8;
location sll = new location(getLocation(self));
sll.x -= 100;
sll.z -= 100;
location sur = new location(getLocation(self));
sur.x += 100;
sur.z += 100;
for (int i = 0; i < numObjects; ++i)
{
location goodLocation = getGoodLocation(areaSizeX, areaSizeY, sll, sur, false, true);
if (goodLocation != null)
{
createObject("object/tangible/furniture/frn_all_table_s01.iff", goodLocation);
}
else
{
debugSpeakMsg(self, "Failed to find good location.");
}
}
}
public void getHeight(obj_id self) throws InterruptedException
{
float result = getHeightAtLocation(0, 0);
debugSpeakMsg(self, "" + result);
}
}
@@ -1,93 +0,0 @@
void end(obj_id self)
{
debugSpeakMsg(self, "Testing of GetGoodLocation has begun");
}
void start(obj_id self)
{
debugSpeakMsg(self, "Testing of GetGoodLocation has begun");
}
trigger OnAttach()
{
start(self);
return SCRIPT_CONTINUE;
}
trigger OnDetach()
{
end(self);
return SCRIPT_CONTINUE;
}
trigger OnHearSpeech(obj_id speaker, string text)
{
string[] words = split( text, ' ' );
if ( words[0].equals("getgoodloc" ))
{
getGoodLoc(self);
}
if ( words[0].equals("getheight" ))
{
getHeight(self);
}
if (words[0].equals("dropobjectstest" ))
{
dropTestObjects(self, 100);
}
return SCRIPT_CONTINUE;
}
void getGoodLoc(obj_id self)
{
location sll = new location (getLocation (self));
sll.x -= 8;
sll.z -= 8;
location sur = new location (getLocation (self));
sur.x += 8;
sur.z += 8;
location goodLocation = getGoodLocation(8, 8, sll, sur, false, true);
if(goodLocation != null)
{
debugSpeakMsg(self, goodLocation.x + ", " + goodLocation.y + ", " + goodLocation.z + " is a good location.");
}
else
{
debugSpeakMsg(self, "Failed");
}
}
void dropTestObjects(obj_id self, int numObjects)
{
int areaSizeX = 8;
int areaSizeY = 8;
location sll = new location (getLocation (self));
sll.x -= 100;
sll.z -= 100;
location sur = new location (getLocation (self));
sur.x += 100;
sur.z += 100;
for(int i = 0; i < numObjects; ++i)
{
location goodLocation = getGoodLocation(areaSizeX, areaSizeY, sll, sur, false, true);
if(goodLocation != null)
{
createObject("object/tangible/furniture/frn_all_table_s01.iff", goodLocation);
}
else
{
debugSpeakMsg(self, "Failed to find good location.");
}
}
}
void getHeight(obj_id self)
{
float result = getHeightAtLocation(0, 0);
debugSpeakMsg(self, "" + result);
}
@@ -0,0 +1,263 @@
package script.test;
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.space_dungeon;
import script.library.space_dungeon_data;
import script.library.utils;
import script.library.sui;
public class instance_test extends script.base_script
{
public instance_test()
{
}
public static final String dataTable = "datatables/dungeon/space_dungeon.iff";
public static final string_id SID_UNABLE_TO_FIND_DUNGEON = new string_id("dungeon/space_dungeon", "unable_to_find_dungeon");
public static final boolean doLogging = false;
public int OnLogin(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "space_dungeon.ticket.point"))
{
removeObjVar(self, "space_dungeon.ticket.point");
}
if (hasObjVar(self, "space_dungeon.ticket.dungeon"))
{
removeObjVar(self, "space_dungeon.ticket.dungeon");
}
if (utils.hasScriptVar(self, "idx"))
{
utils.removeScriptVar(self, "idx");
}
if (utils.hasScriptVar(self, "instanceType"))
{
utils.removeScriptVar(self, "instanceType");
}
return SCRIPT_CONTINUE;
}
public int cmdActivateInstance(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
String[] dungeons = dataTableGetStringColumn(dataTable, "dungeon");
sui.listbox(self, self, "Select Instnace Dungeon", sui.OK_CANCEL, "Select Dungeon", dungeons, "handleSelectInstance", true);
return SCRIPT_CONTINUE;
}
public int handleSelectInstance(obj_id self, dictionary params) throws InterruptedException
{
int idx = sui.getListboxSelectedRow(params);
obj_id player = sui.getPlayerId(params);
int rows = dataTableGetNumRows(dataTable);
if (idx < 0 || idx > rows - 1)
{
sendSystemMessageTestingOnly(player, "Invalid dungeon selected");
return SCRIPT_CONTINUE;
}
dictionary dungeonDict = dataTableGetRow(dataTable, idx);
String type = dungeonDict.getString("instanceType");
if (!type.equals("dungeon_default"))
{
String[] parse = split(type, ':');
utils.setScriptVar(player, "idx", idx);
utils.setScriptVar(player, "instanceType", type);
sui.listbox(self, player, "Select Instance Type", sui.OK_CANCEL, "Select Type", parse, "handleSelectType", true);
return SCRIPT_CONTINUE;
}
else
{
String dungeon = dungeonDict.getString("dungeon");
String scene = getCurrentSceneName();
setObjVar(self, "space_dungeon.ticket.point", scene);
setObjVar(self, "space_dungeon.ticket.dungeon", dungeon);
space_dungeon.sendGroupToDungeonWithoutTicket(self, dungeon, scene, scene, type, self);
return SCRIPT_CONTINUE;
}
}
public int handleSelectType(obj_id self, dictionary params) throws InterruptedException
{
int dungeonIdx = utils.getIntScriptVar(self, "idx");
String dungeonType = utils.getStringScriptVar(self, "instanceType");
String[] parse = split(dungeonType, ':');
int idx = sui.getListboxSelectedRow(params);
obj_id player = sui.getPlayerId(params);
dictionary dungeonDict = dataTableGetRow(dataTable, dungeonIdx);
if (idx < 0 || idx > parse.length - 1)
{
sendSystemMessageTestingOnly(player, "Invalid Selection");
return SCRIPT_CONTINUE;
}
else
{
String type = parse[idx];
String dungeon = dungeonDict.getString("dungeon");
String scene = getCurrentSceneName();
setObjVar(self, "space_dungeon.ticket.point", scene);
setObjVar(self, "space_dungeon.ticket.dungeon", dungeon);
space_dungeon.sendGroupToDungeonWithoutTicket(self, dungeon, scene, scene, type, self);
return SCRIPT_CONTINUE;
}
}
public int OnClusterWideDataResponse(obj_id self, String manage_name, String dungeon_type, int request_id, String[] element_name_list, dictionary[] dungeon_data, int lock_key) throws InterruptedException
{
LOG("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse");
obj_id player = space_dungeon.getDungeonTraveler(self, request_id);
if (!isIdValid(player) || !player.isAuthoritative())
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- player is invalid or not authoritative.");
releaseClusterWideDataLock("dungeon", lock_key);
if (isIdValid(player))
{
space_dungeon.cleanupPlayerTicketObjvars(player);
}
return SCRIPT_CONTINUE;
}
obj_id ticket = null;
if (hasObjVar(player, space_dungeon.VAR_TICKET_USED))
{
ticket = getObjIdObjVar(player, space_dungeon.VAR_TICKET_USED);
}
else
{
ticket = player;
}
if (!isIdValid(ticket) || !ticket.isAuthoritative())
{
sendSystemMessage(player, space_dungeon.SID_ILLEGAL_TICKET);
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (!manage_name.equals("dungeon"))
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- ignorning manage_name " + manage_name + " because it is not dungeon.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (request_id < 1)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- invalid request_id value of " + request_id);
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (dungeon_data == null)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- dungeon_data is null.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (element_name_list == null)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- element_name_list is null.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (dungeon_type == null)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- dungeon_type is null.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
String dungeon_name = dungeon_type.substring(0, dungeon_type.length() - 1);
for (int i = 0; i < dungeon_data.length; i++)
{
if (false == space_dungeon_data.isValidDungeon(dungeon_name))
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- dungeon name of " + dungeon_name + " is not in the dungeon datatable.");
break;
}
dictionary dungeon = dungeon_data[i];
obj_id dungeon_id = dungeon.getObjId("dungeon_id");
int session_id = dungeon.getInt("session_id");
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- session_id ->" + session_id + " dungeon_instance ->" + element_name_list[i]);
if (!isIdValid(dungeon_id))
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- bad data found for dungeon entry " + i + ". Ignoring.");
continue;
}
if (session_id < 1)
{
setObjVar(player, space_dungeon.VAR_SESSION_ID, lock_key);
dictionary dungeon_update = new dictionary();
dungeon_update.put("session_id", lock_key);
updateClusterWideData("dungeon", element_name_list[i], dungeon_update, lock_key);
releaseClusterWideDataLock("dungeon", lock_key);
dictionary d = new dictionary();
d.put("session_id", lock_key);
d.put("request_id", request_id);
d.put("player", player);
d.put("ticket_collector", self);
if (hasObjVar(ticket, space_dungeon.VAR_TICKET_QUEST_TYPE))
{
d.put("quest_type", getStringObjVar(ticket, space_dungeon.VAR_TICKET_QUEST_TYPE));
}
messageTo(dungeon_id, "msgSetSessionId", d, 0.0f, false);
return SCRIPT_CONTINUE;
}
}
releaseClusterWideDataLock("dungeon", lock_key);
space_dungeon.cleanupPlayerTicketObjvars(player);
space_dungeon.removeDungeonTraveler(self, request_id);
string_id success = space_dungeon_data.getDungeonFailureString(dungeon_name);
if (success == null)
{
sendSystemMessage(player, SID_UNABLE_TO_FIND_DUNGEON);
}
else
{
sendSystemMessage(player, success);
}
return SCRIPT_CONTINUE;
}
public int msgStartDungeonTravel(obj_id self, dictionary params) throws InterruptedException
{
int session_id = params.getInt("session_id");
doLogging("space_dungeon", "msgStartDungeonTravel -- session_id ->" + session_id);
obj_id dungeon_id = params.getObjId("dungeon_id");
if (!isIdValid(dungeon_id))
{
doLogging("space_dungeon", "player_travel.msgStartDungeonTravel -- dungeon_id is invalid for " + self + ".");
return SCRIPT_CONTINUE;
}
String dungeon_name = params.getString("dungeon_name");
if (dungeon_id == null)
{
doLogging("space_dungeon", "player_travel.msgStartDungeonTravel -- dungeon_name is null for " + self + ".");
return SCRIPT_CONTINUE;
}
int request_id = params.getInt("request_id");
obj_id player = space_dungeon.getDungeonTraveler(self, request_id);
if (!isIdValid(player))
{
doLogging("space_dungeon", "player_travel.msgStartDungeonTravel -- player is null for " + self);
return SCRIPT_CONTINUE;
}
space_dungeon.removeDungeonTraveler(self, request_id);
if (player.isAuthoritative())
{
location dungeon_loc = params.getLocation("dungeon_loc");
if (dungeon_loc == null)
{
doLogging("space_dungeon", "travel_space_dungeon.msgStartDungeonTravel -- location is null for " + self + ".");
return SCRIPT_CONTINUE;
}
space_dungeon.movePlayerGroupToDungeon(player, dungeon_id, dungeon_name, dungeon_loc);
}
return SCRIPT_CONTINUE;
}
public void doLogging(String section, String message) throws InterruptedException
{
if (doLogging)
{
LOG("debug/instance_test/" + section, message);
}
}
}
@@ -1,293 +0,0 @@
include library.space_dungeon;
include library.space_dungeon_data;
include library.utils;
include library.sui;
const string dataTable = "datatables/dungeon/space_dungeon.iff";
const string_id SID_UNABLE_TO_FIND_DUNGEON = new string_id("dungeon/space_dungeon", "unable_to_find_dungeon");
const boolean doLogging = false;
trigger OnLogin()
{
if (hasObjVar(self, "space_dungeon.ticket.point"))
removeObjVar(self, "space_dungeon.ticket.point");
if (hasObjVar(self, "space_dungeon.ticket.dungeon"))
removeObjVar(self, "space_dungeon.ticket.dungeon");
if (utils.hasScriptVar(self, "idx"))
utils.removeScriptVar(self, "idx");
if (utils.hasScriptVar(self, "instanceType"))
utils.removeScriptVar(self, "instanceType");
return SCRIPT_CONTINUE;
}
commandHandler cmdActivateInstance()
{
string[] dungeons = dataTableGetStringColumn(dataTable, "dungeon");
sui.listbox(self, self, "Select Instnace Dungeon", sui.OK_CANCEL, "Select Dungeon", dungeons, "handleSelectInstance", true);
return SCRIPT_CONTINUE;
}
messageHandler handleSelectInstance()
{
int idx = sui.getListboxSelectedRow( params );
obj_id player = sui.getPlayerId( params );
int rows = dataTableGetNumRows(dataTable);
if (idx < 0 || idx > rows -1)
{
sendSystemMessageTestingOnly(player, "Invalid dungeon selected");
return SCRIPT_CONTINUE;
}
dictionary dungeonDict = dataTableGetRow(dataTable, idx);
string type = dungeonDict.getString("instanceType");
if (!type.equals("dungeon_default"))
{
string[] parse = split(type, ':');
utils.setScriptVar(player, "idx", idx);
utils.setScriptVar(player, "instanceType", type);
sui.listbox(self, player, "Select Instance Type", sui.OK_CANCEL, "Select Type", parse, "handleSelectType", true);
return SCRIPT_CONTINUE;
}
else
{
string dungeon = dungeonDict.getString("dungeon");
string scene = getCurrentSceneName();
setObjVar(self, "space_dungeon.ticket.point", scene);
setObjVar(self, "space_dungeon.ticket.dungeon", dungeon);
space_dungeon.sendGroupToDungeonWithoutTicket(self, dungeon, scene, scene, type, self);
return SCRIPT_CONTINUE;
}
}
messageHandler handleSelectType()
{
int dungeonIdx = utils.getIntScriptVar(self, "idx");
string dungeonType = utils.getStringScriptVar(self, "instanceType");
string[] parse = split(dungeonType, ':');
int idx = sui.getListboxSelectedRow( params );
obj_id player = sui.getPlayerId(params);
dictionary dungeonDict = dataTableGetRow(dataTable, dungeonIdx);
if (idx < 0 || idx > parse.length -1)
{
sendSystemMessageTestingOnly(player, "Invalid Selection");
return SCRIPT_CONTINUE;
}
else
{
string type = parse[idx];
string dungeon = dungeonDict.getString("dungeon");
string scene = getCurrentSceneName();
setObjVar(self, "space_dungeon.ticket.point", scene);
setObjVar(self, "space_dungeon.ticket.dungeon", dungeon);
space_dungeon.sendGroupToDungeonWithoutTicket(self, dungeon, scene, scene, type, self);
return SCRIPT_CONTINUE;
}
}
trigger OnClusterWideDataResponse(string manage_name, string dungeon_type, int request_id, string[] element_name_list, dictionary[] dungeon_data, int lock_key)
{
// This trigger is fired whenever a request for space dungeon travel has been made.
LOG("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse");
// Get the player that initiated this trigger.
obj_id player = space_dungeon.getDungeonTraveler(self, request_id);
if (!isIdValid(player) || !player.isAuthoritative())
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- player is invalid or not authoritative.");
releaseClusterWideDataLock("dungeon", lock_key);
if (isIdValid(player))
space_dungeon.cleanupPlayerTicketObjvars(player);
return SCRIPT_CONTINUE;
}
obj_id ticket = null;
if (hasObjVar(player, space_dungeon.VAR_TICKET_USED))
ticket = getObjIdObjVar(player, space_dungeon.VAR_TICKET_USED);
else
{
//-- player can be used as the ticket, and carries all the necessary ticket information as objvars
ticket = player;
}
// Make sure the player ticket is still valid
if (!isIdValid(ticket) || !ticket.isAuthoritative())
{
sendSystemMessage(player, space_dungeon.SID_ILLEGAL_TICKET);
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (!manage_name.equals("dungeon"))
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- ignorning manage_name " + manage_name + " because it is not dungeon.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (request_id < 1)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- invalid request_id value of " + request_id);
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (dungeon_data == null)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- dungeon_data is null.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (element_name_list == null)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- element_name_list is null.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
if (dungeon_type == null)
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- dungeon_type is null.");
space_dungeon.cleanupPlayerTicketObjvars(player);
releaseClusterWideDataLock("dungeon", lock_key);
return SCRIPT_CONTINUE;
}
// The dungeon type is the dungeon name with a wildcard search (ie: dungeon_name*)
string dungeon_name = dungeon_type.substring(0, dungeon_type.length() - 1);
// Pull the data we need from the dictionary.
for (int i = 0; i < dungeon_data.length; i++)
{
// Check to make certain that the name is in the dungeon datatable.
if (false == space_dungeon_data.isValidDungeon(dungeon_name))
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- dungeon name of " + dungeon_name + " is not in the dungeon datatable.");
break;
}
dictionary dungeon = dungeon_data[i];
obj_id dungeon_id = dungeon.getObjId("dungeon_id");
//int participants = dungeon.getInt("participants");
int session_id = dungeon.getInt("session_id");
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- session_id ->" + session_id + " dungeon_instance ->" + element_name_list[i]);
if (!isIdValid(dungeon_id))
{
doLogging("space_dungeon", "travel_space_dungeon.OnClusterWideDataResponse -- bad data found for dungeon entry " + i + ". Ignoring.");
continue;
}
if (session_id < 1)
{
// Mark the player with his dungeon session id
setObjVar(player, space_dungeon.VAR_SESSION_ID, lock_key);
// Update the cluster data with the session_id.
dictionary dungeon_update = new dictionary();
dungeon_update.put("session_id", lock_key);
updateClusterWideData("dungeon", element_name_list[i], dungeon_update, lock_key);
// Release the lock on the dungeon data
releaseClusterWideDataLock("dungeon", lock_key);
// Send a message to the dungeon to mark it's session id. After this is acknowledged, the transport starts.
dictionary d = new dictionary();
d.put("session_id", lock_key);
d.put("request_id", request_id);
d.put("player", player);
d.put("ticket_collector", self);
if (hasObjVar(ticket, space_dungeon.VAR_TICKET_QUEST_TYPE))
d.put("quest_type", getStringObjVar(ticket, space_dungeon.VAR_TICKET_QUEST_TYPE));
messageTo(dungeon_id, "msgSetSessionId", d, 0.0f, false);
return SCRIPT_CONTINUE;
}
}
// Release the lock on the dungeon data
releaseClusterWideDataLock("dungeon", lock_key);
// Clean up the player's ticket data
space_dungeon.cleanupPlayerTicketObjvars(player);
space_dungeon.removeDungeonTraveler(self, request_id);
// Could not find a dungeon. Check for a "fictional" reason to deny entry. If that doesn't exist, give the
// generic response.
string_id success = space_dungeon_data.getDungeonFailureString(dungeon_name);
if (success == null)
sendSystemMessage(player, SID_UNABLE_TO_FIND_DUNGEON);
else
sendSystemMessage(player, success);
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
messageHandler msgStartDungeonTravel()
{
int session_id = params.getInt("session_id");
doLogging("space_dungeon", "msgStartDungeonTravel -- session_id ->" + session_id);
obj_id dungeon_id = params.getObjId("dungeon_id");
if (!isIdValid(dungeon_id))
{
doLogging("space_dungeon", "player_travel.msgStartDungeonTravel -- dungeon_id is invalid for " + self + ".");
return SCRIPT_CONTINUE;
}
string dungeon_name = params.getString("dungeon_name");
if (dungeon_id == null)
{
doLogging("space_dungeon", "player_travel.msgStartDungeonTravel -- dungeon_name is null for " + self + ".");
return SCRIPT_CONTINUE;
}
int request_id = params.getInt("request_id");
obj_id player = space_dungeon.getDungeonTraveler(self, request_id);
if (!isIdValid(player))
{
doLogging("space_dungeon", "player_travel.msgStartDungeonTravel -- player is null for " + self);
return SCRIPT_CONTINUE;
}
space_dungeon.removeDungeonTraveler(self, request_id);
if (player.isAuthoritative())
{
location dungeon_loc = params.getLocation("dungeon_loc");
if (dungeon_loc == null)
{
doLogging("space_dungeon", "travel_space_dungeon.msgStartDungeonTravel -- location is null for " + self + ".");
return SCRIPT_CONTINUE;
}
space_dungeon.movePlayerGroupToDungeon(player, dungeon_id, dungeon_name, dungeon_loc);
}
return SCRIPT_CONTINUE;
}
void doLogging(string section, string message)
{
if (doLogging)
LOG("debug/instance_test/"+section, message);
}
@@ -0,0 +1,112 @@
package script.test;
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.ai_lib;
import script.library.create;
import script.library.groundquests;
import script.library.pclib;
import script.library.skill;
import script.library.space_quest;
import script.library.sui;
import script.library.utils;
import script.library.weapons;
import script.library.player_structure;
public class juriarte_test extends script.base.remote_object_requester
{
public juriarte_test()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equalsIgnoreCase("ju_getPobBaseItemLimit_target"))
{
final obj_id target = getLookAtTarget(self);
int baseItemLimit = getPobBaseItemLimit(target);
String s = "getPobBaseItemLimit_target returns " + baseItemLimit;
debugSpeakMsg(self, s);
}
if (command.equalsIgnoreCase("ju_getPobBaseItemLimit_myContainer"))
{
final obj_id target = getTopMostContainer(self);
int baseItemLimit = getPobBaseItemLimit(target);
String s = "getPobBaseItemLimit_myContainer returns " + baseItemLimit;
debugSpeakMsg(self, s);
}
if (command.equalsIgnoreCase("ju_getHologramType_target"))
{
final obj_id target = getLookAtTarget(self);
int hologramType = getHologramType(target);
String s = "getHologramType returns " + hologramType;
debugSpeakMsg(self, s);
}
if (command.equalsIgnoreCase("ju_setHologramType4_target"))
{
final obj_id target = getLookAtTarget(self);
setHologramType(target, HOLOGRAM_TYPE1_QUALITY4);
}
if (command.equalsIgnoreCase("ju_setHologramType1_target"))
{
final obj_id target = getLookAtTarget(self);
setHologramType(target, HOLOGRAM_TYPE1_QUALITY1);
}
if (command.equalsIgnoreCase("ju_setVisibleOnMapAndRadar_true"))
{
final obj_id target = getLookAtTarget(self);
debugConsoleMsg(self, "... command is: " + command + " target is " + target);
setVisibleOnMapAndRadar(target, true);
}
if (command.equalsIgnoreCase("ju_setVisibleOnMapAndRadar_false"))
{
final obj_id target = getLookAtTarget(self);
debugConsoleMsg(self, "... command is: " + command + " target is " + target);
setVisibleOnMapAndRadar(target, false);
}
if (command.equalsIgnoreCase("ju_getVisibleOnMapAndRadar"))
{
final obj_id target = getLookAtTarget(self);
debugConsoleMsg(self, "... command is: " + command + " target is " + target + " result is " + getVisibleOnMapAndRadar(target));
}
if (command.equalsIgnoreCase("ju_incubator_development"))
{
final obj_id target = getLookAtTarget(self);
debugConsoleMsg(self, "... command is: " + command + " target is " + target);
incubatorStart_development(self, target);
}
if (command.equalsIgnoreCase("ju_incubator_test0"))
{
final obj_id target = getLookAtTarget(self);
debugConsoleMsg(self, "... command is: " + command + " target is " + target);
incubatorStart(1, self, target, 72, 2, 3, 4, 5, 6, 7, 4, 5, -1, "foobar_deadbeef_1");
}
}
}
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int startPerform(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int stopPerform(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
}
@@ -1,177 +0,0 @@
// ======================================================================
include library.ai_lib;
include library.create;
include library.groundquests;
include library.pclib;
include library.skill;
include library.space_quest;
include library.sui;
include library.utils;
include library.weapons;
include library.player_structure;
inherits base.remote_object_requester;
// ======================================================================
trigger OnSpeaking(String text)
{
if(isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
if (tok.hasMoreTokens ())
{
String command = tok.nextToken ();
debugConsoleMsg( self, "command is: " + command);
// ----------------------------------------------------------------------
if (command.equalsIgnoreCase ("ju_getPobBaseItemLimit_target"))
{
const obj_id target = getLookAtTarget(self);
int baseItemLimit = getPobBaseItemLimit(target);
String s = "getPobBaseItemLimit_target returns " + baseItemLimit;
debugSpeakMsg(self, s);
}
if (command.equalsIgnoreCase ("ju_getPobBaseItemLimit_myContainer"))
{
const obj_id target = getTopMostContainer(self);
int baseItemLimit = getPobBaseItemLimit(target);
String s = "getPobBaseItemLimit_myContainer returns " + baseItemLimit;
debugSpeakMsg(self, s);
}
if (command.equalsIgnoreCase ("ju_getHologramType_target"))
{
const obj_id target = getLookAtTarget(self);
int hologramType = getHologramType(target);
String s = "getHologramType returns " + hologramType;
debugSpeakMsg(self,s);
}
if (command.equalsIgnoreCase ("ju_setHologramType4_target"))
{
const obj_id target = getLookAtTarget(self);
setHologramType(target,HOLOGRAM_TYPE1_QUALITY4);
}
if (command.equalsIgnoreCase ("ju_setHologramType1_target"))
{
const obj_id target = getLookAtTarget(self);
setHologramType(target,HOLOGRAM_TYPE1_QUALITY1);
}
if (command.equalsIgnoreCase ("ju_setVisibleOnMapAndRadar_true"))
{
const obj_id target = getLookAtTarget(self);
debugConsoleMsg( self, "... command is: " + command + " target is " + target);
setVisibleOnMapAndRadar(target,true);
}
if (command.equalsIgnoreCase ("ju_setVisibleOnMapAndRadar_false"))
{
const obj_id target = getLookAtTarget(self);
debugConsoleMsg( self, "... command is: " + command + " target is " + target);
setVisibleOnMapAndRadar(target,false);
}
if (command.equalsIgnoreCase ("ju_getVisibleOnMapAndRadar"))
{
const obj_id target = getLookAtTarget(self);
debugConsoleMsg( self, "... command is: " + command + " target is " + target + " result is " + getVisibleOnMapAndRadar(target));
}
if (command.equalsIgnoreCase ("ju_incubator_development"))
{
const obj_id target = getLookAtTarget(self);
debugConsoleMsg( self, "... command is: " + command + " target is " + target);
incubatorStart_development(self,target);
}
if (command.equalsIgnoreCase ("ju_incubator_test0"))
{
const obj_id target = getLookAtTarget(self);
debugConsoleMsg( self, "... command is: " + command + " target is " + target);
incubatorStart(
1, // sessionNumber
self, // playerId
target, // terminalId
72, // powerGauge
2, // initialPointsSurvival
3, // initialPointsBeastialResilience
4, // initialPointsCunning
5, // initialPointsIntelligence
6, // initialPointsAggression
7, // initialPointsHuntersInstinct
4, // temperatureGauge
5, // nutrientGuage
-1,
"foobar_deadbeef_1"
);
}
}
}
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
trigger OnAttach()
{
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
messageHandler startPerform()
{
//LOG("QUEST_DEBUG", "startPerform");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
messageHandler stopPerform()
{
//LOG("QUEST_DEBUG", "stopPerform");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ======================================================================
@@ -0,0 +1,98 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
import script.library.chat;
import script.library.pclib;
import script.library.vehicle;
import script.library.ship_ai;
public class jwatson_mining_asteroid_dynamic extends script.base_script
{
public jwatson_mining_asteroid_dynamic()
{
}
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
{
obj_id pilot = getPilotId(self);
if (pilot != null)
{
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
}
return SCRIPT_CONTINUE;
}
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
{
obj_id attackingPilot = getPilotId(attacker);
location attackingLocation = getLocation(attacker);
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
transform selfTransform = getTransform_o2w(self);
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
if (getShipComponentDescriptorWeaponIsMissile(weaponCrc))
{
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
vector directionToAttacker_w = new vector(attackingPosition_w);
directionToAttacker_w = directionToAttacker_w.subtract(selfTransform.getPosition_p());
directionToAttacker_w = directionToAttacker_w.normalize();
directionToAttacker_w = directionToAttacker_w.multiply(20.0f);
currentVelocity_w = currentVelocity_w.add(directionToAttacker_w);
float velocityMagnitude = currentVelocity_w.magnitude();
float MAX_VELOCITY_MAGNITUDE = 50.0f;
if (velocityMagnitude > MAX_VELOCITY_MAGNITUDE)
{
float velocityMultiplier = MAX_VELOCITY_MAGNITUDE / velocityMagnitude;
currentVelocity_w = currentVelocity_w.multiply(velocityMultiplier);
}
sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic TRACTOR PULSE add=" + directionToAttacker_w);
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
return SCRIPT_CONTINUE;
}
int maxHitpoints = getMaxHitpoints(self);
int oldHitpoints = getHitpoints(self);
setHitpoints(self, oldHitpoints - 10);
int newHitpoints = getHitpoints(self);
sendSystemMessageTestingOnly(attackingPilot, "hit asteroid dynamic " + newHitpoints + "/" + maxHitpoints);
if (newHitpoints <= 0)
{
sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic DESTROYED");
handleShipDestruction(self, 1.0f);
}
else
{
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
if ((newHitpoints < (maxHitpoints / 2)) && (oldHitpoints >= (maxHitpoints / 2)))
{
if (random.rand() > 0.5f)
{
location selfLocation = getLocation(self);
obj_id spawnDynamicAsteroid = createObject("object/ship/asteroid/mining_asteroid_dynamic_nugget.iff", selfLocation);
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
sendSystemMessageTestingOnly(attackingPilot, "*** uber-nugget-roid SPAWNED!");
vector spawnDirection_w = currentVelocity_w.cross(vector.randomUnit());
spawnDirection_w = spawnDirection_w.normalize();
spawnDirection_w = spawnDirection_w.multiply(15.0f);
sendSystemMessageTestingOnly(attackingPilot, "spawn dir =" + spawnDirection_w);
currentVelocity_w = currentVelocity_w.add(spawnDirection_w);
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, currentVelocity_w);
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
}
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,116 +0,0 @@
include library.combat;
include library.sui;
include library.quests;
include library.ai_lib;
include library.money;
include library.chat;
include library.pclib;
include library.vehicle;
include library.ship_ai;
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
{
obj_id pilot = getPilotId(self);
if (pilot != null)
{
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
}
return SCRIPT_CONTINUE;
}
trigger OnShipWasHit (obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
{
obj_id attackingPilot = getPilotId(attacker);
location attackingLocation = getLocation(attacker);
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
transform selfTransform = getTransform_o2w(self);
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
int weaponCrc = getShipComponentCrc(attacker, weaponIndex + ship_chassis_slot_type.SCST_weapon_first);
if (getShipComponentDescriptorWeaponIsMissile(weaponCrc))
{
//-- is missile, do tractor beam action
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
vector directionToAttacker_w = new vector(attackingPosition_w);
directionToAttacker_w = directionToAttacker_w.subtract(selfTransform.getPosition_p());
directionToAttacker_w = directionToAttacker_w.normalize();
directionToAttacker_w = directionToAttacker_w.multiply(20.0f);
currentVelocity_w = currentVelocity_w.add(directionToAttacker_w);
//-- clamp velocity to 50 m/s
float velocityMagnitude = currentVelocity_w.magnitude();
float MAX_VELOCITY_MAGNITUDE = 50.0f;
if (velocityMagnitude > MAX_VELOCITY_MAGNITUDE)
{
float velocityMultiplier = MAX_VELOCITY_MAGNITUDE / velocityMagnitude;
currentVelocity_w = currentVelocity_w.multiply(velocityMultiplier);
}
sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic TRACTOR PULSE add=" + directionToAttacker_w);
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
return SCRIPT_CONTINUE;
}
int maxHitpoints = getMaxHitpoints(self);
int oldHitpoints = getHitpoints(self);
setHitpoints(self, oldHitpoints - 10);
int newHitpoints = getHitpoints(self);
sendSystemMessageTestingOnly(attackingPilot, "hit asteroid dynamic " + newHitpoints + "/" + maxHitpoints);
if (newHitpoints <= 0)
{
sendSystemMessageTestingOnly(attackingPilot, "*** asteroid dynamic DESTROYED");
handleShipDestruction(self, 1.0f);
}
else
{
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
if ((newHitpoints < (maxHitpoints / 2)) && (oldHitpoints >= (maxHitpoints / 2)))
{
if (random.rand() > 0.5f)
{
//-- spawn uber-nugget roid
location selfLocation = getLocation(self);
obj_id spawnDynamicAsteroid =
createObject("object/ship/asteroid/mining_asteroid_dynamic_nugget.iff", selfLocation);
vector currentVelocity_w = getDynamicMiningAsteroidVelocity(self);
sendSystemMessageTestingOnly(attackingPilot, "*** uber-nugget-roid SPAWNED!");
vector spawnDirection_w = currentVelocity_w.cross(vector.randomUnit());
spawnDirection_w = spawnDirection_w.normalize();
spawnDirection_w = spawnDirection_w.multiply(15.0f);
sendSystemMessageTestingOnly(attackingPilot, "spawn dir =" + spawnDirection_w);
currentVelocity_w = currentVelocity_w.add(spawnDirection_w);
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, currentVelocity_w);
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
currentVelocity_w = currentVelocity_w.subtract(spawnDirection_w);
setDynamicMiningAsteroidVelocity(self, currentVelocity_w);
}
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,73 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
import script.library.chat;
import script.library.pclib;
import script.library.vehicle;
import script.library.ship_ai;
public class jwatson_mining_asteroid_static extends script.base_script
{
public jwatson_mining_asteroid_static()
{
}
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
{
obj_id pilot = getPilotId(self);
if (pilot != null)
{
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
}
return SCRIPT_CONTINUE;
}
public int OnShipWasHit(obj_id self, obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o) throws InterruptedException
{
obj_id attackingPilot = getPilotId(attacker);
location attackingLocation = getLocation(attacker);
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
transform selfTransform = getTransform_o2w(self);
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
int maxHitpoints = getMaxHitpoints(self);
int oldHitpoints = getHitpoints(self);
setHitpoints(self, oldHitpoints - 3);
int newHitpoints = getHitpoints(self);
sendSystemMessageTestingOnly(attackingPilot, "hit asteroid static " + newHitpoints + "/" + maxHitpoints);
if (newHitpoints <= 0)
{
sendSystemMessageTestingOnly(attackingPilot, "*** asteroid static DESTROYED");
handleShipDestruction(self, 1.0f);
}
else
{
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
int newDamageBracket = newHitpoints / 10;
int oldDamageBracket = oldHitpoints / 10;
int damageBracketDifference = oldDamageBracket - newDamageBracket;
vector direction_o = attackingLocation_o.approximateNormalize();
location selfLocation = getLocation(self);
for (int i = 0; i < damageBracketDifference; ++i)
{
vector spawnDirection_o = new vector(direction_o.x * random.rand(), direction_o.y * random.rand(), direction_o.z * random.rand());
spawnDirection_o = spawnDirection_o.approximateNormalize();
spawnDirection_o = spawnDirection_o.multiply(40.0f + (random.rand() * 40.0f));
obj_id spawnDynamicAsteroid = createObject("object/ship/asteroid/mining_asteroid_dynamic_default.iff", selfLocation);
sendSystemMessageTestingOnly(attackingPilot, "*** mini-roid SPAWNED! vel=" + spawnDirection_o + ", mag=" + spawnDirection_o.magnitude());
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, spawnDirection_o);
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,81 +0,0 @@
include library.combat;
include library.sui;
include library.quests;
include library.ai_lib;
include library.money;
include library.chat;
include library.pclib;
include library.vehicle;
include library.ship_ai;
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
{
obj_id pilot = getPilotId(self);
if (pilot != null)
{
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
}
return SCRIPT_CONTINUE;
}
trigger OnShipWasHit (obj_id attacker, int weaponIndex, boolean isMissile, int missileType, int chassisSlot, boolean isPlayerAutoTurret, float hitLocationX_o, float hitLocationY_o, float hitLocationZ_o)
{
obj_id attackingPilot = getPilotId(attacker);
location attackingLocation = getLocation(attacker);
vector attackingPosition_w = new vector(attackingLocation.x, attackingLocation.y, attackingLocation.z);
transform selfTransform = getTransform_o2w(self);
vector attackingLocation_o = selfTransform.rotateTranslate_p2l(attackingPosition_w);
int maxHitpoints = getMaxHitpoints(self);
int oldHitpoints = getHitpoints(self);
setHitpoints(self, oldHitpoints - 3);
int newHitpoints = getHitpoints(self);
sendSystemMessageTestingOnly(attackingPilot, "hit asteroid static " + newHitpoints + "/" + maxHitpoints);
if (newHitpoints <= 0)
{
sendSystemMessageTestingOnly(attackingPilot, "*** asteroid static DESTROYED");
handleShipDestruction(self, 1.0f);
}
else
{
vector hitLocation_o = new vector(hitLocationX_o, hitLocationY_o, hitLocationZ_o);
notifyShipHit(self, attackingLocation_o, hitLocation_o, ship_hit_type.HT_chassis, 0.5f, 1.0f);
//-- spawn new mini-roid every 10 hps
int newDamageBracket = newHitpoints / 10;
int oldDamageBracket = oldHitpoints / 10;
int damageBracketDifference = oldDamageBracket - newDamageBracket;
vector direction_o = attackingLocation_o.approximateNormalize();
location selfLocation = getLocation(self);
for (int i = 0; i < damageBracketDifference; ++i)
{
vector spawnDirection_o = new vector(direction_o.x * random.rand(), direction_o.y * random.rand(), direction_o.z * random.rand());
spawnDirection_o = spawnDirection_o.approximateNormalize();
spawnDirection_o = spawnDirection_o.multiply(40.0f + (random.rand() * 40.0f));
obj_id spawnDynamicAsteroid =
createObject("object/ship/asteroid/mining_asteroid_dynamic_default.iff", selfLocation);
sendSystemMessageTestingOnly(attackingPilot, "*** mini-roid SPAWNED! vel=" + spawnDirection_o + ", mag=" + spawnDirection_o.magnitude());
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, spawnDirection_o);
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,35 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
import script.library.chat;
import script.library.pclib;
import script.library.vehicle;
import script.library.ship_ai;
public class jwatson_ship extends script.base_script
{
public jwatson_ship()
{
}
public int OnShipInternalDamageOverTimeRemoved(obj_id self, int chassisSlot, float damageRate, float damageThreshold) throws InterruptedException
{
obj_id pilot = getPilotId(self);
if (pilot != null)
{
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
}
return SCRIPT_CONTINUE;
}
}
@@ -1,22 +0,0 @@
include library.combat;
include library.sui;
include library.quests;
include library.ai_lib;
include library.money;
include library.chat;
include library.pclib;
include library.vehicle;
include library.ship_ai;
trigger OnShipInternalDamageOverTimeRemoved(int chassisSlot, float damageRate, float damageThreshold)
{
obj_id pilot = getPilotId(self);
if (pilot != null)
{
sendSystemMessageTestingOnly(pilot, "jwatson_ship IDOT removed slot=" + chassisSlot + ", damageRate=" + damageRate + ", threshold=" + damageThreshold);
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,140 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
import script.library.chat;
import script.library.pclib;
import script.library.vehicle;
public class jwatson_sui_test extends script.base_script
{
public jwatson_sui_test()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equals("jw_suiTargetInfo"))
{
spawnSuiTargetInfo(self);
}
if (command.equals("jw_suiTargetViewer"))
{
spawnSuiTargetViewer(self);
}
}
return SCRIPT_CONTINUE;
}
public static String OBJVAR_SUI_TARGET_INFO_PID = "suiTargetInfoPid";
public static String OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID = "suiTargetInfoTargetObjId";
public void spawnSuiTargetInfo(obj_id player) throws InterruptedException
{
int pId = createSUIPage("Script.ColorPicker", player, player, "suiTargetInfoCallbackClosedCancel");
if (pId < 0)
{
return;
}
obj_id target = getLookAtTarget(player);
if (target == null)
{
target = player;
}
setSUIProperty(pId, "ColorPicker", "TargetNetworkId", target.toString());
setSUIProperty(pId, "ColorPicker", "TargetVariable", "/shared_owner/index_color_skin");
setSUIProperty(pId, "ColorPicker", "TargetRangeMin", "0");
setSUIProperty(pId, "ColorPicker", "TargetRangeMax", "500");
setSUIProperty(pId, "bg.caption.lblTitle", "text", "(test) SuiTargetInfo");
subscribeToSUIProperty(pId, "ColorPicker", "SelectedIndex");
setSUIAssociatedObject(pId, target);
showSUIPage(pId);
setObjVar(player, OBJVAR_SUI_TARGET_INFO_PID, pId);
setObjVar(player, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID, target);
messageTo(player, "updateSuiTargetInfo", null, 1.0f, true);
}
public int updateSuiTargetInfo(obj_id self, dictionary params) throws InterruptedException
{
obj_id target = getLookAtTarget(self);
if (target == null)
{
target = self;
}
obj_id oldTarget = getObjIdObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID);
if (!oldTarget.equals(target))
{
setObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID, target);
int pId = getIntObjVar(self, OBJVAR_SUI_TARGET_INFO_PID);
setSUIProperty(pId, "ColorPicker", "TargetNetworkId", target.toString());
setSUIProperty(pId, "ColorPicker", "TargetRangeMin", "0");
setSUIProperty(pId, "ColorPicker", "TargetRangeMax", "500");
flushSUIPage(pId);
}
messageTo(self, "updateSuiTargetInfo", null, 1.0f, true);
return SCRIPT_CONTINUE;
}
public int suiTargetInfoCallbackClosedCancel(obj_id self, dictionary params) throws InterruptedException
{
removeObjVar(self, OBJVAR_SUI_TARGET_INFO_PID);
removeObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID);
return SCRIPT_CONTINUE;
}
public static String OBJVAR_SUI_TARGET_VIEWER_PID = "suiTargetViewerPid";
public static String OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID = "suiTargetViewerTargetObjId";
public void spawnSuiTargetViewer(obj_id player) throws InterruptedException
{
int pId = createSUIPage("Script.ObjectViewer", player, player, "suiTargetViewerCallbackClosedCancel");
if (pId < 0)
{
return;
}
obj_id target = getLookAtTarget(player);
if (target == null)
{
target = player;
}
setSUIProperty(pId, "v", "SetObject", target.toString());
setSUIProperty(pId, "bg.caption.lblTitle", "text", "(test) SuiTargetViewer");
showSUIPage(pId);
setObjVar(player, OBJVAR_SUI_TARGET_VIEWER_PID, pId);
setObjVar(player, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID, target);
messageTo(player, "updateSuiTargetViewer", null, 1.0f, true);
}
public int updateSuiTargetViewer(obj_id self, dictionary params) throws InterruptedException
{
obj_id target = getLookAtTarget(self);
if (target == null)
{
target = self;
}
obj_id oldTarget = getObjIdObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID);
if (!oldTarget.equals(target))
{
setObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID, target);
int pId = getIntObjVar(self, OBJVAR_SUI_TARGET_VIEWER_PID);
setSUIProperty(pId, "v", "SetObject", target.toString());
flushSUIPage(pId);
}
messageTo(self, "updateSuiTargetViewer", null, 1.0f, true);
return SCRIPT_CONTINUE;
}
public int suiTargetViewerCallbackClosedCancel(obj_id self, dictionary params) throws InterruptedException
{
removeObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID);
removeObjVar(self, OBJVAR_SUI_TARGET_VIEWER_PID);
return SCRIPT_CONTINUE;
}
}
@@ -1,191 +0,0 @@
include library.combat;
include library.sui;
include library.quests;
include library.ai_lib;
include library.money;
include library.chat;
include library.pclib;
include library.vehicle;
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
trigger OnSpeaking(String text)
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
if (tok.hasMoreTokens ())
{
String command = tok.nextToken ();
debugConsoleMsg( self, "command is: " + command);
//----------------------------------------------------------------------
if (command.equals ("jw_suiTargetInfo") )
{
spawnSuiTargetInfo(self);
}
//----------------------------------------------------------------------
if (command.equals ("jw_suiTargetViewer") )
{
spawnSuiTargetViewer(self);
}
}
return SCRIPT_CONTINUE;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//-- SUI TARGET INFO
//----------------------------------------------------------------------
//----------------------------------------------------------------------
string OBJVAR_SUI_TARGET_INFO_PID = "suiTargetInfoPid";
string OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID = "suiTargetInfoTargetObjId";
//----------------------------------------------------------------------
void spawnSuiTargetInfo(obj_id player)
{
int pId = createSUIPage ("Script.ColorPicker", player, player, "suiTargetInfoCallbackClosedCancel");
if (pId < 0)
return;
obj_id target = getLookAtTarget(player);
if (target == null)
target = player;
setSUIProperty (pId, "ColorPicker", "TargetNetworkId", target.toString ());
setSUIProperty (pId, "ColorPicker", "TargetVariable", "/shared_owner/index_color_skin");
setSUIProperty (pId, "ColorPicker", "TargetRangeMin", "0");
setSUIProperty (pId, "ColorPicker", "TargetRangeMax", "500");
setSUIProperty (pId, "bg.caption.lblTitle", "text", "(test) SuiTargetInfo");
subscribeToSUIProperty (pId, "ColorPicker", "SelectedIndex");
setSUIAssociatedObject (pId, target);
showSUIPage (pId);
setObjVar(player, OBJVAR_SUI_TARGET_INFO_PID, pId);
setObjVar(player, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID, target);
messageTo(player, "updateSuiTargetInfo", null, 1.0f, true);
}
//----------------------------------------------------------------------
messageHandler updateSuiTargetInfo()
{
obj_id target = getLookAtTarget(self);
if (target == null)
target = self;
obj_id oldTarget = getObjIdObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID);
if (!oldTarget.equals(target))
{
setObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID, target);
int pId = getIntObjVar(self, OBJVAR_SUI_TARGET_INFO_PID);
setSUIProperty (pId, "ColorPicker", "TargetNetworkId", target.toString ());
setSUIProperty (pId, "ColorPicker", "TargetRangeMin", "0");
setSUIProperty (pId, "ColorPicker", "TargetRangeMax", "500");
flushSUIPage(pId);
}
messageTo(self, "updateSuiTargetInfo", null, 1.0f, true);
return SCRIPT_CONTINUE;
}
//----------------------------------------------------------------------
messageHandler suiTargetInfoCallbackClosedCancel()
{
removeObjVar(self, OBJVAR_SUI_TARGET_INFO_PID);
removeObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID);
return SCRIPT_CONTINUE;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//-- SUI TARGET VIEWER
//----------------------------------------------------------------------
//----------------------------------------------------------------------
string OBJVAR_SUI_TARGET_VIEWER_PID = "suiTargetViewerPid";
string OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID = "suiTargetViewerTargetObjId";
//----------------------------------------------------------------------
void spawnSuiTargetViewer(obj_id player)
{
int pId = createSUIPage ("Script.ObjectViewer", player, player, "suiTargetViewerCallbackClosedCancel");
if (pId < 0)
return;
obj_id target = getLookAtTarget(player);
if (target == null)
target = player;
setSUIProperty (pId, "v", "SetObject", target.toString ());
setSUIProperty (pId, "bg.caption.lblTitle", "text", "(test) SuiTargetViewer");
showSUIPage (pId);
setObjVar(player, OBJVAR_SUI_TARGET_VIEWER_PID, pId);
setObjVar(player, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID, target);
messageTo(player, "updateSuiTargetViewer", null, 1.0f, true);
}
//----------------------------------------------------------------------
messageHandler updateSuiTargetViewer()
{
obj_id target = getLookAtTarget(self);
if (target == null)
target = self;
obj_id oldTarget = getObjIdObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID);
if (!oldTarget.equals(target))
{
setObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID, target);
int pId = getIntObjVar(self, OBJVAR_SUI_TARGET_VIEWER_PID);
setSUIProperty (pId, "v", "SetObject", target.toString ());
flushSUIPage(pId);
}
messageTo(self, "updateSuiTargetViewer", null, 1.0f, true);
return SCRIPT_CONTINUE;
}
//----------------------------------------------------------------------
messageHandler suiTargetViewerCallbackClosedCancel()
{
removeObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID);
removeObjVar(self, OBJVAR_SUI_TARGET_VIEWER_PID);
return SCRIPT_CONTINUE;
}
//----------------------------------------------------------------------
@@ -0,0 +1,879 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
import script.library.chat;
import script.library.pclib;
import script.library.vehicle;
import script.library.ship_ai;
import script.library.space_crafting;
import script.library.space_transition;
import script.library.space_dungeon;
import script.library.space_utils;
import java.lang.Long;
public class jwatson_test extends script.base_script
{
public jwatson_test()
{
}
public void colorize(obj_id player, obj_id target, String customizationVar) throws InterruptedException
{
int pId = createSUIPage("Script.ColorPicker", player, player, "ColorizeCallback");
setSUIProperty(pId, "ColorPicker", "TargetNetworkId", target.toString());
setSUIProperty(pId, "ColorPicker", "TargetVariable", customizationVar);
setSUIProperty(pId, "ColorPicker", "TargetRange", "500");
subscribeToSUIProperty(pId, "ColorPicker", "SelectedIndex");
setSUIAssociatedObject(pId, target);
showSUIPage(pId);
}
public void maxStats(obj_id objPlayer) throws InterruptedException
{
addAttribModifier(objPlayer, HEALTH, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, ACTION, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, MIND, 2000, 0, 0, MOD_POOL);
}
public boolean sendStartingLocations(obj_id player) throws InterruptedException
{
newbieTutorialSendStartingLocationsToPlayer(player, null);
return true;
}
public int newbieRequestStartingLocations(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
sendStartingLocations(self);
return SCRIPT_CONTINUE;
}
public int newbieSelectStartingLocation(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
String name = params;
boolean available = isStartingLocationAvailable(name);
newbieTutorialSendStartingLocationSelectionResult(self, name, available);
if (available)
{
location loc = getStartingLocationInfo(name);
if (loc != null)
{
if (loc.cell != null && loc.cell != obj_id.NULL_ID)
{
warpPlayer(self, loc.area, 0.0f, 0.0f, 0.0f, loc.cell, loc.x, loc.y, loc.z);
}
else
{
warpPlayer(self, loc.area, loc.x, loc.y, loc.z, null, 0.0f, 0.0f, 0.0f);
}
}
}
return SCRIPT_CONTINUE;
}
public int OnApplyPowerup(obj_id self, obj_id playerId, obj_id targetId) throws InterruptedException
{
chat.chat(playerId, "OnApplyPowerup " + self.toString() + " -> " + targetId.toString());
return SCRIPT_CONTINUE;
}
public int OnGetAttributes(obj_id self, obj_id playerId, String[] names, String[] attribs) throws InterruptedException
{
names[0] = "jwatson_test";
attribs[0] = "What's up my homies?\nYeah";
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equals("jw_colorize"))
{
if (tok.countTokens() < 2)
{
debugSpeakMsg(self, "Not enough arguments: colorize <obj_id> <customization var>");
}
else
{
tok.nextToken();
String idString = tok.nextToken();
String customizationVar = tok.nextToken();
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(idString));
colorize(self, id, customizationVar);
}
}
else if (command.equals("jw_scale"))
{
if (tok.countTokens() < 1)
{
debugSpeakMsg(self, "Not enough arguments: scale <factor> [obj_id]");
}
else
{
float scaleFactor = Float.parseFloat(tok.nextToken());
obj_id id = null;
if (tok.countTokens() > 0)
{
String idString = tok.nextToken();
id = obj_id.getObjId(java.lang.Long.parseLong(idString));
}
else
{
id = self;
}
setScale(id, scaleFactor);
}
}
else if (command.equals("jw_systemMessage"))
{
debugSpeakMsg(self, "jwatson_test jw_systemMessage: " + text);
if (tok.countTokens() < 2)
{
debugSpeakMsg(self, "Not enough arguments: jw_systemMessage <id> <msg>");
}
else
{
obj_id id = null;
String idString = tok.nextToken();
if (!idString.equals("0"))
{
id = obj_id.getObjId(java.lang.Long.parseLong(idString));
}
else
{
id = self;
}
sendSystemMessageTestingOnly(id, text);
}
}
else if (command.equals("jw_systemMessagePlanet"))
{
sendSystemMessagePlanetTestingOnly(text);
}
else if (command.equals("jw_systemMessageGalaxy"))
{
LOG("jw", "jw_systemMessageGalaxy");
prose_package pp = new prose_package();
LOG("jw", "jw_systemMessageGalaxy prose created");
pp.stringId = new string_id("ui", "test_pp");
LOG("jw", "jw_systemMessageGalaxy stringId set");
pp.actor.set(self);
LOG("jw", "jw_systemMessageGalaxy actor set");
pp.target.set(getLookAtTarget(self));
LOG("jw", "jw_systemMessageGalaxy target set");
pp.other.set("other_here");
LOG("jw", "jw_systemMessageGalaxy other set");
pp.digitInteger = 666;
pp.digitFloat = 0.333f;
LOG("jw", "jw_systemMessageGalaxy sending");
String oob = packOutOfBandProsePackage(null, pp);
sendSystemMessageGalaxyOob(oob);
LOG("jw", "jw_systemMessageGalaxy oob size=" + oob.length());
sendSystemMessageGalaxyProse(pp);
}
else if (command.equals("jw_maxStats"))
{
maxStats(self);
}
else if (command.equals("jw_pm1"))
{
prose_package bodyProse = new prose_package();
prose_package subjectProse = new prose_package();
bodyProse.stringId = new string_id("pm", "body_id");
String oob = chatMakePersistentMessageOutOfBandBody(null, bodyProse);
String subject_str = "@" + (new string_id("pm", "subject_id")).toString();
String sender_str = "@" + (new string_id("pm", "sender_id")).toString();
LOG("jw", "jw_pm1 oob size = " + oob.length());
chatSendPersistentMessage(self, subject_str, "Here is the body", oob);
}
else if (command.equals("jw_pm2"))
{
chatSendPersistentMessage(self, "This is a message (2)", "Here is the body (2)", null);
}
else if (command.equals("jw_pm3"))
{
String oob = chatAppendPersistentMessageWaypoint(null, self);
LOG("jw", "jw_pm3 oob size = " + oob.length());
chatSendPersistentMessage(self, "This is a message (waypoint)", "Here is the body", oob);
oob = chatAppendPersistentMessageWaypointData(null, null, -666.0f, 999.0f, null, "dummytext");
chatSendPersistentMessage(self, "This is a message (object)", "Here is the body", oob);
}
else if (command.equals("jw_pm4"))
{
String from = "default_from";
String subj = "default_subj";
String body = "default_body";
if (tok.hasMoreTokens())
{
from = tok.nextToken();
if (tok.hasMoreTokens())
{
subj = tok.nextToken();
if (tok.hasMoreTokens())
{
body = tok.nextToken();
}
}
}
chatSendPersistentMessage(from, getChatName(self), subj, body, null);
}
else if (command.equals("jw_setMaster"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
setMaster(target, self);
}
}
else if (command.equals("jw_joinMe"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
queueCommand(target, (-1449236473), null, "", COMMAND_PRIORITY_DEFAULT);
}
}
else if (command.equals("jw_inviteMe"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
queueCommand(target, (-2007999144), self, "", COMMAND_PRIORITY_DEFAULT);
}
}
else if (command.equals("jw_speak"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
StringBuffer output = new StringBuffer();
while (tok.hasMoreTokens())output.append(tok.nextToken());
queueCommand(target, (-296481545), null, output.toString(), COMMAND_PRIORITY_DEFAULT);
}
}
else if (command.equals("jw_speakProse"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
prose_package pp = new prose_package();
pp.stringId = new string_id("ui", "test_pp");
pp.actor.set(self);
pp.target.set(getLookAtTarget(self));
pp.other.set("other_here");
pp.digitInteger = 666;
pp.digitFloat = 0.333f;
chat.publicChat(target, null, null, null, pp);
chat.chat(target, chat.CHAT_PARROT, chat.MOOD_PLAYFUL, new string_id("ui", "test_pp_2"));
chat.chat(target, "This is the third message");
}
}
else if (command.equals("jw_testSui"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
int pid = createSUIPage(sui.SUI_MSGBOX, self, target, "");
setSUIAssociatedObject(pid, target);
setSUIProperty(pid, "bg.caption.lbltitle", "Text", "MY TITLE");
setSUIProperty(pid, "%text%", "Text", "WTF2");
showSUIPage(pid);
}
}
else if (command.equals("jw_money"))
{
StringBuffer output = new StringBuffer();
if (tok.hasMoreTokens())
{
String amountStr = tok.nextToken();
int amount = Integer.parseInt(amountStr);
if (amount > 0)
{
money.bankTo(money.ACCT_CHARACTER_CREATION, self, amount);
}
else
{
money.bankTo(self, money.ACCT_CHARACTER_CREATION, -amount);
}
}
}
else if (command.equals("jw_kill"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
hit_result cbtHitData = new hit_result();
cbtHitData.success = true;
cbtHitData.baseRoll = 1000;
cbtHitData.finalRoll = 100000;
cbtHitData.canSee = true;
cbtHitData.hitLocation = 0;
cbtHitData.damage = 100000000;
doDamage(self, target, getCurrentWeapon(self), cbtHitData);
pclib.coupDeGrace(self, target, false);
}
}
else if (command.equals("jw_ownVendor"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
createVendorMarket(self, target, 0);
}
}
else if (command.equals("jw_putMeInCell"))
{
if (tok.countTokens() < 3)
{
debugSpeakMsg(self, "Not enough arguments: jw_putMeInCell <planet> <obj_id> <cell name>");
}
else
{
String arg1 = tok.nextToken();
String arg2 = tok.nextToken();
String arg3 = tok.nextToken();
String planet = arg1;
obj_id building = obj_id.getObjId(Long.valueOf(arg2));
obj_id cellId = getCellId(building, arg3);
debugSpeakMsg(self, "Warping to " + building + ", " + cellId);
warpPlayer(self, planet, 0, 0, 0, cellId, 0, 0, 0);
}
}
else if (command.equals("jw_planetmap"))
{
addPlanetaryMapLocation(obj_id.getObjId(1), "city 1", -4000, -3000, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(2), "city 2", -2500, 3500, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(3), "city 3", 3000, 7000, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(4), "city 4", 1000, -6000, "city", "", MLT_STATIC, 0);
addPlanetaryMapLocation(obj_id.getObjId(5), "vendor 1", 100, -4300, "cantina", "", MLT_PERSIST, 0);
addPlanetaryMapLocation(obj_id.getObjId(6), "vendor 2", 2100, 6300, "cantina", "", MLT_PERSIST, 0);
addPlanetaryMapLocation(obj_id.getObjId(7), "vendor 3", -3100, -6300, "cantina", "", MLT_PERSIST, 0);
addPlanetaryMapLocation(obj_id.getObjId(8), "vendor 4", -3400, -6500, "cantina", "hospital", MLT_DYNAMIC, MLF_INACTIVE);
addPlanetaryMapLocation(obj_id.getObjId(9), "vendor 5", 4400, -2600, "cantina", "hospital", MLT_DYNAMIC, MLF_ACTIVE);
}
else if (command.equals("jw_mapget"))
{
String arg1 = tok.nextToken();
obj_id id = obj_id.getObjId(Long.valueOf(arg1));
map_location loc = getPlanetaryMapLocation(id);
debugSpeakMsg(self, "got [" + loc + "]");
}
else if (command.equals("jw_mapRegisterSelf"))
{
String arg1 = tok.nextToken();
String arg2 = tok.nextToken();
String arg3 = null;
if (tok.hasMoreTokens())
{
arg3 = tok.nextToken();
}
addPlanetaryMapLocation(self, arg1, -4000, -3000, arg2, arg3 != null ? arg3 : "", MLT_DYNAMIC, 0);
}
else if (command.equals("jw_vset"))
{
int index = Integer.parseInt(tok.nextToken());
float value = Float.parseFloat(tok.nextToken());
int ivalue = vehicle.setValue(getLookAtTarget(self), value, index);
debugSpeakMsg(self, "set value to " + ivalue);
}
else if (command.equals("jw_vget"))
{
int index = Integer.parseInt(tok.nextToken());
float value = vehicle.getValue(getLookAtTarget(self), index);
debugSpeakMsg(self, "value is " + value);
}
else if (command.equals("jw_dirtyAttributes"))
{
String idString = tok.nextToken();
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(idString));
sendDirtyAttributesNotification(id);
debugSpeakMsg(self, "dirty attrs");
}
else if (command.equals("jw_dirtyMenu"))
{
String idString = tok.nextToken();
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(idString));
sendDirtyObjectMenuNotification(id);
debugSpeakMsg(self, "dirty attrs");
}
else if (command.equals("jw_suiTest"))
{
}
else if (command.equals("jw_shipInstall"))
{
String idString = tok.nextToken();
int index = Integer.parseInt(tok.nextToken());
obj_id componentId = obj_id.getObjId(java.lang.Long.parseLong(idString));
boolean result = shipInstallComponent(self, getLookAtTarget(self), index, componentId);
debugSpeakMsg(self, "installed result:" + result);
}
else if (command.equals("jw_shipUninstall"))
{
int index = Integer.parseInt(tok.nextToken());
obj_id componentId = shipUninstallComponent(self, getLookAtTarget(self), index, getObjectInSlot(self, "inventory"));
debugSpeakMsg(self, "uninstalled component:" + componentId);
}
else if (command.equals("jw_shipPurge"))
{
int index = Integer.parseInt(tok.nextToken());
obj_id componentId = shipUninstallComponent(null, getLookAtTarget(self), index, null);
debugSpeakMsg(self, "uninstalled component:" + componentId);
}
else if (command.equals("jw_shipGetSlots"))
{
debugSpeakMsg(self, "... getting slots ...");
obj_id shipId = getLookAtTarget(self);
int[] shipChassisSlots = getShipChassisSlots(shipId);
if (shipChassisSlots != null)
{
for (int i = 0; i < shipChassisSlots.length; ++i)
{
boolean installed = isShipSlotInstalled(shipId, shipChassisSlots[i]);
debugSpeakMsg(self, "slot " + shipChassisSlots[i] + ", installed:" + installed);
}
}
}
else if (command.equals("jw_shipSetEnergyRequirement"))
{
int index = Integer.parseInt(tok.nextToken());
float requirement = Float.parseFloat(tok.nextToken());
setShipComponentEnergyMaintenanceRequirement(getLookAtTarget(self), index, requirement);
}
else if (command.equals("jw_shipSetEfficiencyGeneral"))
{
int index = Integer.parseInt(tok.nextToken());
float requirement = Float.parseFloat(tok.nextToken());
setShipComponentEfficiencyGeneral(getLookAtTarget(self), index, requirement);
}
else if (command.equals("jw_shipSetEfficiencyEnergy"))
{
int index = Integer.parseInt(tok.nextToken());
float requirement = Float.parseFloat(tok.nextToken());
setShipComponentEfficiencyEnergy(getLookAtTarget(self), index, requirement);
}
else if (command.equals("jw_shipSetArmor"))
{
int index = Integer.parseInt(tok.nextToken());
float cur = Float.parseFloat(tok.nextToken());
float max = Float.parseFloat(tok.nextToken());
setShipComponentArmorHitpointsMaximum(getLookAtTarget(self), index, max);
setShipComponentArmorHitpointsCurrent(getLookAtTarget(self), index, cur);
}
else if (command.equals("jw_shipSetHp"))
{
int index = Integer.parseInt(tok.nextToken());
float cur = Float.parseFloat(tok.nextToken());
float max = Float.parseFloat(tok.nextToken());
setShipComponentHitpointsMaximum(getLookAtTarget(self), index, max);
setShipComponentHitpointsCurrent(getLookAtTarget(self), index, cur);
}
else if (command.equals("jw_shipSetFlags"))
{
int index = Integer.parseInt(tok.nextToken());
int flags = Integer.parseInt(tok.nextToken());
setShipComponentFlags(getLookAtTarget(self), index, flags);
}
else if (command.equals("jw_shipSetShipHp"))
{
float cur = Float.parseFloat(tok.nextToken());
float max = Float.parseFloat(tok.nextToken());
setShipMaximumChassisHitPoints(getLookAtTarget(self), max);
setShipCurrentChassisHitPoints(getLookAtTarget(self), cur);
}
else if (command.equals("jw_shipSetReactorGeneration"))
{
float val = Float.parseFloat(tok.nextToken());
setShipReactorEnergyGenerationRate(getLookAtTarget(self), val);
}
else if (command.equals("jw_shipSetShieldHpFrontCurrent"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsFrontCurrent(getLookAtTarget(self), val);
}
else if (command.equals("jw_shipSetShieldHpFrontMax"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsFrontMaximum(getLookAtTarget(self), val);
}
else if (command.equals("jw_shipSetShieldHpBackCurrent"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsBackCurrent(getLookAtTarget(self), val);
}
else if (command.equals("jw_shipSetShieldHpBackMax"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldHitpointsBackMaximum(getLookAtTarget(self), val);
}
else if (command.equals("jw_shipSetShieldRechargeRate"))
{
float val = Float.parseFloat(tok.nextToken());
setShipShieldRechargeRate(getLookAtTarget(self), val);
}
else if (command.equals("jw_terminalSet"))
{
debugSpeakMsg(self, "terminal setting");
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(tok.nextToken()));
setObjVar(id, "space.destination", getWorldLocation(id));
}
else if (command.equals("jw_weaponComponentSetup"))
{
debugSpeakMsg(self, "component setup");
obj_id id = obj_id.getObjId(java.lang.Long.parseLong(tok.nextToken()));
setObjVar(id, "ship_comp.weapon.refire_rate", 20.0f);
setObjVar(id, "ship_comp.weapon.projectile_speed", 150.0f);
setObjVar(id, "ship_comp.weapon.energy_per_shot", 50.0f);
setObjVar(id, "ship_comp.weapon.damage_maximum", 10.0f);
}
else if (command.equals("jw_shipComponentName"))
{
int index = Integer.parseInt(tok.nextToken());
String name = tok.nextToken();
setShipComponentName(getLookAtTarget(self), index, name);
}
else if (command.equals("jw_shipDestroy"))
{
float val = Float.parseFloat(tok.nextToken());
handleShipDestruction(getLookAtTarget(self), val);
}
else if (command.equals("jw_shipDestroyComponent"))
{
int index = Integer.parseInt(tok.nextToken());
float val = Float.parseFloat(tok.nextToken());
handleShipComponentDestruction(getLookAtTarget(self), index, val);
}
else if (command.equals("jw_shipHitMe"))
{
obj_id objTarget = getLookAtTarget(self);
obj_id objShip = getPilotedShip(self);
sendSystemMessageTestingOnly(self, "objTarget of " + objTarget + " is attacking " + objShip);
ship_ai.spaceAttack(objTarget, objShip);
}
else if (command.equals("jw_shipSetWeaponEfficiencyRefireRate"))
{
int index = Integer.parseInt(tok.nextToken());
float eff = Float.parseFloat(tok.nextToken());
setShipWeaponEfficiencyRefireRate(getLookAtTarget(self), index, eff);
}
else if (command.equals("jw_shipSetWeaponDamage"))
{
int index = Integer.parseInt(tok.nextToken());
sendSystemMessageTestingOnly(self, "index=" + index);
setShipWeaponDamageMaximum(getLookAtTarget(self), ship_chassis_slot_type.SCST_weapon_0 + index, 500.0f);
}
else if (command.equals("jw_leet"))
{
obj_id objTarget = getLookAtTarget(self);
if (objTarget == null)
{
objTarget = getPilotedShip(self);
}
for (int i = 0; i < ship_chassis_slot_type.SCST_num_types; ++i)
{
if (isShipSlotInstalled(objTarget, i))
{
setShipComponentEfficiencyEnergy(objTarget, i, 10.0f);
setShipComponentEfficiencyGeneral(objTarget, i, 2.0f);
}
}
for (int i = ship_chassis_slot_type.SCST_weapon_first; i < ship_chassis_slot_type.SCST_weapon_last; ++i)
{
if (isShipSlotInstalled(objTarget, i))
{
setShipWeaponEfficiencyRefireRate(objTarget, i, 10.0f);
setShipComponentEfficiencyEnergy(objTarget, i, 10.0f);
setShipComponentEfficiencyGeneral(objTarget, i, 10.0f);
setShipWeaponAmmoCurrent(objTarget, i, getShipWeaponAmmoMaximum(objTarget, i));
}
}
}
else if (command.equals("jw_fullAmmo"))
{
obj_id objTarget = getLookAtTarget(self);
if (objTarget == null)
{
objTarget = getPilotedShip(self);
}
for (int i = ship_chassis_slot_type.SCST_weapon_first; i < ship_chassis_slot_type.SCST_weapon_last; ++i)
{
if (isShipSlotInstalled(objTarget, i))
{
sendSystemMessageTestingOnly(self, "up ammo");
setShipWeaponAmmoCurrent(objTarget, i, getShipWeaponAmmoMaximum(objTarget, i));
}
}
}
else if (command.equals("jw_clientEffect"))
{
String cef = "clienteffect/space_scram_spark.cef";
if (tok.hasMoreTokens())
{
cef = tok.nextToken();
}
transform t = new transform();
t = t.move_p(new vector(10.0f, 0.0f, 0.0f));
playClientEffectObj(self, cef, getLookAtTarget(self), null, t);
}
else if (command.equals("jw_powerDebug"))
{
obj_id[] objPcds = space_transition.findShipControlDevicesForPlayer(self);
obj_id objShip = space_transition.getShipFromShipControlDevice(objPcds[0]);
objShip = space_transition.getContainingShip(self);
setShipReactorEnergyGenerationRate(objShip, 500);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.SHIELD_GENERATOR, 200);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.ENGINE, 100);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.WEAPON_0, 100);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.WEAPON_1, 100);
setShipComponentEnergyMaintenanceRequirement(objShip, space_crafting.CAPACITOR, 100);
sendSystemMessageTestingOnly(self, "whacked ");
}
else if (command.equals("jw_sprTest"))
{
obj_id[] objPcds = space_transition.findShipControlDevicesForPlayer(self);
obj_id objShip = space_transition.getShipFromShipControlDevice(objPcds[0]);
objShip = space_transition.getContainingShip(self);
setShipEngineSpeedRotationFactorMaximum(objShip, 3.88f);
setShipEngineSpeedRotationFactorMinimum(objShip, 6.33f);
setShipEngineSpeedRotationFactorOptimal(objShip, 0.75f);
}
else if (command.equals("jw_chassisMod"))
{
obj_id[] objPcds = space_transition.findShipControlDevicesForPlayer(self);
obj_id objShip = space_transition.getShipFromShipControlDevice(objPcds[0]);
objShip = space_transition.getContainingShip(self);
float val = Float.parseFloat(tok.nextToken());
setShipChassisSpeedMaximumModifier(objShip, val);
}
else if (command.equals("jw_maDynVel"))
{
obj_id objTarget = getLookAtTarget(self);
float x = Float.parseFloat(tok.nextToken());
float y = Float.parseFloat(tok.nextToken());
float z = Float.parseFloat(tok.nextToken());
setDynamicMiningAsteroidVelocity(objTarget, new vector(x, y, z));
}
else if (command.equals("jw_maDynVel"))
{
obj_id objTarget = getLookAtTarget(self);
float x = Float.parseFloat(tok.nextToken());
float y = Float.parseFloat(tok.nextToken());
float z = Float.parseFloat(tok.nextToken());
setDynamicMiningAsteroidVelocity(objTarget, new vector(x, y, z));
}
else if (command.equals("jw_maSpawnStatic"))
{
}
else if (command.equals("jw_maSpawnDynamic"))
{
location selfLocation = getLocation(self);
obj_id spawnDynamicAsteroid = createObject("object/ship/asteroid/mining_asteroid_dynamic_default.iff", selfLocation);
setDynamicMiningAsteroidVelocity(spawnDynamicAsteroid, new vector(0.0f, 40.0f, 0.0f));
}
else if (command.equals("jw_dt"))
{
obj_id ticket = space_dungeon.createTicket(self, "tatooine", "tatooine", "avatar_platform");
}
else if (command.equals("jw_dt_curr"))
{
String planet = getCurrentSceneName();
obj_id ticket = space_dungeon.createTicket(self, planet, planet, "avatar_platform");
}
else if (command.equals("jw_spaceTicket"))
{
obj_id objTarget = getLookAtTarget(self);
space_dungeon.selectDungeonTicket(objTarget, self);
}
else if (command.equals("jw_spaceEject"))
{
sendSystemMessageTestingOnly(self, "now ejecting... ");
space_dungeon.ejectPlayerFromDungeon(self);
}
else if (command.equals("jw_avatarPlatform"))
{
location selfLocation = getLocation(self);
selfLocation.x += 400.0f;
obj_id platform = createObject("object/ship/spacestation_avatar_platform.iff", selfLocation);
}
else if (command.equals("jw_spaceDungeonInit"))
{
long id = Long.parseLong(tok.nextToken());
obj_id dungeon = obj_id.getObjId(id);
messageTo(dungeon, "msgManualDungeonReset", new dictionary(), 0.0f, false);
}
else if (command.equals("jw_spaceLaunch"))
{
sendSystemMessageTestingOnly(self, "now launching... ");
space_dungeon.launchPlayerFromDungeon(self);
}
else if (command.equals("jw_spaceDupe"))
{
obj_id[] scds = space_transition.findShipControlDevicesForPlayer(self);
obj_id ship = space_transition.getShipFromShipControlDevice(scds[0]);
if (null == ship)
{
ship = getPilotedShip(self);
}
sendSystemMessageTestingOnly(self, "scds.length=" + scds.length + ", ship=" + ship);
if (null == ship)
{
}
else
{
location selfLocation = getLocation(self);
selfLocation.y += 2.0f;
obj_id copy = createObject(ship, selfLocation);
for (int chassisSlot = 0; chassisSlot < ship_chassis_slot_type.SCST_weapon_10; ++chassisSlot)
{
int crc = getShipComponentCrc(ship, chassisSlot);
if (0 != crc)
{
shipPseudoInstallComponent(copy, chassisSlot, crc);
setShipComponentArmorHitpointsMaximum(copy, chassisSlot, getShipComponentArmorHitpointsMaximum(ship, chassisSlot));
setShipComponentArmorHitpointsCurrent(copy, chassisSlot, getShipComponentArmorHitpointsCurrent(ship, chassisSlot));
setShipComponentHitpointsMaximum(copy, chassisSlot, getShipComponentHitpointsMaximum(ship, chassisSlot));
setShipComponentHitpointsCurrent(copy, chassisSlot, getShipComponentHitpointsCurrent(ship, chassisSlot));
setShipComponentFlags(copy, chassisSlot, getShipComponentFlags(ship, chassisSlot) & ~ship_component_flags.SCF_active);
}
}
space_utils.setComponentDisabled(copy, ship_chassis_slot_type.SCST_engine, true);
custom_var[] cvars = getAllCustomVars(ship);
if (null != cvars)
{
for (int i = 0; i < cvars.length; ++i)
{
custom_var cvar = cvars[i];
if (cvar.isRangedInt())
{
ranged_int_custom_var ricvar = (ranged_int_custom_var)cvar;
String varName = cvar.getVarName();
setRangedIntCustomVarValue(copy, varName, ricvar.getValue());
}
}
}
}
}
else if (command.equals("jw_ticketCollector"))
{
location selfLocation = getLocation(self);
obj_id collector = createObject("object/tangible/travel/ticket_collector/ticket_collector.iff", selfLocation);
attachScript(collector, "item.travel_ticket.travel_space_dungeon");
setObjVar(collector, "space_dungeon.ticket.dungeon", "avatar_platform");
setObjVar(collector, "space_dungeon.ticket.point", getCurrentSceneName());
}
else if (command.equals("jw_getDungeonRegistered"))
{
long id = Long.parseLong(tok.nextToken());
obj_id dungeon = obj_id.getObjId(id);
if (!isValidId(dungeon))
{
sendSystemMessageTestingOnly(self, "NO SUCH OBJECT: [" + dungeon + "]");
return SCRIPT_CONTINUE;
}
obj_id[] registered = space_dungeon.getRegisteredObjects(dungeon);
if (null == registered)
{
sendSystemMessageTestingOnly(self, "REGISTERED NULL!");
}
else
{
sendSystemMessageTestingOnly(self, "REGISTERED " + registered.length);
for (int i = 0; i < registered.length; ++i)
{
obj_id rid = registered[i];
if (null != rid)
{
sendSystemMessageTestingOnly(self, " ... " + rid);
}
else
{
sendSystemMessageTestingOnly(self, " ... NULL!");
}
}
}
}
else if (command.equals("jw_getCollisionRadius"))
{
long id = Long.parseLong(tok.nextToken());
obj_id obj = obj_id.getObjId(id);
float f = getObjectCollisionRadius(obj);
sendSystemMessageTestingOnly(self, "radius=" + f);
}
else if (command.equals("jw_dungeonLandTicketless"))
{
obj_id npc = getLookAtTarget(self);
String planet = getCurrentSceneName();
space_dungeon.sendGroupToDungeonWithoutTicket(self, "avatar_platform", planet, planet, "quest_type", npc);
}
else if (command.equals("jw_shipCargoDump"))
{
obj_id ship = getPilotedShip(self);
obj_id[] resources = getShipCargoHoldContentsResourceTypes(ship);
for (int i = 0; i < resources.length; ++i)
{
setShipCargoHoldContent(ship, resources[i], 0);
}
}
else if (command.equals("jw_spaceMiningSale"))
{
obj_id ship = getPilotedShip(self);
openSpaceMiningUi(self, self, "tatooine");
}
else if (command.equals("jw_shipTestCargo"))
{
obj_id ship = getPilotedShip(self);
setShipCargoHoldContentsMaximum(ship, 100);
setShipCargoHoldContent(ship, "space_gem_diamond", 44);
setShipCargoHoldContent(ship, "space_metal_carbonaceous", 22);
int cd = getShipCargoHoldContent(ship, "space_gem_diamond");
int cc = getShipCargoHoldContent(ship, "space_metal_carbonaceous");
sendSystemMessageTestingOnly(self, "1) cargo " + getShipCargoHoldContentsCurrent(ship) + "/" + getShipCargoHoldContentsMaximum(ship) + ", contains=" + cd + "," + cc);
modifyShipCargoHoldContent(ship, "space_gem_diamond", 4);
modifyShipCargoHoldContent(ship, "space_metal_carbonaceous", 2);
cd = getShipCargoHoldContent(ship, "space_gem_diamond");
cc = getShipCargoHoldContent(ship, "space_metal_carbonaceous");
sendSystemMessageTestingOnly(self, "2) cargo " + getShipCargoHoldContentsCurrent(ship) + "/" + getShipCargoHoldContentsMaximum(ship) + ", contains=" + cd + "," + cc);
modifyShipCargoHoldContent(ship, "space_gem_diamond", -8);
modifyShipCargoHoldContent(ship, "space_metal_carbonaceous", -4);
cd = getShipCargoHoldContent(ship, "space_gem_diamond");
cc = getShipCargoHoldContent(ship, "space_metal_carbonaceous");
sendSystemMessageTestingOnly(self, "3) cargo " + getShipCargoHoldContentsCurrent(ship) + "/" + getShipCargoHoldContentsMaximum(ship) + ", contains=" + cd + "," + cc);
}
}
return SCRIPT_CONTINUE;
}
public int TestSUICallback(obj_id self, dictionary params) throws InterruptedException
{
debugServerConsoleMsg(self, "callback started");
obj_id player = params.getObjId("player");
int pageId = -5;
pageId = params.getInt("pageId");
debugSpeakMsg(player, Integer.toString(pageId));
String[] props = params.getStringArray("propertyStrings");
for (int i = 0; i < props.length; ++i)
{
debugSpeakMsg(player, props[i]);
}
return SCRIPT_CONTINUE;
}
public int ColorizeCallback(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnSpaceMiningSellResource(obj_id self, obj_id player, obj_id ship, obj_id station, obj_id resourceId, int amount) throws InterruptedException
{
int amountDeducted = -modifyShipCargoHoldContent(ship, resourceId, -amount);
sendSystemMessageTestingOnly(player, "Sold Resources: " + amountDeducted + "units");
return SCRIPT_CONTINUE;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,80 @@
package script.test;
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.create;
import script.library.pclib;
import script.library.utils;
import java.util.StringTokenizer;
public class lec_particleplayer extends script.base_script
{
public lec_particleplayer()
{
}
public int OnHearSpeech(obj_id self, obj_id speaker, String text) throws InterruptedException
{
if (speaker != self)
{
return SCRIPT_CONTINUE;
}
text = toLower(text);
if (text.startsWith("playparticleme"))
{
StringTokenizer st = new StringTokenizer(text);
int numArgs = st.countTokens();
if (numArgs > 2)
{
sendSystemMessage(self, "Incorrect number of arguments. [Syntax] playParticleMe <particle name.prt>", null);
return SCRIPT_CONTINUE;
}
st.nextToken();
String particleName = st.nextToken();
LOG("particleP", "Playing " + particleName + " on me");
playClientEffectObj(self, "appearance/" + particleName, self, "root");
return SCRIPT_CONTINUE;
}
else if (text.startsWith("playparticletarget"))
{
StringTokenizer st = new StringTokenizer(text);
int numArgs = st.countTokens();
if (numArgs > 2)
{
sendSystemMessage(self, "[Syntax] playParticleTarget <particle name.prt> -- Plays the specified particle at your current look at target", null);
return SCRIPT_CONTINUE;
}
st.nextToken();
String particleName = st.nextToken();
obj_id myTarget = getLookAtTarget(self);
if (!isIdValid(myTarget) || myTarget == null)
{
sendSystemMessage(self, "Invalid target.", null);
return SCRIPT_CONTINUE;
}
else
{
playClientEffectObj(self, "appearance/" + particleName, myTarget, "root");
}
}
else if (text.startsWith("playparticleloc"))
{
StringTokenizer st = new StringTokenizer(text);
int numArgs = st.countTokens();
if (numArgs > 2)
{
sendSystemMessage(self, "[Syntax] playParticleLoc <particle name.prt> -- Plays the specified particle at your current location", null);
return SCRIPT_CONTINUE;
}
st.nextToken();
String particleName = st.nextToken();
playClientEffectLoc(self, "appearance/" + particleName, getLocation(self), 0.0f);
}
return SCRIPT_CONTINUE;
}
}
@@ -1,77 +0,0 @@
include library.create;
include library.pclib;
include library.utils;
include java.util.StringTokenizer;
trigger OnHearSpeech(obj_id speaker, string text)
{
if(speaker != self)
{
return SCRIPT_CONTINUE;
}
text = toLower(text);
if(text.startsWith("playparticleme"))
{
StringTokenizer st = new StringTokenizer(text);
int numArgs = st.countTokens();
if(numArgs > 2)
{
sendSystemMessage(self, "Incorrect number of arguments. [Syntax] playParticleMe <particle name.prt>", null);
return SCRIPT_CONTINUE;
}
st.nextToken();
string particleName = st.nextToken();
LOG("particleP", "Playing " + particleName + " on me");
playClientEffectObj(self, "appearance/" + particleName, self, "root");
return SCRIPT_CONTINUE;
}
else if(text.startsWith("playparticletarget"))
{
StringTokenizer st = new StringTokenizer(text);
int numArgs = st.countTokens();
if(numArgs > 2)
{
sendSystemMessage(self, "[Syntax] playParticleTarget <particle name.prt> -- Plays the specified particle at your current look at target", null);
return SCRIPT_CONTINUE;
}
st.nextToken();
string particleName = st.nextToken();
obj_id myTarget = getLookAtTarget(self);
if (!isIdValid(myTarget)||myTarget == null)
{
sendSystemMessage(self, "Invalid target.", null);
return SCRIPT_CONTINUE;
}
else
playClientEffectObj(self, "appearance/" + particleName, myTarget, "root");
}
else if(text.startsWith("playparticleloc"))
{
StringTokenizer st = new StringTokenizer(text);
int numArgs = st.countTokens();
if(numArgs > 2)
{
sendSystemMessage(self, "[Syntax] playParticleLoc <particle name.prt> -- Plays the specified particle at your current location", null);
return SCRIPT_CONTINUE;
}
st.nextToken();
string particleName = st.nextToken();
playClientEffectLoc(self, "appearance/" + particleName, getLocation(self), 0.0f);
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,772 @@
package script.test;
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 java.lang.Math;
import java.util.Random;
import script.vector;
import script.library.ship_ai;
import script.library.space_create;
import script.library.space_transition;
import script.library.load_test;
public class mbogue_test extends script.base_script
{
public mbogue_test()
{
}
public static final String s_logLabel = "space_debug_ai";
public static final String s_tooFewParameters = "too few parameters\n";
public static final String s_usageSpaceUnitAddPatrolPath = "Usage: spaceUnitAddPatrolPath <unitObjId>";
public static final String s_usageSpaceUnitClearPatrolPath = "Usage: spaceUnitClearPatrolPath <unitObjId>";
public static final String s_usageSpaceUnitFollow = "Usage: spaceUnitFollow <unitObjId> <targetObjId> <x> <y> <z> <offset>";
public static final String s_usageAiAttack = "Usage: ai_attack <unitObjId> <targetObjId>";
public static final String s_usageSpaceUnitSetIdle = "Usage: spaceUnitSetIdle <unitObjId>";
public static final String s_usageSpaceUnitGetPilotType = "Usage: spaceUnitGetPilotType <unitObjId>";
public static final String s_usageSpaceUnitGetBehavior = "Usage: spaceUnitGetBehavior <unitObjId>";
public static final String s_usageSpaceUnitSetAttackOrders = "Usage: spaceUnitSetAttackOrders <unitObjId> <int>";
public static final String s_usageSpaceUnitSetTargetOrders = "Usage: spaceUnitSetTargetOrders <unitObjId> <int>";
public static final String s_usageSpaceUnitSetSquad = "Usage: spaceUnitSetSquad <unitObjId> <int>";
public static final String s_usageSpaceSquadAddPatrolPath = "Usage: spaceSquadAddPatrolPath <int>";
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(text);
if (tokenizer.hasMoreTokens())
{
String command = tokenizer.nextToken();
LOG("space_debug_ai", "command is: " + command + " ---------------------------------------");
if (command.equalsIgnoreCase("ai"))
{
debugConsoleMsg(self, "** ai usage **");
debugConsoleMsg(self, s_usageSpaceUnitAddPatrolPath);
debugConsoleMsg(self, s_usageSpaceUnitClearPatrolPath);
debugConsoleMsg(self, s_usageSpaceUnitFollow);
debugConsoleMsg(self, s_usageAiAttack);
debugConsoleMsg(self, s_usageSpaceUnitSetIdle);
debugConsoleMsg(self, s_usageSpaceUnitSetSquad);
}
else if (command.equalsIgnoreCase("spaceUnitAddPatrolPath"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
debugSpaceUnitAddPatrolPath(self, unit, ship_ai.createPatrolPathCircle(new vector(0.0f, 0.0f, 0.0f), 100.0f));
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitAddPatrolPath);
}
}
else if (command.equalsIgnoreCase("spaceUnitClearPatrolPath"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitClearPatrolPath(unitObjectId);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitClearPatrolPath);
}
}
else if (command.equalsIgnoreCase("spaceUnitFollow"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
obj_id targetObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
final float x = java.lang.Float.parseFloat(tokenizer.nextToken());
if (tokenizer.hasMoreTokens())
{
final float y = java.lang.Float.parseFloat(tokenizer.nextToken());
if (tokenizer.hasMoreTokens())
{
final float z = java.lang.Float.parseFloat(tokenizer.nextToken());
if (tokenizer.hasMoreTokens())
{
error = false;
float offset = java.lang.Float.parseFloat(tokenizer.nextToken());
debugSpaceUnitFollow(self, unitObjectId, targetObjectId, new vector(x, y, z), offset);
}
}
}
}
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitFollow);
}
}
else if (command.equalsIgnoreCase("ai_attack"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
Vector targetObjectIdList = new Vector();
while (tokenizer.hasMoreTokens())
{
targetObjectIdList.addElement(obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken())));
}
if (targetObjectIdList.size() == 1)
{
error = false;
obj_id targetObjectId = (obj_id)targetObjectIdList.elementAt(0);
ship_ai.unitAddDamageTaken(unitObjectId, targetObjectId, 100000.0f);
debugConsoleMsg(self, unitObjectId + " is attacking " + targetObjectId);
}
else if (targetObjectIdList.size() > 1)
{
error = false;
obj_id targets[] = new obj_id[targetObjectIdList.size()];
targetObjectIdList.toArray(targets);
ship_ai.spaceAttack(unitObjectId, targets);
debugConsoleMsg(self, unitObjectId + " is attacking " + targetObjectIdList.size() + " targets");
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageAiAttack);
}
}
else if (command.equalsIgnoreCase("ai_idle"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitIdle(unitObjectId);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetIdle);
}
}
else if (command.equalsIgnoreCase("spaceUnitGetPilotType"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
debugConsoleMsg(self, "unit: " + unitObjectId + " pilotType: " + ship_ai.unitGetPilotType(unitObjectId));
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitGetPilotType);
}
}
else if (command.equalsIgnoreCase("spaceUnitGetBehavior"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
final int behavior = ship_ai.unitGetBehavior(unitObjectId);
debugConsoleMsg(self, "unit: " + unitObjectId + " behavior: " + behavior + " - " + ship_ai.unitGetBehaviorString(behavior));
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitGetBehavior);
}
}
else if (command.equalsIgnoreCase("spaceUnitSetAttackOrders"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
final obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
error = false;
final int attackOrders = java.lang.Integer.parseInt(tokenizer.nextToken());
ship_ai.unitSetAttackOrders(unitObjectId, attackOrders);
debugConsoleMsg(self, "unit: " + unitObjectId + " attack orders: " + attackOrders + " - " + ship_ai.unitGetAttackOrdersString(attackOrders));
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetAttackOrders);
}
}
else if (command.equalsIgnoreCase("spaceUnitSetSquad"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
final obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
error = false;
final int squad = java.lang.Integer.parseInt(tokenizer.nextToken());
ship_ai.unitSetSquadId(unitObjectId, squad);
debugConsoleMsg(self, "unit: " + unitObjectId + " squad: " + squad);
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetSquad);
}
}
else if (command.equalsIgnoreCase("spaceSquadAddPatrolPath"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
final int squad = java.lang.Integer.parseInt(tokenizer.nextToken());
transform path[] = new transform[4];
path[0] = transform.identity.setPosition_p(-100, 0, -100);
path[1] = transform.identity.setPosition_p(100, 0, -100);
path[2] = transform.identity.setPosition_p(100, 0, 100);
path[3] = transform.identity.setPosition_p(-100, 0, 100);
ship_ai.squadAddPatrolPath(squad, path);
debugConsoleMsg(self, "spaceSquadAddPatrolPath - " + "squad: " + squad);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceSquadAddPatrolPath);
}
}
else if (command.equalsIgnoreCase("ai_superweapon"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
setShipWeaponDamageMinimum(unitObjectId, ship_chassis_slot_type.SCST_weapon_0, 400000);
setShipWeaponDamageMaximum(unitObjectId, ship_chassis_slot_type.SCST_weapon_0, 500000);
debugConsoleMsg(self, unitObjectId + " now has a super weapon");
}
}
else if (command.equalsIgnoreCase("ai_moveto"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
final obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
transform path[] = new transform[4];
path[0] = transform.identity.setPosition_p(50.0f, 0.0f, 0.0f);
path[1] = transform.identity.setPosition_p(00.0f, 50.0f, 0.0f);
path[2] = transform.identity.setPosition_p(00.0f, 0.0f, 50.0f);
path[3] = transform.identity.setPosition_p(50.0f, 0.0f, 0.0f);
ship_ai.unitMoveTo(unitObjectId, path);
}
if (error)
{
}
}
else if (command.equalsIgnoreCase("ai_patrol"))
{
ship_ai.unitAddPatrolPath(createUnit(self, "tiefighter", 200.0f), ship_ai.createPatrolPathCircle(new vector(0.0f, 0.0f, 0.0f), 100.0f));
ship_ai.unitAddPatrolPath(createUnit(self, "tiefighter", 200.0f), ship_ai.createPatrolPathCircle(new vector(0.0f, 10.0f, 0.0f), 100.0f));
}
else if (command.equalsIgnoreCase("ai_single"))
{
boolean error = true;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
error = false;
shipName = tokenizer.nextToken();
final float createRadius = 100.0f;
obj_id unit = createUnit(self, shipName, createRadius, anchorPosition_w);
final float pathRadius = 200.0f;
debugSpaceUnitAddPatrolPath(self, unit, ship_ai.createPatrolPathCircle(anchorPosition_w, pathRadius));
ship_ai.unitSetLeashDistance(unit, 16000.0f);
debugConsoleMsg(self, "ai_single: Creating a single " + shipName);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_single <shipType>");
}
}
else if (command.equalsIgnoreCase("ai_squad"))
{
boolean error = true;
final float createRadius = 200.0f;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
final int tokenCount = tokenizer.countTokens();
if (tokenCount >= 1)
{
shipName = tokenizer.nextToken();
error = false;
int squadSize = 4;
if (tokenCount == 2)
{
squadSize = java.lang.Integer.parseInt(tokenizer.nextToken());
}
final obj_id squadLeader = createUnit(self, shipName, createRadius, anchorPosition_w);
for (int i = 0; i < squadSize - 1; ++i)
{
obj_id unit = createUnit(self, shipName, createRadius, anchorPosition_w);
ship_ai.unitSetSquadId(unit, _spaceUnitGetSquadId(squadLeader));
}
ship_ai.squadSetFormationRandom(_spaceUnitGetSquadId(squadLeader));
ship_ai.squadSetFormationSpacing(_spaceUnitGetSquadId(squadLeader), 1.0f);
ship_ai.squadPatrol(_spaceUnitGetSquadId(squadLeader), createPatrolPathSpiral(anchorPosition_w, 200.0f));
debugConsoleMsg(self, "ai_squad: Creating a squad of " + squadSize + " " + shipName);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_squad <shipType>");
}
}
else if (command.equalsIgnoreCase("ai_squadtest"))
{
boolean error = true;
final float createRadius = 200.0f;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
int squadSize = 4;
final obj_id squadLeader = createUnit(self, "vortex_mission_4_shuttle", createRadius, anchorPosition_w);
for (int i = 0; i < squadSize - 1; ++i)
{
obj_id unit = createUnit(self, "vortex_mission_4_guard", createRadius, anchorPosition_w);
ship_ai.unitSetSquadId(unit, _spaceUnitGetSquadId(squadLeader));
}
ship_ai.squadSetFormationRandom(_spaceUnitGetSquadId(squadLeader));
ship_ai.squadSetFormationSpacing(_spaceUnitGetSquadId(squadLeader), 1.0f);
ship_ai.squadPatrol(_spaceUnitGetSquadId(squadLeader), createPatrolPathSpiral(anchorPosition_w, 200.0f));
debugConsoleMsg(self, "ai_squad: Creating a squad of " + squadSize + " ");
}
else if (command.equalsIgnoreCase("ai_clear_random"))
{
obj_id objectList[] = getObjectsInRange(self, 16000.0f);
int count = 0;
for (int i = 0; i < objectList.length; ++i)
{
if (isGameObjectTypeOf(objectList[i], GOT_ship) && !isGameObjectTypeOf(objectList[i], GOT_ship_station) && !(getTemplateName(objectList[i])).startsWith("object/ship/player"))
{
Random random = new Random();
if ((Math.abs(random.nextInt()) % 2) == 0)
{
debugDestroyObject(self, objectList[i]);
++count;
}
}
}
debugConsoleMsg(self, count + " object destroyed");
}
else if (command.equalsIgnoreCase("ai_clear"))
{
obj_id objectList[] = getObjectsInRange(self, 16000.0f);
int count = 0;
for (int i = 0; i < objectList.length; ++i)
{
if (isGameObjectTypeOf(objectList[i], GOT_ship) && !isGameObjectTypeOf(objectList[i], GOT_ship_station) && !(getTemplateName(objectList[i])).startsWith("object/ship/player"))
{
debugDestroyObject(self, objectList[i]);
++count;
}
}
debugConsoleMsg(self, count + " object destroyed");
}
else if (command.equalsIgnoreCase("ai_getDockTransform"))
{
if (tokenizer.hasMoreTokens())
{
obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
transform dockTransform = ship_ai.unitGetDockTransform(dockTarget, self);
debugConsoleMsg(self, "dockTarget: " + dockTarget + " dockingUnit: " + self + " dockTransform: " + dockTransform);
}
}
else if (command.equalsIgnoreCase("ai_test"))
{
obj_id unit = createUnit(self, "xwing", 100.0f);
ship_ai.squadRemoveUnit(unit);
}
else if (command.equalsIgnoreCase("ai_guard"))
{
final float createRadius = 200.0f;
final float pathRadius = 400.0f;
String formationShip;
if (tokenizer.hasMoreTokens())
{
formationShip = tokenizer.nextToken();
}
else
{
formationShip = new String("tiefighter");
}
final obj_id guardedUnit = createUnit(self, "tiefighter", createRadius);
ship_ai.unitSetAttackOrders(guardedUnit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
ship_ai.unitLoiter(guardedUnit, transform.identity, 50.0f, 50.0f);
{
final int squadLeaderSquad = ship_ai.squadCreateSquadId();
final int squadCount = 1;
final int unitCount = 4;
for (int i = 0; i < unitCount; ++i)
{
obj_id unit = createUnit(self, formationShip, createRadius);
ship_ai.unitSetSquadId(unit, squadLeaderSquad);
ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
}
ship_ai.squadSetFormation(squadLeaderSquad, ship_ai.FORMATION_WALL);
ship_ai.squadSetFormationSpacing(squadLeaderSquad, 1.0f);
ship_ai.squadAddPatrolPath(squadLeaderSquad, ship_ai.createPatrolPathCircle(new vector(2000.0f, 0.0f, 0.0f), 200.0f));
ship_ai.squadSetGuardTarget(squadLeaderSquad, ship_ai.unitGetSquadId(guardedUnit));
}
}
else if (command.equalsIgnoreCase("ai_dock"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
final obj_id spaceStation = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
String shipName;
if (tokenizer.hasMoreTokens())
{
shipName = tokenizer.nextToken();
}
else
{
shipName = new String("yt1300");
}
final obj_id dockingUnit = createUnit(self, shipName, 200.0f);
ship_ai.unitDock(dockingUnit, spaceStation, 10.0f);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_dockWith"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
obj_id playerShip = space_transition.getContainingShip(self);
final obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitDock(playerShip, dockTarget, 10.0f);
error = false;
}
else if (tokenCount == 2)
{
final obj_id dockingUnit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
final obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitDock(dockingUnit, dockTarget, 10.0f);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_singleDockWith"))
{
boolean error = true;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 2)
{
error = false;
shipName = tokenizer.nextToken();
final float createRadius = 100.0f;
obj_id unit = createUnit(self, shipName, createRadius, anchorPosition_w);
final float pathRadius = 200.0f;
debugSpaceUnitAddPatrolPath(self, unit, ship_ai.createPatrolPathCircle(anchorPosition_w, pathRadius));
final obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitDock(unit, dockTarget, 10.0f);
debugConsoleMsg(self, "ai_singleDockWith: Creating a single " + shipName);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_singleDockWith <shipType> <dockTarget>");
}
}
else if (command.equalsIgnoreCase("ai_isAutoAggroImmune"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
final obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(unit) ? "[ENABLED]" : "[DISABLED]") + " ship aggro immunity " + unit);
error = false;
}
else
{
obj_id playerShip = space_transition.getContainingShip(self);
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_aggroImmune"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
final obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitSetAutoAggroImmune(unit, !ship_ai.unitIsAutoAggroImmune(unit));
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(unit) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + unit);
error = false;
}
else
{
obj_id playerShip = space_transition.getContainingShip(self);
ship_ai.unitSetAutoAggroImmune(playerShip, !ship_ai.unitIsAutoAggroImmune(playerShip));
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_immune"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
final obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitRemoveFromAllAttackTargetLists(unit);
ship_ai.unitSetAutoAggroImmune(unit, true);
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(unit) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + unit);
error = false;
}
else
{
obj_id playerShip = space_transition.getContainingShip(self);
ship_ai.unitRemoveFromAllAttackTargetLists(playerShip);
ship_ai.unitSetAutoAggroImmune(playerShip, true);
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_holdFire"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
final obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_testGuard"))
{
boolean error = true;
final float squadSpacingRadius = 1200.0f;
String unitName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
final int tokenCount = tokenizer.countTokens();
if (tokenCount >= 1)
{
error = false;
unitName = tokenizer.nextToken();
obj_id unitToGuard = createUnit(self, unitName, 0.0f, anchorPosition_w);
ship_ai.unitSetAttackOrders(unitToGuard, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
debugSpaceUnitAddPatrolPath(self, unitToGuard, ship_ai.createPatrolPathCircle(anchorPosition_w, 200.0f));
final int unitToGuardSquadId = ship_ai.unitGetSquadId(unitToGuard);
final int squadCount = 1;
int squadSize = 4;
if (tokenCount == 2)
{
squadSize = java.lang.Integer.parseInt(tokenizer.nextToken());
}
for (int index = 0; index < squadCount; ++index)
{
final float radian = (float)Math.PI * 2.0f * ((float)index / (float)squadCount);
final float x = anchorPosition_w.x + (float)Math.sin(radian) * squadSpacingRadius;
final float y = anchorPosition_w.y;
final float z = anchorPosition_w.z + (float)Math.cos(radian) * squadSpacingRadius;
final int newSquad = createPatrollingSquad(self, unitName, squadSize, new vector(x, y, z));
ship_ai.squadSetGuardTarget(newSquad, unitToGuardSquadId);
}
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_testGuard <shipType> <guardSquadSize>");
}
}
else if (command.equalsIgnoreCase("ai_addExclusiveAggro"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount >= 2)
{
error = false;
final obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
final obj_id pilot = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitAddExclusiveAggro(unit, pilot);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_addExclusiveAggro <unit> <pilot>");
}
}
else if (command.equalsIgnoreCase("ai_removeExclusiveAggro"))
{
boolean error = true;
final int tokenCount = tokenizer.countTokens();
if (tokenCount >= 2)
{
error = false;
final obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
final obj_id pilot = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitRemoveExclusiveAggro(unit, pilot);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_removeExclusiveAggro <unit> <pilot>");
}
}
else if (command.equalsIgnoreCase("mb_overt"))
{
space_transition.setPlayerOvert(self);
}
else if (command.equalsIgnoreCase("mb_rebel"))
{
load_test.revokeSkills(self, load_test.NEUTRAL_PILOT);
load_test.revokeSkills(self, load_test.IMPERIAL_PILOT);
load_test.grantSkills(self, load_test.REBEL_PILOT);
}
else if (command.equalsIgnoreCase("mb_imperial"))
{
load_test.revokeSkills(self, load_test.NEUTRAL_PILOT);
load_test.revokeSkills(self, load_test.REBEL_PILOT);
load_test.grantSkills(self, load_test.IMPERIAL_PILOT);
}
else if (command.equalsIgnoreCase("mb_neutral"))
{
load_test.revokeSkills(self, load_test.REBEL_PILOT);
load_test.revokeSkills(self, load_test.IMPERIAL_PILOT);
load_test.grantSkills(self, load_test.NEUTRAL_PILOT);
}
else if (command.equalsIgnoreCase("isOn"))
{
obj_id lookAtTarget = getLookAtTarget(self);
debugConsoleMsg(self, lookAtTarget + ": hasCondition(CONDITION_ON): " + (hasCondition(lookAtTarget, CONDITION_ON) ? "yes" : "no"));
}
else
{
LOG("space_debug_ai", "unknown command");
}
}
}
return SCRIPT_CONTINUE;
}
public vector getRandomPosition(float radius) throws InterruptedException
{
final float x = radius * 2.0f * (0.5f - (float)Math.random());
final float y = radius * 2.0f * (0.5f - (float)Math.random());
final float z = radius * 2.0f * (0.5f - (float)Math.random());
return new vector(x, y, z);
}
public obj_id createUnit(obj_id self, String unitName, float radius, vector position) throws InterruptedException
{
final vector randomPosition = new vector(getRandomPosition(radius));
final float x = position.x + randomPosition.x;
final float y = position.y + randomPosition.y;
final float z = position.z + randomPosition.z;
obj_id unitId = space_create.createShip(unitName, transform.identity.move_p(new vector(x, y, z)));
return unitId;
}
public obj_id createUnit(obj_id self, String unitName, float radius) throws InterruptedException
{
obj_id unitId = createUnit(self, unitName, radius, vector.zero);
return unitId;
}
public void debugSpaceUnitFollow(obj_id self, obj_id unit, obj_id followedUnit, vector direction, float offset) throws InterruptedException
{
debugConsoleMsg(self, "spaceUnitFollow() unit: " + unit + " followedUnit: " + followedUnit + " (" + direction.x + ", " + direction.y + ", " + direction.z + ") offset: " + offset);
ship_ai.unitFollow(unit, followedUnit, direction, offset);
}
public void debugDestroyObject(obj_id self, obj_id object) throws InterruptedException
{
destroyObject(object);
}
public void debugSpaceUnitAddPatrolPath(obj_id self, obj_id unit, transform[] path) throws InterruptedException
{
debugConsoleMsg(self, "spaceUnitAddPatrolPath() unit: " + unit + " path.length: " + path.length);
ship_ai.spacePatrol(unit, path);
}
public transform[] createPatrolPathSpiral(vector position_w, float radius) throws InterruptedException
{
final int points = 60;
transform path[] = new transform[points];
for (int i = 0; i < points; ++i)
{
final float halfHeightPercent = 2.0f;
final float yOffset = ((float)i / (float)points) * radius * (halfHeightPercent * 2.0f) - radius * halfHeightPercent;
final float radian = (float)Math.PI * 4.0f * ((float)i / (float)points);
final float x = position_w.x + (float)Math.sin(radian) * radius;
final float y = position_w.y + yOffset;
final float z = position_w.z + (float)Math.cos(radian) * radius;
path[i] = transform.identity.setPosition_p(x, y, z);
}
return path;
}
public int createPatrollingSquad(obj_id self, String unitName, int squadSize, vector position_w) throws InterruptedException
{
final float createRadius = 200.0f;
final obj_id squadLeader = createUnit(self, unitName, createRadius, position_w);
final int squadLeaderSquadId = ship_ai.unitGetSquadId(squadLeader);
for (int i = 0; i < squadSize - 1; ++i)
{
ship_ai.unitSetSquadId(createUnit(self, unitName, createRadius, position_w), squadLeaderSquadId);
}
ship_ai.squadSetAttackOrders(squadLeaderSquadId, ship_ai.ATTACK_ORDERS_RETURN_FIRE);
ship_ai.squadSetFormationRandom(squadLeaderSquadId);
ship_ai.squadSetFormationSpacing(squadLeaderSquadId, 1.0f);
ship_ai.squadPatrol(squadLeaderSquadId, createPatrolPathSpiral(position_w, 200.0f));
debugConsoleMsg(self, "ai_squad: Creating a squad of " + squadSize + " " + unitName + " at " + position_w);
return squadLeaderSquadId;
}
}
@@ -1,935 +0,0 @@
include java.lang.Math;
include java.util.Random;
include vector;
include library.ship_ai;
include library.space_create;
include library.space_transition;
include library.load_test;
const string s_logLabel = "space_debug_ai";
const string s_tooFewParameters = "too few parameters\n";
const string s_usageSpaceUnitAddPatrolPath = "Usage: spaceUnitAddPatrolPath <unitObjId>";
const string s_usageSpaceUnitClearPatrolPath = "Usage: spaceUnitClearPatrolPath <unitObjId>";
const string s_usageSpaceUnitFollow = "Usage: spaceUnitFollow <unitObjId> <targetObjId> <x> <y> <z> <offset>";
const string s_usageAiAttack = "Usage: ai_attack <unitObjId> <targetObjId>";
const string s_usageSpaceUnitSetIdle = "Usage: spaceUnitSetIdle <unitObjId>";
const string s_usageSpaceUnitGetPilotType = "Usage: spaceUnitGetPilotType <unitObjId>";
const string s_usageSpaceUnitGetBehavior = "Usage: spaceUnitGetBehavior <unitObjId>";
const string s_usageSpaceUnitSetAttackOrders = "Usage: spaceUnitSetAttackOrders <unitObjId> <int>";
const string s_usageSpaceUnitSetTargetOrders = "Usage: spaceUnitSetTargetOrders <unitObjId> <int>";
const string s_usageSpaceUnitSetSquad = "Usage: spaceUnitSetSquad <unitObjId> <int>";
const string s_usageSpaceSquadAddPatrolPath = "Usage: spaceSquadAddPatrolPath <int>";
trigger OnSpeaking(String text)
{
if (isGod(self))
{
java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(text);
if (tokenizer.hasMoreTokens())
{
String command = tokenizer.nextToken();
LOG("space_debug_ai", "command is: " + command + " ---------------------------------------");
if (command.equalsIgnoreCase("ai"))
{
debugConsoleMsg(self, "** ai usage **");
debugConsoleMsg(self, s_usageSpaceUnitAddPatrolPath);
debugConsoleMsg(self, s_usageSpaceUnitClearPatrolPath);
debugConsoleMsg(self, s_usageSpaceUnitFollow);
debugConsoleMsg(self, s_usageAiAttack);
debugConsoleMsg(self, s_usageSpaceUnitSetIdle);
debugConsoleMsg(self, s_usageSpaceUnitSetSquad);
}
else if (command.equalsIgnoreCase("spaceUnitAddPatrolPath"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
debugSpaceUnitAddPatrolPath(self, unit, ship_ai.createPatrolPathCircle(new vector(0.0f, 0.0f, 0.0f), 100.0f));
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitAddPatrolPath);
}
}
else if (command.equalsIgnoreCase("spaceUnitClearPatrolPath"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitClearPatrolPath(unitObjectId);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitClearPatrolPath);
}
}
else if (command.equalsIgnoreCase("spaceUnitFollow"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
obj_id targetObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
const float x = java.lang.Float.parseFloat(tokenizer.nextToken());
if (tokenizer.hasMoreTokens())
{
const float y = java.lang.Float.parseFloat(tokenizer.nextToken());
if (tokenizer.hasMoreTokens())
{
const float z = java.lang.Float.parseFloat(tokenizer.nextToken());
if (tokenizer.hasMoreTokens())
{
error = false;
float offset = java.lang.Float.parseFloat(tokenizer.nextToken());
debugSpaceUnitFollow(self, unitObjectId, targetObjectId, new vector(x, y, z), offset);
}
}
}
}
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitFollow);
}
}
else if (command.equalsIgnoreCase("ai_attack"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
Vector targetObjectIdList = new Vector();
while (tokenizer.hasMoreTokens())
{
targetObjectIdList.addElement(obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken())));
}
if (targetObjectIdList.size() == 1)
{
error = false;
obj_id targetObjectId = (obj_id)targetObjectIdList.elementAt(0);
ship_ai.unitAddDamageTaken(unitObjectId, targetObjectId, 100000.0f);
debugConsoleMsg(self, unitObjectId + " is attacking " + targetObjectId);
}
else if (targetObjectIdList.size() > 1)
{
error = false;
obj_id targets[] = new obj_id[targetObjectIdList.size()];
targetObjectIdList.toArray(targets);
ship_ai.spaceAttack(unitObjectId, targets);
debugConsoleMsg(self, unitObjectId + " is attacking " + targetObjectIdList.size() + " targets");
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageAiAttack);
}
}
else if (command.equalsIgnoreCase("ai_idle"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitIdle(unitObjectId);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetIdle);
}
}
else if (command.equalsIgnoreCase("spaceUnitGetPilotType"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
debugConsoleMsg(self, "unit: " + unitObjectId + " pilotType: " + ship_ai.unitGetPilotType(unitObjectId));
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitGetPilotType);
}
}
else if (command.equalsIgnoreCase("spaceUnitGetBehavior"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
const int behavior = ship_ai.unitGetBehavior(unitObjectId);
debugConsoleMsg(self, "unit: " + unitObjectId + " behavior: " + behavior + " - " + ship_ai.unitGetBehaviorString(behavior));
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitGetBehavior);
}
}
else if (command.equalsIgnoreCase("spaceUnitSetAttackOrders"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
const obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
error = false;
const int attackOrders = java.lang.Integer.parseInt(tokenizer.nextToken());
ship_ai.unitSetAttackOrders(unitObjectId, attackOrders);
debugConsoleMsg(self, "unit: " + unitObjectId + " attack orders: " + attackOrders + " - " + ship_ai.unitGetAttackOrdersString(attackOrders));
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetAttackOrders);
}
}
else if (command.equalsIgnoreCase("spaceUnitSetSquad"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
const obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
if (tokenizer.hasMoreTokens())
{
error = false;
const int squad = java.lang.Integer.parseInt(tokenizer.nextToken());
ship_ai.unitSetSquadId(unitObjectId, squad);
debugConsoleMsg(self, "unit: " + unitObjectId + " squad: " + squad);
}
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetSquad);
}
}
else if (command.equalsIgnoreCase("spaceSquadAddPatrolPath"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
const int squad = java.lang.Integer.parseInt(tokenizer.nextToken());
transform path[] = new transform[4];
path[0] = transform.identity.setPosition_p(-100, 0, -100);
path[1] = transform.identity.setPosition_p(100, 0, -100);
path[2] = transform.identity.setPosition_p(100, 0, 100);
path[3] = transform.identity.setPosition_p(-100, 0, 100);
ship_ai.squadAddPatrolPath(squad, path);
debugConsoleMsg(self, "spaceSquadAddPatrolPath - " + "squad: " + squad);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters + s_usageSpaceSquadAddPatrolPath);
}
}
else if (command.equalsIgnoreCase("ai_superweapon"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
setShipWeaponDamageMinimum(unitObjectId, ship_chassis_slot_type.SCST_weapon_0, 400000);
setShipWeaponDamageMaximum(unitObjectId, ship_chassis_slot_type.SCST_weapon_0, 500000);
debugConsoleMsg(self, unitObjectId + " now has a super weapon");
}
//if (error)
//{
// LOG(s_logLabel, s_tooFewParameters + s_usageAiStopAttack);
//}
}
else if (command.equalsIgnoreCase("ai_moveto"))
{
boolean error = true;
if (tokenizer.hasMoreTokens())
{
error = false;
const obj_id unitObjectId = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
transform path[] = new transform[4];
path[0] = transform.identity.setPosition_p(50.0f, 0.0f, 0.0f);
path[1] = transform.identity.setPosition_p(00.0f, 50.0f, 0.0f);
path[2] = transform.identity.setPosition_p(00.0f, 0.0f, 50.0f);
path[3] = transform.identity.setPosition_p(50.0f, 0.0f, 0.0f);
ship_ai.unitMoveTo(unitObjectId, path);
}
if (error)
{
//LOG(s_logLabel, s_tooFewParameters + s_usageSpaceUnitSetAttackOrders);
}
}
else if (command.equalsIgnoreCase("ai_patrol"))
{
ship_ai.unitAddPatrolPath(createUnit(self, "tiefighter", 200.0f), ship_ai.createPatrolPathCircle(new vector(0.0f, 0.0f, 0.0f), 100.0f));
ship_ai.unitAddPatrolPath(createUnit(self, "tiefighter", 200.0f), ship_ai.createPatrolPathCircle(new vector(0.0f, 10.0f, 0.0f), 100.0f));
}
else if (command.equalsIgnoreCase("ai_single"))
{
boolean error = true;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
error = false;
shipName = tokenizer.nextToken();
const float createRadius = 100.0f;
obj_id unit = createUnit(self, shipName, createRadius, anchorPosition_w);
const float pathRadius = 200.0f;
debugSpaceUnitAddPatrolPath(self, unit, ship_ai.createPatrolPathCircle(anchorPosition_w, pathRadius));
//ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
//ship_ai.unitIdle(unit);
ship_ai.unitSetLeashDistance(unit, 16000.0f);
debugConsoleMsg(self, "ai_single: Creating a single " + shipName);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_single <shipType>");
}
}
else if (command.equalsIgnoreCase("ai_squad"))
{
boolean error = true;
const float createRadius = 200.0f;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
const int tokenCount = tokenizer.countTokens();
if (tokenCount >= 1)
{
shipName = tokenizer.nextToken();
error = false;
int squadSize = 4;
if (tokenCount == 2)
{
squadSize = java.lang.Integer.parseInt(tokenizer.nextToken());
}
const obj_id squadLeader = createUnit(self, shipName, createRadius, anchorPosition_w);
//ship_ai.unitSetAttackOrders(squadLeader, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
for (int i = 0; i < squadSize - 1; ++i)
{
obj_id unit = createUnit(self, shipName, createRadius, anchorPosition_w);
ship_ai.unitSetSquadId(unit, _spaceUnitGetSquadId(squadLeader));
//ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
}
ship_ai.squadSetFormationRandom(_spaceUnitGetSquadId(squadLeader));
ship_ai.squadSetFormationSpacing(_spaceUnitGetSquadId(squadLeader), 1.0f);
ship_ai.squadPatrol(_spaceUnitGetSquadId(squadLeader), createPatrolPathSpiral(anchorPosition_w, 200.0f));
debugConsoleMsg(self, "ai_squad: Creating a squad of " + squadSize + " " + shipName);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_squad <shipType>");
}
}
else if (command.equalsIgnoreCase("ai_squadtest"))
{
boolean error = true;
const float createRadius = 200.0f;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
int squadSize = 4;
const obj_id squadLeader = createUnit(self, "vortex_mission_4_shuttle", createRadius, anchorPosition_w);
//ship_ai.unitSetAttackOrders(squadLeader, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
for (int i = 0; i < squadSize - 1; ++i)
{
obj_id unit = createUnit(self, "vortex_mission_4_guard", createRadius, anchorPosition_w);
ship_ai.unitSetSquadId(unit, _spaceUnitGetSquadId(squadLeader));
//ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
}
ship_ai.squadSetFormationRandom(_spaceUnitGetSquadId(squadLeader));
ship_ai.squadSetFormationSpacing(_spaceUnitGetSquadId(squadLeader), 1.0f);
ship_ai.squadPatrol(_spaceUnitGetSquadId(squadLeader), createPatrolPathSpiral(anchorPosition_w, 200.0f));
debugConsoleMsg(self, "ai_squad: Creating a squad of " + squadSize + " ");
}
else if (command.equalsIgnoreCase("ai_clear_random"))
{
obj_id objectList[] = getObjectsInRange(self, 16000.0f);
int count = 0;
for (int i = 0; i < objectList.length; ++i)
{
if ( isGameObjectTypeOf(objectList[i], GOT_ship)
&& !isGameObjectTypeOf(objectList[i], GOT_ship_station)
&& !getTemplateName(objectList[i]).startsWith("object/ship/player"))
{
Random random = new Random();
if ((Math.abs(random.nextInt()) % 2) == 0)
{
debugDestroyObject(self, objectList[i]);
++count;
}
}
}
debugConsoleMsg(self, count + " object destroyed");
}
else if (command.equalsIgnoreCase("ai_clear"))
{
obj_id objectList[] = getObjectsInRange(self, 16000.0f);
int count = 0;
for (int i = 0; i < objectList.length; ++i)
{
if ( isGameObjectTypeOf(objectList[i], GOT_ship)
&& !isGameObjectTypeOf(objectList[i], GOT_ship_station)
&& !getTemplateName(objectList[i]).startsWith("object/ship/player"))
{
debugDestroyObject(self, objectList[i]);
++count;
}
}
debugConsoleMsg(self, count + " object destroyed");
}
else if (command.equalsIgnoreCase("ai_getDockTransform"))
{
if (tokenizer.hasMoreTokens())
{
obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
transform dockTransform = ship_ai.unitGetDockTransform(dockTarget, self);
debugConsoleMsg(self, "dockTarget: " + dockTarget + " dockingUnit: " + self + " dockTransform: " + dockTransform);
}
}
else if (command.equalsIgnoreCase("ai_test"))
{
obj_id unit = createUnit(self, "xwing", 100.0f);
ship_ai.squadRemoveUnit(unit);
}
else if (command.equalsIgnoreCase("ai_guard"))
{
const float createRadius = 200.0f;
const float pathRadius = 400.0f;
String formationShip;
if (tokenizer.hasMoreTokens())
{
formationShip = tokenizer.nextToken();
}
else
{
formationShip = new String("tiefighter");
}
// Create the guarded unit
const obj_id guardedUnit = createUnit(self, "tiefighter", createRadius);
ship_ai.unitSetAttackOrders(guardedUnit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
ship_ai.unitLoiter(guardedUnit, transform.identity, 50.0f, 50.0f);
// Create the guarding squad
{
const int squadLeaderSquad = ship_ai.squadCreateSquadId();
const int squadCount = 1;
const int unitCount = 4;
for (int i = 0; i < unitCount; ++i)
{
obj_id unit = createUnit(self, formationShip, createRadius);
ship_ai.unitSetSquadId(unit, squadLeaderSquad);
ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
}
ship_ai.squadSetFormation(squadLeaderSquad, ship_ai.FORMATION_WALL);
ship_ai.squadSetFormationSpacing(squadLeaderSquad, 1.0f);
ship_ai.squadAddPatrolPath(squadLeaderSquad, ship_ai.createPatrolPathCircle(new vector(2000.0f, 0.0f, 0.0f), 200.0f));
ship_ai.squadSetGuardTarget(squadLeaderSquad, ship_ai.unitGetSquadId(guardedUnit));
}
}
else if (command.equalsIgnoreCase("ai_dock"))
{
boolean error = true;
// Get a space station
if (tokenizer.hasMoreTokens())
{
error = false;
const obj_id spaceStation = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
String shipName;
if (tokenizer.hasMoreTokens())
{
shipName = tokenizer.nextToken();
}
else
{
shipName = new String("yt1300");
}
const obj_id dockingUnit = createUnit(self, shipName, 200.0f);
ship_ai.unitDock(dockingUnit, spaceStation, 10.0f);
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_dockWith"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
obj_id playerShip = space_transition.getContainingShip(self);
const obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitDock(playerShip, dockTarget, 10.0f);
error = false;
}
else if (tokenCount == 2)
{
const obj_id dockingUnit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
const obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitDock(dockingUnit, dockTarget, 10.0f);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_singleDockWith"))
{
boolean error = true;
String shipName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 2)
{
error = false;
shipName = tokenizer.nextToken();
const float createRadius = 100.0f;
obj_id unit = createUnit(self, shipName, createRadius, anchorPosition_w);
const float pathRadius = 200.0f;
debugSpaceUnitAddPatrolPath(self, unit, ship_ai.createPatrolPathCircle(anchorPosition_w, pathRadius));
// Assign it to dock
const obj_id dockTarget = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitDock(unit, dockTarget, 10.0f);
debugConsoleMsg(self, "ai_singleDockWith: Creating a single " + shipName);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_singleDockWith <shipType> <dockTarget>");
}
}
else if (command.equalsIgnoreCase("ai_isAutoAggroImmune"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
const obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(unit) ? "[ENABLED]" : "[DISABLED]") + " ship aggro immunity " + unit);
error = false;
}
else
{
obj_id playerShip = space_transition.getContainingShip(self);
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_aggroImmune"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
const obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitSetAutoAggroImmune(unit, !ship_ai.unitIsAutoAggroImmune(unit));
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(unit) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + unit);
error = false;
}
else
{
obj_id playerShip = space_transition.getContainingShip(self);
ship_ai.unitSetAutoAggroImmune(playerShip, !ship_ai.unitIsAutoAggroImmune(playerShip));
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_immune"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
const obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitRemoveFromAllAttackTargetLists(unit);
ship_ai.unitSetAutoAggroImmune(unit, true);
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(unit) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + unit);
error = false;
}
else
{
obj_id playerShip = space_transition.getContainingShip(self);
ship_ai.unitRemoveFromAllAttackTargetLists(playerShip);
ship_ai.unitSetAutoAggroImmune(playerShip, true);
debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_holdFire"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount == 1)
{
const obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitSetAttackOrders(unit, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
error = false;
}
if (error)
{
LOG(s_logLabel, s_tooFewParameters);
}
}
else if (command.equalsIgnoreCase("ai_testGuard"))
{
boolean error = true;
const float squadSpacingRadius = 1200.0f;
String unitName;
location selfLocation = getLocation(space_transition.getContainingShip(self));
vector anchorPosition_w = new vector(selfLocation.x, selfLocation.y, selfLocation.z);
const int tokenCount = tokenizer.countTokens();
if (tokenCount >= 1)
{
error = false;
unitName = tokenizer.nextToken();
obj_id unitToGuard = createUnit(self, unitName, 0.0f, anchorPosition_w);
ship_ai.unitSetAttackOrders(unitToGuard, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
debugSpaceUnitAddPatrolPath(self, unitToGuard, ship_ai.createPatrolPathCircle(anchorPosition_w, 200.0f));
const int unitToGuardSquadId = ship_ai.unitGetSquadId(unitToGuard);
const int squadCount = 1;
int squadSize = 4;
if (tokenCount == 2)
{
squadSize = java.lang.Integer.parseInt(tokenizer.nextToken());
}
for (int index = 0; index < squadCount; ++index)
{
const float radian = (float)Math.PI * 2.0f * ((float)index / (float)squadCount);
const float x = anchorPosition_w.x + (float)Math.sin(radian) * squadSpacingRadius;
const float y = anchorPosition_w.y;
const float z = anchorPosition_w.z + (float)Math.cos(radian) * squadSpacingRadius;
const int newSquad = createPatrollingSquad(self, unitName, squadSize, new vector(x, y, z));
ship_ai.squadSetGuardTarget(newSquad, unitToGuardSquadId);
}
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_testGuard <shipType> <guardSquadSize>");
}
}
else if (command.equalsIgnoreCase("ai_addExclusiveAggro"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount >= 2)
{
error = false;
const obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
const obj_id pilot = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitAddExclusiveAggro(unit, pilot);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_addExclusiveAggro <unit> <pilot>");
}
}
else if (command.equalsIgnoreCase("ai_removeExclusiveAggro"))
{
boolean error = true;
const int tokenCount = tokenizer.countTokens();
if (tokenCount >= 2)
{
error = false;
const obj_id unit = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
const obj_id pilot = obj_id.getObjId(java.lang.Long.parseLong(tokenizer.nextToken()));
ship_ai.unitRemoveExclusiveAggro(unit, pilot);
}
if (error)
{
debugConsoleMsg(self, "************* ERROR *************");
debugConsoleMsg(self, "usage: ai_removeExclusiveAggro <unit> <pilot>");
}
}
else if (command.equalsIgnoreCase("mb_overt"))
{
//obj_id playerShip = space_transition.getContainingShip(self);
space_transition.setPlayerOvert(self);
//debugConsoleMsg(self, (ship_ai.unitIsAutoAggroImmune(playerShip) ? "[ENABLED]" : "[DISABLED]") + " player ship aggro immunity " + playerShip);
}
else if (command.equalsIgnoreCase("mb_rebel"))
{
load_test.revokeSkills(self, load_test.NEUTRAL_PILOT);
load_test.revokeSkills(self, load_test.IMPERIAL_PILOT);
load_test.grantSkills(self, load_test.REBEL_PILOT);
}
else if (command.equalsIgnoreCase("mb_imperial"))
{
load_test.revokeSkills(self, load_test.NEUTRAL_PILOT);
load_test.revokeSkills(self, load_test.REBEL_PILOT);
load_test.grantSkills(self, load_test.IMPERIAL_PILOT);
}
else if (command.equalsIgnoreCase("mb_neutral"))
{
load_test.revokeSkills(self, load_test.REBEL_PILOT);
load_test.revokeSkills(self, load_test.IMPERIAL_PILOT);
load_test.grantSkills(self, load_test.NEUTRAL_PILOT);
}
else if (command.equalsIgnoreCase("isOn"))
{
obj_id lookAtTarget = getLookAtTarget(self);
debugConsoleMsg(self, lookAtTarget + ": hasCondition(CONDITION_ON): " + (hasCondition(lookAtTarget, CONDITION_ON) ? "yes": "no"));
}
else
{
LOG("space_debug_ai", "unknown command");
}
}
}
return SCRIPT_CONTINUE;
}
vector getRandomPosition(float radius)
{
const float x = radius * 2.0f * (0.5f - (float)Math.random());
const float y = radius * 2.0f * (0.5f - (float)Math.random());
const float z = radius * 2.0f * (0.5f - (float)Math.random());
return new vector(x, y, z);
}
obj_id createUnit(obj_id self, String unitName, float radius, vector position)
{
const vector randomPosition = new vector(getRandomPosition(radius));
const float x = position.x + randomPosition.x;
const float y = position.y + randomPosition.y;
const float z = position.z + randomPosition.z;
obj_id unitId = space_create.createShip(unitName, transform.identity.move_p(new vector(x, y, z)));
//debugConsoleMsg(self, "Created unit: " + unitId);
return unitId;
}
obj_id createUnit(obj_id self, String unitName, float radius)
{
obj_id unitId = createUnit(self, unitName, radius, vector.zero);
return unitId;
}
void debugSpaceUnitFollow(obj_id self, obj_id unit, obj_id followedUnit, vector direction, float offset)
{
debugConsoleMsg(self, "spaceUnitFollow() unit: " + unit + " followedUnit: " + followedUnit + " (" + direction.x + ", " + direction.y + ", " + direction.z + ") offset: " + offset);
ship_ai.unitFollow(unit, followedUnit, direction, offset);
}
void debugDestroyObject(obj_id self, obj_id object)
{
//debugConsoleMsg(self, "destroying unit: " + object);
destroyObject(object);
}
void debugSpaceUnitAddPatrolPath(obj_id self, obj_id unit, transform[] path)
{
debugConsoleMsg(self, "spaceUnitAddPatrolPath() unit: " + unit + " path.length: " + path.length);
ship_ai.spacePatrol(unit, path);
}
transform[] createPatrolPathSpiral(vector position_w, float radius)
{
const int points = 60;
transform path[] = new transform[points];
for (int i = 0; i < points; ++i)
{
const float halfHeightPercent = 2.0f;
const float yOffset = ((float)i / (float)points) * radius * (halfHeightPercent * 2.0f) - radius * halfHeightPercent;
const float radian = (float)Math.PI * 4.0f * ((float)i / (float)points);
const float x = position_w.x + (float)Math.sin(radian) * radius;
const float y = position_w.y + yOffset;
const float z = position_w.z + (float)Math.cos(radian) * radius;
path[i] = transform.identity.setPosition_p(x, y, z);
}
return path;
}
int createPatrollingSquad(obj_id self, string unitName, int squadSize, vector position_w)
{
const float createRadius = 200.0f;
const obj_id squadLeader = createUnit(self, unitName, createRadius, position_w);
const int squadLeaderSquadId = ship_ai.unitGetSquadId(squadLeader);
for (int i = 0; i < squadSize - 1; ++i)
{
ship_ai.unitSetSquadId(createUnit(self, unitName, createRadius, position_w), squadLeaderSquadId);
}
ship_ai.squadSetAttackOrders(squadLeaderSquadId, ship_ai.ATTACK_ORDERS_RETURN_FIRE);
ship_ai.squadSetFormationRandom(squadLeaderSquadId);
ship_ai.squadSetFormationSpacing(squadLeaderSquadId, 1.0f);
ship_ai.squadPatrol(squadLeaderSquadId, createPatrolPathSpiral(position_w, 200.0f));
debugConsoleMsg(self, "ai_squad: Creating a squad of " + squadSize + " " + unitName + " at " + position_w);
return squadLeaderSquadId;
}
@@ -0,0 +1,939 @@
package script.test;
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.ai_lib;
import script.library.create;
import script.library.groundquests;
import script.library.locations;
import script.library.pclib;
import script.library.skill;
import script.library.space_quest;
import script.library.space_utils;
import script.library.static_item;
import script.library.utils;
import script.library.weapons;
import script.library.chat;
import script.library.npe;
import script.library.xp;
import script.library.dump;
import script.library.combat;
import script.library.sui;
import script.library.regions;
import script.library.prose;
public class mboudreaux_test extends script.base.remote_object_requester
{
public mboudreaux_test()
{
}
public static final String FINISH_PLANET = "tatooine";
public static final float FINISH_X = 3528.0f;
public static final float FINISH_Z = -4804.0f;
public static final String PGC_QUEST_CONTROL_DEVICE = "object/intangible/saga_system/sage_intangible_holocron.iff";
public static final int PQ_TASK_FINISHED = 2;
public static final int PQ_TASK_INACTIVE = 4;
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (true)
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
if (command.equalsIgnoreCase("mb_performance"))
{
if (tok.hasMoreTokens())
{
int rounds = 50;
float totalCanSee = 0;
float totalCached = 0;
long frequency = queryPerformanceCounterFrequency();
if (frequency == 0L)
{
frequency = 1L;
}
dictionary localDict = new dictionary();
String value = tok.nextToken();
long lValue = Long.parseLong(value);
obj_id target = getObjIdWithNull(lValue);
int iterations = 1000;
if (tok.hasMoreTokens())
{
value = tok.nextToken();
iterations = Integer.parseInt(value);
}
for (int j = 0; j < rounds; ++j)
{
long startTimeCanSee = queryPerformanceCounter();
for (int i = 0; i < iterations; ++i)
{
boolean ret = canSee(self, target);
}
long endTimeCanSee = queryPerformanceCounter();
long startTimeLocalCache = queryPerformanceCounter();
boolean cacheValue = canSee(self, target);
localDict.put("cachedCanSee", cacheValue);
for (int i = 0; i < iterations; ++i)
{
boolean cache = localDict.getBoolean("cachedCanSee");
localDict.remove("cachedCanSee");
localDict.put("cachedCanSee", cache);
}
long endTimeLocalCache = queryPerformanceCounter();
totalCanSee += (float)(endTimeCanSee - startTimeCanSee) / (float)frequency;
totalCached += (float)(endTimeLocalCache - startTimeLocalCache) / (float)frequency;
}
debugConsoleMsg(self, "Average Times for " + rounds + " of " + iterations + " iterations each were: canSee (" + totalCanSee + "), Java Cache (" + totalCached + ")");
}
return SCRIPT_CONTINUE;
}
if (command.equalsIgnoreCase("mb_addObjectEffect"))
{
vector vec = new vector(0.0f, 0.0f, 0.0f);
if (tok.hasMoreTokens())
{
String object = tok.nextToken();
String filename = tok.nextToken();
String scale = tok.nextToken();
String label = tok.nextToken();
float scaleFloat = Float.parseFloat(scale);
long object_id = Long.parseLong(object);
addObjectEffect(getObjIdWithNull(object_id), filename, "head", vec, scaleFloat, label);
}
else
{
addObjectEffect(self, "appearance/pt_green_fire_base.prt", "head", vec, 0.25f, "TestGreenFire");
}
return SCRIPT_CONTINUE;
}
if (command.equalsIgnoreCase("mb_removeObjectEffect"))
{
if (tok.hasMoreTokens())
{
String object = tok.nextToken();
String label = tok.nextToken();
long object_id = Long.parseLong(object);
removeObjectEffect(getObjIdWithNull(object_id), label);
}
else
{
removeObjectEffect(self, "TestGreenFire");
}
return SCRIPT_CONTINUE;
}
if (command.equalsIgnoreCase("mb_hasObjectEffect"))
{
if (tok.hasMoreTokens())
{
String object = tok.nextToken();
String label = tok.nextToken();
long object_id = Long.parseLong(object);
debugConsoleMsg(self, "Has Effect = " + hasObjectEffect(getObjIdWithNull(object_id), label));
}
else
{
debugConsoleMsg(self, "Has Effect = " + hasObjectEffect(self, "TestGreenFire"));
}
return SCRIPT_CONTINUE;
}
if (command.equalsIgnoreCase("mb_stand"))
{
debugConsoleMsg(self, "hit mb_stand");
setPosture(self, POSTURE_UPRIGHT);
}
if (command.equalsIgnoreCase("mb_warp"))
{
debugConsoleMsg(self, "hit mb_warp");
warpPlayer(self, FINISH_PLANET, FINISH_X, 0, FINISH_Z, null, 0.0f, 0.0f, 0.0f, null, false);
}
if (command.equalsIgnoreCase("mb_goodloc"))
{
debugConsoleMsg(self, "hit mb_goodloc");
location locLowerLeft = new location();
locLowerLeft.x = 200 + 20;
locLowerLeft.z = 200 + 20;
location locUpperRight = new location();
locUpperRight.x = 200 + 40;
locUpperRight.z = 200 + 40;
location goodLoc = getGoodLocationAvoidCollidables(15.0f, 15.0f, locLowerLeft, locUpperRight, false, false, 5.0f);
if (goodLoc == null)
{
debugConsoleMsg(self, "did NOT find goodLocation");
}
else
{
debugConsoleMsg(self, "did find goodlocation");
}
}
if (command.equalsIgnoreCase("mb_acklay"))
{
debugConsoleMsg(self, "hit mb_acklay");
debugConsoleMsg(self, "It's morphing time!");
setObjectAppearance(self, "object/mobile/shared_mutant_acklay.iff");
}
if (command.equalsIgnoreCase("mb_rancor"))
{
debugConsoleMsg(self, "hit mb_rancor");
debugConsoleMsg(self, "It's morphing time!");
setObjectAppearance(self, "object/mobile/shared_mutant_rancor.iff");
}
if (command.equalsIgnoreCase("mb_boba"))
{
debugConsoleMsg(self, "hit mb_boba");
debugConsoleMsg(self, "It's morphing time!");
setObjectAppearance(self, "object/mobile/shared_boba_fett.iff");
}
if (command.equalsIgnoreCase("mb_revert"))
{
debugConsoleMsg(self, "hit mb_revert");
revertObjectAppearance(self);
}
if (command.equalsIgnoreCase("mb_states"))
{
debugConsoleMsg(self, "hit mb_states");
debugConsoleMsg(self, "Disguised State: " + getState(self, 35));
debugConsoleMsg(self, "Acid Burned State: " + getState(self, 38));
debugConsoleMsg(self, "Energy Burned State: " + getState(self, 39));
}
if (command.equalsIgnoreCase("mb_acidBurned"))
{
debugConsoleMsg(self, "hit mb_acidBurned");
int active = getState(self, 38);
if (active == 0)
{
setState(self, 38, true);
}
else
{
setState(self, 38, false);
}
}
if (command.equalsIgnoreCase("mb_energyBurned"))
{
debugConsoleMsg(self, "hit mb_energyBurned");
int active = getState(self, 39);
if (active == 0)
{
setState(self, 39, true);
}
else
{
setState(self, 39, false);
}
}
if (command.equalsIgnoreCase("mb_helmetbackpack"))
{
debugConsoleMsg(self, "hit mb_helmetbackpack");
debugConsoleMsg(self, "Helmet: " + isPlayerHelmetHidden(self));
debugConsoleMsg(self, "Backpack: " + isPlayerBackpackHidden(self));
}
else if (command.equalsIgnoreCase("mb_ticket"))
{
enterClientTicketPurchaseMode(self, "tatooine", "Starport", false);
return SCRIPT_CONTINUE;
}
else if (command.equalsIgnoreCase("mb_clientProjectileObjToObj"))
{
debugConsoleMsg(self, "hit mb_clientProjectileObjToObj");
final obj_id target = getIntendedTarget(self);
if (isValidId(target))
{
createClientProjectileObjectToObject(self, "object/weapon/ranged/pistol/shared_pistol_dl44.iff", self, "hold_r", target, "hold_l", 30.0f, 4.0f, true, 255, 0, 0, 255);
}
}
else if (command.equalsIgnoreCase("mb_clientProjectileLocToObj"))
{
debugConsoleMsg(self, "hit mb_clientProjectileLocToObj");
final obj_id target = getIntendedTarget(self);
if (isValidId(target))
{
createClientProjectileLocationToObject(self, "object/weapon/ranged/pistol/shared_pistol_dl44.iff", getLocation(self), target, "hold_l", 30.0f, 4.0f, true, 255, 0, 0, 255);
}
}
else if (command.equalsIgnoreCase("mb_clientProjectileObjToLoc"))
{
debugConsoleMsg(self, "hit mb_clientProjectileObjToLoc");
final obj_id target = getIntendedTarget(self);
if (isValidId(target))
{
createClientProjectileObjectToLocation(self, "object/weapon/ranged/pistol/shared_pistol_dl44.iff", self, "hold_r", getLocation(target), 30.0f, 4.0f, true, 255, 0, 0, 255);
}
}
else if (command.equalsIgnoreCase("mb_override"))
{
debugConsoleMsg(self, "hit mb_override");
if (tok.hasMoreTokens())
{
String action = tok.nextToken();
overrideDefaultAttack(self, action);
}
}
else if (command.equalsIgnoreCase("mb_clearoverride"))
{
debugConsoleMsg(self, "hit mb_clearoverride");
removeDefaultAttackOverride(self);
}
else if (command.equalsIgnoreCase("mb_getoverride"))
{
debugConsoleMsg(self, "Current override: " + getDefaultAttackOverrideActionName(self));
}
else if (command.equalsIgnoreCase("mb_setMC"))
{
debugConsoleMsg(self, "Hit mb_setMC");
final obj_id target = getIntendedTarget(self);
addMissionCriticalObject(self, target);
}
else if (command.equalsIgnoreCase("mb_triggerRadius"))
{
debugConsoleMsg(self, "Hit mb_triggerRadius");
final obj_id target = getIntendedTarget(self);
updateNetworkTriggerVolume(target, 512.0f);
}
else if (command.equalsIgnoreCase("mb_hologram"))
{
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int intValue = Integer.parseInt(value);
obj_id target = getIntendedTarget(self);
setHologramType(target, intValue);
}
}
else if (command.equalsIgnoreCase("mb_isContainedByPA"))
{
obj_id target = null;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
target = getObjIdWithNull(lValue);
}
if (!isIdValid(target))
{
return SCRIPT_CONTINUE;
}
debugConsoleMsg(self, "isContainedByPlayerAppearanceInv: " + isContainedByPlayerAppearanceInventory(self, target));
}
else if (command.equalsIgnoreCase("mb_getAllPAItems"))
{
obj_id[] allItems = getAllItemsFromAppearanceInventory(self);
debugConsoleMsg(self, "Found " + allItems.length + " total items.");
for (int i = 0; i < allItems.length; ++i)
{
debugConsoleMsg(self, "Item [" + i + "] " + allItems[i]);
}
}
else if (command.equalsIgnoreCase("mb_animate"))
{
obj_id target = getIntendedTarget(self);
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
doAnimationAction(target, value);
}
}
else if (command.equalsIgnoreCase("mb_custom"))
{
obj_id target = null;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
target = getObjIdWithNull(lValue);
}
custom_var[] allVars = getAllCustomVars(target);
debugConsoleMsg(self, "Var length = " + allVars.length);
if (allVars.length == 1)
{
openCustomizationWindow(self, target, allVars[0].getVarName(), -1, -1, "", -1, -1, "", -1, -1, "", -1, -1);
}
else if (allVars.length == 2)
{
openCustomizationWindow(self, target, allVars[0].getVarName(), 0, 10, allVars[1].getVarName(), -1, -1, "", -1, -1, "", -1, -1);
}
else if (allVars.length == 3)
{
openCustomizationWindow(self, target, allVars[0].getVarName(), -1, -1, allVars[1].getVarName(), -1, -1, allVars[2].getVarName(), -1, -1, "", -1, -1);
}
else if (allVars.length == 4)
{
openCustomizationWindow(self, target, allVars[0].getVarName(), -1, -1, allVars[1].getVarName(), -1, -1, allVars[2].getVarName(), -1, -1, allVars[3].getVarName(), -1, -1);
}
}
else if (command.equalsIgnoreCase("mb_table"))
{
String type = "";
if (tok.hasMoreTokens())
{
type = tok.nextToken();
}
if (type.equalsIgnoreCase("column"))
{
String title = "My Guild";
String prompt = "This is my prompt. Text is going in here!";
String[] colTitles =
{
"Name",
"Guild Rank",
"PvP Kills",
"Last Login Date"
};
String[] colTypes =
{
"text",
"text",
"integer",
"text"
};
String[][] data =
{
{
"PlayerA",
"PlayerB",
"PlayerC",
"PlayerD",
"PlayerE"
},
{
"Awesome Dude",
"Great Dude",
"Okay Dude",
"Meh Dude",
"Poor Dude"
},
{
"200",
"150",
"100",
"50",
"0"
},
{
"01/04/2009",
"01/03/2009",
"01/02/2009",
"01/01/2009",
"01/05/2009"
}
};
int id = sui.table(self, self, sui.OK_CANCEL, title, "tableHandler", prompt, colTitles, colTypes, data, false, true);
debugConsoleMsg(self, "Table PID is " + id);
}
else if (type.equalsIgnoreCase("row"))
{
String title = "My Table";
String[] colTitles =
{
"Name",
"Weight",
"BMI",
"BMI"
};
String[] colTypes =
{
"text",
"integer",
"percent",
"text"
};
String[][] data =
{
{
"John",
"180",
"12",
"12"
},
{
"Steve",
"190",
"20",
"12"
},
{
"Andy",
"230",
"40",
"12"
}
};
int id = sui.table(self, self, sui.OK_CANCEL, title, "tableHandler", null, colTitles, colTypes, data, true, false);
debugConsoleMsg(self, "Table PID is " + id);
}
}
else if (command.equalsIgnoreCase("mb_holiday"))
{
obj_id target = getIntendedTarget(self);
if (isIdValid(target))
{
setCondition(target, CONDITION_HOLIDAY_INTERESTING);
}
}
else if (command.equalsIgnoreCase("mb_addAccess"))
{
obj_id target = getIntendedTarget(self);
obj_id user = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
user = getObjIdWithNull(lValue);
}
if (isIdValid(target))
{
addUserToAccessList(target, user);
}
}
else if (command.equalsIgnoreCase("mb_addGuildAccess"))
{
debugConsoleMsg(self, "Hit mb_addGuildAccess");
obj_id target = getIntendedTarget(self);
int lValue = 0;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
lValue = Integer.parseInt(value);
debugConsoleMsg(self, "Parsed out guild value of " + lValue);
}
if (isIdValid(target))
{
debugConsoleMsg(self, "Adding Guild " + lValue + " to object " + target);
addGuildToAccessList(target, lValue);
}
}
else if (command.equalsIgnoreCase("mb_removeAccess"))
{
obj_id target = getIntendedTarget(self);
obj_id user = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
user = getObjIdWithNull(lValue);
}
if (isIdValid(target))
{
removeUserFromAccessList(target, user);
}
}
else if (command.equalsIgnoreCase("mb_clearAccess"))
{
obj_id target = getIntendedTarget(self);
if (isIdValid(target))
{
clearUserAccessList(target);
}
}
else if (command.equalsIgnoreCase("mb_getUserAccess"))
{
obj_id[] items = getUserAccessList(getIntendedTarget(self));
if (items != null && items.length > 0)
{
for (int i = 0; i < items.length; ++i)
{
debugConsoleMsg(self, "User: " + items[i]);
}
}
}
else if (command.equalsIgnoreCase("mb_getGuildAccess"))
{
int[] items = getGuildAccessList(getIntendedTarget(self));
if (items != null && items.length > 0)
{
for (int i = 0; i < items.length; ++i)
{
debugConsoleMsg(self, "Guild: " + items[i]);
}
}
}
else if (command.equalsIgnoreCase("mb_getObjects"))
{
obj_id[] items = getObjectsInRange(self, 64.0f);
if (items != null && items.length > 0)
{
for (int i = 0; i < items.length; ++i)
{
debugConsoleMsg(self, "Object in range: " + items[i]);
}
}
}
else if (command.equalsIgnoreCase("mb_getCreatureObjects"))
{
obj_id[] items = getCreaturesInRange(self, 64.0f);
if (items != null && items.length > 0)
{
for (int i = 0; i < items.length; ++i)
{
debugConsoleMsg(self, "Creature Object in range: " + items[i]);
}
}
}
else if (command.equalsIgnoreCase("mb_loc"))
{
obj_id user = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
user = getObjIdWithNull(lValue);
}
location myLoc = getLocation(user);
debugConsoleMsg(self, "Location Info: " + myLoc);
}
else if (command.equalsIgnoreCase("mb_dynamic"))
{
location myLoc = getLocation(self);
debugConsoleMsg(self, "Attempting to create dynamic spawn at " + myLoc);
obj_id newRegion = createCircleRegionWithSpawn(myLoc, 50.0f, "mboudreaux2", 0, 0, 0, 0, 10, 20, 1, 0, true, false, "datatables/dynamic_region_spawns/banthatest.iff", 3);
debugConsoleMsg(self, "New Region = " + newRegion);
}
else if (command.equalsIgnoreCase("mb_removedynamic"))
{
region[] regionsHere = getRegionsAtPoint(getLocation(self));
if (regionsHere != null && regionsHere.length > 0)
{
for (int i = 0; i < regionsHere.length; i++)
{
region currentRegion = regionsHere[i];
String regionName = currentRegion.getName();
if (regionName.equals("mboudreaux2"))
{
debugConsoleMsg(self, "Found region, removing it");
deleteRegion(currentRegion);
}
}
}
}
else if (command.equalsIgnoreCase("mb_pq"))
{
obj_id entry = createPlayerQuestObjectInInventory(self);
if (isIdValid(entry))
{
setPlayerQuestTitle(entry, "Matt's Super Kill Extravaganza");
setPlayerQuestDescription(entry, "Kill lots of stuff. For fun!");
setPlayerQuestDifficulty(entry, 90);
}
debugConsoleMsg(self, "PQ OID: " + entry);
}
else if (command.equalsIgnoreCase("mb_addTask"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
boolean returnVal = false;
if (tok.hasMoreTokens())
{
returnVal = addPlayerQuestTask(pq, "Matt's Kill Task", "I hate kreetles! Go kill 10 of them!", 10, getLocation(self));
}
else
{
returnVal = addPlayerQuestTask(pq, "Matt's Kill Task", "I hate kreetles! Go kill 10 of them!", 10, null);
}
debugConsoleMsg(self, "Added task = " + returnVal);
}
else if (command.equalsIgnoreCase("mb_getTasks"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
String[] tasks = getPlayerQuestTasks(pq);
if (tasks != null && tasks.length > 0)
{
for (int i = 0; i < tasks.length; ++i)
{
debugConsoleMsg(self, "Task " + i + ":" + tasks[i]);
}
}
}
else if (command.equalsIgnoreCase("mb_taskStatus"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int iValue = Integer.parseInt(value);
debugConsoleMsg(self, "Status for Index " + iValue + " is " + getPlayerQuestTaskStatus(pq, iValue));
}
else
{
int[] status = getAllPlayerQuestTaskStatus(pq);
if (status != null && status.length > 0)
{
for (int i = 0; i < status.length; ++i)
{
debugConsoleMsg(self, "Task " + i + " status = " + status[i]);
}
}
}
}
else if (command.equalsIgnoreCase("mb_pqLevel"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int iValue = Integer.parseInt(value);
setPlayerQuestDifficulty(pq, iValue);
debugConsoleMsg(self, "Level for PQ " + pq + " is now " + iValue);
}
}
else if (command.equalsIgnoreCase("mb_pqActivate"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
else
{
return SCRIPT_CONTINUE;
}
obj_id datapad = utils.getPlayerDatapad(self);
if (isIdValid(datapad))
{
obj_id controlDevice = createObject(PGC_QUEST_CONTROL_DEVICE, datapad, "");
if (isIdValid(controlDevice))
{
putIn(pq, controlDevice, self);
debugConsoleMsg(self, "PQ Activated");
}
else
{
debugConsoleMsg(self, "Failed to create PQ control device.");
}
}
}
else if (command.equalsIgnoreCase("mb_pqCounter"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int index = Integer.parseInt(value);
value = tok.nextToken();
int iValue = Integer.parseInt(value);
setPlayerQuestTaskCounter(pq, index, iValue);
debugConsoleMsg(self, "Level for PQ " + pq + " is now " + iValue);
}
}
else if (command.equalsIgnoreCase("mb_pqWaypoint"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int index = Integer.parseInt(value);
debugConsoleMsg(self, "Waypoint for index " + index + " is " + getPlayerQuestWaypoint(pq, index));
}
}
else if (command.equalsIgnoreCase("mb_pqComplete"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int index = Integer.parseInt(value);
debugConsoleMsg(self, "Marking PQ Task " + index + " as completed.");
setPlayerQuestTaskStatus(pq, index, PQ_TASK_FINISHED);
}
}
else if (command.equalsIgnoreCase("mb_pqInactive"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
int index = Integer.parseInt(value);
debugConsoleMsg(self, "Marking PQ Task " + index + " as inactive.");
setPlayerQuestTaskStatus(pq, index, PQ_TASK_INACTIVE);
}
}
else if (command.equalsIgnoreCase("mb_rating"))
{
openRatingWindow(self, "Some Title", "Some Description!");
}
else if (command.equalsIgnoreCase("mb_recipe"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
else
{
return SCRIPT_CONTINUE;
}
setPlayerQuestRecipe(pq, true);
debugConsoleMsg(self, "PQ Recipe set.");
}
else if (command.equalsIgnoreCase("mb_addRecipeData"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
}
else
{
return SCRIPT_CONTINUE;
}
if (tok.hasMoreTokens())
{
String data = tok.nextToken();
addPlayerQuestTaskRecipeData(pq, data);
debugConsoleMsg(self, "Recipe data added.");
}
}
else if (command.equalsIgnoreCase("mb_filter"))
{
debugConsoleMsg(self, filterText(text));
}
else if (command.equalsIgnoreCase("mb_editRecipe"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
openPlayerQuestRecipe(self, pq);
}
}
else if (command.equalsIgnoreCase("mb_resetRecipe"))
{
obj_id pq = self;
if (tok.hasMoreTokens())
{
String value = tok.nextToken();
long lValue = Long.parseLong(value);
pq = getObjIdWithNull(lValue);
resetAllPlayerQuestData(pq);
setPlayerQuestTitle(pq, "Matt's Super Kill Extravaganza");
setPlayerQuestDescription(pq, "Kill lots of stuff. For fun!");
setPlayerQuestDifficulty(pq, 90);
addPlayerQuestTask(pq, "Matt's Kill Task", "I hate kreetles! Go kill 10 of them!", 10, null);
setPlayerQuestCreator(pq, self);
}
}
else if (command.equalsIgnoreCase("mb_commTest"))
{
String message_string = "\\#FF0000Hi %NT also known as %TT";
prose_package pp = new prose_package();
string_id message_base = new string_id("saga_system", "holocron_string_message");
pp = prose.getPackage(message_base, self, self);
prose.setTO(pp, message_string);
prose.setTT(pp, self);
String appearance = "object/mobile/boba_fett.iff";
commPlayerQuest(self, self, pp, appearance);
}
else if (command.equalsIgnoreCase("mb_gots"))
{
debugConsoleMsg(self, "GOT_chronicles_relic = " + GOT_chronicles_relic);
debugConsoleMsg(self, "GOT_chronicles_chronicle = " + GOT_chronicles_chronicle);
debugConsoleMsg(self, "GOT_chronicles_quest_holocron = " + GOT_chronicles_quest_holocron);
debugConsoleMsg(self, "GOT_chornicles_quest_holocron_recipe = " + GOT_chronicles_quest_holocron_recipe);
debugConsoleMsg(self, "GOT_chronicles_relic_fragment = " + GOT_chronicles_relic_fragment);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
public int tableHandler(obj_id self, dictionary params) throws InterruptedException
{
debugConsoleMsg(self, "handler hit. Params = " + params);
debugConsoleMsg(self, "Visual Index = " + sui.getTableSelectedRow(params) + " Logic Index = " + sui.getTableLogicalIndex(params));
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int startPerform(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int stopPerform(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnCreateSaga(obj_id self, dictionary params) throws InterruptedException
{
debugConsoleMsg(self, "Params = " + params.toString());
return SCRIPT_CONTINUE;
}
public int OnRatingFinished(obj_id self, int rating) throws InterruptedException
{
debugConsoleMsg(self, "OnRatingFinished: Params = " + rating);
return SCRIPT_CONTINUE;
}
public int OnAbandonPlayerQuest(obj_id self, obj_id playerQuest) throws InterruptedException
{
debugConsoleMsg(self, "OnAbandonPlayerQuest: Params = " + playerQuest);
return SCRIPT_CONTINUE;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,143 @@
package script.test;
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.ai.ai_combat;
import script.library.ai_lib;
import script.library.badge;
import script.library.buff;
import script.library.chat;
import script.library.corpse;
import script.library.create;
import script.library.factions;
import script.library.groundquests;
import script.library.holiday;
import script.library.hue;
import script.library.instance;
import script.library.pet_lib;
import script.library.pgc_quests;
import script.library.prose;
import script.library.skill_template;
import script.library.static_item;
import script.library.storyteller;
import script.library.sui;
import script.library.trial;
import script.library.township;
import script.library.utils;
import script.library.vehicle;
public class mfarone_test extends script.base_script
{
public mfarone_test()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "idiot_testing"))
{
sendSystemMessage(self, "mfarone_test script attached.", "");
}
else
{
sendSystemMessage(self, "Attaching script failed.", "");
detachScript(self, "test.mfarone_test");
}
return SCRIPT_CONTINUE;
}
public void areaDebugMessaging(obj_id self, String message) throws InterruptedException
{
obj_id[] players = getAllPlayers(getLocation(getTopMostContainer(self)), 35.0f);
if (players != null && players.length > 0)
{
for (int i = 0; i < players.length; i++)
{
sendSystemMessage(players[i], message, "");
}
}
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (!isGod(self))
{
return SCRIPT_CONTINUE;
}
obj_id player = self;
location here = getLocation(player);
int stringCheck = -1;
obj_id target = getIntendedTarget(self);
if (!isIdValid(target))
{
target = getLookAtTarget(self);
}
String[] commands =
{
"idiot_pgc_grant_all_tasks",
"idiot_pgc_revoke_all_tasks"
};
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String command = st.nextToken();
stringCheck = text.indexOf("idiot_pgc_list");
if (stringCheck > -1)
{
for (int i = 0; i < commands.length; i++)
{
sendSystemMessage(self, commands[i], "");
}
}
stringCheck = text.indexOf("idiot_pgc_grant_all_tasks");
if (stringCheck > -1)
{
for (int i = 0; i < pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES.length; i++)
{
String collectionName = pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES[i];
String[] collctionSlots = getAllCollectionSlotsInCollection(collectionName);
if (collctionSlots != null && collctionSlots.length > 0)
{
for (int j = 0; j < collctionSlots.length; j++)
{
String slotName = collctionSlots[j];
if (slotName != null && slotName.length() > 0)
{
if (getCollectionSlotValue(self, slotName) <= 0)
{
modifyCollectionSlotValue(self, slotName, 1);
}
}
}
}
}
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("idiot_pgc_revoke_all_tasks");
if (stringCheck > -1)
{
for (int i = 0; i < pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES.length; i++)
{
String collectionName = pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES[i];
String[] collctionSlots = getAllCollectionSlotsInCollection(collectionName);
if (collctionSlots != null && collctionSlots.length > 0)
{
for (int j = 0; j < collctionSlots.length; j++)
{
String slotName = collctionSlots[j];
if (slotName != null && slotName.length() > 0)
{
while (getCollectionSlotValue(self, slotName) > 0)
{
modifyCollectionSlotValue(self, slotName, -1);
}
}
}
}
}
return SCRIPT_OVERRIDE;
}
return SCRIPT_CONTINUE;
}
}
@@ -1,136 +0,0 @@
include ai.ai_combat;
include library.ai_lib;
include library.badge;
include library.buff;
include library.chat;
include library.corpse;
include library.create;
include library.factions;
include library.groundquests;
include library.holiday;
include library.hue;
include library.instance;
include library.pet_lib;
include library.pgc_quests;
include library.prose;
include library.skill_template;
include library.static_item;
include library.storyteller;
include library.sui;
include library.trial;
include library.township;
include library.utils;
include library.vehicle;
trigger OnAttach()
{
if ( hasObjVar(self, "idiot_testing") )
{
sendSystemMessage(self, "mfarone_test script attached.", "");
}
else
{
sendSystemMessage(self, "Attaching script failed.", "");
detachScript(self, "test.mfarone_test");
}
return SCRIPT_CONTINUE;
}
void areaDebugMessaging(obj_id self, string message)
{
obj_id[] players = getAllPlayers(getLocation(getTopMostContainer(self)), 35.0f);
if ( players != null && players.length > 0 )
{
for( int i=0; i<players.length; i++ )
sendSystemMessage(players[i], message, "");
}
}
trigger OnSpeaking(string text)
{
if ( !isGod(self) )
{
return SCRIPT_CONTINUE;
}
obj_id player = self;
location here = getLocation(player);
int stringCheck = -1;
obj_id target = getIntendedTarget(self);
if ( !isIdValid(target) )
{
target = getLookAtTarget(self);
}
string[] commands = { "idiot_pgc_grant_all_tasks",
"idiot_pgc_revoke_all_tasks"
};
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string command = st.nextToken();
stringCheck = text.indexOf("idiot_pgc_list");
if ( stringCheck > -1 )
{
for( int i = 0; i < commands.length; i++ )
{
sendSystemMessage(self, commands[i], "");
}
}
stringCheck = text.indexOf("idiot_pgc_grant_all_tasks");
if ( stringCheck > -1 )
{
for ( int i = 0; i < pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES.length; i++ )
{
string collectionName = pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES[i];
string[] collctionSlots = getAllCollectionSlotsInCollection(collectionName);
if ( collctionSlots != null && collctionSlots.length > 0 )
{
for ( int j = 0; j < collctionSlots.length; j++ )
{
string slotName = collctionSlots[j];
if ( slotName != null && slotName.length() > 0 )
{
if ( getCollectionSlotValue(self, slotName) <= 0 )
{
modifyCollectionSlotValue(self, slotName, 1);
}
}
}
}
}
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("idiot_pgc_revoke_all_tasks");
if ( stringCheck > -1 )
{
for ( int i = 0; i < pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES.length; i++ )
{
string collectionName = pgc_quests.ALL_PGC_COLLECTION_TASK_NAMES[i];
string[] collctionSlots = getAllCollectionSlotsInCollection(collectionName);
if ( collctionSlots != null && collctionSlots.length > 0 )
{
for ( int j = 0; j < collctionSlots.length; j++ )
{
string slotName = collctionSlots[j];
if ( slotName != null && slotName.length() > 0 )
{
while ( getCollectionSlotValue(self, slotName) > 0 )
{
modifyCollectionSlotValue(self, slotName, -1);
}
}
}
}
}
return SCRIPT_OVERRIDE;
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,96 @@
package script.test;
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.static_item;
public class mhalash_test extends script.base_script
{
public mhalash_test()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
String command = tok.nextToken();
if (command.equalsIgnoreCase("d_item"))
{
String strName = tok.nextToken();
String levelStr = tok.nextToken();
int intLevel = utils.stringToInt(levelStr);
if (strName == null || strName.equals("") || levelStr == null || levelStr.equals(""))
{
sendSystemMessageTestingOnly(self, "Use d_item itemCat intLevel");
return SCRIPT_CONTINUE;
}
obj_id inventory = utils.getInventoryContainer(self);
static_item.makeDynamicObject(strName, inventory, intLevel);
}
if (command.equalsIgnoreCase("num_combos"))
{
String numberStr1 = tok.nextToken();
String numberStr2 = tok.nextToken();
int number1 = utils.stringToInt(numberStr1);
int number2 = utils.stringToInt(numberStr2);
if (numberStr1 == null || numberStr1.equals("") || numberStr2 == null || numberStr2.equals(""))
{
sendSystemMessageTestingOnly(self, "num_combos number1 number2");
return SCRIPT_CONTINUE;
}
int numCombos = 0;
for (int i = 1; i < 71; i++)
{
for (int j = 1; j < 71; j++)
{
if ((i * j) >= number1 && (i * j) <= number2)
{
numCombos++;
sendSystemMessageTestingOnly(self, "Valid hit " + i + "*" + j + "= " + (i * j));
}
}
}
sendSystemMessageTestingOnly(self, "numbCombos =" + numCombos);
}
if (command.equalsIgnoreCase("buildabuff"))
{
utils.removeScriptVar(self, "performance.buildabuff.modNames");
utils.removeScriptVar(self, "performance.buildabuff.modValues");
String modName1 = tok.nextToken();
String modValStr1 = tok.nextToken();
String modName2 = tok.nextToken();
String modValStr2 = tok.nextToken();
int modVal1 = utils.stringToInt(modValStr1);
int modVal2 = utils.stringToInt(modValStr2);
String[] modNames =
{
modName1,
modName2
};
float[] modVals =
{
modVal1,
modVal2
};
utils.setScriptVar(self, "performance.buildabuff.modNames", modNames);
utils.setScriptVar(self, "performance.buildabuff.modValues", modVals);
sendSystemMessageTestingOnly(self, "buildabuff!" + modName1 + modVal1 + modName2 + modVal2);
}
if (command.equalsIgnoreCase("token_vendor_sui"))
{
dictionary d = new dictionary();
d.put("player", self);
messageTo(self, "showInventorySUI", d, 0, false);
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,99 +0,0 @@
include library.utils;
include library.static_item;
trigger OnSpeaking(String text)
{
if(isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
// if (tok.countTokens() == 3)
// {
String command = tok.nextToken ();
if (command.equalsIgnoreCase ("d_item"))
{
string strName = tok.nextToken();
string levelStr = tok.nextToken();
int intLevel = utils.stringToInt(levelStr);
if(strName == null || strName.equals("") || levelStr == null || levelStr.equals(""))
{
sendSystemMessageTestingOnly(self, "Use d_item itemCat intLevel");
return SCRIPT_CONTINUE;
}
obj_id inventory = utils.getInventoryContainer(self);
static_item.makeDynamicObject(strName, inventory, intLevel);
}
if(command.equalsIgnoreCase("num_combos"))
{
string numberStr1 = tok.nextToken();
string numberStr2 = tok.nextToken();
// string verbose = tok.nextToken();
int number1 = utils.stringToInt(numberStr1);
int number2 = utils.stringToInt(numberStr2);
if(numberStr1 == null || numberStr1.equals("") || numberStr2 == null || numberStr2.equals(""))
{
sendSystemMessageTestingOnly(self, "num_combos number1 number2");
return SCRIPT_CONTINUE;
}
int numCombos = 0;
for(int i = 1; i < 71; i++)
{
for(int j = 1; j < 71; j++)
{
if( (i*j) >= number1 && (i*j) <= number2)
{
numCombos++;
// if(verbose.equals("verbose") )
// {
sendSystemMessageTestingOnly(self, "Valid hit " + i +"*"+j +"= " + (i*j) );
// }
}
}
}
sendSystemMessageTestingOnly(self, "numbCombos =" + numCombos);
}
// }
if(command.equalsIgnoreCase("buildabuff"))
{
utils.removeScriptVar(self, "performance.buildabuff.modNames");
utils.removeScriptVar(self, "performance.buildabuff.modValues");
string modName1 = tok.nextToken();
string modValStr1 = tok.nextToken();
string modName2 = tok.nextToken();
string modValStr2 = tok.nextToken();
int modVal1 = utils.stringToInt(modValStr1);
int modVal2 = utils.stringToInt(modValStr2);
string[] modNames = {modName1, modName2};
float[] modVals = {modVal1, modVal2};
utils.setScriptVar(self, "performance.buildabuff.modNames", modNames);
utils.setScriptVar(self, "performance.buildabuff.modValues", modVals);
sendSystemMessageTestingOnly(self, "buildabuff!"+modName1+modVal1+modName2+modVal2);
}
if(command.equalsIgnoreCase("token_vendor_sui"))
{
dictionary d = new dictionary();
d.put("player", self);
messageTo(self, "showInventorySUI", d, 0, false);
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,136 @@
package script.test;
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.buff;
import script.library.city;
import script.library.house_pet;
import script.library.utils;
import script.library.static_item;
public class millbarge_test extends script.base_script
{
public millbarge_test()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
String command = tok.nextToken();
obj_id myTarget = getIntendedTarget(self);
if (myTarget == null || myTarget.equals(""))
{
myTarget = self;
}
if (command.equalsIgnoreCase("log"))
{
LOG("sissynoid", "Test Log");
}
if (command.equalsIgnoreCase("applyRoot"))
{
buff.applyBuff(myTarget, "sp_cc_dot");
}
if (command.equalsIgnoreCase("rootImmune"))
{
buff.applyBuff(myTarget, "battlefield_vehicle_1");
}
if (command.equalsIgnoreCase("removeBuffs"))
{
if (buff.hasBuff(myTarget, "of_vortex_root"))
{
buff.removeBuff(myTarget, "of_vortex_root");
}
if (buff.hasBuff(myTarget, "battlefield_vehicle_1"))
{
buff.removeBuff(myTarget, "battlefield_vehicle_1");
}
}
if (command.equalsIgnoreCase("clearDot"))
{
if (buff.hasBuff(myTarget, "sp_cc_dot"))
{
buff.removeBuff(myTarget, "sp_cc_dot");
}
}
if (command.equalsIgnoreCase("playSmoke"))
{
playClientEffectObj(myTarget, "appearance/pt_hoth_destroyed_turret_smoke.prt", self, "");
}
if (command.equalsIgnoreCase("getCityA"))
{
int city_id = getCityAtLocation(getLocation(self), 0);
obj_id vote = cityGetCitizenAllegiance(city_id, self);
sendSystemMessageTestingOnly(self, "City ID: " + city_id + " : My Allegience is to: (" + vote + ") " + cityGetCitizenName(city_id, vote));
}
if (command.equalsIgnoreCase("mayor"))
{
int city_id = getCityAtLocation(getLocation(self), 0);
obj_id mayor = cityGetLeader(city_id);
String name = cityGetCitizenName(city_id, mayor);
sendSystemMessageTestingOnly(self, "mayor's name is: " + name + " Obj_Id: " + mayor);
}
if (command.equalsIgnoreCase("setEntSpec"))
{
int city_id = city.checkCity(self, false);
city.setSpecialization(city_id, "city_spec_entertainer");
obj_id city_hall = cityGetCityHall(city_id);
removeObjVar(city_hall, "spec_stamp");
}
if (command.equalsIgnoreCase("removeEntSpec"))
{
int city_id = city.checkCity(self, false);
city.setSpecialization(city_id, "city_spec_sample_rich");
obj_id city_hall = cityGetCityHall(city_id);
removeObjVar(city_hall, "spec_stamp");
}
if (command.equalsIgnoreCase("test_safe_house_system_overload"))
{
int city_id = getCityAtLocation(getLocation(self), 0);
obj_id city_hall = cityGetCityHall(city_id);
messageTo(city_hall, "QaTestSafeHouseOverload", null, 0.0f, true);
}
if (command.equalsIgnoreCase("whatCity"))
{
int city = getCitizenOfCityId(self);
sendSystemMessageTestingOnly(self, "My getCitizenOfCityId Returned: " + city);
}
if (command.equalsIgnoreCase("breakspawner"))
{
Vector spawnedList = utils.getResizeableObjIdArrayScriptVar(myTarget, "myCreations");
obj_id brokenId = obj_id.NULL_ID;
for (int i = 0; i < spawnedList.size(); i++)
{
sendSystemMessageTestingOnly(self, "Breaking Spawner - previous ID: " + ((obj_id)spawnedList.get(i)));
spawnedList.set(i, brokenId);
}
utils.setScriptVar(myTarget, "myCreations", spawnedList);
}
if (command.equalsIgnoreCase("owner"))
{
obj_id owner = getOwner(myTarget);
sendSystemMessageTestingOnly(self, "Owner is: " + owner);
}
if (command.equalsIgnoreCase("resetScurrierSnackTime"))
{
if (hasObjVar(myTarget, house_pet.SCURRIER_SNACK_LAST_FED))
{
removeObjVar(myTarget, house_pet.SCURRIER_SNACK_LAST_FED);
sendSystemMessageTestingOnly(self, "Scurrier Snack Time has been reset");
}
else
{
sendSystemMessageTestingOnly(self, "Scurrier Snack Time objvar could not be found. You must target the Controller (Feeding Bowl) for this command to work.");
}
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,122 +0,0 @@
include library.buff;
include library.city;
include library.house_pet;
include library.utils;
include library.static_item;
trigger OnSpeaking(String text)
{
if(isGod(self))
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
String command = tok.nextToken ();
obj_id myTarget = getIntendedTarget(self);
if(myTarget == null || myTarget.equals(""))
{
myTarget = self;
}
//test log
if(command.equalsIgnoreCase("log"))
{
LOG("sissynoid", "Test Log");
}
if(command.equalsIgnoreCase("applyRoot"))
{
buff.applyBuff(myTarget, "sp_cc_dot");
}
if(command.equalsIgnoreCase("rootImmune"))
{
buff.applyBuff(myTarget, "battlefield_vehicle_1");
}
if(command.equalsIgnoreCase("removeBuffs"))
{
if(buff.hasBuff(myTarget, "of_vortex_root"))
buff.removeBuff(myTarget, "of_vortex_root");
if(buff.hasBuff(myTarget, "battlefield_vehicle_1"))
buff.removeBuff(myTarget, "battlefield_vehicle_1");
}
if(command.equalsIgnoreCase("clearDot"))
{
if(buff.hasBuff(myTarget, "sp_cc_dot"))
buff.removeBuff(myTarget, "sp_cc_dot");
}
if(command.equalsIgnoreCase("playSmoke"))
{
playClientEffectObj(myTarget, "appearance/pt_hoth_destroyed_turret_smoke.prt", self, "");
}
if(command.equalsIgnoreCase("getCityA"))
{
int city_id = getCityAtLocation(getLocation(self), 0);
obj_id vote = cityGetCitizenAllegiance(city_id, self);
sendSystemMessageTestingOnly(self, "City ID: " + city_id + " : My Allegience is to: (" + vote + ") " + cityGetCitizenName(city_id, vote));
}
if(command.equalsIgnoreCase("mayor"))
{
int city_id = getCityAtLocation(getLocation(self), 0);
obj_id mayor = cityGetLeader(city_id);
string name = cityGetCitizenName(city_id, mayor);
sendSystemMessageTestingOnly(self, "mayor's name is: " + name + " Obj_Id: " + mayor);
}
if(command.equalsIgnoreCase("setEntSpec"))
{
int city_id = city.checkCity(self, false);
city.setSpecialization(city_id, "city_spec_entertainer");
obj_id city_hall = cityGetCityHall(city_id);
removeObjVar(city_hall, "spec_stamp");
}
if(command.equalsIgnoreCase("removeEntSpec"))
{
int city_id = city.checkCity(self, false);
city.setSpecialization(city_id, "city_spec_sample_rich");
obj_id city_hall = cityGetCityHall(city_id);
removeObjVar(city_hall, "spec_stamp");
}
if(command.equalsIgnoreCase("test_safe_house_system_overload"))
{
int city_id = getCityAtLocation(getLocation(self), 0);
obj_id city_hall = cityGetCityHall(city_id);
messageTo(city_hall, "QaTestSafeHouseOverload", null, 0.0f, true);
}
if(command.equalsIgnoreCase("whatCity"))
{
int city = getCitizenOfCityId(self);
sendSystemMessageTestingOnly(self, "My getCitizenOfCityId Returned: " + city);
}
if(command.equalsIgnoreCase("breakspawner"))
{
resizeable obj_id[] spawnedList = utils.getResizeableObjIdArrayScriptVar(myTarget, "myCreations");
obj_id brokenId = obj_id.NULL_ID;
for(int i = 0; i < spawnedList.length; i++)
{
sendSystemMessageTestingOnly(self, "Breaking Spawner - previous ID: " + spawnedList[i]);
spawnedList[i] = brokenId;
}
utils.setScriptVar(myTarget, "myCreations", spawnedList);
}
if(command.equalsIgnoreCase("owner"))
{
obj_id owner = getOwner(myTarget);
sendSystemMessageTestingOnly(self, "Owner is: " + owner);
}
if(command.equalsIgnoreCase("resetScurrierSnackTime"))
{
if(hasObjVar(myTarget, house_pet.SCURRIER_SNACK_LAST_FED))
{
removeObjVar(myTarget, house_pet.SCURRIER_SNACK_LAST_FED);
sendSystemMessageTestingOnly(self, "Scurrier Snack Time has been reset");
}
else
{
sendSystemMessageTestingOnly(self, "Scurrier Snack Time objvar could not be found. You must target the Controller (Feeding Bowl) for this command to work.");
}
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,247 @@
package script.test;
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 java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Vector;
import script.library.combat;
import script.library.qa;
import script.library.sui;
import script.library.utils;
public class mitigation extends script.base_script
{
public mitigation()
{
}
public static final String PID_SCRIPTVAR = "mitigationPid";
public static final String SCRIPTVAR = "mitigation";
public static final String MITIGATION_TOOL_PROMPT = "SELECT AN ATTACK LOCATION.\n\r\n\rThe mitigation tool tests armor mitigation based on the attacker weapon. No actual damage is performed on the target. Damage and mitigation is simulated using the current mitigation system (without elemental damage). When the test is conducted a report will be exported to your client directory.";
public static final String MITIGATION_TOOL_TITLE = "MITIGATION TOOL";
public static final String[] MITIGATION_HIT_LOCATIONS =
{
"Body",
"Head",
"Right Arm",
"Left Arm",
"Right Leg",
"Left Leg"
};
public static final String[] WEAPON_DAMAGE_TYPE =
{
"DAMAGE_NONE",
"DAMAGE_KINETIC",
"DAMAGE_ENERGY",
"DAMAGE_BLAST",
"DAMAGE_STUN",
"DAMAGE_RESTRAINT",
"DAMAGE_ELEMENTAL_HEAT",
"DAMAGE_ELEMENTAL_COLD",
"DAMAGE_ELEMENTAL_ACID",
"DAMAGE_ELEMENTAL_ELECTRICAL",
"DAMAGE_ENVIRONMENTAL_HEAT",
"DAMAGE_ENVIRONMENTAL_COLD",
"DAMAGE_ENVIRONMENTAL_ACID",
"DAMAGE_ENVIRONMENTAL_ELECTRICAL"
};
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR))
{
obj_id lookAtTarget = getLookAtTarget(self);
if (isIdValid(lookAtTarget))
{
if (isPlayer(lookAtTarget) || isMob(lookAtTarget))
{
obj_id objWeapon = getCurrentWeapon(self);
if (isIdValid(objWeapon))
{
weapon_data newWpnData = getWeaponData(objWeapon);
utils.setScriptVar(self, SCRIPTVAR + ".lookAtTarget", "" + lookAtTarget);
utils.setScriptVar(self, SCRIPTVAR + ".objWeapon", "" + objWeapon);
utils.setScriptVar(self, SCRIPTVAR + ".minDamage", newWpnData.minDamage);
utils.setScriptVar(self, SCRIPTVAR + ".maxDamage", newWpnData.maxDamage);
String[] dmgMenu = new String[3];
dmgMenu[0] = "Do Minimum Damage ( " + newWpnData.minDamage + " )";
dmgMenu[1] = "Do Maximum Damage ( " + newWpnData.maxDamage + " )";
dmgMenu[2] = "Do Random Damage";
utils.setScriptVar(self, SCRIPTVAR + ".dmgMenu", dmgMenu);
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, MITIGATION_HIT_LOCATIONS, "handleAttackLocationOptions", true, PID_SCRIPTVAR + ".pid", SCRIPTVAR + ".hitLocationMenu");
}
else
{
sendSystemMessageTestingOnly(self, "Equip a weapon before attempting to use this tool.");
}
}
else
{
sendSystemMessageTestingOnly(self, "You must have a valid mob or player targeted.");
}
}
else
{
sendSystemMessageTestingOnly(self, "You must have a valid mob or player targeted.");
}
}
return SCRIPT_OVERRIDE;
}
return SCRIPT_CONTINUE;
}
public int handleAttackLocationOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, PID_SCRIPTVAR + ".pid"))
{
qa.checkParams(params, PID_SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "Tool Exiting.");
return SCRIPT_CONTINUE;
}
else
{
if (idx > -1)
{
utils.setScriptVar(self, SCRIPTVAR + ".attackLocation", idx);
String[] hitAmountArray = utils.getStringArrayScriptVar(self, SCRIPTVAR + ".dmgMenu");
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, hitAmountArray, "handleDamageOptions", PID_SCRIPTVAR + ".pid", sui.OK_CANCEL);
}
else
{
removePlayer(self, "There was an error. Tool Exiting.");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
public int handleDamageOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, PID_SCRIPTVAR + ".pid"))
{
qa.checkParams(params, PID_SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "");
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
String[] hitAmountArray = utils.getStringArrayScriptVar(self, SCRIPTVAR + ".dmgMenu");
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, MITIGATION_HIT_LOCATIONS, "handleAttackLocationOptions", true, PID_SCRIPTVAR + ".pid", SCRIPTVAR + ".hitLocationMenu");
return SCRIPT_CONTINUE;
}
else
{
if (idx > -1)
{
obj_id objWeapon = utils.stringToObjId(utils.getStringScriptVar(self, SCRIPTVAR + ".objWeapon"));
weapon_data newWpnData = getWeaponData(objWeapon);
int testDamage = 0;
switch (idx)
{
case 0:
testDamage = utils.getIntScriptVar(self, SCRIPTVAR + ".minDamage");
utils.setScriptVar(self, SCRIPTVAR + ".damage", testDamage);
break;
case 1:
testDamage = utils.getIntScriptVar(self, SCRIPTVAR + ".maxDamage");
utils.setScriptVar(self, SCRIPTVAR + ".damage", testDamage);
break;
case 2:
utils.setScriptVar(self, SCRIPTVAR + ".damage", testDamage);
break;
default:
removePlayer(self, "");
return SCRIPT_CONTINUE;
}
int pid = sui.transfer(self, self, "Give the amount of tests you would like to conduct on the location specified", "TEST ITERATION", "Maximum", 1000, "Amount", 1, "mitigationReport");
sui.showSUIPage(pid);
utils.setScriptVar(self, PID_SCRIPTVAR + ".pid", pid);
}
else
{
removePlayer(self, "There was an error. Tool Exiting.");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
public int mitigationReport(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, PID_SCRIPTVAR + ".pid"))
{
qa.checkParams(params, PID_SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int testIteration = sui.getTransferInputTo(params);
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, SCRIPTVAR + ".lookAtTarget"));
obj_id objWeapon = utils.stringToObjId(utils.getStringScriptVar(self, SCRIPTVAR + ".objWeapon"));
int attackLocation = utils.getIntScriptVar(self, SCRIPTVAR + ".attackLocation");
int damage = utils.getIntScriptVar(self, SCRIPTVAR + ".damage");
int minDmg = utils.getIntScriptVar(self, SCRIPTVAR + ".minDamage");
int maxDmg = utils.getIntScriptVar(self, SCRIPTVAR + ".maxDamage");
if (btn == sui.BP_CANCEL)
{
String[] hitAmountArray = utils.getStringArrayScriptVar(self, SCRIPTVAR + ".dmgMenu");
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, MITIGATION_HIT_LOCATIONS, "handleAttackLocationOptions", true, PID_SCRIPTVAR + ".pid", SCRIPTVAR + ".hitLocationMenu");
return SCRIPT_CONTINUE;
}
else
{
String testData = "";
int damageTotal = damage;
for (int i = 0; i < testIteration; i++)
{
if (damageTotal == 0)
{
damageTotal = rand(minDmg, maxDmg);
}
weapon_data newWpnData = getWeaponData(objWeapon);
hit_result hitData = new hit_result();
hitData.damage = damageTotal;
hitData.success = true;
hitData.damageType = newWpnData.attackType;
int blockedDamage = combat.applyArmorProtection(self, lookAtTarget, newWpnData, hitData, 0f);
testData += (i + 1) + "\t" + damageTotal + "\t" + blockedDamage + "\t" + WEAPON_DAMAGE_TYPE[newWpnData.attackType + 1] + "\n";
}
String topStrings = "Weapon OID: " + objWeapon + "\tAttack Location: " + MITIGATION_HIT_LOCATIONS[attackLocation] + "\tMinimum Damage: " + minDmg + "\tMaximum Damage: " + maxDmg + "\n\r";
topStrings += "Attack #\tDamage Amount\tDamage Blocked\tWeapon Damage Type\n\r";
topStrings += testData + "\n\r";
saveTextOnClient(self, "weapon" + objWeapon + "MitigationTest.tab", topStrings);
removePlayer(self, "");
}
}
}
return SCRIPT_CONTINUE;
}
public void removePlayer(obj_id self, String err) throws InterruptedException
{
sendSystemMessageTestingOnly(self, err);
qa.removeScriptVars(self, SCRIPTVAR);
qa.removeScriptVars(self, PID_SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
utils.removeScriptVarTree(self, PID_SCRIPTVAR);
}
}
@@ -1,284 +0,0 @@
// ======================================================================
// mitigation.script
// [internal]
// QA Tool - Mitigation Tool Version 1.00
// [public]
// not for public use
// [testplan]
// Attach the test.qatools script to the test character and use the spatial command 'mitigation'. If the tester has a valid mob or player targeted (to include themself) a SUI will instantiate
// and give the tester a list of attack locations. Once the tester selects an attack location, they will be asked to select a damage amount (minimum, maximum, random)
// as well as the test iteration (how many attacks to conduct). When the test is carried out, the target is not actually attacked but the damage and armor resistence is calculated. A print out is sent to the tester root directory.
// ======================================================================
/***** INCLUDES ********************************************************/
include java.util.HashSet;
include java.util.StringTokenizer;
include java.util.Vector
include library.combat;
include library.qa;
include library.sui;
include library.utils;
/***** CONSTANTS *******************************************************/
const string PID_SCRIPTVAR = "mitigationPid";
const string SCRIPTVAR = "mitigation";
const string MITIGATION_TOOL_PROMPT = "SELECT AN ATTACK LOCATION.\n\r\n\rThe mitigation tool tests armor mitigation based on the attacker weapon. No actual damage is performed on the target. Damage and mitigation is simulated using the current mitigation system (without elemental damage). When the test is conducted a report will be exported to your client directory.";
const string MITIGATION_TOOL_TITLE = "MITIGATION TOOL";
const string[] MITIGATION_HIT_LOCATIONS = {
"Body",
"Head",
"Right Arm",
"Left Arm",
"Right Leg",
"Left Leg"
};
const string[] WEAPON_DAMAGE_TYPE = {
"DAMAGE_NONE",
"DAMAGE_KINETIC",
"DAMAGE_ENERGY",
"DAMAGE_BLAST",
"DAMAGE_STUN",
"DAMAGE_RESTRAINT",
"DAMAGE_ELEMENTAL_HEAT",
"DAMAGE_ELEMENTAL_COLD",
"DAMAGE_ELEMENTAL_ACID",
"DAMAGE_ELEMENTAL_ELECTRICAL",
"DAMAGE_ENVIRONMENTAL_HEAT",
"DAMAGE_ENVIRONMENTAL_COLD",
"DAMAGE_ENVIRONMENTAL_ACID",
"DAMAGE_ENVIRONMENTAL_ELECTRICAL"
};
/***** TRIGGER *******************************************************/
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if ( toLower(text).equals(SCRIPTVAR) )
{
obj_id lookAtTarget = getLookAtTarget(self);
if (isIdValid(lookAtTarget))
{
if (isPlayer(lookAtTarget) || isMob(lookAtTarget))
{
obj_id objWeapon = getCurrentWeapon(self);
if (isIdValid(objWeapon))
{
weapon_data newWpnData = getWeaponData(objWeapon);
utils.setScriptVar(self, SCRIPTVAR+".lookAtTarget", ""+lookAtTarget);
utils.setScriptVar(self, SCRIPTVAR+".objWeapon", ""+objWeapon);
utils.setScriptVar(self, SCRIPTVAR+".minDamage", newWpnData.minDamage);
utils.setScriptVar(self, SCRIPTVAR+".maxDamage", newWpnData.maxDamage);
//Build Damage Menu for future SUI
string[] dmgMenu = new string[3];
dmgMenu[0] = "Do Minimum Damage ( " + newWpnData.minDamage + " )";
dmgMenu[1] = "Do Maximum Damage ( " + newWpnData.maxDamage + " )";
dmgMenu[2] = "Do Random Damage";
utils.setScriptVar(self, SCRIPTVAR+".dmgMenu", dmgMenu);
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, MITIGATION_HIT_LOCATIONS, "handleAttackLocationOptions", true, PID_SCRIPTVAR+".pid", SCRIPTVAR+".hitLocationMenu" );
}
else
{
sendSystemMessageTestingOnly(self, "Equip a weapon before attempting to use this tool.");
}
}
else
{
sendSystemMessageTestingOnly(self, "You must have a valid mob or player targeted.");
}
}
else
{
sendSystemMessageTestingOnly(self, "You must have a valid mob or player targeted.");
}
}
return SCRIPT_OVERRIDE;
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler handleAttackLocationOptions()
{
if (isGod(self))
{
if (utils.hasScriptVar( self, PID_SCRIPTVAR+".pid"))
{
//sendSystemMessageTestingOnly(self, "handler handleMitigationOptions");
qa.checkParams(params, PID_SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "Tool Exiting.");
return SCRIPT_CONTINUE;
}
else
{
//sendSystemMessageTestingOnly(self, "Inside handleMitigationOptions "+idx);
if (idx > -1)
{
utils.setScriptVar(self, SCRIPTVAR+".attackLocation", idx);
string[] hitAmountArray = utils.getStringArrayScriptVar(self, SCRIPTVAR+".dmgMenu");
qa.refreshMenu (self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, hitAmountArray, "handleDamageOptions", PID_SCRIPTVAR+".pid", sui.OK_CANCEL);
}
else
{
removePlayer(self, "There was an error. Tool Exiting.");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleDamageOptions()
{
if (isGod(self))
{
if (utils.hasScriptVar( self, PID_SCRIPTVAR+".pid"))
{
//sendSystemMessageTestingOnly(self, "handler handleDamageOptions");
qa.checkParams(params, PID_SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "");
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
string[] hitAmountArray = utils.getStringArrayScriptVar(self, SCRIPTVAR+".dmgMenu");
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, MITIGATION_HIT_LOCATIONS, "handleAttackLocationOptions", true, PID_SCRIPTVAR+".pid", SCRIPTVAR+".hitLocationMenu" );
return SCRIPT_CONTINUE;
}
else
{
if (idx > -1)
{
obj_id objWeapon = utils.stringToObjId(utils.getStringScriptVar(self, SCRIPTVAR+".objWeapon"));
weapon_data newWpnData = getWeaponData(objWeapon);
int testDamage = 0;
switch (idx)
{
case 0: //MIN DMG
testDamage = utils.getIntScriptVar(self, SCRIPTVAR+".minDamage");
//sendSystemMessageTestingOnly(self, "testDamage: "+testDamage);
utils.setScriptVar(self, SCRIPTVAR+".damage", testDamage);
break;
case 1: //MAX DMG
testDamage = utils.getIntScriptVar(self, SCRIPTVAR+".maxDamage");
//sendSystemMessageTestingOnly(self, "testDamage: "+testDamage);
utils.setScriptVar(self, SCRIPTVAR+".damage", testDamage);
break;
case 2: //RAND DMG
utils.setScriptVar(self, SCRIPTVAR+".damage", testDamage);
//sendSystemMessageTestingOnly(self, "testDamage: "+testDamage);
break;
default:
removePlayer(self, "");
return SCRIPT_CONTINUE;
}
int pid = sui.transfer(self, self, "Give the amount of tests you would like to conduct on the location specified", "TEST ITERATION", "Maximum", 1000, "Amount", 1, "mitigationReport");
sui.showSUIPage(pid);
utils.setScriptVar(self, PID_SCRIPTVAR+".pid", pid);
}
else
{
removePlayer(self, "There was an error. Tool Exiting.");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler mitigationReport()
{
if (isGod(self))
{
if (utils.hasScriptVar( self, PID_SCRIPTVAR+".pid"))
{
//sendSystemMessageTestingOnly(self, "handler mitigationReport");
qa.checkParams(params, PID_SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int testIteration = sui.getTransferInputTo(params);
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, SCRIPTVAR+".lookAtTarget"));
obj_id objWeapon = utils.stringToObjId(utils.getStringScriptVar(self, SCRIPTVAR+".objWeapon"));
int attackLocation = utils.getIntScriptVar(self, SCRIPTVAR+".attackLocation");
int damage = utils.getIntScriptVar(self, SCRIPTVAR+".damage");
int minDmg = utils.getIntScriptVar(self, SCRIPTVAR+".minDamage");
int maxDmg = utils.getIntScriptVar(self, SCRIPTVAR+".maxDamage");
if (btn == sui.BP_CANCEL)
{
string[] hitAmountArray = utils.getStringArrayScriptVar(self, SCRIPTVAR+".dmgMenu");
qa.refreshMenu(self, MITIGATION_TOOL_PROMPT, MITIGATION_TOOL_TITLE, MITIGATION_HIT_LOCATIONS, "handleAttackLocationOptions", true, PID_SCRIPTVAR+".pid", SCRIPTVAR+".hitLocationMenu" );
return SCRIPT_CONTINUE;
}
else
{
string testData = "";
int damageTotal = damage;
for ( int i = 0; i < testIteration; i++ )
{
if (damageTotal == 0)
{
damageTotal = rand(minDmg, maxDmg);
}
weapon_data newWpnData = getWeaponData(objWeapon);
hit_result hitData = new hit_result();
hitData.damage = damageTotal;
hitData.success = true;
hitData.damageType = newWpnData.attackType;
int blockedDamage = combat.applyArmorProtection(self, lookAtTarget, newWpnData, hitData, 0f);
testData += (i+1) + "\t" + damageTotal + "\t" + blockedDamage + "\t" + WEAPON_DAMAGE_TYPE[newWpnData.attackType+1] + "\n";
}
string topStrings = "Weapon OID: " + objWeapon + "\tAttack Location: " + MITIGATION_HIT_LOCATIONS[attackLocation] + "\tMinimum Damage: " + minDmg + "\tMaximum Damage: " + maxDmg + "\n\r";
topStrings += "Attack #\tDamage Amount\tDamage Blocked\tWeapon Damage Type\n\r";
topStrings += testData + "\n\r";
saveTextOnClient(self, "weapon" + objWeapon + "MitigationTest.tab", topStrings);
removePlayer(self, "");
}
}
}
return SCRIPT_CONTINUE;
}
//THIS FUNCTION IS A GENERIC SCRIPT REMOVAL FUNCTION
void removePlayer ( obj_id self, string err )
{
sendSystemMessageTestingOnly(self, err);
qa.removeScriptVars(self, SCRIPTVAR);
qa.removeScriptVars(self, PID_SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
utils.removeScriptVarTree(self, PID_SCRIPTVAR);
}
@@ -0,0 +1,205 @@
package script.test;
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.armor;
import script.library.skill;
import script.library.utils;
import script.library.create;
import script.library.respec;
import script.library.static_item;
import script.library.skill_template;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.Arrays;
import script.library.qa;
import script.library.sui;
import script.library.utils;
import script.library.pclib;
import script.library.weapons;
import script.library.skill;
import script.library.gm;
import script.library.respec;
import script.library.buff;
import script.library.performance;
import script.library.space_transition;
import script.library.space_utils;
import script.library.space_create;
import script.library.ship_ai;
public class mjensen_test extends script.base_script
{
public mjensen_test()
{
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
obj_id pInv = utils.getInventoryContainer(self);
if (text.equals("space-generateSpaceParts"))
{
obj_id itemArmor = createObject("object/tangible/ship/components/armor/arm_corellian_reinforced_light_durasteel.iff", pInv, "");
setObjVar(itemArmor, "ship_comp.hitpoints_current", 5000.000f);
setObjVar(itemArmor, "ship_comp.hitpoints_maximum", 5000.000f);
setObjVar(itemArmor, "ship_comp.mass", 5000.000f);
obj_id itemArmor2 = createObject("object/tangible/ship/components/armor/arm_corellian_reinforced_light_durasteel.iff", pInv, "");
setObjVar(itemArmor2, "ship_comp.hitpoints_current", 5000.000f);
setObjVar(itemArmor2, "ship_comp.hitpoints_maximum", 5000.000f);
setObjVar(itemArmor2, "ship_comp.mass", 5000.000f);
obj_id itemEngine = createObject("object/tangible/ship/components/engine/eng_cygnus_hdx.iff", pInv, "");
setObjVar(itemEngine, "ship_comp.mass", 100.000f);
setObjVar(itemEngine, "ship_comp.engine.pitch_rate_maximum", 150.000f);
setObjVar(itemEngine, "ship_comp.engine.yaw_rate_maximum", 150.000f);
setObjVar(itemEngine, "ship_comp.engine.roll_rate_maximum", 150.000f);
setObjVar(itemEngine, "ship_comp.engine.speed_maximum", 250.000f);
obj_id itemShield = createObject("object/tangible/ship/components/shield_generator/shd_koensayr_deflector_m3.iff", pInv, "");
setObjVar(itemShield, "ship_comp.mass", 100.000f);
setObjVar(itemShield, "ship_comp.shield.hitpoints_back_current", 5000.000f);
setObjVar(itemShield, "ship_comp.shield.hitpoints_back_maximum", 5000.000f);
setObjVar(itemShield, "ship_comp.shield.hitpoints_front_current", 5000.000f);
setObjVar(itemShield, "ship_comp.shield.hitpoints_front_maximum", 5000.000f);
setObjVar(itemShield, "ship_comp.shield.recharge_rate", 500.000f);
obj_id itemBooster = createObject("object/tangible/ship/components/booster/bst_corellian_experimental_tjh3.iff", pInv, "");
setObjVar(itemBooster, "ship_comp.booster.acceleration", 80.000f);
setObjVar(itemBooster, "ship_comp.booster.energy_consumption_rate", 150.000f);
setObjVar(itemBooster, "ship_comp.booster.energy_current", 3000.000f);
setObjVar(itemBooster, "ship_comp.booster.energy_maximum", 3000.000f);
setObjVar(itemBooster, "ship_comp.booster.energy_recharge_rate", 500.00f);
setObjVar(itemBooster, "ship_comp.booster.speed_maximum", 400.000f);
setObjVar(itemBooster, "ship_comp.mass", 100.000f);
obj_id itemRactor = createObject("object/tangible/ship/components/reactor/rct_freitek_improved_powerhouse_mk1.iff", pInv, "");
setObjVar(itemRactor, "ship_comp.mass", 100.000f);
setObjVar(itemRactor, "ship_comp.reactor.energy_generation_rate", 80000.000f);
obj_id itemCap = createObject("object/tangible/ship/components/weapon_capacitor/cap_corellian_cruiser_grade_cap9.iff", pInv, "");
setObjVar(itemCap, "ship_comp.mass", 100.000f);
setObjVar(itemCap, "ship_comp.capacitor.energy_current", 5000.000f);
setObjVar(itemCap, "ship_comp.capacitor.energy_maximum", 5000.000f);
setObjVar(itemCap, "ship_comp.capacitor.energy_recharge_rate", 250.000f);
obj_id itemWeapon = createObject("object/tangible/ship/components/weapon/wpn_mission_reward_rebel_incom_tricannon.iff", pInv, "");
setObjVar(itemWeapon, "ship_comp.mass", 100.000f);
setObjVar(itemWeapon, "ship_comp.weapon.damage_maximum", 5000.000f);
setObjVar(itemWeapon, "ship_comp.weapon.damage_minimum", 3000.000f);
setObjVar(itemWeapon, "ship_comp.weapon.effectiveness_armor", 0.950f);
setObjVar(itemWeapon, "ship_comp.weapon.effectiveness_shields", 0.950f);
setObjVar(itemWeapon, "ship_comp.weapon.energy_per_shot", 15.000f);
setObjVar(itemWeapon, "ship_comp.weapon.refire_rate", 0.3900f);
}
if (text.equals("makeZoneToChips"))
{
obj_id moduleImpDS = createObject("object/tangible/droid/droid_space_memory_module_1.iff", pInv, "");
setObjVar(moduleImpDS, "programSize", 1);
setObjVar(moduleImpDS, "strDroidCommand", "droidcommand_zonetoimperialdeepspace");
setName(moduleImpDS, "");
setName(moduleImpDS, new string_id("space/droid_commands", "droidcommand_zonetoimperialdeepspace_chipname"));
obj_id moduleRebDS = createObject("object/tangible/droid/droid_space_memory_module_1.iff", pInv, "");
setObjVar(moduleRebDS, "programSize", 1);
setObjVar(moduleRebDS, "strDroidCommand", "droidcommand_zonetorebeldeepspace");
setName(moduleRebDS, "");
setName(moduleRebDS, new string_id("space/droid_commands", "droidcommand_zonetorebeldeepspace_chipname"));
obj_id moduleKessel = createObject("object/tangible/droid/droid_space_memory_module_1.iff", pInv, "");
setObjVar(moduleKessel, "programSize", 1);
setObjVar(moduleKessel, "strDroidCommand", "droidcommand_zonetokessel");
setName(moduleKessel, "");
setName(moduleKessel, new string_id("space/droid_commands", "droidcommand_zonetokessel_chipname"));
}
if (text.equals("spawnShip"))
{
transform gloc = getTransform_o2w(space_transition.getContainingShip(self));
float dist = rand(50.f, 100.f);
vector n = ((gloc.getLocalFrameK_p()).normalize()).multiply(dist);
gloc = gloc.move_p(n);
String targetShipType = "experimental_ship";
obj_id targetShip = space_create.createShipHyperspace(targetShipType, gloc);
sendSystemMessage(self, "Spawned ship - OID: " + targetShip, null);
}
if (text.equals("spawnShip2"))
{
transform gloc = getTransform_o2w(space_transition.getContainingShip(self));
float dist = rand(50.f, 100.f);
vector n = ((gloc.getLocalFrameK_p()).normalize()).multiply(dist);
gloc = gloc.move_p(n);
String targetShipType = "reb_gunboat_kessel_tier5";
obj_id targetShip = space_create.createShipHyperspace(targetShipType, gloc);
sendSystemMessage(self, "Spawned ship - OID: " + targetShip, null);
}
if (text.equals("cleanupPiracyEvent"))
{
obj_id beacon = utils.getObjIdScriptVar(self, "beacon");
messageTo(beacon, "cleanupPiracyEvent", null, 3.f, false);
}
if (text.equals("rebelHelper"))
{
obj_id ship = space_transition.getContainingShip(self);
setObjVar(ship, "spaceFaction.FactionOverride", (370444368));
space_utils.notifyObject(ship, "checkSpacePVPStatus", null);
sendSystemMessage(self, "Starting rebel fac helper", null);
}
if (text.equals("imperialHelper"))
{
obj_id ship = space_transition.getContainingShip(self);
setObjVar(ship, "spaceFaction.FactionOverride", (-615855020));
space_utils.notifyObject(ship, "checkSpacePVPStatus", null);
sendSystemMessage(self, "Starting imperial fac helper", null);
}
if (text.equals("cleanHyper"))
{
obj_id ship = space_transition.getContainingShip(self);
utils.removeScriptVar(self, "space.zoneDestination");
sendSystemMessage(self, "clean scriptVars", null);
}
if (text.equals("scriptVarCleanup"))
{
obj_id ship = space_transition.getContainingShip(self);
utils.removeScriptVar(ship, "space.goOvertTimer");
utils.removeScriptVar(ship, "space.goOvert");
utils.removeScriptVar(ship, "space.goOvertLoc");
}
if (text.equals("stopBlink"))
{
obj_id ship = space_transition.getContainingShip(self);
pvpPrepareToBeNeutral(ship);
}
if (text.equals("startBlink"))
{
obj_id ship = space_transition.getContainingShip(self);
pvpPrepareToBeDeclared(ship);
}
if (text.equals("spawnExpShip"))
{
int numships = 4;
obj_id[] escortIdArray = new obj_id[4];
for (int i = 0; i < numships; i++)
{
int escortSquad = ship_ai.squadCreateSquadId();
obj_id ship = space_transition.getContainingShip(self);
transform t = getTransform_o2w(ship);
transform spawnLoc = t.move_l(new vector(rand(-200, 200), rand(-200, 200), rand(-200, 200)));
sendSystemMessage(self, "spawning", null);
escortIdArray[i] = space_create.createShipHyperspace("experimental_ship", spawnLoc);
addMissionCriticalObject(self, escortIdArray[i]);
ship_ai.unitSetLeashDistance(escortIdArray[i], 16000);
ship_ai.unitSetSquadId(escortIdArray[i], escortSquad);
ship_ai.unitAddExclusiveAggro(escortIdArray[i], self);
ship_ai.squadSetLeader(escortSquad, escortIdArray[i]);
ship_ai.squadSetFormation(escortSquad, 5);
}
}
return SCRIPT_CONTINUE;
}
public void logIt(String logText) throws InterruptedException
{
LOG("mikkel", logText);
}
public void sysMes(String sysMessage) throws InterruptedException
{
obj_id self = getSelf();
sendSystemMessageTestingOnly(self, sysMessage);
}
}
@@ -1,253 +0,0 @@
/***** INCLUDES ********************************************************/
include library.armor;
include library.skill;
include library.utils;
include library.create;
include library.respec;
include library.static_item;
include library.skill_template;
include java.util.HashSet;
include java.util.StringTokenizer;
include java.util.Vector;
include java.util.Arrays;
include library.qa;
include library.sui;
include library.utils;
include library.pclib;
include library.weapons;
include library.skill;
include library.gm;
include library.respec;
include library.buff;
include library.performance;
include library.space_transition;
include library.space_utils;
include library.space_create;
include library.ship_ai;
trigger OnSpeaking(string text)
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
//pInv = players inventory
obj_id pInv = utils.getInventoryContainer(self);
if (text == "space-generateSpaceParts")
{
//Armor1
obj_id itemArmor = createObject("object/tangible/ship/components/armor/arm_corellian_reinforced_light_durasteel.iff", pInv, "");
setObjVar (itemArmor, "ship_comp.hitpoints_current", 5000.000f);
setObjVar (itemArmor, "ship_comp.hitpoints_maximum", 5000.000f);
setObjVar (itemArmor, "ship_comp.mass", 5000.000f);
//Armor2
obj_id itemArmor2 = createObject("object/tangible/ship/components/armor/arm_corellian_reinforced_light_durasteel.iff", pInv, "");
setObjVar (itemArmor2, "ship_comp.hitpoints_current", 5000.000f);
setObjVar (itemArmor2, "ship_comp.hitpoints_maximum", 5000.000f);
setObjVar (itemArmor2, "ship_comp.mass", 5000.000f);
//Engine
obj_id itemEngine = createObject("object/tangible/ship/components/engine/eng_cygnus_hdx.iff", pInv, "");
setObjVar (itemEngine, "ship_comp.mass", 100.000f);
setObjVar (itemEngine, "ship_comp.engine.pitch_rate_maximum", 150.000f);
setObjVar (itemEngine, "ship_comp.engine.yaw_rate_maximum", 150.000f);
setObjVar (itemEngine, "ship_comp.engine.roll_rate_maximum", 150.000f);
setObjVar (itemEngine, "ship_comp.engine.speed_maximum", 250.000f);
//shield
obj_id itemShield = createObject("object/tangible/ship/components/shield_generator/shd_koensayr_deflector_m3.iff", pInv, "");
setObjVar (itemShield, "ship_comp.mass", 100.000f);
setObjVar (itemShield, "ship_comp.shield.hitpoints_back_current", 5000.000f);
setObjVar (itemShield, "ship_comp.shield.hitpoints_back_maximum", 5000.000f);
setObjVar (itemShield, "ship_comp.shield.hitpoints_front_current", 5000.000f);
setObjVar (itemShield, "ship_comp.shield.hitpoints_front_maximum", 5000.000f);
setObjVar (itemShield, "ship_comp.shield.recharge_rate", 500.000f);
//Booster
obj_id itemBooster = createObject("object/tangible/ship/components/booster/bst_corellian_experimental_tjh3.iff", pInv, "");
setObjVar (itemBooster, "ship_comp.booster.acceleration", 80.000f);
setObjVar (itemBooster, "ship_comp.booster.energy_consumption_rate", 150.000f);
setObjVar (itemBooster, "ship_comp.booster.energy_current", 3000.000f);
setObjVar (itemBooster, "ship_comp.booster.energy_maximum", 3000.000f);
setObjVar (itemBooster, "ship_comp.booster.energy_recharge_rate", 500.00f);
setObjVar (itemBooster, "ship_comp.booster.speed_maximum", 400.000f);
setObjVar (itemBooster, "ship_comp.mass", 100.000f);
//Reactor
obj_id itemRactor = createObject("object/tangible/ship/components/reactor/rct_freitek_improved_powerhouse_mk1.iff", pInv, "");
setObjVar (itemRactor, "ship_comp.mass", 100.000f);
setObjVar (itemRactor, "ship_comp.reactor.energy_generation_rate", 80000.000f);
//Cap
obj_id itemCap = createObject("object/tangible/ship/components/weapon_capacitor/cap_corellian_cruiser_grade_cap9.iff", pInv, "");
setObjVar (itemCap, "ship_comp.mass", 100.000f);
setObjVar (itemCap, "ship_comp.capacitor.energy_current", 5000.000f);
setObjVar (itemCap, "ship_comp.capacitor.energy_maximum", 5000.000f);
setObjVar (itemCap, "ship_comp.capacitor.energy_recharge_rate", 250.000f);
//Weapon
obj_id itemWeapon = createObject("object/tangible/ship/components/weapon/wpn_mission_reward_rebel_incom_tricannon.iff", pInv, "");
setObjVar (itemWeapon, "ship_comp.mass", 100.000f);
setObjVar (itemWeapon, "ship_comp.weapon.damage_maximum", 5000.000f);
setObjVar (itemWeapon, "ship_comp.weapon.damage_minimum", 3000.000f);
setObjVar (itemWeapon, "ship_comp.weapon.effectiveness_armor", 0.950f);
setObjVar (itemWeapon, "ship_comp.weapon.effectiveness_shields", 0.950f);
setObjVar (itemWeapon, "ship_comp.weapon.energy_per_shot", 15.000f);
setObjVar (itemWeapon, "ship_comp.weapon.refire_rate", 0.3900f);
}
if(text == "makeZoneToChips")
{
obj_id moduleImpDS = createObject("object/tangible/droid/droid_space_memory_module_1.iff", pInv, "");
setObjVar(moduleImpDS, "programSize", 1);
setObjVar(moduleImpDS, "strDroidCommand", "droidcommand_zonetoimperialdeepspace");
setName(moduleImpDS, "");
//setName(moduleKessel, "Imperial Travel Algoritm");
setName(moduleImpDS, new string_id("space/droid_commands", "droidcommand_zonetoimperialdeepspace_chipname"));
obj_id moduleRebDS = createObject("object/tangible/droid/droid_space_memory_module_1.iff", pInv, "");
setObjVar(moduleRebDS, "programSize", 1);
setObjVar(moduleRebDS, "strDroidCommand", "droidcommand_zonetorebeldeepspace");
setName(moduleRebDS, "");
//setName(moduleKessel, "Imperial Travel Algoritm");
setName(moduleRebDS, new string_id("space/droid_commands", "droidcommand_zonetorebeldeepspace_chipname"));
obj_id moduleKessel = createObject("object/tangible/droid/droid_space_memory_module_1.iff", pInv, "");
setObjVar(moduleKessel, "programSize", 1);
setObjVar(moduleKessel, "strDroidCommand", "droidcommand_zonetokessel");
setName(moduleKessel, "");
//setName(moduleKessel, "Imperial Travel Algoritm");
setName(moduleKessel, new string_id("space/droid_commands", "droidcommand_zonetokessel_chipname"));
}
if(text == "spawnShip")
{
// Method to spawn object in front of player
transform gloc = getTransform_o2w(space_transition.getContainingShip(self));
// Move the starting spot out in front of us.
float dist = rand(50.f, 100.f);
vector n = gloc.getLocalFrameK_p().normalize().multiply( dist ); // Project a point out in front of us.
gloc = gloc.move_p( n );
string targetShipType = "experimental_ship";
obj_id targetShip = space_create.createShipHyperspace(targetShipType, gloc);
sendSystemMessage(self, "Spawned ship - OID: "+targetShip, null);
}
if(text == "spawnShip2")
{
// Method to spawn object in front of player
transform gloc = getTransform_o2w(space_transition.getContainingShip(self));
// Move the starting spot out in front of us.
float dist = rand(50.f, 100.f);
vector n = gloc.getLocalFrameK_p().normalize().multiply( dist ); // Project a point out in front of us.
gloc = gloc.move_p( n );
string targetShipType = "reb_gunboat_kessel_tier5";
obj_id targetShip = space_create.createShipHyperspace(targetShipType, gloc);
sendSystemMessage(self, "Spawned ship - OID: "+targetShip, null);
}
if(text == "cleanupPiracyEvent")
{
obj_id beacon = utils.getObjIdScriptVar(self, "beacon");
messageTo(beacon, "cleanupPiracyEvent", null, 3.f, false);
}
if(text == "rebelHelper")
{
obj_id ship = space_transition.getContainingShip(self);
setObjVar(ship, "spaceFaction.FactionOverride", ##"rebel");
space_utils.notifyObject(ship, "checkSpacePVPStatus", null);
sendSystemMessage(self, "Starting rebel fac helper", null);
}
if(text == "imperialHelper")
{
obj_id ship = space_transition.getContainingShip(self);
setObjVar(ship, "spaceFaction.FactionOverride", ##"imperial");
space_utils.notifyObject(ship, "checkSpacePVPStatus", null);
sendSystemMessage(self, "Starting imperial fac helper", null);
}
if(text == "cleanHyper")
{
obj_id ship = space_transition.getContainingShip(self);
utils.removeScriptVar(self,"space.zoneDestination");
sendSystemMessage(self, "clean scriptVars", null);
}
if(text == "scriptVarCleanup")
{
obj_id ship = space_transition.getContainingShip(self);
utils.removeScriptVar(ship, "space.goOvertTimer");
utils.removeScriptVar(ship, "space.goOvert");
utils.removeScriptVar(ship, "space.goOvertLoc");
}
if(text == "stopBlink")
{
obj_id ship = space_transition.getContainingShip(self);
pvpPrepareToBeNeutral(ship);
}
if(text == "startBlink")
{
obj_id ship = space_transition.getContainingShip(self);
pvpPrepareToBeDeclared(ship);
}
if(text == "spawnExpShip")
{
int numships = 4;
obj_id[] escortIdArray = new obj_id[4];
for (int i=0; i<numships; i++ )
{
int escortSquad = ship_ai.squadCreateSquadId();
// Spawn the escorts.
obj_id ship = space_transition.getContainingShip(self);
transform t = getTransform_o2w(ship);
transform spawnLoc = t.move_l(new vector(rand(-200, 200), rand(-200, 200), rand(-200, 200))) /*.yaw_l( (float) -Math.PI )*/;
sendSystemMessage(self, "spawning", null);
escortIdArray[i] = space_create.createShipHyperspace("experimental_ship", spawnLoc);
addMissionCriticalObject(self, escortIdArray[i]);
ship_ai.unitSetLeashDistance(escortIdArray[i], 16000 );
ship_ai.unitSetSquadId(escortIdArray[i], escortSquad );
ship_ai.unitAddExclusiveAggro(escortIdArray[i], self);
ship_ai.squadSetLeader(escortSquad, escortIdArray[i]);
ship_ai.squadSetFormation(escortSquad, 5);
}
}
return SCRIPT_CONTINUE;
}
void logIt(string logText)
{
LOG("mikkel", logText);
}
void sysMes(string sysMessage)
{
obj_id self = getSelf();
sendSystemMessageTestingOnly(self, sysMessage);
}
@@ -0,0 +1,133 @@
package script.test;
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.combat;
import script.library.sui;
import script.library.quests;
import script.library.ai_lib;
import script.library.money;
public class msivertson_test extends script.base_script
{
public msivertson_test()
{
}
public void maxStats(obj_id objPlayer) throws InterruptedException
{
addAttribModifier(objPlayer, HEALTH, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, ACTION, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, MIND, 2000, 0, 0, MOD_POOL);
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
java.util.StringTokenizer tok = new java.util.StringTokenizer(text);
if (tok.hasMoreTokens())
{
String command = tok.nextToken();
debugConsoleMsg(self, "command is: " + command);
if (command.equals("ms_setSkillMod"))
{
String mod = tok.nextToken();
String amountStr = tok.nextToken();
int amount = Integer.parseInt(amountStr);
applySkillStatisticModifier(self, mod, amount);
}
else if (command.equals("ms_fillContainer"))
{
String amountStr = tok.nextToken();
int amount = Integer.parseInt(amountStr);
obj_id target = getLookAtTarget(self);
for (int i = 0; i < amount; ++i)
{
createObject("object/tangible/food/fruit_melon.iff", target, "");
}
}
else if (command.equals("ms_setVendorSlotsUsed"))
{
String amountStr = tok.nextToken();
int amount = Integer.parseInt(amountStr);
setObjVar(self, "used_vendor_slots", amount);
}
else if (command.equals("ms_logBalance"))
{
String comment = tok.nextToken();
logBalance(comment);
}
else if (command.equals("ms_maxStats"))
{
maxStats(self);
}
else if (command.equals("ms_money"))
{
StringBuffer output = new StringBuffer();
if (tok.hasMoreTokens())
{
String amountStr = tok.nextToken();
int amount = Integer.parseInt(amountStr);
if (amount > 0)
{
money.bankTo(money.ACCT_CHARACTER_CREATION, self, amount);
}
else
{
money.bankTo(self, money.ACCT_CHARACTER_CREATION, -amount);
}
}
}
else if (command.equals("ms_ownVendor"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
createVendorMarket(self, target, 0);
}
}
else if (command.equals("ms_valueVendor"))
{
obj_id target = getLookAtTarget(self);
if (target != null)
{
updateVendorValue(target);
}
}
else if (command.equals("ms_createRoomPrivate"))
{
String name = tok.nextToken();
String title = tok.nextToken();
chatCreateRoom(false, name, title);
}
else if (command.equals("ms_createRoomPublic"))
{
String name = tok.nextToken();
String title = tok.nextToken();
chatCreateRoom(true, name, title);
}
else if (command.equals("ms_joinRoom"))
{
String name = tok.nextToken();
chatEnterRoom(name);
}
else if (command.equals("ms_leaveRoom"))
{
String name = tok.nextToken();
chatExitRoom(name);
}
else if (command.equals("ms_speak"))
{
String avatarName = getChatName(self);
String roomName = tok.nextToken();
String msg = tok.nextToken();
String oob = new String();
chatSendToRoom(roomName, msg, oob);
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,131 +0,0 @@
include library.combat;
include library.sui;
include library.quests;
include library.ai_lib;
include library.money;
//----------------------------------------------------------------------
void maxStats(obj_id objPlayer)
{
addAttribModifier(objPlayer, HEALTH, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, ACTION, 2000, 0, 0, MOD_POOL);
addAttribModifier(objPlayer, MIND, 2000, 0, 0, MOD_POOL);
}
//----------------------------------------------------------------------
trigger OnSpeaking(String text)
{
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
if (tok.hasMoreTokens ())
{
String command = tok.nextToken ();
debugConsoleMsg( self, "command is: " + command);
//----------------------------------------------------------------------
//----------------------------------------------------------------------
if (command.equals("ms_setSkillMod"))
{
String mod = tok.nextToken ();
String amountStr = tok.nextToken ();
int amount = Integer.parseInt (amountStr);
applySkillStatisticModifier(self, mod, amount);
}
else if (command.equals("ms_fillContainer"))
{
String amountStr = tok.nextToken ();
int amount = Integer.parseInt (amountStr);
obj_id target = getLookAtTarget (self);
for (int i = 0; i < amount; ++i)
{
createObject("object/tangible/food/fruit_melon.iff", target, "");
}
}
else if (command.equals("ms_setVendorSlotsUsed"))
{
String amountStr = tok.nextToken ();
int amount = Integer.parseInt (amountStr);
setObjVar(self, "used_vendor_slots", amount);
}
else if (command.equals("ms_logBalance"))
{
String comment = tok.nextToken ();
logBalance(comment);
}
else if (command.equals ("ms_maxStats"))
{
maxStats (self);
}
else if (command.equals ("ms_money"))
{
StringBuffer output = new StringBuffer ();
if (tok.hasMoreTokens ())
{
String amountStr = tok.nextToken ();
int amount = Integer.parseInt (amountStr);
if (amount > 0)
money.bankTo (money.ACCT_CHARACTER_CREATION, self, amount);
else
money.bankTo (self, money.ACCT_CHARACTER_CREATION, -amount);
}
}
else if (command.equals ("ms_ownVendor"))
{
obj_id target = getLookAtTarget (self);
if (target != null)
createVendorMarket (self, target, 0);
}
else if (command.equals ("ms_valueVendor"))
{
obj_id target = getLookAtTarget (self);
if (target != null)
updateVendorValue (target);
}
else if (command.equals ("ms_createRoomPrivate"))
{
String name = tok.nextToken();
String title = tok.nextToken();
chatCreateRoom(false, name, title);
}
else if (command.equals ("ms_createRoomPublic"))
{
String name = tok.nextToken();
String title = tok.nextToken();
chatCreateRoom(true, name, title);
}
else if (command.equals ("ms_joinRoom"))
{
String name = tok.nextToken();
chatEnterRoom(name);
}
else if (command.equals("ms_leaveRoom"))
{
String name = tok.nextToken();
chatExitRoom(name);
}
else if (command.equals ("ms_speak"))
{
String avatarName = getChatName(self);
String roomName = tok.nextToken();
String msg = tok.nextToken();
String oob = new String();
chatSendToRoom(roomName, msg, oob);
}
}
return SCRIPT_CONTINUE;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,372 @@
package script.test;
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 java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.Arrays;
import script.library.utils;
import script.library.qa;
import script.library.sui;
import script.library.skill;
import script.library.respec;
import script.library.skill_template;
import script.library.gm;
import script.library.buff;
import script.library.performance;
public class qa_character extends script.base_script
{
public qa_character()
{
}
public static final String TEMPLATE_TABLE = "datatables/test/qa_setup_expertise.iff";
public static final String EXOTIC_MOD_STRINGS = "datatables/crafting/reverse_engineering_mods.iff";
public static final String[] QASETUP_MAIN_MENU =
{
"Quick Buff",
"Set Template",
"Generate Equipment",
"Write Template to Disk"
};
public static final String QASETUP_TITLE = "QA Setup";
public static final String QASETUP_PROMPT = "Choose the tool you want to use";
public static final String[] TOOL_OPTIONS =
{
"Quick Setup",
"Quick Buff",
"Set Class and Template",
"Generate Equipment"
};
public static final String[] MOD_TYPES =
{
"basic1",
"basic2",
"basic3",
"exotic1",
"exotic2",
"exotic3"
};
public static final String[] EQUIPMENT_OPTIONS =
{
"Prefered Mods",
"All",
"Weapon",
"Armor",
"Powerups",
"Consumables"
};
public static final String[] CLASS_LIST =
{
"bounty_hunter_1a",
"commando_1a",
"officer_1a",
"force_sensitive_1a",
"medic_1a",
"spy_1a",
"smuggler_1a",
"trader_1a",
"trader_1d",
"trader_1b",
"trader_1c"
};
public static final String[] BASIC_MOD_STRINGS =
{
"precision_modified",
"strength_modified",
"agility_modified",
"stamina_modified",
"constitution_modified",
"luck_modified",
"camouflage",
"combat_block_value"
};
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
debugConsoleMsg(self, text);
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
obj_id pInv = utils.getInventoryContainer(self);
if (text.equals("qaCharacter"))
{
sendSystemMessageTestingOnly(self, "start menu wooo hoo.");
qaToolMainMenu(self);
}
if (text.equals("writeTemp"))
{
writeTemplateFile();
}
return SCRIPT_CONTINUE;
}
public void qaToolMainMenu(obj_id self) throws InterruptedException
{
qa.refreshMenu(self, QASETUP_PROMPT, QASETUP_TITLE, QASETUP_MAIN_MENU, "handleMainMenu", true, "qasetup.pid", "qasetup.qasetup");
}
public int handleMainMenu(obj_id self, dictionary params) throws InterruptedException
{
if (utils.hasScriptVar(self, "qasetup.pid"))
{
qa.checkParams(params, "qasetup");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String previousMainMenuArray[] = utils.getStringArrayScriptVar(self, "qasetup.qasetup");
if (btn == sui.BP_CANCEL)
{
return SCRIPT_CONTINUE;
}
else
{
String previousSelection = previousMainMenuArray[idx];
if (previousSelection.equals("Quick Buff"))
{
quickBuff(self);
}
if (previousSelection.equals("Set Template"))
{
String[] templateList = dataTableGetColumnNames(TEMPLATE_TABLE);
qa.refreshMenu(self, "Select the profession you wish to use.", "Set Profession", templateList, "handleSetProfession", true, "profession.pid", "qasetup.qasetup");
}
if (previousSelection.equals("Generate Equipment"))
{
qa.refreshMenu(self, "Select the equipment type you want to generate.", "Generate Equipment", EQUIPMENT_OPTIONS, "handleEquipmentMenu", true, "equipment.pid", "equipment.qasetup");
return SCRIPT_CONTINUE;
}
if (previousSelection.equals("Write Template to Disk"))
{
writeTemplateFile();
}
}
}
return SCRIPT_CONTINUE;
}
public void quickBuff(obj_id self) throws InterruptedException
{
String prof = getSkillTemplate(self);
obj_id recipientId = self;
obj_id bufferId = recipientId;
buff.applyBuff(recipientId, "buildabuff_inspiration", 3600);
addSkillModModifier(self, "buildabuff_expertise_action_all", "expertise_action_all", 9, 3600, false, true);
addSkillModModifier(self, "buildabuff_expertise_glancing_blow_all", "expertise_glancing_blow_all", 7, 3600, false, true);
addSkillModModifier(self, "buildabuff_expertise_innate_protection_energy", "expertise_innate_protection_energy", 3750, 3600, false, true);
addSkillModModifier(self, "buildabuff_expertise_innate_protection_kinetic", "expertise_innate_protection_kinetic", 3750, 3600, false, true);
messageTo(self, "recalcPools", null, .25f, false);
messageTo(self, "recalcArmor", null, .25f, false);
buff.applyBuff((recipientId), "me_buff_health_2", 3600);
buff.applyBuff((recipientId), "me_buff_action_3", 3600);
buff.applyBuff((recipientId), "me_buff_strength_3", 3600);
buff.applyBuff((recipientId), "me_buff_agility_3", 3600);
buff.applyBuff((recipientId), "me_buff_precision_3", 3600);
buff.applyBuff((recipientId), "drink_flameout", 3600);
qaToolMainMenu(self);
}
public int handleSetProfession(obj_id self, dictionary params) throws InterruptedException
{
if (utils.hasScriptVar(self, "profession.pid"))
{
qa.checkParams(params, "profession");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String previousMainMenuArray[] = utils.getStringArrayScriptVar(self, "qasetup.qasetup");
if (btn == sui.BP_CANCEL)
{
return SCRIPT_CONTINUE;
}
else
{
String previousSelection = previousMainMenuArray[idx];
String[] selectedTemplate = dataTableGetStringColumn(TEMPLATE_TABLE, previousSelection);
String selectedProf = selectedTemplate[0];
for (int i = 1; i < selectedTemplate.length; i++)
{
int n = 0;
if (!selectedTemplate[i].equals("null"))
{
sendSystemMessageTestingOnly(self, "selectedTemp: " + selectedTemplate[i]);
}
}
sendSystemMessageTestingOnly(self, "Class template: " + selectedProf);
if (!previousSelection.equals("null"))
{
setTemplate(self, selectedTemplate, selectedProf);
}
}
}
return SCRIPT_CONTINUE;
}
public void handleProfessionLevelToNinety(obj_id player, String roadmap) throws InterruptedException
{
revokeAllSkills(player);
int currentCombatXp = getExperiencePoints(player, "combat_general");
grantExperiencePoints(player, "combat_general", -currentCombatXp);
skill.recalcPlayerPools(player, true);
setSkillTemplate(player, roadmap);
respec.autoLevelPlayer(player, 90, false);
utils.fullExpertiseReset(player, false);
skill.setPlayerStatsForLevel(player, 90);
}
public void revokeAllSkills(obj_id player) throws InterruptedException
{
String[] skillList = getSkillListingForPlayer(player);
int attempts = skillList.length;
if ((skillList != null) && (skillList.length != 0))
{
while (skillList.length > 0 && attempts > 0)
{
for (int i = 0; i < skillList.length; i++)
{
String skillName = skillList[i];
if (!skillName.startsWith("species_") && !skillName.startsWith("social_language_") && !skillName.startsWith("utility_") && !skillName.startsWith("common_") && !skillName.startsWith("demo_") && !skillName.startsWith("force_title_") && !skillName.startsWith("force_sensitive_") && !skillName.startsWith("combat_melee_basic") && !skillName.startsWith("pilot_") && !skillName.startsWith("internal_expertise_") && !skillName.startsWith("combat_ranged_weapon_basic"))
{
skill.revokeSkillSilent(player, skillName);
}
}
skillList = getSkillListingForPlayer(player);
--attempts;
}
}
skill.recalcPlayerPools(player, true);
}
public void setTemplate(obj_id self, String[] skillList, String baseClass) throws InterruptedException
{
handleProfessionLevelToNinety(self, baseClass);
utils.fullExpertiseReset(self, false);
for (int j = 1; j < skillList.length; j++)
{
int exotic = 1;
int basic = 1;
String expertiseSkill = skillList[j];
if (expertiseSkill.startsWith("expertise_"))
{
skill.grantSkillToPlayer(self, expertiseSkill);
}
if (expertiseSkill.startsWith("mod_exotic") && exotic <= 3)
{
String[] modString = split(expertiseSkill, ':');
String scriptVarName = "qacharacter.exotic" + exotic;
utils.setScriptVar(self, scriptVarName, modString[1]);
exotic++;
}
if (expertiseSkill.startsWith("mod_basic") && basic <= 3)
{
String[] modString = split(expertiseSkill, ':');
String scriptVarName = "qacharacter.basic" + basic;
utils.setScriptVar(self, scriptVarName, modString[1]);
basic++;
}
}
qaToolMainMenu(self);
}
public void writeTemplateFile() throws InterruptedException
{
obj_id self = getSelf();
sendSystemMessageTestingOnly(self, "In write file method");
String[] pSkill = getSkillListingForPlayer(self);
String prof = getSkillTemplate(self);
String template = "Template Name\n" + "s\n" + prof;
String temp;
int attempts = pSkill.length;
if ((pSkill != null) && (pSkill.length != 0))
{
while (pSkill.length > 0 && attempts > 0)
{
for (int i = 0; i < pSkill.length; i++)
{
String skillName = pSkill[i];
if (skillName.startsWith("expertise_"))
{
temp = pSkill[i];
sendSystemMessageTestingOnly(self, "Adding line: " + pSkill[i]);
template += "\n" + temp;
}
--attempts;
}
}
}
saveTextOnClient(self, "qaSetup_" + getServerFrame() + ".tab", template);
qaToolMainMenu(self);
}
public void startModSelection() throws InterruptedException
{
obj_id self = getSelf();
if (!utils.hasScriptVar(self, "modSelectionInProgress"))
{
boolean rm = removeMods();
utils.setScriptVar(self, "modSelectionInProgress", 1);
utils.setScriptVar(self, "modBasic", 1);
utils.setScriptVar(self, "modExotic", 1);
}
String[] exoticModList = getExoticMods();
int basicCounter = utils.getIntScriptVar(self, "modBasic");
int exoticCounter = utils.getIntScriptVar(self, "modExotic");
if (basicCounter <= 3)
{
qa.refreshMenu(self, "Select basic mod number " + basicCounter + " of 3", "Select Mods", BASIC_MOD_STRINGS, "handleMod", true, "profession.pid", "qasetup.qasetup");
}
if (basicCounter > 3 && exoticCounter <= 3)
{
qa.refreshMenu(self, "Select exotic mod number " + exoticCounter + " of 3", "Select Mods", exoticModList, "handleMod", true, "profession.pid", "qasetup.qasetup");
}
utils.removeScriptVar(self, "modSelectionInProgress");
}
public boolean removeMods() throws InterruptedException
{
obj_id self = getSelf();
for (int j = 1; j < MOD_TYPES.length; j++)
{
if (utils.hasScriptVar(self, MOD_TYPES[j]))
{
utils.removeScriptVar(self, MOD_TYPES[j]);
}
}
if (utils.hasScriptVar(self, "modBasic"))
{
utils.removeScriptVar(self, "modBasic");
}
if (utils.hasScriptVar(self, "modExotic"))
{
utils.removeScriptVar(self, "modExotic");
}
return true;
}
public int handleMod(obj_id self, dictionary params) throws InterruptedException
{
if (utils.hasScriptVar(self, "selectMod.pid"))
{
qa.checkParams(params, "selectMod");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String previousMainMenuArray[] = utils.getStringArrayScriptVar(self, "selectMod.qasetup");
String modChoice = previousMainMenuArray[idx];
int basicCounter = utils.getIntScriptVar(self, "modBasic");
int exoticCounter = utils.getIntScriptVar(self, "modExotic");
String type = "basic";
String modType = "modBasic";
if (basicCounter > 3)
{
type = "exotic";
modType = "modExotic";
}
int modNumber = utils.getIntScriptVar(self, modType);
utils.setScriptVar(self, type + modNumber, 1);
modNumber++;
utils.setScriptVar(self, modType, modNumber);
startModSelection();
}
return SCRIPT_CONTINUE;
}
public String[] getExoticMods() throws InterruptedException
{
String[] skillMods = dataTableGetStringColumn(EXOTIC_MOD_STRINGS, "name");
for (int i = 0; i < skillMods.length; i++)
{
skillMods[i] = utils.packStringId(new string_id("stat_n", skillMods[i]));
}
return skillMods;
}
}
@@ -1,486 +0,0 @@
//**********************************************************
// Title: qaset
// Description: QA Character Setup Tool
//***********************************************************
include java.util.HashSet;
include java.util.StringTokenizer;
include java.util.Vector;
include java.util.Arrays;
include library.utils;
include library.qa;
include library.sui;
include library.skill;
include library.respec;
include library.skill_template;
include library.gm;
include library.buff;
include library.performance;
/*
add to line 2205 in systems/buff/buff_handler
if(attemptingToSpendPoints > actualPointsToSpend && !isGod(self))
*/
// Constants
const string TEMPLATE_TABLE = "datatables/test/qa_setup_expertise.iff";
const string EXOTIC_MOD_STRINGS = "datatables/crafting/reverse_engineering_mods.iff";
const string[] QASETUP_MAIN_MENU = {"Quick Buff", "Set Template", "Generate Equipment", "Write Template to Disk"};
const string QASETUP_TITLE = "QA Setup";
const string QASETUP_PROMPT = "Choose the tool you want to use";
const string[] TOOL_OPTIONS = {
"Quick Setup",
"Quick Buff",
"Set Class and Template",
"Generate Equipment"
};
const string[] MOD_TYPES = {
"basic1",
"basic2",
"basic3",
"exotic1",
"exotic2",
"exotic3"
};
const string[] EQUIPMENT_OPTIONS = {
"Prefered Mods",
"All",
"Weapon",
"Armor",
"Powerups",
"Consumables"
};
const string[] CLASS_LIST = {
"bounty_hunter_1a",
"commando_1a",
"officer_1a",
"force_sensitive_1a",
"medic_1a",
"spy_1a",
"smuggler_1a",
"trader_1a",
"trader_1d",
"trader_1b",
"trader_1c"
};
const string[] BASIC_MOD_STRINGS = {
"precision_modified",
"strength_modified",
"agility_modified",
"stamina_modified",
"constitution_modified",
"luck_modified",
"camouflage",
"combat_block_value"
};
//****************QATool Main Menu*************************************************
trigger OnSpeaking(string text)
{
debugConsoleMsg(self, text);
java.util.StringTokenizer st = new java.util.StringTokenizer (text);
//pInv = players inventory
obj_id pInv = utils.getInventoryContainer(self);
if (text == "qaCharacter")
{
sendSystemMessageTestingOnly(self, "start menu wooo hoo.");
qaToolMainMenu(self);
}
if (text == "writeTemp")
{
writeTemplateFile();
}
return SCRIPT_CONTINUE;
}
//Generates the main menu for the QASetup script
void qaToolMainMenu(obj_id self)
{
qa.refreshMenu(self, QASETUP_PROMPT, QASETUP_TITLE, QASETUP_MAIN_MENU, "handleMainMenu", true, "qasetup.pid", "qasetup.qasetup");
}
messageHandler handleMainMenu()
{
if(utils.hasScriptVar(self, "qasetup.pid"))
{
qa.checkParams(params, "qasetup");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string previousMainMenuArray[] = utils.getStringArrayScriptVar( self, "qasetup.qasetup" );
if(btn == sui.BP_CANCEL)
{
return SCRIPT_CONTINUE;
}
else
{
string previousSelection = previousMainMenuArray[idx];
if (previousSelection == "Quick Buff")
{
quickBuff(self);
}
if (previousSelection == "Set Template")
{
String[] templateList = dataTableGetColumnNames(TEMPLATE_TABLE);
qa.refreshMenu(self, "Select the profession you wish to use.", "Set Profession", templateList, "handleSetProfession", true, "profession.pid", "qasetup.qasetup");
}
if (previousSelection == "Generate Equipment")
{
qa.refreshMenu(self, "Select the equipment type you want to generate.", "Generate Equipment", EQUIPMENT_OPTIONS, "handleEquipmentMenu", true, "equipment.pid", "equipment.qasetup");
return SCRIPT_CONTINUE;
}
if (previousSelection == "Write Template to Disk")
{
writeTemplateFile();
}
}
}
return SCRIPT_CONTINUE;
}
/********************************* QUICK BUFF ***********************************
This section allows the user to instantly recieve a large selection of buffs based
on what a well prepared high level player would use.
*********************************************************************************/
void quickBuff(obj_id self)
{
string prof = getSkillTemplate(self);
obj_id recipientId = self;
obj_id bufferId = recipientId;
buff.applyBuff(recipientId, "buildabuff_inspiration", 3600);
addSkillModModifier(self, "buildabuff_expertise_action_all", "expertise_action_all", 9, 3600, false, true);
addSkillModModifier(self, "buildabuff_expertise_glancing_blow_all", "expertise_glancing_blow_all", 7, 3600, false, true);
addSkillModModifier(self, "buildabuff_expertise_innate_protection_energy", "expertise_innate_protection_energy", 3750, 3600, false, true);
addSkillModModifier(self, "buildabuff_expertise_innate_protection_kinetic", "expertise_innate_protection_kinetic", 3750, 3600, false, true);
messageTo(self, "recalcPools", null, .25f, false);
messageTo(self, "recalcArmor", null, .25f, false);
buff.applyBuff((recipientId), "me_buff_health_2", 3600);
buff.applyBuff((recipientId), "me_buff_action_3", 3600);
buff.applyBuff((recipientId), "me_buff_strength_3", 3600);
buff.applyBuff((recipientId), "me_buff_agility_3", 3600);
buff.applyBuff((recipientId), "me_buff_precision_3", 3600);
buff.applyBuff((recipientId), "drink_flameout", 3600);
qaToolMainMenu(self);
}
//base_class.java(7939): public static boolean addSkillModModifier(obj_id target, String name, String skill, int value, float duration,
/**
* Adds a skillmod modifier to a creature.
* @param target the creature
* @param name the mod name
* @param skill the skill to effect
* @param value modifier value
* @param duration how long it lasts
* @param triggerOnDone flag to trigger OnSkillModDone(string modName) when the mod is removed from the creature*/
/********************************** RESPEC TO LEVEL 90 *************************
This section will allow the user to select a template from a preset list based on
the datatable in "datatables/test/qa_setup_expertise.iff". The script will remove
all existing class and expertise skills. Set the player to level 90 (based on the
template) and grant the preset expertise skills.
The writeTemplateFile allows a user to save his expertise setup to a .tab file to
make it easier to add it to the list of available templates.
********************************************************************************/
//Takes the selected template from the qasetup.tab and passes it to 'setTemplate'
messageHandler handleSetProfession()
{
if(utils.hasScriptVar(self, "profession.pid"))
{
qa.checkParams(params, "profession");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string previousMainMenuArray[] = utils.getStringArrayScriptVar( self, "qasetup.qasetup" );
if(btn == sui.BP_CANCEL)
{
return SCRIPT_CONTINUE;
}
else
{
string previousSelection = previousMainMenuArray[idx];
String[] selectedTemplate = dataTableGetStringColumn(TEMPLATE_TABLE, previousSelection);
string selectedProf = selectedTemplate[0];
for(int i = 1; i < selectedTemplate.length; i++)
{
int n = 0;
if(selectedTemplate[i] != "null")
{
sendSystemMessageTestingOnly(self, "selectedTemp: " + selectedTemplate[i]);
}
}
sendSystemMessageTestingOnly(self, "Class template: " + selectedProf);
if(!previousSelection == "null")
{
setTemplate(self, selectedTemplate, selectedProf);
}
}
}
return SCRIPT_CONTINUE;
}
void handleProfessionLevelToNinety(obj_id player, string roadmap)
{
revokeAllSkills(player);
int currentCombatXp = getExperiencePoints(player, "combat_general");
grantExperiencePoints(player, "combat_general", -currentCombatXp);
skill.recalcPlayerPools(player, true);
setSkillTemplate(player, roadmap);
respec.autoLevelPlayer(player, 90, false);
//reset the expertise
utils.fullExpertiseReset(player, false);
skill.setPlayerStatsForLevel(player, 90);
}
void revokeAllSkills(obj_id player)
{
string[] skillList = getSkillListingForPlayer(player);
int attempts = skillList.length;
if ((skillList != null) && (skillList.length != 0))
{
while(skillList.length > 0 && attempts > 0)
{
for (int i = 0; i < skillList.length; i++)
{
string skillName = skillList[i];
if (!skillName.startsWith ("species_")&& //don't revoke species skills
!skillName.startsWith("social_language_")&&
!skillName.startsWith("utility_")&&
!skillName.startsWith("common_")&&
!skillName.startsWith("demo_")&&
!skillName.startsWith("force_title_")&&
!skillName.startsWith("force_sensitive_")&&
!skillName.startsWith("combat_melee_basic")&&
!skillName.startsWith("pilot_")&&
!skillName.startsWith("internal_expertise_") &&
!skillName.startsWith("combat_ranged_weapon_basic"))
{
skill.revokeSkillSilent(player, skillName);
}
}
// The new skill list is the remaining skills.
skillList = getSkillListingForPlayer(player);
// Prevent data from creating an infinite loop.
--attempts;
}
}
skill.recalcPlayerPools(player, true);
}
//**************************** Expertise **********************************
// Grants expertise skills to the player based on the template skillList
void setTemplate(obj_id self, string[] skillList, string baseClass)
{
handleProfessionLevelToNinety(self, baseClass);
//reset the expertise
utils.fullExpertiseReset(self, false);
for (int j = 1; j < skillList.length; j++)
{
int exotic = 1;
int basic = 1;
string expertiseSkill = skillList[j];
if(expertiseSkill.startsWith("expertise_"))
{
skill.grantSkillToPlayer(self, expertiseSkill);
}
if(expertiseSkill.startsWith("mod_exotic") && exotic <= 3)
{
string[] modString = split(expertiseSkill, ':');
string scriptVarName = "qacharacter.exotic" + exotic;
utils.setScriptVar(self, scriptVarName, modString[1]);
exotic++;
}
if(expertiseSkill.startsWith("mod_basic") && basic <= 3)
{
string[] modString = split(expertiseSkill, ':');
string scriptVarName = "qacharacter.basic" + basic;
utils.setScriptVar(self, scriptVarName, modString[1]);
basic++;
}
}
qaToolMainMenu(self);
}
//Generates a .tab file with the characters expertise skills
void writeTemplateFile()
{
obj_id self = getSelf();
sendSystemMessageTestingOnly(self, "In write file method");
string[] pSkill = getSkillListingForPlayer(self);
string prof = getSkillTemplate(self);
string template = "Template Name\n"+"s\n"+prof;
string temp;
int attempts = pSkill.length;
if ((pSkill != null) && (pSkill.length != 0))
{
while(pSkill.length > 0 && attempts > 0)
{
for (int i = 0; i < pSkill.length; i++)
{
string skillName = pSkill[i];
if (skillName.startsWith ("expertise_"))
{
temp = pSkill[i];
sendSystemMessageTestingOnly(self, "Adding line: " + pSkill[i]);
template += "\n" +temp;
}
--attempts;
}
}
}
saveTextOnClient(self, "qaSetup_" + getServerFrame() + ".tab", template);
qaToolMainMenu(self);
}
//************************************* SELECT MODS ******************************************
void startModSelection()
{
obj_id self = getSelf();
if(!utils.hasScriptVar(self, "modSelectionInProgress"))
{
boolean rm = removeMods();
utils.setScriptVar(self, "modSelectionInProgress", 1);
utils.setScriptVar(self, "modBasic", 1);
utils.setScriptVar(self, "modExotic", 1);
}
string[] exoticModList = getExoticMods();
int basicCounter = utils.getIntScriptVar(self, "modBasic");
int exoticCounter = utils.getIntScriptVar(self, "modExotic");
if(basicCounter <= 3)
{
qa.refreshMenu(self, "Select basic mod number " + basicCounter + " of 3", "Select Mods", BASIC_MOD_STRINGS, "handleMod", true, "profession.pid", "qasetup.qasetup");
}
if(basicCounter > 3 && exoticCounter <= 3)
{
qa.refreshMenu(self, "Select exotic mod number " + exoticCounter + " of 3", "Select Mods", exoticModList, "handleMod", true, "profession.pid", "qasetup.qasetup");
}
utils.removeScriptVar(self, "modSelectionInProgress");
}
boolean removeMods()
{
obj_id self = getSelf();
for (int j = 1; j < MOD_TYPES.length; j++)
{
if(utils.hasScriptVar(self, MOD_TYPES[j]))
{
utils.removeScriptVar(self, MOD_TYPES[j]);
}
}
if(utils.hasScriptVar(self,"modBasic"))
{
utils.removeScriptVar(self, "modBasic");
}
if(utils.hasScriptVar(self,"modExotic"))
{
utils.removeScriptVar(self, "modExotic");
}
return true;
}
messageHandler handleMod()
{
if(utils.hasScriptVar(self, "selectMod.pid"))
{
qa.checkParams(params, "selectMod");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string previousMainMenuArray[] = utils.getStringArrayScriptVar( self, "selectMod.qasetup" );
string modChoice = previousMainMenuArray[idx];
int basicCounter = utils.getIntScriptVar(self, "modBasic");
int exoticCounter = utils.getIntScriptVar(self, "modExotic");
string type = "basic";
string modType = "modBasic";
if(basicCounter > 3)
{
type = "exotic";
modType = "modExotic";
}
int modNumber = utils.getIntScriptVar(self, modType);
utils.setScriptVar(self, type + modNumber, 1);
modNumber++;
utils.setScriptVar(self, modType, modNumber);
startModSelection();
}
return SCRIPT_CONTINUE;
}
string[] getExoticMods()
{
string[] skillMods = dataTableGetStringColumn(EXOTIC_MOD_STRINGS, "name");
for (int i = 0; i < skillMods.length; i++)
{
skillMods[i] = utils.packStringId(new string_id("stat_n", skillMods[i]));
}
return skillMods;
}
@@ -0,0 +1,156 @@
package script.test;
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.qa;
import script.library.sui;
public class qa_cube extends script.base_script
{
public qa_cube()
{
}
public static final String SCRIPTVAR = "qa_cube";
public static final String CUBE_DATATABLE_1 = "datatables/item/loot_cube/republic_assembly_tool.iff";
public static final String CHU_GON_DAR_CUBE = "object/tangible/container/loot/som_cube.iff";
public static final String CHU_GON_DAR_TITLE = "Chu-Gon Dar Cube Tool";
public static final String CHU_GON_DAR_PROMPT = "This tool allows you to quickly obtain items needed to create the items listed below.\n**If you do not have a Cube, one will be created for you.**\n\nSelect an item to create.";
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_cube");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_cube");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR) || (toLower(text)).equals("qacube"))
{
getNamesArray(self);
ChuGonMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handleChuGonOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
String[] itemList = utils.getStringArrayScriptVar(player, SCRIPTVAR + ".codeStringArray");
String itemToSpawnFor = itemList[idx];
spawnBaseItems(player, itemToSpawnFor, idx);
}
return SCRIPT_CONTINUE;
}
public void ChuGonMainMenu(obj_id player) throws InterruptedException
{
if (utils.hasScriptVar(player, SCRIPTVAR + ".codeStringArray") && utils.hasScriptVar(player, SCRIPTVAR + ".showNamesArray"))
{
String[] showNamesArray = utils.getStringArrayScriptVar(player, SCRIPTVAR + ".showNamesArray");
qa.refreshMenu(player, CHU_GON_DAR_PROMPT, CHU_GON_DAR_TITLE, showNamesArray, "handleChuGonOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".ChuGonMainMenu", sui.OK_CANCEL_REFRESH);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
}
}
public void getNamesArray(obj_id player) throws InterruptedException
{
String[] codeStringArray = dataTableGetStringColumn(CUBE_DATATABLE_1, "finalTemplate");
String[] showNamesArray = new String[codeStringArray.length];
for (int i = 0; i < codeStringArray.length; i++)
{
if (codeStringArray[i].endsWith(".iff"))
{
int idxSlash = codeStringArray[i].lastIndexOf("/") + 1;
int idxPeriod = codeStringArray[i].lastIndexOf(".");
String lookUp = codeStringArray[i].substring(idxSlash, idxPeriod) + "_n";
showNamesArray[i] = localize(new string_id("som/som_item", lookUp));
}
else
{
showNamesArray[i] = localize(new string_id("static_item_n", codeStringArray[i]));
}
showNamesArray[i] = showNamesArray[i] + ": (" + codeStringArray[i] + ")";
}
utils.setScriptVar(player, SCRIPTVAR + ".codeStringArray", codeStringArray);
utils.setScriptVar(player, SCRIPTVAR + ".showNamesArray", showNamesArray);
}
public void checkForCube(obj_id player) throws InterruptedException
{
checkInventory(player);
boolean hasCube = false;
obj_id[] invAndEquip = getInventoryAndEquipment(player);
for (int i = 0; i < invAndEquip.length; i++)
{
String templateName = getTemplateName(invAndEquip[i]);
if (templateName.equals("object/tangible/container/loot/som_cube.iff"))
{
hasCube = true;
}
}
if (hasCube == false)
{
obj_id myCube = createObjectInInventoryAllowOverload("object/tangible/container/loot/som_cube.iff", player);
}
}
public void spawnBaseItems(obj_id player, String itemToSpawnFor, int idx) throws InterruptedException
{
checkForCube(player);
obj_id inventory = utils.getInventoryContainer(player);
for (int i = 0; i < 3; i++)
{
String subComponent = dataTableGetString(CUBE_DATATABLE_1, idx, i);
obj_id newObj = createObject(subComponent, inventory, "");
}
sendSystemMessageTestingOnly(player, "The components have been successfully created in your inventory.");
qa.removePlayer(player, SCRIPTVAR, "");
}
public void checkInventory(obj_id player) throws InterruptedException
{
obj_id inventory = utils.getInventoryContainer(player);
obj_id[] invItems = getContents(inventory);
if (invItems.length > 75)
{
sendSystemMessageTestingOnly(player, "Please delete some items from your Inventory and try again.");
}
}
}
@@ -1,190 +0,0 @@
//************************************************************/
// Title: qacube.script
// Description: Testers can use this tool to test all items that are spawned by the Chu-Gon Dar Cube.
// When using this tool, the player will be:
// 1. Given a Chu-Gon Dar Cube
// 2. Given the ability to choose what item they wish to create
// 3. Given the components needed to create the selected item.
//************************************************************/
/********* Includes ******************************************/
include library.utils;
include library.qa;
include library.sui;
/********* CONSTANTS *****************************************/
const string SCRIPTVAR = "qa_cube";
const string CUBE_DATATABLE_1 = "datatables/item/loot_cube/republic_assembly_tool.iff";
const string CHU_GON_DAR_CUBE = "object/tangible/container/loot/som_cube.iff";
const string CHU_GON_DAR_TITLE = "Chu-Gon Dar Cube Tool";
const string CHU_GON_DAR_PROMPT = "This tool allows you to quickly obtain items needed to create the items listed below.\n**If you do not have a Cube, one will be created for you.**\n\nSelect an item to create.";
/********* Triggers ******************************************/
trigger OnAttach()
{
if(isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_cube");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if(!isGod(self))
{
detachScript(self, "test.qa_cube");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if(toLower(text).equals(SCRIPTVAR) || toLower(text).equals("qacube"))
{
getNamesArray(self);
ChuGonMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
messageHandler handleChuGonOptions()
{
if(isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if(idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
//retrieve the item list scriptVar
string[] itemList = utils.getStringArrayScriptVar(player, SCRIPTVAR+".codeStringArray");
//get the item to spawn by referencing the index #
string itemToSpawnFor = itemList[idx];
spawnBaseItems(player, itemToSpawnFor, idx);
}
return SCRIPT_CONTINUE;
}
/***** FUNCTIONS *******************************************************/
//BUILDS THE MAIN TOOL MENU
void ChuGonMainMenu(obj_id player)
{
if(utils.hasScriptVar(player, SCRIPTVAR+".codeStringArray") && utils.hasScriptVar(player, SCRIPTVAR+".showNamesArray"))
{
string[] showNamesArray = utils.getStringArrayScriptVar(player, SCRIPTVAR+".showNamesArray");
qa.refreshMenu(player, CHU_GON_DAR_PROMPT, CHU_GON_DAR_TITLE, showNamesArray, "handleChuGonOptions", SCRIPTVAR+".pid", SCRIPTVAR+".ChuGonMainMenu", sui.OK_CANCEL_REFRESH);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
}
}
void getNamesArray(obj_id player)
{
string[] codeStringArray = dataTableGetStringColumn(CUBE_DATATABLE_1, "finalTemplate");
string[] showNamesArray = new string[codeStringArray.length];
for(int i = 0; i < codeStringArray.length; i++)
{
if(codeStringArray[i].endsWith(".iff"))
{
//Get the indexOf the last "/"
int idxSlash = codeStringArray[i].lastIndexOf("/") + 1;
//Get the index of the last "."
int idxPeriod = codeStringArray[i].lastIndexOf(".");
//Place our findings in the string "lookup"
string lookUp = codeStringArray[i].substring(idxSlash, idxPeriod) + "_n";
//sendSystemMessageTestingOnly(player, lookUp);
showNamesArray[i] = localize(new string_id("som/som_item", lookUp));
}
else
{
showNamesArray[i] = localize(new string_id("static_item_n", codeStringArray[i]));
}
showNamesArray[i] = showNamesArray[i] + ": (" + codeStringArray[i] + ")";
}
utils.setScriptVar(player, SCRIPTVAR+".codeStringArray", codeStringArray);
utils.setScriptVar(player, SCRIPTVAR+".showNamesArray", showNamesArray);
}
void checkForCube(obj_id player)
{
//insure the inventory can hold the droid
checkInventory(player);
boolean hasCube = false;
//get all items in the player's inventory
obj_id[] invAndEquip = getInventoryAndEquipment(player);
for(int i = 0; i < invAndEquip.length; i++)
{
string templateName = getTemplateName(invAndEquip[i]);
//check each template name for the Chu-Gon Dar Cube.
if(templateName == "object/tangible/container/loot/som_cube.iff")
{
hasCube = true;
}
}
//if tester does not have a cube, create one.
if(hasCube == false)
{
obj_id myCube = createObjectInInventoryAllowOverload("object/tangible/container/loot/som_cube.iff", player);
}
}
void spawnBaseItems(obj_id player, string itemToSpawnFor, int idx)
{
checkForCube(player);
//get tester's inventory
obj_id inventory = utils.getInventoryContainer(player);
for(int i = 0; i < 3; i++)
{
string subComponent = dataTableGetString(CUBE_DATATABLE_1, idx, i);
//create the items in the tester's inventory
obj_id newObj = createObject(subComponent, inventory, "");
}
sendSystemMessageTestingOnly(player, "The components have been successfully created in your inventory.");
qa.removePlayer(player, SCRIPTVAR, "");
}
void checkInventory(obj_id player)
{
// get player inventory
obj_id inventory = utils.getInventoryContainer(player);
// get array of items in player inventory
obj_id[] invItems = getContents(inventory);
// test for room in backpack
if(invItems.length > 75)
{
// system message: no room in inventory
sendSystemMessageTestingOnly(player, "Please delete some items from your Inventory and try again.");
}
}
@@ -0,0 +1,318 @@
package script.test;
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.qa;
import script.library.sui;
import script.library.cybernetic;
public class qa_cybernetic extends script.base_script
{
public qa_cybernetic()
{
}
public static final String SCRIPTVAR = "qacybernetic";
public static final int INSTALL_OPTION = 0;
public static final int UNINSTALL_OPTION = 1;
public static final int REPAIR_OPTION = 2;
public static final int STRENGTH_ARM = 0;
public static final int LIGHTNING = 1;
public static final int BURST_RUN = 2;
public static final int REVIVE = 3;
public static final int ARMOR = 4;
public static final int SURE_SHOT = 5;
public static final int CRIT_SNIPE = 6;
public static final int KICK_DOWN = 7;
public static final String ARM_STRENGTH = "object/tangible/wearables/cybernetic/s02/cybernetic_s02_arm_l.iff";
public static final String ARM_LIGHTNING = "object/tangible/wearables/cybernetic/s02/cybernetic_s02_arm_r.iff";
public static final String LEGS_BURST = "object/tangible/wearables/cybernetic/s02/cybernetic_s02_legs.iff";
public static final String ARM_REVIVE = "object/tangible/wearables/cybernetic/s03/cybernetic_s03_arm_l.iff";
public static final String ARM_ARMOR = "object/tangible/wearables/cybernetic/s03/cybernetic_s03_arm_r.iff";
public static final String ARM_SURESHOT = "object/tangible/wearables/cybernetic/s05/cybernetic_s05_arm_l.iff";
public static final String ARM_SNIPE = "object/tangible/wearables/cybernetic/s05/cybernetic_s05_arm_r.iff";
public static final String LEGS_KICK = "object/tangible/wearables/cybernetic/s05/cybernetic_s05_legs.iff";
public static final String[] CYBER_MENU_LIST =
{
"Install",
"Uninstall",
"Repair"
};
public static final String[] CYBERNETIC_LIST_OPTIONS =
{
"Cyborg Strength Arm",
"Cyborg Lightning Arm",
"Cyborg Burst Run Legs",
"Cyborg Revive Arm",
"Cyborg Armor Arm",
"Cyborg Sure Shot Arm",
"Cyborg Critical Snipe Arm",
"Cyborg Kick Down Legs"
};
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_cybernetic");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_cybernetic");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR))
{
toolCyberMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handleChoice(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
switch (idx)
{
case INSTALL_OPTION:
boolean boolCheck = cybernetic.hasMaxInstalled(player);
if (boolCheck == false)
{
installChoiceMenu(player);
}
else
{
sendSystemMessageTestingOnly(player, "This character already has the maximum number of Cybernetics installed!");
}
break;
case UNINSTALL_OPTION:
utils.setScriptVar(player, SCRIPTVAR + ".uninstall", "uninstall");
getAttachedCybers(player);
break;
case REPAIR_OPTION:
utils.setScriptVar(player, SCRIPTVAR + ".repair", "repair");
getAttachedCybers(player);
break;
default:
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
public int handleInstallOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
switch (idx)
{
case STRENGTH_ARM:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", ARM_STRENGTH);
installCyber(player);
break;
case LIGHTNING:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", ARM_LIGHTNING);
installCyber(player);
break;
case BURST_RUN:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", LEGS_BURST);
installCyber(player);
break;
case REVIVE:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", ARM_REVIVE);
installCyber(player);
break;
case ARMOR:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", ARM_ARMOR);
installCyber(player);
break;
case SURE_SHOT:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", ARM_SURESHOT);
installCyber(player);
break;
case CRIT_SNIPE:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", ARM_SNIPE);
installCyber(player);
break;
case KICK_DOWN:
utils.setScriptVar(player, SCRIPTVAR + ".cyberChoice", LEGS_KICK);
installCyber(player);
break;
default:
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
public int handleUninstallRepairChoice(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
String[] list = utils.getStringArrayScriptVar(player, SCRIPTVAR + ".cyberList");
obj_id[] idxObj_id_list = utils.getObjIdArrayScriptVar(player, SCRIPTVAR + ".cyberID");
obj_id idxObj_id = idxObj_id_list[idx];
if (utils.hasScriptVar(player, SCRIPTVAR + ".uninstall"))
{
removeCyber(player, idxObj_id);
}
else if (utils.hasScriptVar(player, SCRIPTVAR + ".repair"))
{
repairCyber(player, idxObj_id);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
toolCyberMainMenu(player);
}
}
return SCRIPT_CONTINUE;
}
public void toolCyberMainMenu(obj_id player) throws InterruptedException
{
qa.refreshMenu(player, "- Cybernetic Install Menu -\nSelect Install, Uninstall or Repair.", "Cybernetic Tool", CYBER_MENU_LIST, "handleChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".CyberMainMenu", sui.OK_CANCEL_REFRESH);
}
public void installChoiceMenu(obj_id player) throws InterruptedException
{
qa.refreshMenu(player, "- Cybernetic List Menu -\nSelect a Cybernetic to install.", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleInstallOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".CyberInstallMenu", sui.OK_CANCEL_REFRESH);
}
public void uninstallChoices(obj_id player, String[] list) throws InterruptedException
{
qa.refreshMenu(player, "- Cybernetic Uninstall Menu -\nChoose a Cybernetic to Uninstall.", "Cybernetic Tool", list, "handleUninstallRepairChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".uninstallMenu", sui.OK_CANCEL_REFRESH);
}
public void repairChoices(obj_id player, String[] list) throws InterruptedException
{
qa.refreshMenu(player, "- Cybernetic Repair Menu -\nChoose a Cybernetic to Repair.", "Cybernetic Tool", list, "handleUninstallRepairChoice", SCRIPTVAR + ".pid", SCRIPTVAR + ".uninstallMenu", sui.OK_CANCEL_REFRESH);
}
public void installCyber(obj_id player) throws InterruptedException
{
if (utils.hasScriptVar(player, SCRIPTVAR + ".cyberChoice"))
{
String myLimb = utils.getStringScriptVar(player, SCRIPTVAR + ".cyberChoice");
obj_id inventory = utils.getInventoryContainer(player);
obj_id cyberItemID = createObject(myLimb, inventory, "");
cybernetic.installCyberneticItem(player, player, cyberItemID);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
toolCyberMainMenu(player);
}
qa.removePlayer(player, SCRIPTVAR, "");
}
public void getAttachedCybers(obj_id player) throws InterruptedException
{
Vector installList = new Vector();
obj_id[] installed = cybernetic.getInstalledCybernetics(player);
if (installed != null)
{
for (int i = 0; i < installed.length; i++)
{
String itemName = getTemplateName(installed[i]);
installList.add(itemName);
}
String[] list = new String[installList.size()];
installList.toArray(list);
utils.setScriptVar(player, SCRIPTVAR + ".cyberID", installed);
utils.setScriptVar(player, SCRIPTVAR + ".cyberList", list);
if (utils.hasScriptVar(player, SCRIPTVAR + ".uninstall"))
{
uninstallChoices(player, list);
}
else if (utils.hasScriptVar(player, SCRIPTVAR + ".repair"))
{
repairChoices(player, list);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
toolCyberMainMenu(player);
}
}
else
{
sendSystemMessageTestingOnly(player, "There are not cybernetics installed on this character.");
toolCyberMainMenu(player);
}
}
public void removeCyber(obj_id player, obj_id idxObj_id) throws InterruptedException
{
cybernetic.unInstallCyberneticItem(player, player, idxObj_id);
qa.removePlayer(player, SCRIPTVAR, "");
}
public void repairCyber(obj_id player, obj_id idxObj_id) throws InterruptedException
{
cybernetic.repairCyberneticItem(player, player, idxObj_id);
qa.removePlayer(player, SCRIPTVAR, "");
}
}
@@ -1,344 +0,0 @@
//************************************************************/
// Title: qacybernetic.script
// Description: Testers will be able to install/uninstall/repair cybernetic limbs without having to find the correct NPCs.
//************************************************************/
/********* Includes ******************************************/
include library.utils;
include library.qa;
include library.sui;
include library.cybernetic;
/********* CONSTANTS *****************************************/
const string SCRIPTVAR = "qacybernetic";
const int INSTALL_OPTION = 0;
const int UNINSTALL_OPTION = 1;
const int REPAIR_OPTION = 2;
const int STRENGTH_ARM = 0;
const int LIGHTNING = 1;
const int BURST_RUN = 2;
const int REVIVE = 3;
const int ARMOR = 4;
const int SURE_SHOT = 5;
const int CRIT_SNIPE = 6;
const int KICK_DOWN = 7;
const string ARM_STRENGTH = "object/tangible/wearables/cybernetic/s02/cybernetic_s02_arm_l.iff";//Cyborg Strength Arm
const string ARM_LIGHTNING = "object/tangible/wearables/cybernetic/s02/cybernetic_s02_arm_r.iff";//Cyborg Lightning Arm
const string LEGS_BURST = "object/tangible/wearables/cybernetic/s02/cybernetic_s02_legs.iff";//Cyborg Burst Run Legs
const string ARM_REVIVE = "object/tangible/wearables/cybernetic/s03/cybernetic_s03_arm_l.iff";//Cyborg Revive Arm
const string ARM_ARMOR = "object/tangible/wearables/cybernetic/s03/cybernetic_s03_arm_r.iff";//Cyborg Armor Arm
const string ARM_SURESHOT = "object/tangible/wearables/cybernetic/s05/cybernetic_s05_arm_l.iff";//Cyborg Sure Shot Arm
const string ARM_SNIPE = "object/tangible/wearables/cybernetic/s05/cybernetic_s05_arm_r.iff";//Cyborg Critical Snipe Arm
const string LEGS_KICK = "object/tangible/wearables/cybernetic/s05/cybernetic_s05_legs.iff";//Cyborg Kick Down Legs
const string[] CYBER_MENU_LIST =
{
"Install",
"Uninstall",
"Repair"
};
const string[] CYBERNETIC_LIST_OPTIONS =
{
"Cyborg Strength Arm",
"Cyborg Lightning Arm",
"Cyborg Burst Run Legs",
"Cyborg Revive Arm",
"Cyborg Armor Arm",
"Cyborg Sure Shot Arm",
"Cyborg Critical Snipe Arm",
"Cyborg Kick Down Legs"
};
/********* Triggers ******************************************/
trigger OnAttach()
{
if(isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_cybernetic");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if(!isGod(self))
{
detachScript(self, "test.qa_cybernetic");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if(toLower(text).equals(SCRIPTVAR))
{
//FUNCTION TO SHOW THE MAIN MENU OF THE TOOL
toolCyberMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
//main menu - tester chooses to ether install, uninstall or repair cybernetics
messageHandler handleChoice()
{
if(isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if(idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
switch(idx)
{
case INSTALL_OPTION:
//check to see if the tester has the max number of cybernetics installed.
boolean boolCheck = cybernetic.hasMaxInstalled(player);
if(boolCheck == false)
{
installChoiceMenu(player);
}
else
{
sendSystemMessageTestingOnly(player, "This character already has the maximum number of Cybernetics installed!");
}
break;
case UNINSTALL_OPTION:
utils.setScriptVar(player, SCRIPTVAR+".uninstall", "uninstall");
getAttachedCybers(player);
break;
case REPAIR_OPTION:
utils.setScriptVar(player, SCRIPTVAR+".repair", "repair");
getAttachedCybers(player);
break;
default:
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR+".pid", SCRIPTVAR+".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
//This is a list of cybernetics a tester can install
messageHandler handleInstallOptions()
{
if(isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR+".pid", SCRIPTVAR+".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if(idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
switch(idx)
{
case STRENGTH_ARM:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", ARM_STRENGTH);
installCyber(player);
break;
case LIGHTNING:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", ARM_LIGHTNING);
installCyber(player);
break;
case BURST_RUN:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", LEGS_BURST);
installCyber(player);
break;
case REVIVE:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", ARM_REVIVE);
installCyber(player);
break;
case ARMOR:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", ARM_ARMOR);
installCyber(player);
break;
case SURE_SHOT:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", ARM_SURESHOT);
installCyber(player);
break;
case CRIT_SNIPE:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", ARM_SNIPE);
installCyber(player);
break;
case KICK_DOWN:
utils.setScriptVar(player, SCRIPTVAR+".cyberChoice", LEGS_KICK);
installCyber(player);
break;
default:
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR+".pid", SCRIPTVAR+".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
//handles the uninstall list - this lists cybernetics currently installed on the tester
messageHandler handleUninstallRepairChoice()
{
if(isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(player, " - Cybernetic Main Menu - \nSelect Install, Uninstall or Repair", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleChoice", SCRIPTVAR+".pid", SCRIPTVAR+".CyberMainMenu", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if(idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
string[] list = utils.getStringArrayScriptVar(player, SCRIPTVAR+".cyberList");
obj_id[] idxObj_id_list = utils.getObjIdArrayScriptVar(player, SCRIPTVAR+".cyberID");
obj_id idxObj_id = idxObj_id_list[idx];
if(utils.hasScriptVar(player, SCRIPTVAR+".uninstall"))
{
removeCyber(player, idxObj_id);
}
else if(utils.hasScriptVar(player, SCRIPTVAR+".repair"))
{
repairCyber(player, idxObj_id);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
toolCyberMainMenu(player);
}
}
return SCRIPT_CONTINUE;
}
//***** FUNCTIONS *******************************************************
//BUILDS THE Cybernetic Tool MAIN MENU
void toolCyberMainMenu(obj_id player)
{
qa.refreshMenu(player, "- Cybernetic Install Menu -\nSelect Install, Uninstall or Repair.", "Cybernetic Tool", CYBER_MENU_LIST, "handleChoice", SCRIPTVAR+".pid", SCRIPTVAR+".CyberMainMenu", sui.OK_CANCEL_REFRESH);
}
//Builds the install choice menu - this is a list of available cybernetic limbs
void installChoiceMenu(obj_id player)
{
qa.refreshMenu(player, "- Cybernetic List Menu -\nSelect a Cybernetic to install.", "Cybernetic Tool", CYBERNETIC_LIST_OPTIONS, "handleInstallOptions", SCRIPTVAR+".pid", SCRIPTVAR+".CyberInstallMenu", sui.OK_CANCEL_REFRESH);
}
//show the player which cybernetics are currently installed
void uninstallChoices(obj_id player, string[] list)
{
qa.refreshMenu(player, "- Cybernetic Uninstall Menu -\nChoose a Cybernetic to Uninstall.", "Cybernetic Tool", list, "handleUninstallRepairChoice", SCRIPTVAR+".pid", SCRIPTVAR+".uninstallMenu", sui.OK_CANCEL_REFRESH);
}
//show the player which cybernetics are currently installed
void repairChoices(obj_id player, string[] list)
{
qa.refreshMenu(player, "- Cybernetic Repair Menu -\nChoose a Cybernetic to Repair.", "Cybernetic Tool", list, "handleUninstallRepairChoice", SCRIPTVAR+".pid", SCRIPTVAR+".uninstallMenu", sui.OK_CANCEL_REFRESH);
}
//install the cybernetic the player chooses
void installCyber(obj_id player)
{
if(utils.hasScriptVar(player, SCRIPTVAR+".cyberChoice"))
{
string myLimb = utils.getStringScriptVar(player, SCRIPTVAR+".cyberChoice");
obj_id inventory = utils.getInventoryContainer(player);
obj_id cyberItemID = createObject(myLimb, inventory, "");
cybernetic.installCyberneticItem(player, player, cyberItemID);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
toolCyberMainMenu(player);
}
qa.removePlayer(player, SCRIPTVAR, "");
}
//repairCyberneticItem(obj_id player, obj_id npc, obj_id item)
void getAttachedCybers(obj_id player)
{
Vector installList = new Vector();
obj_id[] installed = cybernetic.getInstalledCybernetics(player);
if(installed != null)
{
for(int i = 0; i < installed.length; i++)
{
string itemName = getTemplateName(installed[i]);
installList.add(itemName);
}
string[] list = new string[installList.size()];
installList.toArray(list);
utils.setScriptVar(player, SCRIPTVAR+".cyberID", installed);
utils.setScriptVar(player, SCRIPTVAR+".cyberList", list);
if(utils.hasScriptVar(player, SCRIPTVAR+".uninstall"))
{
uninstallChoices(player, list);
}
else if(utils.hasScriptVar(player, SCRIPTVAR+".repair"))
{
repairChoices(player, list);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please try again.");
toolCyberMainMenu(player);
}
}
else
{
sendSystemMessageTestingOnly(player, "There are not cybernetics installed on this character.");
toolCyberMainMenu(player);
}
}
//remove cybernetics once the tester has chosen which to remove
void removeCyber(obj_id player, obj_id idxObj_id)
{
cybernetic.unInstallCyberneticItem(player, player, idxObj_id);
qa.removePlayer(player, SCRIPTVAR, "");
}
//repair cybernetics once the tester has chosen which to repair
void repairCyber(obj_id player, obj_id idxObj_id)
{
cybernetic.repairCyberneticItem(player, player, idxObj_id);
qa.removePlayer(player, SCRIPTVAR, "");
}
@@ -0,0 +1,144 @@
package script.test;
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.qa;
import script.library.sui;
import script.library.utils;
public class qa_damage extends script.base_script
{
public qa_damage()
{
}
public static final String DAMAGE_PID_SCRIPTVAR = "doDamage.pid";
public static final String DAMAGE_SCRIPTVAR = "doDamageVar";
public static final String HEAL_PID_SCRIPTVAR = "healDamage.pid";
public static final String HEAL_SCRIPTVAR = "healDamageVar";
public static final String HEAL_TOOL_PROMPT = "Give the amount you want to heal the target for. This tool will heal in the amount you specify as long as it doesn't exceed the target's maximum health.";
public static final String HEAL_TOOL_TITLE = "HEAL AMOUNT";
public static final String DAMAGE_TOOL_PROMPT = "Give the amount you want to damage the target for. This tool will cause damage in the amount you specify. ARMOR AND OTHER MITIGATION WILL NOT BE CONSIDERED. Use the Mitigation Tool to test Mitigation.";
public static final String DAMAGE_TOOL_TITLE = "DAMAGE AMOUNT";
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qatool");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qatool");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals("qadamage") || (toLower(text)).equals("mobdamage") || (toLower(text)).equals("playerdamage"))
{
qa.damageMobTool(self);
}
else if ((toLower(text)).equals("heal") || (toLower(text)).equals("mobheal") || (toLower(text)).equals("playerheal"))
{
qa.healMobTool(self);
}
}
return SCRIPT_CONTINUE;
}
public int doTheDamage(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, DAMAGE_PID_SCRIPTVAR))
{
qa.checkParams(params, "doDamage");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int damageAmount = sui.getTransferInputTo(params);
int healthWhenAttacked = utils.getIntScriptVar(self, DAMAGE_SCRIPTVAR + ".targetCurrentHealth");
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, DAMAGE_SCRIPTVAR + ".lookAtTarget"));
int healthRightNow = getAttrib(lookAtTarget, HEALTH);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "Tool Exiting");
return SCRIPT_CONTINUE;
}
else
{
if (damageAmount > 0 && isIdValid(lookAtTarget))
{
damage(lookAtTarget, DAMAGE_KINETIC, HIT_LOCATION_BODY, damageAmount);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has healed (" + lookAtTarget + ") using the QA Damage Tool.");
sendSystemMessageTestingOnly(self, "Damage to target completed.");
}
else
{
sendSystemMessageTestingOnly(self, "Variables not valid");
}
removePlayer(self, "");
}
}
}
return SCRIPT_CONTINUE;
}
public int healDamage(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, HEAL_PID_SCRIPTVAR))
{
qa.checkParams(params, "healDamage");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int healAmount = sui.getTransferInputTo(params);
int healthWhenAttacked = utils.getIntScriptVar(self, HEAL_SCRIPTVAR + ".targetCurrentHealth");
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, HEAL_SCRIPTVAR + ".lookAtTarget"));
int healthRightNow = getAttrib(lookAtTarget, HEALTH);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "Tool Exiting");
return SCRIPT_CONTINUE;
}
else
{
if (healAmount > 0 && isIdValid(lookAtTarget))
{
int totalHeal = healAmount + healthRightNow;
setAttrib(lookAtTarget, HEALTH, totalHeal);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has healed (" + lookAtTarget + ") using the QA Heal Tool.");
sendSystemMessageTestingOnly(self, "Heal target completed.");
}
else
{
sendSystemMessageTestingOnly(self, "Variables not valid");
}
removePlayer(self, "");
}
}
}
return SCRIPT_CONTINUE;
}
public void removePlayer(obj_id self, String err) throws InterruptedException
{
sendSystemMessageTestingOnly(self, err);
qa.removeScriptVars(self, DAMAGE_SCRIPTVAR);
qa.removeScriptVars(self, DAMAGE_PID_SCRIPTVAR);
utils.removeScriptVarTree(self, DAMAGE_SCRIPTVAR);
utils.removeScriptVarTree(self, DAMAGE_PID_SCRIPTVAR);
qa.removeScriptVars(self, HEAL_SCRIPTVAR);
qa.removeScriptVars(self, HEAL_PID_SCRIPTVAR);
utils.removeScriptVarTree(self, HEAL_SCRIPTVAR);
utils.removeScriptVarTree(self, HEAL_PID_SCRIPTVAR);
}
}
@@ -1,168 +0,0 @@
// ======================================================================
// QA Tool - Damage/Health Tool Version 1.50
//
// not for public use
//
// Attach the test.qatools script to the test character and use the spatial command 'damage'. If the tester has a valid mob or player targeted (to include themself) a SUI will instantiate
// and give the tester a transfer UI with the target's current health max. The tester can use the slider to subtract health from the target for any testing purpose
//
// ======================================================================
//
/***** INCLUDES ********************************************************/
include library.qa;
include library.sui;
include library.utils;
/***** CONSTANTS *******************************************************/
const string DAMAGE_PID_SCRIPTVAR = "doDamage.pid";
const string DAMAGE_SCRIPTVAR = "doDamageVar";
const string HEAL_PID_SCRIPTVAR = "healDamage.pid";
const string HEAL_SCRIPTVAR = "healDamageVar";
const string HEAL_TOOL_PROMPT = "Give the amount you want to heal the target for. This tool will heal in the amount you specify as long as it doesn't exceed the target's maximum health.";
const string HEAL_TOOL_TITLE = "HEAL AMOUNT";
const string DAMAGE_TOOL_PROMPT = "Give the amount you want to damage the target for. This tool will cause damage in the amount you specify. ARMOR AND OTHER MITIGATION WILL NOT BE CONSIDERED. Use the Mitigation Tool to test Mitigation.";
const string DAMAGE_TOOL_TITLE = "DAMAGE AMOUNT";
/***** TRIGGERS *******************************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qatool");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qatool");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if ( toLower(text).equals("qadamage") || toLower(text).equals("mobdamage") || toLower(text).equals("playerdamage"))
{
qa.damageMobTool(self);
}
else if ( toLower(text).equals("heal") || toLower(text).equals("mobheal") || toLower(text).equals("playerheal"))
{
qa.healMobTool(self);
}
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler doTheDamage()
{
if (isGod(self))
{
if (utils.hasScriptVar( self, DAMAGE_PID_SCRIPTVAR))
{
//sendSystemMessageTestingOnly(self, "handler doTheDamage");
qa.checkParams(params, "doDamage");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int damageAmount = sui.getTransferInputTo(params);
int healthWhenAttacked = utils.getIntScriptVar(self, DAMAGE_SCRIPTVAR + ".targetCurrentHealth");
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, DAMAGE_SCRIPTVAR + ".lookAtTarget"));
int healthRightNow = getAttrib(lookAtTarget, HEALTH);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "Tool Exiting");
return SCRIPT_CONTINUE;
}
else
{
if (damageAmount > 0 && isIdValid(lookAtTarget))
{
damage(lookAtTarget, DAMAGE_KINETIC, HIT_LOCATION_BODY, damageAmount);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has healed (" + lookAtTarget + ") using the QA Damage Tool.");
sendSystemMessageTestingOnly(self, "Damage to target completed.");
}
else
{
sendSystemMessageTestingOnly(self, "Variables not valid");
}
removePlayer(self, "");
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler healDamage()
{
if (isGod(self))
{
if (utils.hasScriptVar(self, HEAL_PID_SCRIPTVAR))
{
//sendSystemMessageTestingOnly(self, "handler healDamage");
qa.checkParams(params, "healDamage");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int healAmount = sui.getTransferInputTo(params);
int healthWhenAttacked = utils.getIntScriptVar(self, HEAL_SCRIPTVAR + ".targetCurrentHealth");
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, HEAL_SCRIPTVAR + ".lookAtTarget"));
int healthRightNow = getAttrib(lookAtTarget, HEALTH);
if (btn == sui.BP_CANCEL)
{
removePlayer(self, "Tool Exiting");
return SCRIPT_CONTINUE;
}
else
{
if (healAmount > 0 && isIdValid(lookAtTarget))
{
int totalHeal = healAmount + healthRightNow;
setAttrib(lookAtTarget, HEALTH, totalHeal);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has healed (" + lookAtTarget + ") using the QA Heal Tool.");
// sendSystemMessageTestingOnly(self, ""+totalHeal);
sendSystemMessageTestingOnly(self, "Heal target completed.");
}
else
{
sendSystemMessageTestingOnly(self, "Variables not valid");
}
removePlayer(self, "");
}
}
}
return SCRIPT_CONTINUE;
}
//THIS FUNCTION IS A GENERIC SCRIPT REMOVAL FUNCTION
void removePlayer(obj_id self, string err)
{
sendSystemMessageTestingOnly(self, err);
qa.removeScriptVars(self, DAMAGE_SCRIPTVAR);
qa.removeScriptVars(self, DAMAGE_PID_SCRIPTVAR);
utils.removeScriptVarTree(self, DAMAGE_SCRIPTVAR);
utils.removeScriptVarTree(self, DAMAGE_PID_SCRIPTVAR);
qa.removeScriptVars(self, HEAL_SCRIPTVAR);
qa.removeScriptVars(self, HEAL_PID_SCRIPTVAR);
utils.removeScriptVarTree(self, HEAL_SCRIPTVAR);
utils.removeScriptVarTree(self, HEAL_PID_SCRIPTVAR);
}
@@ -0,0 +1,213 @@
package script.test;
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.qa;
import script.library.sui;
import script.library.static_item;
public class qa_dynamic extends script.base_script
{
public qa_dynamic()
{
}
public static final String SCRIPTVAR = "qadynamic";
public static final String DYNAMIC_DESCRIPTION = "This tool allows a tester to spawn armor, clothing and weapons based on a selected level. The items spawned resemble what a player would find on a mob in-game as random loot.";
public static final String[] DATA_SOURCE_MENU_LIST =
{
"spawn dynamic armor",
"spawn dynamic clothing",
"spawn dynamic weapons"
};
public static final int DYNAMIC_ARMOR = 0;
public static final int DYNAMIC_CLOTHING = 1;
public static final int DYNAMIC_WEAPONS = 2;
public static final String DYNAMIC_ARMOR_TABLE = "datatables/item/dynamic_item/types/armor.iff";
public static final String DYNAMIC_CLOTHING_TABLE = "datatables/item/dynamic_item/types/clothing.iff";
public static final String DYNAMIC_WEAPONS_TABLE = "datatables/item/dynamic_item/types/weapons.iff";
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_dynamic");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_dynamic");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR))
{
toolArmorMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handleMainOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
int idx = sui.getListboxSelectedRow(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
switch (idx)
{
case DYNAMIC_ARMOR:
utils.setScriptVar(player, SCRIPTVAR + ".dynamicChoice", DYNAMIC_ARMOR_TABLE);
sui.inputbox(player, player, "Enter the Armor Level.", "handleLevelSelect");
break;
case DYNAMIC_CLOTHING:
utils.setScriptVar(player, SCRIPTVAR + ".dynamicChoice", DYNAMIC_CLOTHING_TABLE);
sui.inputbox(player, player, "Enter the Clothing Level.", "handleLevelSelect");
break;
case DYNAMIC_WEAPONS:
utils.setScriptVar(player, SCRIPTVAR + ".dynamicChoice", DYNAMIC_WEAPONS_TABLE);
sui.inputbox(player, player, "Enter the Weapon Level.", "handleLevelSelect");
break;
default:
qa.qaToolMainMenu(self);
qa.removePlayer(player, SCRIPTVAR, "This Armor is not currently available.");
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
public int handleLevelSelect(obj_id self, dictionary params) throws InterruptedException
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".dynamicChoice"))
{
obj_id player = sui.getPlayerId(params);
String text = sui.getInputBoxText(params);
int level = utils.stringToInt(text);
if (level < 1 || level > 90)
{
sendSystemMessageTestingOnly(player, "Invalid level entered!");
}
else
{
utils.setScriptVar(player, SCRIPTVAR + ".dynamicLevel", level);
getColumnToDisplay(player);
}
}
else
{
sendSystemMessageTestingOnly(self, "There was an error with the previous selection - please try again");
qa.removePlayer(self, SCRIPTVAR, "");
}
return SCRIPT_CONTINUE;
}
public int handleDynamicSpawn(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
toolArmorMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if (utils.hasScriptVar(player, SCRIPTVAR + ".listTracking"))
{
String[] dataTableNameColumn = utils.getStringArrayScriptVar(player, SCRIPTVAR + ".listTracking");
String spawnNameChoice = dataTableNameColumn[idx];
createStatics(player, spawnNameChoice);
}
else
{
sendSystemMessageTestingOnly(player, "There was an error with the previous selection - please try again");
qa.removePlayer(player, SCRIPTVAR, "");
}
}
return SCRIPT_CONTINUE;
}
public void columnNamesDisplay(obj_id player, String[] dataTableNames) throws InterruptedException
{
qa.refreshMenu(player, DYNAMIC_DESCRIPTION, "Dynamic Spawner", dataTableNames, "handleDynamicSpawn", SCRIPTVAR + ".pid", SCRIPTVAR + ".columnsMenu", sui.OK_CANCEL_REFRESH);
}
public void toolArmorMainMenu(obj_id player) throws InterruptedException
{
qa.refreshMenu(player, DYNAMIC_DESCRIPTION, "Dynamic Spawner", DATA_SOURCE_MENU_LIST, "handleMainOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".dynamicMainMenu", sui.OK_CANCEL_REFRESH);
}
public void getColumnToDisplay(obj_id player) throws InterruptedException
{
String[] dataTableNameColumn = dataTableGetStringColumn(utils.getStringScriptVar(player, SCRIPTVAR + ".dynamicChoice"), "strName");
Arrays.sort(dataTableNameColumn);
if (dataTableNameColumn.length >= 1)
{
utils.setScriptVar(player, SCRIPTVAR + ".listTracking", dataTableNameColumn);
columnNamesDisplay(player, dataTableNameColumn);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please contact the Tool Team.");
qa.removePlayer(player, SCRIPTVAR, "");
}
}
public void createStatics(obj_id player, String spawnNameChoice) throws InterruptedException
{
obj_id inventory = utils.getInventoryContainer(player);
if (utils.hasScriptVar(player, SCRIPTVAR + ".dynamicLevel"))
{
int chosenLevel = utils.getIntScriptVar(player, SCRIPTVAR + ".dynamicLevel");
int number = 40;
for (int i = 0; i < number; i++)
{
obj_id myObj = static_item.makeDynamicObject(spawnNameChoice, inventory, chosenLevel);
}
qa.findOrCreateAndEquipQABag(player, inventory, true);
sendSystemMessageTestingOnly(player, "Spawning of dynamic items is complete");
qa.removePlayer(player, SCRIPTVAR, "");
}
else
{
sendSystemMessageTestingOnly(player, "There was an error with the previous selection - please try again");
qa.removePlayer(player, SCRIPTVAR, "");
}
}
}
@@ -1,237 +0,0 @@
//************************************************************/
// Title: qa_dynamic.script
// Description: Dynamic Loot Tool
//************************************************************/
/********* Includes ******************************************/
include library.utils;
include library.qa;
include library.sui;
include library.static_item;
/********* CONSTANTS *****************************************/
const string SCRIPTVAR = "qadynamic";
const string DYNAMIC_DESCRIPTION = "This tool allows a tester to spawn armor, clothing and weapons based on a selected level. The items spawned resemble what a player would find on a mob in-game as random loot.";
const string[] DATA_SOURCE_MENU_LIST =
{
"spawn dynamic armor",
"spawn dynamic clothing",
"spawn dynamic weapons"
};
const int DYNAMIC_ARMOR = 0;
const int DYNAMIC_CLOTHING = 1;
const int DYNAMIC_WEAPONS = 2;
/*********************Data Sources****************************/
const string DYNAMIC_ARMOR_TABLE = "datatables/item/dynamic_item/types/armor.iff";
const string DYNAMIC_CLOTHING_TABLE = "datatables/item/dynamic_item/types/clothing.iff";
const string DYNAMIC_WEAPONS_TABLE = "datatables/item/dynamic_item/types/weapons.iff";
/********* Triggers ******************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_dynamic");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_dynamic");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if (isGod(self))
{
if (toLower(text).equals(SCRIPTVAR))
{
//FUNCTION TO SHOW THE MAIN MENU OF THE TOOL
toolArmorMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
//Armor Type Options
messageHandler handleMainOptions()
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
int idx = sui.getListboxSelectedRow(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
switch (idx)
{
case DYNAMIC_ARMOR:
utils.setScriptVar(player, SCRIPTVAR+".dynamicChoice", DYNAMIC_ARMOR_TABLE);
sui.inputbox(player, player, "Enter the Armor Level.", "handleLevelSelect");
break;
case DYNAMIC_CLOTHING:
utils.setScriptVar(player, SCRIPTVAR+".dynamicChoice", DYNAMIC_CLOTHING_TABLE);
sui.inputbox(player, player, "Enter the Clothing Level.", "handleLevelSelect");
break;
case DYNAMIC_WEAPONS:
utils.setScriptVar(player, SCRIPTVAR+".dynamicChoice", DYNAMIC_WEAPONS_TABLE);
sui.inputbox(player, player, "Enter the Weapon Level.", "handleLevelSelect");
break;
default:
qa.qaToolMainMenu(self);
qa.removePlayer(player, SCRIPTVAR, "This Armor is not currently available.");
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleLevelSelect()
{
if(utils.hasScriptVar(self, SCRIPTVAR+".dynamicChoice"))
{
obj_id player = sui.getPlayerId(params);
string text = sui.getInputBoxText(params);
int level = utils.stringToInt(text);
if (level < 1 || level > 90)
{
sendSystemMessageTestingOnly(player, "Invalid level entered!");
}
else
{
utils.setScriptVar(player, SCRIPTVAR+".dynamicLevel", level);
getColumnToDisplay(player);
}
}
else
{
sendSystemMessageTestingOnly(self, "There was an error with the previous selection - please try again");
qa.removePlayer(self, SCRIPTVAR, "");
}
return SCRIPT_CONTINUE;
}
messageHandler handleDynamicSpawn()
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
toolArmorMainMenu(player);
utils.removeScriptVarTree(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
if(utils.hasScriptVar(player, SCRIPTVAR+".listTracking"))
{
string[] dataTableNameColumn = utils.getStringArrayScriptVar(player, SCRIPTVAR+".listTracking");
string spawnNameChoice = dataTableNameColumn[idx];
createStatics(player, spawnNameChoice);
}
else
{
sendSystemMessageTestingOnly(player, "There was an error with the previous selection - please try again");
qa.removePlayer(player, SCRIPTVAR, "");
}
}
return SCRIPT_CONTINUE;
}
/***** FUNCTIONS *******************************************************/
//BUILDS DYNAMIC SPAWN CHOICES FROM THE SELECTED DATATABLE
void columnNamesDisplay(obj_id player, string[] dataTableNames)
{
qa.refreshMenu(player, DYNAMIC_DESCRIPTION, "Dynamic Spawner", dataTableNames, "handleDynamicSpawn", SCRIPTVAR+".pid", SCRIPTVAR+".columnsMenu", sui.OK_CANCEL_REFRESH);
}
//BUILDS THE DYNAMIC TOOL MAIN MENU
void toolArmorMainMenu(obj_id player)
{
qa.refreshMenu(player, DYNAMIC_DESCRIPTION, "Dynamic Spawner", DATA_SOURCE_MENU_LIST, "handleMainOptions", SCRIPTVAR+".pid", SCRIPTVAR+".dynamicMainMenu", sui.OK_CANCEL_REFRESH);
}
void getColumnToDisplay(obj_id player)
{
/*********************Datatable*****************************/
string[] dataTableNameColumn = dataTableGetStringColumn(utils.getStringScriptVar(player, SCRIPTVAR+".dynamicChoice"), "strName");
Arrays.sort(dataTableNameColumn);
if(dataTableNameColumn.length >= 1)
{
utils.setScriptVar(player, SCRIPTVAR+".listTracking", dataTableNameColumn);
columnNamesDisplay(player, dataTableNameColumn);
}
else
{
sendSystemMessageTestingOnly(player, "An error has occurred, please contact the Tool Team.");
qa.removePlayer(player, SCRIPTVAR, "");
}
}
void createStatics(obj_id player, string spawnNameChoice)
{
//get player inventory
obj_id inventory = utils.getInventoryContainer(player);
//ensure the tester has this scriptvar before continuing
if(utils.hasScriptVar(player, SCRIPTVAR+".dynamicLevel"))
{
int chosenLevel = utils.getIntScriptVar(player, SCRIPTVAR+".dynamicLevel");
int number = 40;
for(int i = 0; i < number; i++)
{
obj_id myObj = static_item.makeDynamicObject(spawnNameChoice, inventory, chosenLevel);
}
//QABag function - checks inventory for QABag - if not - creates one.
qa.findOrCreateAndEquipQABag(player, inventory, true);
sendSystemMessageTestingOnly(player, "Spawning of dynamic items is complete");
qa.removePlayer(player, SCRIPTVAR, "");
}
else
{
sendSystemMessageTestingOnly(player, "There was an error with the previous selection - please try again");
qa.removePlayer(player, SCRIPTVAR, "");
}
}
@@ -0,0 +1,123 @@
package script.test;
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 java.util.StringTokenizer;
import script.library.create;
import script.library.combat;
import script.library.qa;
import script.library.sui;
import script.library.utils;
public class qa_helper extends script.base_script
{
public qa_helper()
{
}
public static final String PID_SCRIPTVAR = "qa_helper";
public static final String SCRIPTVAR = "qahelper";
public static final String SCRIPTVAR_MOB = "qahelper_record";
public static final String CREATURE_TABLE = "datatables/mob/creatures.iff";
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if (text.startsWith(SCRIPTVAR))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
String cmd = st.nextToken();
String arg = "";
if (st.hasMoreTokens())
{
arg = st.nextToken();
}
makeHelper(self, arg);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int OnCreatureDamaged(obj_id self, obj_id attacker, obj_id weapon, int[] damage) throws InterruptedException
{
if (hasScript(self, "player.yavin_e3") && utils.getBooleanScriptVar(self, SCRIPTVAR_MOB + ".recordDamage") && utils.getObjIdScriptVar(attacker, "spawnedBy") == self)
{
sendSystemMessageTestingOnly(self, "Damage numbers will not be accurate due to player.yavin_e3 script attached to your character");
}
else
{
if (utils.getObjIdScriptVar(attacker, "spawnedBy") == self)
{
if (utils.getBooleanScriptVar(self, SCRIPTVAR_MOB + ".recordDamage"))
{
String weaponString = "";
String unlocalizedWeaponName = "";
int testerHealth = utils.getIntScriptVar(self, SCRIPTVAR_MOB + ".healthVar");
int currentTime = getGameTime();
int currentHealth = getAttrib(self, HEALTH);
int damageAmount = testerHealth - currentHealth;
utils.setScriptVar(self, SCRIPTVAR_MOB + ".healthVar", currentHealth);
obj_id objWeapon = getCurrentWeapon(attacker);
String objectWeaponName = getName(objWeapon);
int staticItem = objectWeaponName.indexOf("static_item_n:");
int nonStaticItem = objectWeaponName.indexOf("weapon_name:");
if (nonStaticItem > -1)
{
unlocalizedWeaponName = objectWeaponName.substring(12);
weaponString = localize(new string_id("weapon_name", unlocalizedWeaponName));
}
else if (staticItem > -1)
{
unlocalizedWeaponName = objectWeaponName.substring(14);
weaponString = localize(new string_id("static_item_n", unlocalizedWeaponName));
}
else if (!unlocalizedWeaponName.equals(""))
{
weaponString = unlocalizedWeaponName;
}
else
{
weaponString = "Error Retirieving Weapon Data";
}
String damageData = attacker + "\t" + currentTime + "\t " + damageAmount + "\t" + weaponString + "\r\n";
String appendDamage = "";
String damageDone = utils.getStringScriptVar(self, SCRIPTVAR_MOB + ".damageDone");
if (!damageDone.equals("No Data"))
{
appendDamage = damageDone + damageData;
}
else
{
appendDamage = damageData;
}
utils.setScriptVar(self, SCRIPTVAR_MOB + ".damageDone", appendDamage);
currentHealth = 0;
damageAmount = 0;
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
public void makeHelper(obj_id self, String argumentString) throws InterruptedException
{
int creatureRowNumber = dataTableSearchColumnForString(argumentString, "creatureName", CREATURE_TABLE);
if (creatureRowNumber > -1)
{
obj_id helperMob = create.createCreature(argumentString, getLocation(self), true);
attachScript(helperMob, "test.qa_ai_helper_attach");
sendSystemMessageTestingOnly(self, "Helper Created. Use radial menu.");
dictionary creatureRow = dataTableGetRow(CREATURE_TABLE, creatureRowNumber);
utils.setScriptVar(self, SCRIPTVAR + ".creatureDictionary", creatureRow);
}
else
{
sendSystemMessageTestingOnly(self, "Creature name invalid.");
}
}
}
@@ -1,155 +0,0 @@
// ======================================================================
// qa_helper.script
// [internal]
// QA Tool - AI Helper Tool Version 1.00
// [public]
// not for public use
// [testplan]
// Attach the test.qatools script to the test character and use the spatial command 'qahelper'.
// ======================================================================
//
/***** INCLUDES ********************************************************/
include java.util.StringTokenizer;
include library.create;
include library.combat;
include library.qa;
include library.sui;
include library.utils;
/***** CONSTANTS *******************************************************/
const string PID_SCRIPTVAR = "qa_helper";
const string SCRIPTVAR = "qahelper";
const string SCRIPTVAR_MOB = "qahelper_record";
const string CREATURE_TABLE = "datatables/mob/creatures.iff";
//const int MAXHEALTH = getMaxAttrib( self, HEALTH );
/***** TRIGGER *******************************************************/
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if (text.startsWith(SCRIPTVAR))
{
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
string cmd = st.nextToken();
string arg = "";
if (st.hasMoreTokens())
arg = st.nextToken();
makeHelper(self, arg);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
trigger OnCreatureDamaged(obj_id attacker, obj_id weapon, int[] damage)
{
if (hasScript(self, "player.yavin_e3") && utils.getBooleanScriptVar(self, SCRIPTVAR_MOB+".recordDamage") && utils.getObjIdScriptVar(attacker, "spawnedBy") == self)
{
sendSystemMessageTestingOnly(self, "Damage numbers will not be accurate due to player.yavin_e3 script attached to your character");
}
else
{
//check to make sure we are registering hits from the helper
if (utils.getObjIdScriptVar(attacker, "spawnedBy") == self)
{
//make sure we are recording
if (utils.getBooleanScriptVar(self, SCRIPTVAR_MOB+".recordDamage"))
{
string weaponString = "";
string unlocalizedWeaponName = "";
int testerHealth = utils.getIntScriptVar(self, SCRIPTVAR_MOB+".healthVar");
int currentTime = getGameTime();
int currentHealth = getAttrib(self, HEALTH);
int damageAmount = testerHealth - currentHealth;
//sendSystemMessageTestingOnly(attacker, "testerHealth: "+ testerHealth);
//sendSystemMessageTestingOnly(attacker, "testerHealth: "+ testerHealth);
//sendSystemMessageTestingOnly(attacker, "testerHealth: "+ testerHealth);
//set the health value to the current value so we can get an accurate damage number next time
utils.setScriptVar(self, SCRIPTVAR_MOB+".healthVar", currentHealth);
//Get weapon data
obj_id objWeapon = getCurrentWeapon(attacker);
string objectWeaponName = getName(objWeapon);
int staticItem = objectWeaponName.indexOf("static_item_n:");
int nonStaticItem = objectWeaponName.indexOf("weapon_name:");
//The weapon used could be in one of 2 string files on the server (see above)
//Based on the int value, the weapon data will be saved/exported in the report
if (nonStaticItem > -1)
{
unlocalizedWeaponName = objectWeaponName.substring(12);
weaponString = localize(new string_id( "weapon_name", unlocalizedWeaponName));
}
else if (staticItem > -1)
{
unlocalizedWeaponName = objectWeaponName.substring(14);
weaponString = localize(new string_id( "static_item_n", unlocalizedWeaponName));
}
//Make the weapon string the unlocalized code string if the string isn't localized. Better a code string than nothing
else if (unlocalizedWeaponName != "")
{
weaponString = unlocalizedWeaponName;
}
//If all else fails, leave an error message so that the user will contact tool team to fix
else
{
weaponString = "Error Retirieving Weapon Data";
}
//sendSystemMessageTestingOnly(attacker, "weaponString: "+ weaponString);
string damageData = attacker + "\t" + currentTime + "\t " + damageAmount + "\t" + weaponString +"\r\n";
string appendDamage = "";
//Get Previous Damage Data if any
string damageDone = utils.getStringScriptVar(self, SCRIPTVAR_MOB+".damageDone");
if (damageDone != "No Data")
{
appendDamage = damageDone + damageData;
}
else
{
appendDamage = damageData;
}
//Append the new data and place it into a script var for use later
utils.setScriptVar(self, SCRIPTVAR_MOB+".damageDone", appendDamage);
currentHealth = 0;
damageAmount = 0;
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
/***** FUNCTION *******************************************************/
void makeHelper(obj_id self, string argumentString)
{
//sendSystemMessageTestingOnly(self, "function test completed");
int creatureRowNumber = dataTableSearchColumnForString(argumentString, "creatureName", CREATURE_TABLE);
if (creatureRowNumber > -1)
{
obj_id helperMob = create.createCreature(argumentString, getLocation(self), true);
attachScript(helperMob, "test.qa_ai_helper_attach");
sendSystemMessageTestingOnly(self,"Helper Created. Use radial menu.");
dictionary creatureRow = dataTableGetRow (CREATURE_TABLE, creatureRowNumber);
utils.setScriptVar(self, SCRIPTVAR+".creatureDictionary", creatureRow);
}
else
{
sendSystemMessageTestingOnly(self,"Creature name invalid.");
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,623 @@
package script.test;
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.factions;
import script.library.prose;
import script.library.qa;
import script.library.skill;
import script.library.space_flags;
import script.library.space_quest;
import script.library.static_item;
import script.library.sui;
import script.library.utils;
public class qa_pilot_roadmap_tatooine_imperial extends script.base_script
{
public qa_pilot_roadmap_tatooine_imperial()
{
}
public static final String TOOL_TITLE = "Tatooine Imperial Pilot";
public static final String TOOL_PROMPT = "Tatooine Imperial Pilot\nSelect the pilot roadmap quest or function to complete.";
public static final String SCRIPTVAR = "pilotimptat";
public static final String[][] MAIN_TOOL_MENU =
{
{
"Get Novice Tatooine Imperial Pilot and ship",
"Complete First 2 Missions (patrol/tatooine_imperial_1 & destroy_surpriseattack/tatooine_imperial_1)",
"Complete Second Mission (destroy/tatooine_imperial_2)",
"Complete Third Mission Set (patrol/tatooine_imperial_3 & spacequest/escort/tatooine_imperial_3)",
"Complete Fourth Mission (assassinate/tatooine_imperial_4)",
"Train Tier 1 Pilot Skills",
"Complete Fifth Mission (space_quest/inspect/imperial_ss_1)",
"Complete Sixth Mission (space_quest/recovery/imperial_ss_2)",
"Train Naval Pilot 2",
"Complete Seventh Mission (spacequest/assassinate/imperial_ss_3)",
"Train Naval Weapons 2",
"Complete Eighth Mission (spacequest/inspect/imperial_ss_4)",
"Complete Ninth Mission (spacequest/escort/imperial_ss_5)",
"Train Naval Procedures 2 and Droid 2",
"Complete Tenth Mission (spacequest/recovery/imperial_ss_6)",
"Complete Tier 3, Mission Set 1 (spacequest/escort/tatooine_imperial_tier3_1)",
"Train Navy Starships 3",
"Complete Tier 3, Mission Set 2 (spacequest/inspect/tatooine_imperial_tier3_2)",
"Train Naval Weapons 3",
"Complete Tier 3, Mission Set 3 (spacequest/delivery/tatooine_imperial_tier3_3)",
"Train Naval Procedures 3",
"Complete Tier 3, Mission Set 4 (spacequest/assassinate/tatooine_imperial_tier3_4)",
"Train Naval Droid 3",
"Train Naval Starships 4",
"Complete Tier 4, Mission Set 1 (spacequest/patrol/tatooine_imperial_tier4_1)",
"Train Naval Weapons 4",
"Complete Tier 4, Mission Set 2 (spacequest/recovery/tatooine_imperial_tier4_2)",
"Train Naval Procedures 4",
"Complete Tier 4, Mission Set 3 (spacequest/escort/tatooine_imperial_tier4_3)",
"Train Naval Droid 4",
"Complete Tier 4, Mission Set 4 (spacequest/assassinate/tatooine_imperial_tier4_4)",
"Complete 1st Master Mission (spacequest/destroy/master_imperial_1)",
"Complete 2nd Master Mission (spacequest/destroy/master_imperial_2)"
},
{
"",
"spacequest/patrol/tatooine_imperial_1;spacequest/destroy_surpriseattack/tatooine_imperial_1",
"spacequest/destroy/tatooine_imperial_2",
"spacequest/patrol/tatooine_imperial_3;spacequest/escort/tatooine_imperial_3",
"spacequest/assassinate/tatooine_imperial_4",
"pilot_imperial_navy_starships_01;pilot_imperial_navy_weapons_01;pilot_imperial_navy_procedures_01;pilot_imperial_navy_droid_01",
"spacequest/inspect/imperial_ss_1",
"spacequest/recovery/imperial_ss_2",
"pilot_imperial_navy_starships_02",
"spacequest/assassinate/imperial_ss_3",
"pilot_imperial_navy_weapons_02",
"spacequest/inspect/imperial_ss_4",
"spacequest/escort/imperial_ss_5",
"pilot_imperial_navy_procedures_02;pilot_imperial_navy_droid_02",
"spacequest/recovery/imperial_ss_6",
"spacequest/escort/tatooine_imperial_tier3_1;spacequest/recovery/tatooine_imperial_tier3_1_a;spacequest/inspect/tatooine_imperial_tier3_1_b;spacequest/rescue/tatooine_imperial_tier3_1_c;spacequest/delivery_no_pickup/tatooine_imperial_tier3_1_d",
"pilot_imperial_navy_starships_03",
"spacequest/inspect/tatooine_imperial_tier3_2;spacequest/destroy_surpriseattack/tatooine_imperial_tier3_2_a;spacequest/inspect/tatooine_imperial_tier3_2_b;spacequest/delivery_no_pickup/tatooine_imperial_tier3_2_c;spacequest/patrol/tatooine_imperial_tier3_2_d;spacequest/space_battle/tatooine_imperial_tier3_2_e",
"pilot_imperial_navy_weapons_03",
"spacequest/delivery/tatooine_imperial_tier3_3;spacequest/destroy/tatooine_imperial_tier3_3_b;spacequest/escort/tatooine_imperial_tier3_3_a;spacequest/destroy_surpriseattack/tatooine_imperial_tier3_3_d;spacequest/survival/tatooine_imperial_tier3_3_c",
"pilot_imperial_navy_procedures_03",
"spacequest/assassinate/tatooine_imperial_tier3_4;spacequest/rescue/tatooine_imperial_tier3_4_a;spacequest/inspect/tatooine_imperial_tier3_4_b;spacequest/assassinate/tatooine_imperial_tier3_4_c",
"pilot_imperial_navy_droid_03",
"pilot_imperial_navy_starships_04",
"spacequest/patrol/tatooine_imperial_tier4_1;spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a;spacequest/space_battle/tatooine_imperial_tier4_1_b;spacequest/inspect/tatooine_imperial_tier4_1_c;spacequest/delivery_no_pickup/tatooine_imperial_tier4_1_d",
"pilot_imperial_navy_weapons_04",
"spacequest/recovery/tatooine_imperial_tier4_2;spacequest/recovery/tatooine_imperial_tier4_2_a;spacequest/delivery/tatooine_imperial_tier4_2_b;spacequest/delivery_no_pickup/tatooine_imperial_tier4_2_c",
"pilot_imperial_navy_procedures_04",
"spacequest/escort/tatooine_imperial_tier4_3;spacequest/rescue/tatooine_imperial_tier4_3_a;spacequest/space_battle/tatooine_imperial_tier4_3_b",
"pilot_imperial_navy_droid_04",
"spacequest/assassinate/tatooine_imperial_tier4_4;spacequest/assassinate/tatooine_imperial_tier4_4_a;spacequest/recovery/tatooine_imperial_tier4_4_b;spacequest/assassinate/tatooine_imperial_tier4_4_c",
"spacequest/destroy/master_imperial_1",
"pilot_imperial_navy_master"
}
};
public static final int GET_NOVICE_PILOT_AND_SHIP = 0;
public static final int COMPLETE_FIRST_MISSION = 1;
public static final int COMPLETE_SECOND_MISSION = 2;
public static final int COMPLETE_THIRD_MISSION = 3;
public static final int COMPLETE_FOURTH_MISSION = 4;
public static final int GET_FIRST_TIER_SKILLS = 5;
public static final int COMPLETE_FIFTH_MISSION = 6;
public static final int COMPLETE_SIXTH_MISSION = 7;
public static final int TRAIN_NAVAL_PILOT_2 = 8;
public static final int COMPLETE_SEVENTH_MISSION = 9;
public static final int TRAIN_NAVAL_WEAPONS_2 = 10;
public static final int COMPLETE_EIGHTH_MISSION = 11;
public static final int COMPLETE_NINTH_MISSION = 12;
public static final int TRAIN_NAVAL_PROCEDURES_AND_DROID_2 = 13;
public static final int COMPLETE_TENTH_MISSION = 14;
public static final int COMPLETE_TIER_3 = 15;
public static final int TRAIN_NAVAL_STARSHIPS_3 = 16;
public static final int COMPLETE_TIER_3_2 = 17;
public static final int TRAIN_NAVAL_WEAPONS_3 = 18;
public static final int COMPLETE_TIER_3_3 = 19;
public static final int TRAIN_NAVAL_PROCEDURES_3 = 20;
public static final int COMPLETE_TIER_3_4 = 21;
public static final int TRAIN_NAVAL_DROIDS_3 = 22;
public static final int TRAIN_NAVAL_STARSHIPS_4 = 23;
public static final int COMPLETE_TIER_4_1 = 24;
public static final int TRAIN_NAVAL_WEAPONS_4 = 25;
public static final int COMPLETE_TIER_4_2 = 26;
public static final int TRAIN_NAVAL_PROCEDURES_4 = 27;
public static final int COMPLETE_TIER_4_3 = 28;
public static final int TRAIN_NAVAL_DROIDS_4 = 29;
public static final int COMPLETE_TIER_4_4 = 30;
public static final int COMPLETE_MASTER_1 = 31;
public static final int COMPLETE_MASTER_2 = 32;
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR))
{
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int OnQuestActivated(obj_id self, int questId) throws InterruptedException
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".useTrigger") && isGod(self))
{
int questidRecovery3_1_a = questGetQuestId("spacequest/recovery/tatooine_imperial_tier3_1_a");
int questidInspect3_1_b = questGetQuestId("spacequest/inspect/tatooine_imperial_tier3_1_b");
int questidRescue3_1_c = questGetQuestId("spacequest/rescue/tatooine_imperial_tier3_1_c");
int questidDelivery_no_pickup3_1_d = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier3_1_d");
int questidDestroy_surpriseattack3_2_a = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_imperial_tier3_2_a");
int questidInspect3_2_b = questGetQuestId("spacequest/inspect/tatooine_imperial_tier3_2_b");
int questidDelivery_no_pickup3_2_c = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier3_2_c");
int questidPatrol3_2_d = questGetQuestId("spacequest/patrol/tatooine_imperial_tier3_2_d");
int questidSpace_battle3_2_e = questGetQuestId("spacequest/space_battle/tatooine_imperial_tier3_2_e");
int questidDestroy3_3_a = questGetQuestId("spacequest/destroy/tatooine_imperial_tier3_3_b");
int questidEscort3_3_b = questGetQuestId("spacequest/escort/tatooine_imperial_tier3_3_a");
int questidDestroy_surpriseattack3_3_c = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_imperial_tier3_3_d");
int questidSurvival3_3_d = questGetQuestId("spacequest/survival/tatooine_imperial_tier3_3_c");
int questidRescue3_4_a = questGetQuestId("spacequest/rescue/tatooine_imperial_tier3_4_a");
int questidInspect3_4_b = questGetQuestId("spacequest/inspect/tatooine_imperial_tier3_4_b");
int questidAssassinate3_4_c = questGetQuestId("spacequest/assassinate/tatooine_imperial_tier3_4_c");
int questidDestroy_surpriseattack4_1_a = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a");
int questidSpace_battle4_1_b = questGetQuestId("spacequest/space_battle/tatooine_imperial_tier4_1_b");
int questidInspect4_1_c = questGetQuestId("spacequest/inspect/tatooine_imperial_tier4_1_c");
int questidDelivery_no_pickup4_1_d = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier4_1_d");
int questidRevocery4_2_a = questGetQuestId("spacequest/recovery/tatooine_imperial_tier4_2_a");
int questidDelivery4_2_b = questGetQuestId("spacequest/delivery/tatooine_imperial_tier4_2_b");
int questidDelivery_no_pickup4_2_c = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier4_2_c");
int questidRescue4_3_a = questGetQuestId("spacequest/rescue/tatooine_imperial_tier4_3_a");
int questidDelivery4_3_b = questGetQuestId("spacequest/delivery/tatooine_imperial_tier4_2_b");
int questidAssassinate4_4_a = questGetQuestId("spacequest/assassinate/tatooine_imperial_tier4_4_a");
int questidRecovery4_4_b = questGetQuestId("spacequest/recovery/tatooine_imperial_tier4_4_b");
int questidAssassinate4_4_c = questGetQuestId("spacequest/assassinate/tatooine_imperial_tier4_4_c");
if (questId == questidRecovery3_1_a)
{
qa.completeActiveQuest(self, "spacequest/recovery/tatooine_imperial_tier3_1_a");
}
else if (questId == questidInspect3_1_b)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier3_1_b");
}
else if (questId == questidRescue3_1_c)
{
qa.completeActiveQuest(self, "spacequest/rescue/tatooine_imperial_tier3_1_c");
}
else if (questId == questidDelivery_no_pickup3_1_d)
{
boolean successCompleteDelivery_no_pickup = qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier3_1_d");
if (successCompleteDelivery_no_pickup)
{
space_quest.giveReward(self, "escort", "tatooine_imperial_tier3_1", 25000, "object/tangible/ship/components/weapon_capacitor/cap_mission_reward_imperial_rendili_k_class.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
if (questId == questidDestroy_surpriseattack3_2_a)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_imperial_tier3_2_a");
}
else if (questId == questidInspect3_2_b)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier3_2_b");
}
else if (questId == questidDelivery_no_pickup3_2_c)
{
qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier3_2_c");
}
else if (questId == questidPatrol3_2_d)
{
qa.completeActiveQuest(self, "spacequest/patrol/tatooine_imperial_tier3_2_d");
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_imperial_tier3_2_e", "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "tatooine_imperial_tier3_2", 25000, "object/tangible/ship/components/droid_interface/ddi_mission_reward_imperial_sfs_military_grade.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
if (questId == questidDestroy3_3_a)
{
qa.completeActiveQuest(self, "spacequest/destroy/tatooine_imperial_tier3_3_b");
}
else if (questId == questidEscort3_3_b)
{
qa.completeActiveQuest(self, "spacequest/escort/tatooine_imperial_tier3_3_a");
qa.grantOrClearSpaceQuest(self, "spacequest/destroy_surpriseattack/tatooine_imperial_tier3_3_d", "grant");
}
else if (questId == questidSurvival3_3_d)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/survival/tatooine_imperial_tier3_3_c");
if (successGrant)
{
space_quest.giveReward(self, "delivery", "tatooine_imperial_tier3_3", 25000, "object/tangible/ship/components/reactor/rct_mission_reward_imperial_sds_high_output.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
if (questId == questidRescue3_4_a)
{
qa.completeActiveQuest(self, "spacequest/rescue/tatooine_imperial_tier3_4_a");
}
else if (questId == questidInspect3_4_b)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier3_4_b");
}
else if (questId == questidAssassinate3_4_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_imperial_tier3_4_c");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_imperial_tier3_4", 25000, "object/tangible/ship/components/engine/eng_mission_reward_imperial_cygnus_megadrive.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
if (questId == questidSpace_battle4_1_b)
{
qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_imperial_tier4_1_b");
}
else if (questId == questidInspect4_1_c)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier4_1_c");
}
else if (questId == questidDelivery_no_pickup4_1_d)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier4_1_d");
if (successGrant)
{
space_quest.giveReward(self, "patrol", "tatooine_imperial_tier4_1", 10000, "object/tangible/ship/components/weapon/wpn_mission_reward_imperial_sds_boltdriver.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
if (questId == questidRevocery4_2_a)
{
qa.completeActiveQuest(self, "spacequest/recovery/tatooine_imperial_tier4_2_a");
}
else if (questId == questidDelivery4_2_b)
{
qa.completeActiveQuest(self, "spacequest/delivery/tatooine_imperial_tier4_2_b");
}
else if (questId == questidDelivery_no_pickup4_2_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier4_2_c");
if (successGrant)
{
space_quest.giveReward(self, "recovery", "tatooine_imperial_tier4_2", 10000, "object/tangible/ship/components/shield_generator/shd_mission_reward_imperial_cygnus_holoscreen.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
if (questId == questidRescue4_3_a)
{
qa.completeActiveQuest(self, "spacequest/rescue/tatooine_imperial_tier4_3_a");
}
else if (questId == questidDelivery4_3_b)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_imperial_tier4_3_b");
if (successGrant)
{
space_quest.giveReward(self, "escort", "tatooine_imperial_tier4_3", 10000, "object/tangible/ship/components/armor/arm_mission_reward_imperial_rss_special_durasteel.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
if (questId == questidAssassinate4_4_a)
{
qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_imperial_tier4_4_a");
}
else if (questId == questidRecovery4_4_b)
{
qa.completeActiveQuest(self, "spacequest/recovery/tatooine_imperial_tier4_4_b");
}
else if (questId == questidAssassinate4_4_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_imperial_tier4_4_c");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_imperial_tier4_4", 10000, "object/tangible/ship/components/reactor/rct_mission_reward_imperial_rss_advanced_military.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
}
return SCRIPT_CONTINUE;
}
public int delay(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int handleImperialPilotMainMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
detachAndcleanAllScriptVars(self);
String[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu(self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
return SCRIPT_CONTINUE;
}
else
{
if (hasSkill(self, "pilot_imperial_navy_novice") || hasSkill(self, "pilot_rebel_navy_novice") || hasSkill(self, "pilot_neutral_novice"))
{
qa.revokePilotingSkills(self);
qa.blowOutObjVars(self, "space");
}
boolean successStep = stepThroughPilot(self, idx);
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
public boolean stepThroughPilot(obj_id self, int step) throws InterruptedException
{
if (step >= 0)
{
if (step >= GET_NOVICE_PILOT_AND_SHIP)
{
space_flags.setSpaceTrack(self, space_flags.IMPERIAL_TATOOINE);
skill.noisyGrantSkill(self, "pilot_imperial_navy_novice");
messageTo(self, "delay", null, 6, false);
if (space_quest.canGrantNewbieShip(self) && hasSkill(self, "pilot_imperial_navy_novice"))
{
space_quest.grantNewbieShip(self, "imperial");
}
}
if (step >= COMPLETE_FIRST_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIRST_MISSION], "grant");
if (successGrant)
{
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 25.0f);
space_quest.giveReward(self, "destroy_surpriseattack", "tatooine_imperial_1", 100);
}
}
if (step >= COMPLETE_SECOND_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SECOND_MISSION], "grant");
if (successGrant)
{
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
space_quest.giveReward(self, "destroy", "tatooine_imperial_2", 200);
}
}
if (step >= COMPLETE_THIRD_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_THIRD_MISSION], "grant");
if (successGrant)
{
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
space_quest.giveReward(self, "escort", "tatooine_imperial_3", 500, "object/tangible/wearables/bodysuit/bodysuit_tie_fighter.iff");
space_quest.giveReward(self, "escort", "tatooine_imperial_3", 500, "object/tangible/wearables/bandolier/double_bandolier.iff");
space_quest.giveReward(self, "escort", "tatooine_imperial_3", 500, "object/tangible/wearables/bandolier/ith_double_bandolier.iff");
}
}
if (step >= COMPLETE_FOURTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FOURTH_MISSION], "grant");
if (successGrant)
{
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
space_quest.giveReward(self, "assassinate", "tatooine_imperial_4", 1000, "object/tangible/wearables/helmet/helmet_tie_fighter.iff");
}
}
if (step >= GET_FIRST_TIER_SKILLS)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][GET_FIRST_TIER_SKILLS]);
obj_id pInv = utils.getInventoryContainer(self);
if (!isIdNull(pInv))
{
obj_id authorizationTier1 = createObjectOverloaded("object/tangible/space/mission_objects/transfer_auth.iff", pInv);
}
}
if (step >= COMPLETE_FIFTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIFTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "imperial_ss_1", 5000, "object/tangible/ship/components/weapon/wpn_mission_reward_imperial_cygnus_starblaster.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
}
}
if (step >= COMPLETE_SIXTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SIXTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "recovery", "imperial_ss_2", 5000, "object/tangible/ship/components/armor/arm_mission_reward_imperial_sfs_light_military.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
}
}
if (step >= TRAIN_NAVAL_PILOT_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PILOT_2]);
}
if (step >= COMPLETE_SEVENTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SEVENTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "imperial_ss_3", 5000, "object/tangible/ship/components/booster/bst_mission_reward_imperial_rss_ion_booster.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
space_flags.removeSpaceFlag(self, "ss");
}
}
if (step >= TRAIN_NAVAL_WEAPONS_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_2]);
}
if (step >= COMPLETE_EIGHTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_EIGHTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "imperial_ss_4", 5000, "object/tangible/ship/components/shield_generator/shd_mission_reward_imperial_rendili_dual_projector.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
}
}
if (step >= COMPLETE_NINTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_NINTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "escort", "imperial_ss_5", 5000);
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
}
}
if (step >= TRAIN_NAVAL_PROCEDURES_AND_DROID_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_AND_DROID_2]);
}
if (step >= COMPLETE_TENTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_TENTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "recovery", "imperial_ss_6", 5000);
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
}
}
if (step >= COMPLETE_TIER_3)
{
boolean successGrantEscort = qa.grantOrClearSpaceQuest(self, "spacequest/escort/tatooine_imperial_tier3_1", "grant");
}
if (step >= TRAIN_NAVAL_STARSHIPS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_3]);
}
if (step >= COMPLETE_TIER_3_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/inspect/tatooine_imperial_tier3_2", "grant");
}
if (step >= TRAIN_NAVAL_WEAPONS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_3]);
}
if (step >= COMPLETE_TIER_3_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/delivery/tatooine_imperial_tier3_3", "grant");
}
if (step >= TRAIN_NAVAL_PROCEDURES_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_3]);
}
if (step >= COMPLETE_TIER_3_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_imperial_tier3_4", "grant");
}
if (step >= TRAIN_NAVAL_DROIDS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROIDS_3]);
}
if (step >= TRAIN_NAVAL_STARSHIPS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_4]);
}
if (step >= COMPLETE_TIER_4_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/patrol/tatooine_imperial_tier4_1", "grant");
if (successGrant)
{
qa.grantOrClearSpaceQuest(self, "spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a", "grant");
}
}
if (step >= TRAIN_NAVAL_WEAPONS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_4]);
}
if (step >= COMPLETE_TIER_4_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/recovery/tatooine_imperial_tier4_2", "grant");
}
if (step >= TRAIN_NAVAL_PROCEDURES_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_4]);
}
if (step >= COMPLETE_TIER_4_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/escort/tatooine_imperial_tier4_3", "grant");
}
if (step >= TRAIN_NAVAL_DROIDS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROIDS_4]);
}
if (step >= COMPLETE_TIER_4_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_imperial_tier4_4", "grant");
}
if (step >= COMPLETE_MASTER_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_1], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_imperial_1", 25000, "object/tangible/wearables/jacket/jacket_ace_imperial.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 200.0f);
}
}
if (step >= COMPLETE_MASTER_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/destroy/master_imperial_2", "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_imperial_2", 50000, "object/tangible/wearables/helmet/helmet_fighter_imperial_ace.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 400.0f);
obj_id item = static_item.createNewItemFunction("item_quest_reward_imperial_pilot_medal_01_01", self);
string_id name = new string_id("static_item_n", "item_quest_reward_imperial_pilot_medal_01_01");
prose_package pp = new prose_package();
pp = prose.setStringId(pp, new string_id("quest/ground/system_message", "placed_in_inventory"));
pp = prose.setTO(pp, name);
sendQuestSystemMessage(self, pp);
qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_2]);
space_flags.setSpaceFlag(self, "master_pilot_medal_recieved", true);
}
}
return true;
}
return false;
}
public void showToolMainMenu(obj_id self) throws InterruptedException
{
utils.setScriptVar(self, SCRIPTVAR + ".useTrigger", true);
qa.refreshMenu(self, TOOL_PROMPT, TOOL_TITLE, MAIN_TOOL_MENU, "handleImperialPilotMainMenuOptions", true, SCRIPTVAR + ".pid", SCRIPTVAR + ".mainMenu");
}
public void cleanAllScriptVars(obj_id self) throws InterruptedException
{
qa.removeScriptVars(self, SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
public void detachAndcleanAllScriptVars(obj_id self) throws InterruptedException
{
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
}
@@ -1,733 +0,0 @@
// ======================================================================
// qa_pilot_roadmap_tatooine_imperial.script
//
// QA Tatooine Imperial Pilot Roadmap Tool
//
// ======================================================================
//
// Intent:
// This script is intended to provide the tester with the ability to move from
// a non-pilot test character to a valid Master Pilot in a rapid method.
// This tool also should provide the means to test the pilot roadmap itself.
//
// ======================================================================
//
// ======================================================================
// Library Includes
// ======================================================================
include library.factions;
include library.prose;
include library.qa;
include library.skill;
include library.space_flags;
include library.space_quest;
include library.static_item;
include library.sui;
include library.utils;
/********* CONSTANTS *****************************************/
const string TOOL_TITLE = "Tatooine Imperial Pilot";
const string TOOL_PROMPT = "Tatooine Imperial Pilot\nSelect the pilot roadmap quest or function to complete."; //NO QUEST REWARDS ARE GIVEN FOR QUESTS YOU COMPLETE USING THIS TOOL. To get a specific reward you need to complete the quest previous to the reward, complete the quest normally and visit the quest NPC.";
const string SCRIPTVAR = "pilotimptat";
const string[][] MAIN_TOOL_MENU =
{
{
"Get Novice Tatooine Imperial Pilot and ship", //GET_NOVICE_PILOT_AND_SHIP
"Complete First 2 Missions (patrol/tatooine_imperial_1 & destroy_surpriseattack/tatooine_imperial_1)", //COMPLETE_FIRST_MISSION
"Complete Second Mission (destroy/tatooine_imperial_2)", //COMPLETE_SECOND_MISSION
"Complete Third Mission Set (patrol/tatooine_imperial_3 & spacequest/escort/tatooine_imperial_3)", //COMPLETE_THIRD_MISSION
"Complete Fourth Mission (assassinate/tatooine_imperial_4)", //COMPLETE_FOURTH_MISSION
"Train Tier 1 Pilot Skills", //GET_FIRST_TIER_SKILLS
"Complete Fifth Mission (space_quest/inspect/imperial_ss_1)", //COMPLETE_FIFTH_MISSION
"Complete Sixth Mission (space_quest/recovery/imperial_ss_2)", //COMPLETE_SIXTH_MISSION
"Train Naval Pilot 2", //TRAIN_NAVAL_PILOT_2
"Complete Seventh Mission (spacequest/assassinate/imperial_ss_3)", //COMPLETE_SEVENTH_MISSION
"Train Naval Weapons 2", //TRAIN_NAVAL_WEAPONS_2
"Complete Eighth Mission (spacequest/inspect/imperial_ss_4)", //COMPLETE_EIGHTH_MISSION
"Complete Ninth Mission (spacequest/escort/imperial_ss_5)", //COMPLETE_NINTH_MISSION
"Train Naval Procedures 2 and Droid 2", //TRAIN_NAVAL_PROCEDURES_AND_DROID_2
"Complete Tenth Mission (spacequest/recovery/imperial_ss_6)", //COMPLETE_TENTH_MISSION
"Complete Tier 3, Mission Set 1 (spacequest/escort/tatooine_imperial_tier3_1)", //COMPLETE_TIER_3
"Train Navy Starships 3", //TRAIN_NAVAL_STARSHIPS_3
"Complete Tier 3, Mission Set 2 (spacequest/inspect/tatooine_imperial_tier3_2)", //COMPLETE_TIER_3_2
"Train Naval Weapons 3", //TRAIN_NAVAL_WEAPONS_3
"Complete Tier 3, Mission Set 3 (spacequest/delivery/tatooine_imperial_tier3_3)", //COMPLETE_TIER_3_3
"Train Naval Procedures 3", //TRAIN_NAVAL_PROCEDURES_3
"Complete Tier 3, Mission Set 4 (spacequest/assassinate/tatooine_imperial_tier3_4)", //COMPLETE_TIER_3_4
"Train Naval Droid 3", //TRAIN_NAVAL_DROIDS_3
"Train Naval Starships 4", //TRAIN_NAVAL_STARSHIPS_4
"Complete Tier 4, Mission Set 1 (spacequest/patrol/tatooine_imperial_tier4_1)", //COMPLETE_TIER_4_1
"Train Naval Weapons 4", //TRAIN_NAVAL_WEAPONS_4
"Complete Tier 4, Mission Set 2 (spacequest/recovery/tatooine_imperial_tier4_2)", //COMPLETE_TIER_4_2
"Train Naval Procedures 4", //TRAIN_NAVAL_PROCEDURES_4
"Complete Tier 4, Mission Set 3 (spacequest/escort/tatooine_imperial_tier4_3)", //COMPLETE_TIER_4_3
"Train Naval Droid 4", //TRAIN_NAVAL_DROIDS_4
"Complete Tier 4, Mission Set 4 (spacequest/assassinate/tatooine_imperial_tier4_4)", //COMPLETE_TIER_4_4
"Complete 1st Master Mission (spacequest/destroy/master_imperial_1)", //COMPLETE_MASTER_1
"Complete 2nd Master Mission (spacequest/destroy/master_imperial_2)" //COMPLETE_MASTER_2
}
,
{
//The array of arrays isn't used for granting/completing the tier 3 and tier 4 content due to
//recursive quests. This part of the Array is used to REMOVE the quests correctly when the tester wishes to reset their test character.
"", //GET_NOVICE_PILOT_AND_SHIP
"spacequest/patrol/tatooine_imperial_1;spacequest/destroy_surpriseattack/tatooine_imperial_1", //COMPLETE_FIRST_MISSION
"spacequest/destroy/tatooine_imperial_2", //COMPLETE_SECOND_MISSION
"spacequest/patrol/tatooine_imperial_3;spacequest/escort/tatooine_imperial_3", //COMPLETE_THIRD_MISSION
"spacequest/assassinate/tatooine_imperial_4", //COMPLETE_FOURTH_MISSION
"pilot_imperial_navy_starships_01;pilot_imperial_navy_weapons_01;pilot_imperial_navy_procedures_01;pilot_imperial_navy_droid_01",
"spacequest/inspect/imperial_ss_1", //COMPLETE_FIFTH_MISSION
"spacequest/recovery/imperial_ss_2", //COMPLETE_SIXTH_MISSION
"pilot_imperial_navy_starships_02", //TRAIN_NAVAL_PILOT_2
"spacequest/assassinate/imperial_ss_3", //COMPLETE_SEVENTH_MISSION
"pilot_imperial_navy_weapons_02", //TRAIN_NAVAL_WEAPONS_2
"spacequest/inspect/imperial_ss_4", //COMPLETE_EIGHTH_MISSION
"spacequest/escort/imperial_ss_5", //COMPLETE_NINTH_MISSION
"pilot_imperial_navy_procedures_02;pilot_imperial_navy_droid_02", //TRAIN_NAVAL_PROCEDURES_AND_DROID_2
"spacequest/recovery/imperial_ss_6", //COMPLETE_TENTH_MISSION
"spacequest/escort/tatooine_imperial_tier3_1;spacequest/recovery/tatooine_imperial_tier3_1_a;spacequest/inspect/tatooine_imperial_tier3_1_b;spacequest/rescue/tatooine_imperial_tier3_1_c;spacequest/delivery_no_pickup/tatooine_imperial_tier3_1_d",
//^COMPLETE_TIER_3
"pilot_imperial_navy_starships_03", //TRAIN_NAVAL_STARSHIPS_3
"spacequest/inspect/tatooine_imperial_tier3_2;spacequest/destroy_surpriseattack/tatooine_imperial_tier3_2_a;spacequest/inspect/tatooine_imperial_tier3_2_b;spacequest/delivery_no_pickup/tatooine_imperial_tier3_2_c;spacequest/patrol/tatooine_imperial_tier3_2_d;spacequest/space_battle/tatooine_imperial_tier3_2_e",
//^COMPLETE_TIER_3_2
"pilot_imperial_navy_weapons_03", //TRAIN_NAVAL_WEAPONS_3
"spacequest/delivery/tatooine_imperial_tier3_3;spacequest/destroy/tatooine_imperial_tier3_3_b;spacequest/escort/tatooine_imperial_tier3_3_a;spacequest/destroy_surpriseattack/tatooine_imperial_tier3_3_d;spacequest/survival/tatooine_imperial_tier3_3_c",
//^COMPLETE_TIER_3_3
"pilot_imperial_navy_procedures_03", //TRAIN_NAVAL_PROCEDURES_3
"spacequest/assassinate/tatooine_imperial_tier3_4;spacequest/rescue/tatooine_imperial_tier3_4_a;spacequest/inspect/tatooine_imperial_tier3_4_b;spacequest/assassinate/tatooine_imperial_tier3_4_c",
//^COMPLETE_TIER_3_4
"pilot_imperial_navy_droid_03", //TRAIN_NAVAL_DROIDS_3
"pilot_imperial_navy_starships_04", //TRAIN_NAVAL_STARSHIPS_4
"spacequest/patrol/tatooine_imperial_tier4_1;spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a;spacequest/space_battle/tatooine_imperial_tier4_1_b;spacequest/inspect/tatooine_imperial_tier4_1_c;spacequest/delivery_no_pickup/tatooine_imperial_tier4_1_d",
//^COMPLETE_TIER_4_1
"pilot_imperial_navy_weapons_04", //TRAIN_NAVAL_WEAPONS_4
"spacequest/recovery/tatooine_imperial_tier4_2;spacequest/recovery/tatooine_imperial_tier4_2_a;spacequest/delivery/tatooine_imperial_tier4_2_b;spacequest/delivery_no_pickup/tatooine_imperial_tier4_2_c",
//^COMPLETE_TIER_4_2
"pilot_imperial_navy_procedures_04", //TRAIN_NAVAL_PROCEDURES_4
"spacequest/escort/tatooine_imperial_tier4_3;spacequest/rescue/tatooine_imperial_tier4_3_a;spacequest/space_battle/tatooine_imperial_tier4_3_b",
//^COMPLETE_TIER_4_3
"pilot_imperial_navy_droid_04", //TRAIN_NAVAL_DROIDS_4
"spacequest/assassinate/tatooine_imperial_tier4_4;spacequest/assassinate/tatooine_imperial_tier4_4_a;spacequest/recovery/tatooine_imperial_tier4_4_b;spacequest/assassinate/tatooine_imperial_tier4_4_c",
//^COMPLETE_TIER_4_4
"spacequest/destroy/master_imperial_1", //COMPLETE_MASTER_1
"pilot_imperial_navy_master" //COMPLETE_MASTER_2
}
};
const int GET_NOVICE_PILOT_AND_SHIP = 0;
const int COMPLETE_FIRST_MISSION = 1;
const int COMPLETE_SECOND_MISSION = 2;
const int COMPLETE_THIRD_MISSION = 3;
const int COMPLETE_FOURTH_MISSION = 4;
const int GET_FIRST_TIER_SKILLS = 5;
const int COMPLETE_FIFTH_MISSION = 6;
const int COMPLETE_SIXTH_MISSION = 7;
const int TRAIN_NAVAL_PILOT_2 = 8;
const int COMPLETE_SEVENTH_MISSION = 9;
const int TRAIN_NAVAL_WEAPONS_2 = 10;
const int COMPLETE_EIGHTH_MISSION = 11;
const int COMPLETE_NINTH_MISSION = 12;
const int TRAIN_NAVAL_PROCEDURES_AND_DROID_2 = 13;
const int COMPLETE_TENTH_MISSION = 14;
const int COMPLETE_TIER_3 = 15;
const int TRAIN_NAVAL_STARSHIPS_3 = 16;
const int COMPLETE_TIER_3_2 = 17;
const int TRAIN_NAVAL_WEAPONS_3 = 18;
const int COMPLETE_TIER_3_3 = 19;
const int TRAIN_NAVAL_PROCEDURES_3 = 20;
const int COMPLETE_TIER_3_4 = 21;
const int TRAIN_NAVAL_DROIDS_3 = 22;
const int TRAIN_NAVAL_STARSHIPS_4 = 23;
const int COMPLETE_TIER_4_1 = 24;
const int TRAIN_NAVAL_WEAPONS_4 = 25;
const int COMPLETE_TIER_4_2 = 26;
const int TRAIN_NAVAL_PROCEDURES_4 = 27;
const int COMPLETE_TIER_4_3 = 28;
const int TRAIN_NAVAL_DROIDS_4 = 29;
const int COMPLETE_TIER_4_4 = 30;
const int COMPLETE_MASTER_1 = 31;
const int COMPLETE_MASTER_2 = 32;
/***** TRIGGERS *******************************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if (toLower(text).equals(SCRIPTVAR))
{
//Function to show the main menu of the tool
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
//This trigger handles the Recursive/iterative functionality with the Space Quest Tier content
//When a quest is activated, we compare it to the recursive space content quests. When/if found,
//the quest is completed, triggering yet another function.
trigger OnQuestActivated(int questId)
{
//One script var keeps the trigger from firing off everytime the tester receives a quest
if (utils.hasScriptVar(self, SCRIPTVAR + ".useTrigger") && isGod(self))
{
//TIER 3_1
int questidRecovery3_1_a = questGetQuestId("spacequest/recovery/tatooine_imperial_tier3_1_a");
int questidInspect3_1_b = questGetQuestId("spacequest/inspect/tatooine_imperial_tier3_1_b");
int questidRescue3_1_c = questGetQuestId("spacequest/rescue/tatooine_imperial_tier3_1_c");
int questidDelivery_no_pickup3_1_d = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier3_1_d");
//TIER 3_2
int questidDestroy_surpriseattack3_2_a = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_imperial_tier3_2_a");
int questidInspect3_2_b = questGetQuestId("spacequest/inspect/tatooine_imperial_tier3_2_b");
int questidDelivery_no_pickup3_2_c = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier3_2_c");
int questidPatrol3_2_d = questGetQuestId("spacequest/patrol/tatooine_imperial_tier3_2_d");
int questidSpace_battle3_2_e = questGetQuestId("spacequest/space_battle/tatooine_imperial_tier3_2_e");
//TIER 3_3
//Intentionally out of order. The quest starts with B, then A, then D and ends with C
int questidDestroy3_3_a = questGetQuestId("spacequest/destroy/tatooine_imperial_tier3_3_b");
int questidEscort3_3_b = questGetQuestId("spacequest/escort/tatooine_imperial_tier3_3_a");
int questidDestroy_surpriseattack3_3_c = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_imperial_tier3_3_d");
int questidSurvival3_3_d = questGetQuestId("spacequest/survival/tatooine_imperial_tier3_3_c");
//TIER 3_4
int questidRescue3_4_a = questGetQuestId("spacequest/rescue/tatooine_imperial_tier3_4_a");
int questidInspect3_4_b = questGetQuestId("spacequest/inspect/tatooine_imperial_tier3_4_b");
int questidAssassinate3_4_c = questGetQuestId("spacequest/assassinate/tatooine_imperial_tier3_4_c");
//TIER 4_1
int questidDestroy_surpriseattack4_1_a = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a");
int questidSpace_battle4_1_b = questGetQuestId("spacequest/space_battle/tatooine_imperial_tier4_1_b");
int questidInspect4_1_c = questGetQuestId("spacequest/inspect/tatooine_imperial_tier4_1_c");
int questidDelivery_no_pickup4_1_d = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier4_1_d");
//TIER 4_2
int questidRevocery4_2_a = questGetQuestId("spacequest/recovery/tatooine_imperial_tier4_2_a");
int questidDelivery4_2_b = questGetQuestId("spacequest/delivery/tatooine_imperial_tier4_2_b");
int questidDelivery_no_pickup4_2_c = questGetQuestId("spacequest/delivery_no_pickup/tatooine_imperial_tier4_2_c");
//TIER 4_3
int questidRescue4_3_a = questGetQuestId("spacequest/rescue/tatooine_imperial_tier4_3_a");
int questidDelivery4_3_b = questGetQuestId("spacequest/delivery/tatooine_imperial_tier4_2_b");
//TIER 4_4
int questidAssassinate4_4_a = questGetQuestId("spacequest/assassinate/tatooine_imperial_tier4_4_a");
int questidRecovery4_4_b = questGetQuestId("spacequest/recovery/tatooine_imperial_tier4_4_b");
int questidAssassinate4_4_c = questGetQuestId("spacequest/assassinate/tatooine_imperial_tier4_4_c");
//TIER 3_1 QUESTS
if (questId == questidRecovery3_1_a)
{
qa.completeActiveQuest(self, "spacequest/recovery/tatooine_imperial_tier3_1_a");
}
else if (questId == questidInspect3_1_b)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier3_1_b");
}
else if (questId == questidRescue3_1_c)
{
qa.completeActiveQuest(self, "spacequest/rescue/tatooine_imperial_tier3_1_c");
}
else if (questId == questidDelivery_no_pickup3_1_d)
{
boolean successCompleteDelivery_no_pickup = qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier3_1_d");
if (successCompleteDelivery_no_pickup)
{
space_quest.giveReward(self, "escort", "tatooine_imperial_tier3_1", 25000, "object/tangible/ship/components/weapon_capacitor/cap_mission_reward_imperial_rendili_k_class.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
//TIER 3_2 QUESTS
if (questId == questidDestroy_surpriseattack3_2_a)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_imperial_tier3_2_a");
}
else if (questId == questidInspect3_2_b)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier3_2_b");
}
else if (questId == questidDelivery_no_pickup3_2_c)
{
qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier3_2_c");
}
else if (questId == questidPatrol3_2_d)
{
qa.completeActiveQuest(self, "spacequest/patrol/tatooine_imperial_tier3_2_d");
//the 5th quest will not fire off automatically
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_imperial_tier3_2_e", "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "tatooine_imperial_tier3_2", 25000, "object/tangible/ship/components/droid_interface/ddi_mission_reward_imperial_sfs_military_grade.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
//TIER 3_3 QUESTS
if (questId == questidDestroy3_3_a)
{
qa.completeActiveQuest(self, "spacequest/destroy/tatooine_imperial_tier3_3_b");
}
else if (questId == questidEscort3_3_b)
{
qa.completeActiveQuest(self, "spacequest/escort/tatooine_imperial_tier3_3_a");
//the 3rd quest will not fire off automatically
qa.grantOrClearSpaceQuest(self, "spacequest/destroy_surpriseattack/tatooine_imperial_tier3_3_d", "grant");
}
else if (questId == questidSurvival3_3_d)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/survival/tatooine_imperial_tier3_3_c");
if (successGrant)
{
space_quest.giveReward(self, "delivery", "tatooine_imperial_tier3_3", 25000, "object/tangible/ship/components/reactor/rct_mission_reward_imperial_sds_high_output.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
//TIER 3_4 QUESTS
if (questId == questidRescue3_4_a)
{
qa.completeActiveQuest(self, "spacequest/rescue/tatooine_imperial_tier3_4_a");
}
else if (questId == questidInspect3_4_b)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier3_4_b");
}
else if (questId == questidAssassinate3_4_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_imperial_tier3_4_c");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_imperial_tier3_4", 25000, "object/tangible/ship/components/engine/eng_mission_reward_imperial_cygnus_megadrive.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 100.0f);
}
}
//TIER 4_1 QUESTS
//spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a Doesn't fire off automatically -- handled above
if (questId == questidSpace_battle4_1_b)
{
qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_imperial_tier4_1_b");
}
else if (questId == questidInspect4_1_c)
{
qa.completeActiveQuest(self, "spacequest/inspect/tatooine_imperial_tier4_1_c");
}
else if (questId == questidDelivery_no_pickup4_1_d)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier4_1_d");
if (successGrant)
{
space_quest.giveReward(self, "patrol", "tatooine_imperial_tier4_1", 10000, "object/tangible/ship/components/weapon/wpn_mission_reward_imperial_sds_boltdriver.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
//TIER 4_2 QUESTS
if (questId == questidRevocery4_2_a)
{
qa.completeActiveQuest(self, "spacequest/recovery/tatooine_imperial_tier4_2_a");
}
else if (questId == questidDelivery4_2_b)
{
qa.completeActiveQuest(self, "spacequest/delivery/tatooine_imperial_tier4_2_b");
}
else if (questId == questidDelivery_no_pickup4_2_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_imperial_tier4_2_c");
if (successGrant)
{
space_quest.giveReward(self, "recovery", "tatooine_imperial_tier4_2", 10000, "object/tangible/ship/components/shield_generator/shd_mission_reward_imperial_cygnus_holoscreen.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
//TIER 4_3 QUESTS
if (questId == questidRescue4_3_a)
{
qa.completeActiveQuest(self, "spacequest/rescue/tatooine_imperial_tier4_3_a");
}
else if (questId == questidDelivery4_3_b)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_imperial_tier4_3_b");
if (successGrant)
{
space_quest.giveReward(self, "escort", "tatooine_imperial_tier4_3", 10000, "object/tangible/ship/components/armor/arm_mission_reward_imperial_rss_special_durasteel.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
//TIER 4_4 QUESTS
if (questId == questidAssassinate4_4_a)
{
qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_imperial_tier4_4_a");
}
else if (questId == questidRecovery4_4_b)
{
qa.completeActiveQuest(self, "spacequest/recovery/tatooine_imperial_tier4_4_b");
}
else if (questId == questidAssassinate4_4_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_imperial_tier4_4_c");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_imperial_tier4_4", 10000, "object/tangible/ship/components/reactor/rct_mission_reward_imperial_rss_advanced_military.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 150.0f);
}
}
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler delay()
{
//sendSystemMessageTestingOnly(self, "delay 1 second.");
return SCRIPT_CONTINUE;
}
messageHandler handleImperialPilotMainMenuOptions()
{
if (isGod(self))
{
//static script var
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//check for cancel button
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
//@TODO:make the revert go to calling menu?
detachAndcleanAllScriptVars(self);
string[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu(self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
return SCRIPT_CONTINUE;
}
//build the next sui
else
{
//if has pilot skill, revoke it:
if (hasSkill(self, "pilot_imperial_navy_novice") || hasSkill(self, "pilot_rebel_navy_novice") || hasSkill(self, "pilot_neutral_novice"))
{
qa.revokePilotingSkills(self);
qa.blowOutObjVars(self, "space");
}
boolean successStep = stepThroughPilot(self, idx);
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
boolean stepThroughPilot(obj_id self, int step)
{
if (step >= 0)
{
if (step >= GET_NOVICE_PILOT_AND_SHIP)
{
space_flags.setSpaceTrack(self, space_flags.IMPERIAL_TATOOINE);
skill.noisyGrantSkill(self, "pilot_imperial_navy_novice");
messageTo(self, "delay", null, 6, false);
if (space_quest.canGrantNewbieShip(self) && hasSkill(self, "pilot_imperial_navy_novice"))
{
// valid factions:"imperial", "rebel", "neutral"
space_quest.grantNewbieShip(self, "imperial");
}
}
if (step >= COMPLETE_FIRST_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIRST_MISSION], "grant");
if (successGrant)
{
// Give credits.
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 25.0f);
space_quest.giveReward(self, "destroy_surpriseattack", "tatooine_imperial_1", 100);
}
}
if (step >= COMPLETE_SECOND_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SECOND_MISSION], "grant");
if (successGrant)
{
//Rewards are hardcoded
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
space_quest.giveReward(self, "destroy", "tatooine_imperial_2", 200);
}
}
if (step >= COMPLETE_THIRD_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_THIRD_MISSION], "grant");
if (successGrant)
{
//Rewards are hardcoded
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
//if (getSpecies(self) == SPECIES_ITHORIAN || getSpecies(self) == SPECIES_WOOKIEE)
space_quest.giveReward(self, "escort", "tatooine_imperial_3", 500, "object/tangible/wearables/bodysuit/bodysuit_tie_fighter.iff");
//else if (getSpecies(self) != SPECIES_ITHORIAN)
space_quest.giveReward(self, "escort", "tatooine_imperial_3", 500, "object/tangible/wearables/bandolier/double_bandolier.iff");
//else
space_quest.giveReward(self, "escort", "tatooine_imperial_3", 500, "object/tangible/wearables/bandolier/ith_double_bandolier.iff");
}
}
if (step >= COMPLETE_FOURTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FOURTH_MISSION], "grant");
if (successGrant)
{
//Rewards are hardcoded
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
space_quest.giveReward(self, "assassinate", "tatooine_imperial_4", 1000, "object/tangible/wearables/helmet/helmet_tie_fighter.iff");
}
}
if (step >= GET_FIRST_TIER_SKILLS)
{
//sendSystemMessageTestingOnly(self, "GET_FIRST_TIER_SKILLS: " + GET_FIRST_TIER_SKILLS);
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][GET_FIRST_TIER_SKILLS]);
obj_id pInv = utils.getInventoryContainer(self);
if (!isIdNull(pInv))
{
obj_id authorizationTier1 = createObjectOverloaded("object/tangible/space/mission_objects/transfer_auth.iff", pInv);
}
}
if (step >= COMPLETE_FIFTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIFTH_MISSION], "grant");
if (successGrant)
{
//spacequest/inspect/imperial_ss_1
space_quest.giveReward(self, "inspect", "imperial_ss_1", 5000, "object/tangible/ship/components/weapon/wpn_mission_reward_imperial_cygnus_starblaster.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
}
}
if (step >= COMPLETE_SIXTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SIXTH_MISSION], "grant");
if (successGrant)
{
//spacequest/recovery/imperial_ss_2
space_quest.giveReward(self, "recovery", "imperial_ss_2", 5000, "object/tangible/ship/components/armor/arm_mission_reward_imperial_sfs_light_military.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
}
}
if (step >= TRAIN_NAVAL_PILOT_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PILOT_2]);
}
if (step >= COMPLETE_SEVENTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SEVENTH_MISSION], "grant");
if (successGrant)
{
//spacequest/assassinate/imperial_ss_3
space_quest.giveReward(self, "assassinate", "imperial_ss_3", 5000, "object/tangible/ship/components/booster/bst_mission_reward_imperial_rss_ion_booster.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
space_flags.removeSpaceFlag(self, "ss");
}
}
if (step >= TRAIN_NAVAL_WEAPONS_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_2]);
}
if (step >= COMPLETE_EIGHTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_EIGHTH_MISSION], "grant");
if (successGrant)
{
//spacequest/inspect/imperial_ss_4
space_quest.giveReward(self, "inspect", "imperial_ss_4", 5000, "object/tangible/ship/components/shield_generator/shd_mission_reward_imperial_rendili_dual_projector.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 75.0f);
}
}
if (step >= COMPLETE_NINTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_NINTH_MISSION], "grant");
if (successGrant)
{
//spacequest/escort/imperial_ss_5
space_quest.giveReward(self, "escort", "imperial_ss_5", 5000);
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
}
}
if (step >= TRAIN_NAVAL_PROCEDURES_AND_DROID_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_AND_DROID_2]);
}
if (step >= COMPLETE_TENTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_TENTH_MISSION], "grant");
if (successGrant)
{
//spacequest/recovery/imperial_ss_6
space_quest.giveReward(self, "recovery", "imperial_ss_6", 5000);
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 50.0f);
}
}
if (step >= COMPLETE_TIER_3)
{
boolean successGrantEscort = qa.grantOrClearSpaceQuest(self, "spacequest/escort/tatooine_imperial_tier3_1", "grant");
//The tier3_1 quests are handled by the trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_STARSHIPS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_3]);
}
if (step >= COMPLETE_TIER_3_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/inspect/tatooine_imperial_tier3_2", "grant");
//The tier3_2 quests are handled by the trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_WEAPONS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_3]);
}
if (step >= COMPLETE_TIER_3_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/delivery/tatooine_imperial_tier3_3", "grant");
//Tier3_3 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_PROCEDURES_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_3]);
}
if (step >= COMPLETE_TIER_3_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_imperial_tier3_4", "grant");
//Tier3_3 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_DROIDS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROIDS_3]);
}
if (step >= TRAIN_NAVAL_STARSHIPS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_4]);
}
if (step >= COMPLETE_TIER_4_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/patrol/tatooine_imperial_tier4_1", "grant");
if (successGrant)
qa.grantOrClearSpaceQuest(self, "spacequest/destroy_surpriseattack/tatooine_imperial_tier4_1_a", "grant");
//The rest of Tier4_1 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_WEAPONS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_4]);
}
if (step >= COMPLETE_TIER_4_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/recovery/tatooine_imperial_tier4_2", "grant");
//Tier4_2 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_PROCEDURES_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_4]);
}
if (step >= COMPLETE_TIER_4_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/escort/tatooine_imperial_tier4_3", "grant");
//Tier4_3 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_DROIDS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROIDS_4]);
}
if (step >= COMPLETE_TIER_4_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_imperial_tier4_4", "grant");
//Tier4_4 quests handled by trigger OnQuestActivated
}
if (step >= COMPLETE_MASTER_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_1], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_imperial_1", 25000, "object/tangible/wearables/jacket/jacket_ace_imperial.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 200.0f);
}
}
if (step >= COMPLETE_MASTER_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/destroy/master_imperial_2", "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_imperial_2", 50000, "object/tangible/wearables/helmet/helmet_fighter_imperial_ace.iff");
factions.addFactionStanding(self, factions.FACTION_IMPERIAL, 400.0f);
obj_id item = static_item.createNewItemFunction("item_quest_reward_imperial_pilot_medal_01_01", self);
string_id name = new string_id ( "static_item_n", "item_quest_reward_imperial_pilot_medal_01_01" );
prose_package pp = new prose_package ();
pp = prose.setStringId(pp, new string_id( "quest/ground/system_message", "placed_in_inventory" ));
pp = prose.setTO(pp, name);
sendQuestSystemMessage(self, pp);
//sendSystemMessage(self, "*****Master Skill*****.", null);
qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_2]);
space_flags.setSpaceFlag(self, "master_pilot_medal_recieved", true);
}
}
return true;
}
return false;
}
/******** All Functions ********************************************/
//This Function builds the main tool menu. It sniffs out all completed and/or active quests
//that are then displayed to the tester. If no quests are found, the tester is provided a
//base menu called the MAIN_TOOL_MENU
void showToolMainMenu(obj_id self)
{
utils.setScriptVar(self, SCRIPTVAR + ".useTrigger", true);
qa.refreshMenu(self, TOOL_PROMPT, TOOL_TITLE, MAIN_TOOL_MENU, "handleImperialPilotMainMenuOptions", true, SCRIPTVAR + ".pid", SCRIPTVAR + ".mainMenu");
}
//This function is called when the tool is canceled or exited so all script variables are removed
void cleanAllScriptVars(obj_id self)
{
qa.removeScriptVars(self, SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
//This function is called when the tool SUI revert option is selected
void detachAndcleanAllScriptVars(obj_id self)
{
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
@@ -0,0 +1,598 @@
package script.test;
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.factions;
import script.library.prose;
import script.library.qa;
import script.library.skill;
import script.library.space_flags;
import script.library.space_quest;
import script.library.static_item;
import script.library.sui;
import script.library.trainerlocs;
import script.library.utils;
public class qa_pilot_roadmap_tatooine_rebel extends script.base_script
{
public qa_pilot_roadmap_tatooine_rebel()
{
}
public static final String TOOL_TITLE = "Tatooine Rebel Pilot";
public static final String TOOL_PROMPT = "Tatooine Rebel Pilot\nSelect the pilot roadmap quest or function to complete.";
public static final String SCRIPTVAR = "pilotrebtat";
public static final String[][] MAIN_TOOL_MENU =
{
{
"Get Novice Tatooine Rebel Pilot and ship",
"Complete First Mission Set (spacequest/patrol/tatooine_rebel_1)",
"Complete Second Mission (spacequest/destroy/tatooine_rebel_3)",
"Complete Third Mission Set (spacequest/patrol/tatooine_rebel_2)",
"Complete Fourth Mission (spacequest/assassinate/tatooine_rebel_4)",
"Get First Tier Pilot Skills",
"Get Starships Tier 2",
"Complete Fifth Mission (spacequest/escort/yavin_rebel_13)",
"Get Pilot Weapons Tier 2",
"Complete Sixth Mission (spacequest/inspect/yavin_rebel_14)",
"Train Pilot Procedures Tier 2",
"Complete Seventh Mission Set (spacequest/inspect/yavin_rebel_15)",
"Train Droid Tier 2",
"Complete Eighth Mission (spacequest/escort/yavin_rebel_16)",
"Complete Tier 3_1 missions",
"Train Pilot Tier 3",
"Complete Tier 3_2 missions",
"Train Naval Weapons Tier 3",
"Complete Tier 3_3 missions",
"Train Naval Procedures Tier 3",
"Complete Tier 3_4 missions",
"Train Droid Tier 3",
"Train Pilot Tier 4",
"Complete Tier 4_1 missions",
"Get Pilot Weapons Tier 4",
"Complete Tier 4_2 missions",
"Train Pilot Procedures Tier 4",
"Complete Tier 4_3 missions",
"Train Droid Tier 4",
"Complete Tier 4_4 missions",
"Complete Master Mission 1 (spacequest/destroy/master_rebel_1)",
"Complete Master Mission 1 (spacequest/destroy/master_rebel_2)"
},
{
"pilot_rebel_navy_novice",
"spacequest/patrol/tatooine_rebel_1;spacequest/destroy_surpriseattack/tatooine_rebel_1",
"spacequest/destroy/tatooine_rebel_3",
"spacequest/patrol/tatooine_rebel_2;spacequest/escort/tatooine_rebel_2",
"spacequest/assassinate/tatooine_rebel_4",
"pilot_rebel_navy_starships_01;pilot_rebel_navy_weapons_01;pilot_rebel_navy_procedures_01;pilot_rebel_navy_droid_01",
"pilot_rebel_navy_starships_02",
"spacequest/escort/yavin_rebel_13",
"pilot_rebel_navy_weapons_02",
"spacequest/inspect/yavin_rebel_14",
"pilot_rebel_navy_procedures_02",
"spacequest/inspect/yavin_rebel_15;spacequest/destroy_surpriseattack/yavin_rebel_15",
"pilot_rebel_navy_droid_02",
"spacequest/escort/yavin_rebel_16",
"spacequest/recovery/tatooine_rebel_tier3_1;spacequest/delivery/tatooine_rebel_tier3_1_a;spacequest/survival/tatooine_rebel_tier3_1_b;spacequest/escort/tatooine_rebel_tier3_1_c",
"pilot_rebel_navy_starships_03",
"spacequest/inspect/tatooine_rebel_tier3_2;spacequest/destroy_surpriseattack/tatooine_rebel_tier3_2_a;spacequest/assassinate/tatooine_rebel_tier3_2_b;spacequest/space_battle/tatooine_rebel_tier3_2_c",
"pilot_rebel_navy_weapons_03",
"spacequest/delivery/tatooine_rebel_tier3_3;spacequest/space_battle/tatooine_rebel_tier3_3_a;spacequest/escort/tatooine_rebel_tier3_3_b;spacequest/survival/tatooine_rebel_tier3_3_c",
"pilot_rebel_navy_procedures_03",
"spacequest/assassinate/tatooine_rebel_tier3_4;spacequest/patrol/tatooine_rebel_tier3_4_a;spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b;spacequest/delivery_no_pickup/tatooine_rebel_tier3_4_c;spacequest/space_battle/tatooine_rebel_tier3_4_d",
"pilot_rebel_navy_droid_03",
"pilot_rebel_navy_starships_04",
"spacequest/space_battle/tatooine_rebel_tier4_1;spacequest/assassinate/tatooine_rebel_tier4_1_a;spacequest/patrol/tatooine_rebel_tier4_1_b;spacequest/destroy_surpriseattack/tatooine_rebel_tier4_1_c",
"pilot_rebel_navy_weapons_04",
"spacequest/recovery/tatooine_rebel_tier4_2;spacequest/delivery/tatooine_rebel_tier4_2_a;spacequest/survival/tatooine_rebel_tier4_2_b",
"pilot_rebel_navy_procedures_04",
"spacequest/space_battle/tatooine_rebel_tier4_3;spacequest/assassinate/tatooine_rebel_tier4_3_a;spacequest/assassinate/tatooine_rebel_tier4_3_b",
"pilot_rebel_navy_droid_04",
"spacequest/assassinate/tatooine_rebel_tier4_4;spacequest/survival/tatooine_rebel_tier4_4_a;spacequest/space_battle/tatooine_rebel_tier4_4_b",
"spacequest/destroy/master_rebel_1",
"spacequest/destroy/master_rebel_2"
}
};
public static final int GET_NOVICE_PILOT_AND_SHIP = 0;
public static final int COMPLETE_FIRST_MISSION = 1;
public static final int COMPLETE_SECOND_MISSION = 2;
public static final int COMPLETE_THIRD_MISSION = 3;
public static final int COMPLETE_FOURTH_MISSION = 4;
public static final int GET_FIRST_TIER_SKILLS = 5;
public static final int TRAIN_NAVAL_STARSHIPS_2 = 6;
public static final int COMPLETE_FIFTH_MISSION = 7;
public static final int TRAIN_NAVAL_WEAPONS_2 = 8;
public static final int COMPLETE_SIXTH_MISSION = 9;
public static final int TRAIN_NAVAL_PROCEDURES_2 = 10;
public static final int COMPLETE_SEVENTH_MISSION = 11;
public static final int TRAIN_NAVAL_DROID_2 = 12;
public static final int COMPLETE_EIGHTH_MISSION = 13;
public static final int COMPLETE_TIER_3_1 = 14;
public static final int TRAIN_NAVAL_STARSHIPS_3 = 15;
public static final int COMPLETE_TIER_3_2 = 16;
public static final int TRAIN_NAVAL_WEAPONS_3 = 17;
public static final int COMPLETE_TIER_3_3 = 18;
public static final int TRAIN_NAVAL_PROCEDURES_3 = 19;
public static final int COMPLETE_TIER_3_4 = 20;
public static final int TRAIN_NAVAL_DROIDS_3 = 21;
public static final int TRAIN_NAVAL_STARSHIPS_4 = 22;
public static final int COMPLETE_TIER_4_1 = 23;
public static final int TRAIN_NAVAL_WEAPONS_4 = 24;
public static final int COMPLETE_TIER_4_2 = 25;
public static final int TRAIN_NAVAL_PROCEDURES_4 = 26;
public static final int COMPLETE_TIER_4_3 = 27;
public static final int TRAIN_NAVAL_DROID_4 = 28;
public static final int COMPLETE_TIER_4_4 = 29;
public static final int COMPLETE_MASTER_1 = 30;
public static final int COMPLETE_MASTER_2 = 31;
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_rebel");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_rebel");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR))
{
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int OnQuestActivated(obj_id self, int questId) throws InterruptedException
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".useTrigger") && isGod(self))
{
int questidDelivery3_1_a = questGetQuestId("spacequest/delivery/tatooine_rebel_tier3_1_a");
int questidSurvival3_1_b = questGetQuestId("spacequest/survival/tatooine_rebel_tier3_1_b");
int questidEscort3_1_c = questGetQuestId("spacequest/escort/tatooine_rebel_tier3_1_c");
if (questId == questidDelivery3_1_a)
{
qa.completeActiveQuest(self, "spacequest/delivery/tatooine_rebel_tier3_1_a");
}
else if (questId == questidSurvival3_1_b)
{
qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier3_1_b");
}
else if (questId == questidEscort3_1_c)
{
boolean successCompleteEscort = qa.completeActiveQuest(self, "spacequest/escort/tatooine_rebel_tier3_1_c");
if (successCompleteEscort)
{
space_quest.giveReward(self, "recovery", "tatooine_rebel_tier3_1", 25000, "object/tangible/ship/components/armor/arm_mission_reward_rebel_corellian_triplate.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f);
}
else
{
}
}
int questidDestroy_surpriseattack3_2_a = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_rebel_tier3_2_a");
int questidAssassinate3_2_b = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier3_2_b");
int questidSpace_battle3_2_c = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier3_2_c");
if (questId == questidDestroy_surpriseattack3_2_a)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier3_2_a");
}
else if (questId == questidAssassinate3_2_b)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier3_2_b");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "tatooine_rebel_tier3_2", 25000, "object/tangible/ship/components/weapon_capacitor/cap_mission_reward_rebel_qualdex_battery_array.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f);
}
}
int questidSpace_battle3_3_a = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier3_3_a");
int questidEscort3_3_b = questGetQuestId("spacequest/escort/tatooine_rebel_tier3_3_b");
int questidSurvival3_3_c = questGetQuestId("spacequest/survival/tatooine_rebel_tier3_3_c");
if (questId == questidSpace_battle3_3_a)
{
qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_rebel_tier3_3_a");
}
else if (questId == questidEscort3_3_b)
{
qa.completeActiveQuest(self, "spacequest/escort/tatooine_rebel_tier3_3_b");
}
else if (questId == questidSurvival3_3_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier3_3_c");
if (successGrant)
{
space_quest.giveReward(self, "delivery", "tatooine_rebel_tier3_3", 25000, "object/tangible/ship/components/engine/eng_mission_reward_rebel_incom_military.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f);
}
}
int questidPatrol3_4_a = questGetQuestId("spacequest/patrol/tatooine_rebel_tier3_4_a");
int questidDestroy_surpriseattack3_4_b = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b");
int questidDelivery_no_pickup3_4_c = questGetQuestId("spacequest/delivery_no_pickup/tatooine_rebel_tier3_4_c");
int questidSpace_battle3_4_d = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier3_4_d");
if (questId == questidPatrol3_4_a)
{
qa.completeActiveQuest(self, "spacequest/patrol/tatooine_rebel_tier3_4_a");
qa.grantOrClearSpaceQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b", "grant");
}
else if (questId == questidDestroy_surpriseattack3_4_b)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b");
}
else if (questId == questidDelivery_no_pickup3_4_c)
{
qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_rebel_tier3_4_c");
}
else if (questId == questidSpace_battle3_4_d)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_rebel_tier3_4_d");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_rebel_tier3_4", 25000, "object/tangible/ship/components/reactor/rct_mission_reward_rebel_slayn_hypervortex.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f);
}
}
int questidAssassinate4_1_a = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier4_1_a");
int questidDestroy_surpriseattack4_1_c = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_rebel_tier4_1_c");
if (questId == questidDestroy_surpriseattack4_1_c)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier4_1_c");
}
else if (questId == questidAssassinate4_1_a)
{
boolean successComplete = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_1_a");
if (successComplete)
{
space_quest.giveReward(self, "space_battle", "tatooine_rebel_tier4_1", 10000, "object/tangible/ship/components/shield_generator/shd_mission_reward_rebel_taim_military_grade.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f);
}
}
int questidDelivery4_2_a = questGetQuestId("spacequest/delivery/tatooine_rebel_tier4_2_a");
int questidSurvival4_2_b = questGetQuestId("spacequest/survival/tatooine_rebel_tier4_2_b");
if (questId == questidSurvival4_2_b)
{
qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier4_2_b");
}
else if (questId == questidDelivery4_2_a)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/delivery/tatooine_rebel_tier4_2_a");
if (successGrant)
{
space_quest.giveReward(self, "recovery", "tatooine_rebel_tier4_2", 10000, "object/tangible/ship/components/droid_interface/ddi_mission_reward_rebel_novaldex_low_latency.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f);
}
}
int questidAssassinate4_3_a = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier4_3_a");
int questidAssassinate4_3_b = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier4_3_b");
if (questId == questidAssassinate4_3_b)
{
qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_3_b");
}
else if (questId == questidAssassinate4_3_a)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_3_a");
if (successGrant)
{
space_quest.giveReward(self, "space_battle", "tatooine_rebel_tier4_3", 10000, "object/tangible/ship/components/booster/bst_mission_reward_rebel_qualdex_halcyon.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f);
}
}
int questidSurvival4_4_a = questGetQuestId("spacequest/survival/tatooine_rebel_tier4_4_a");
int questidSpace_battle4_4_b = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier4_4_b");
if (questId == questidSpace_battle4_4_b)
{
qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_rebel_tier4_4_b");
}
else if (questId == questidSurvival4_4_a)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier4_4_a");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_rebel_tier4_4", 10000, "object/tangible/ship/components/weapon/wpn_mission_reward_rebel_incom_tricannon.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f);
}
}
}
return SCRIPT_CONTINUE;
}
public int handleRebelPilotMainMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
detachAndcleanAllScriptVars(self);
String[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu(self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
return SCRIPT_CONTINUE;
}
else
{
if (hasSkill(self, "pilot_imperial_navy_novice") || hasSkill(self, "pilot_rebel_navy_novice") || hasSkill(self, "pilot_neutral_novice"))
{
qa.revokePilotingSkills(self);
qa.blowOutObjVars(self, "space");
}
boolean successStep = stepThroughPilot(self, idx);
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
public boolean stepThroughPilot(obj_id self, int step) throws InterruptedException
{
if (step >= 0)
{
if (step >= GET_NOVICE_PILOT_AND_SHIP)
{
space_flags.setSpaceTrack(self, space_flags.REBEL_TATOOINE);
qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][GET_NOVICE_PILOT_AND_SHIP]);
if (space_quest.canGrantNewbieShip(self) && hasSkill(self, MAIN_TOOL_MENU[1][GET_NOVICE_PILOT_AND_SHIP]))
{
space_quest.grantNewbieShip(self, "rebel");
}
}
if (step >= COMPLETE_FIRST_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIRST_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy_surpriseattack", "tatooine_rebel_1", 100);
factions.addFactionStanding(self, factions.FACTION_REBEL, 25.0f);
}
}
if (step >= COMPLETE_SECOND_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SECOND_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "tatooine_rebel_3", 200);
factions.addFactionStanding(self, factions.FACTION_REBEL, 50.0f);
}
}
if (step >= COMPLETE_THIRD_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_THIRD_MISSION], "grant");
if (successGrant)
{
factions.addFactionStanding(self, factions.FACTION_REBEL, 50.0f);
space_quest.giveReward(self, "escort", "tatooine_rebel_2", 500, "object/tangible/wearables/bodysuit/rebel_bodysuit_s14.iff");
space_quest.giveReward(self, "escort", "tatooine_rebel_2", 500, "object/tangible/wearables/bandolier/ith_multipocket_bandolier.iff");
space_quest.giveReward(self, "escort", "tatooine_rebel_2", 500, "object/tangible/wearables/bandolier/multipocket_bandolier.iff");
}
}
if (step >= COMPLETE_FOURTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FOURTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_rebel_4", 1000, "object/tangible/ship/components/armor/arm_mission_reward_rebel_incom_ultralight.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f);
}
}
if (step >= GET_FIRST_TIER_SKILLS)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][GET_FIRST_TIER_SKILLS]);
}
if (step >= TRAIN_NAVAL_STARSHIPS_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_2]);
}
if (step >= COMPLETE_FIFTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIFTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "escort", "yavin_rebel_13", 5000, "object/tangible/ship/components/shield_generator/shd_mission_reward_rebel_incom_k77.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f);
}
}
if (step >= TRAIN_NAVAL_WEAPONS_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_2]);
}
if (step >= COMPLETE_SIXTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SIXTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "yavin_rebel_14", 5000, "object/tangible/ship/components/droid_interface/ddi_mission_reward_rebel_moncal_d22.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f);
}
}
if (step >= TRAIN_NAVAL_PROCEDURES_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_2]);
}
if (step >= COMPLETE_SEVENTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SEVENTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy_surpriseattack", "yavin_rebel_15", 5000, "object/tangible/ship/components/booster/bst_mission_reward_rebel_novaldex_hypernova.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f);
}
}
if (step >= TRAIN_NAVAL_DROID_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROID_2]);
}
if (step >= COMPLETE_EIGHTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_EIGHTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "escort", "yavin_rebel_16", 5000, "object/tangible/ship/components/weapon/wpn_mission_reward_rebel_taim_ion_driver.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f);
space_flags.setSpaceFlag(self, "ekerPilot", 3);
}
}
if (step >= COMPLETE_TIER_3_1)
{
boolean successGrantEscort = qa.grantOrClearSpaceQuest(self, "spacequest/recovery/tatooine_rebel_tier3_1", "grant");
}
if (step >= TRAIN_NAVAL_STARSHIPS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_3]);
}
if (step >= COMPLETE_TIER_3_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/inspect/tatooine_rebel_tier3_2", "grant");
}
if (step >= TRAIN_NAVAL_WEAPONS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_3]);
}
if (step >= COMPLETE_TIER_3_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/delivery/tatooine_rebel_tier3_3", "grant");
}
if (step >= TRAIN_NAVAL_PROCEDURES_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_3]);
}
if (step >= COMPLETE_TIER_3_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_rebel_tier3_4", "grant");
}
if (step >= TRAIN_NAVAL_DROIDS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROIDS_3]);
}
if (step >= TRAIN_NAVAL_STARSHIPS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_4]);
}
if (step >= COMPLETE_TIER_4_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_rebel_tier4_1", "grant");
}
if (step >= TRAIN_NAVAL_WEAPONS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_4]);
}
if (step >= COMPLETE_TIER_4_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/recovery/tatooine_rebel_tier4_2", "grant");
}
if (step >= TRAIN_NAVAL_PROCEDURES_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_4]);
}
if (step >= COMPLETE_TIER_4_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_rebel_tier4_3", "grant");
}
if (step >= TRAIN_NAVAL_DROID_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROID_4]);
}
if (step >= COMPLETE_TIER_4_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_4", "grant");
}
if (step >= COMPLETE_MASTER_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_1], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_rebel_1", 25000, "object/tangible/wearables/jacket/jacket_ace_rebel.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 200.0f);
}
}
if (step >= COMPLETE_MASTER_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_2], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_rebel_2", 50000, "object/tangible/wearables/helmet/helmet_fighter_rebel_ace.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 400.0f);
if (getGender(self) == GENDER_MALE)
{
if (getSpecies(self) == SPECIES_ITHORIAN)
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_m.iff", self);
setBioLink(medal, self);
}
else if (getSpecies(self) == SPECIES_WOOKIEE)
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_m.iff", self);
setBioLink(medal, self);
}
else
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_ace_pilot_rebel_m.iff", self);
setBioLink(medal, self);
}
}
else
{
if (getSpecies(self) == SPECIES_ITHORIAN)
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_f.iff", self);
setBioLink(medal, self);
}
else if (getSpecies(self) == SPECIES_WOOKIEE)
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_trando_ace_pilot_rebel_f.iff", self);
setBioLink(medal, self);
}
else
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_trando_ace_pilot_rebel_f.iff", self);
setBioLink(medal, self);
}
}
skill.noisyGrantSkill(self, "pilot_rebel_navy_master");
space_flags.setSpaceFlag(self, "master_pilot_medal_recieved", true);
}
}
return true;
}
return false;
}
public void showToolMainMenu(obj_id self) throws InterruptedException
{
utils.setScriptVar(self, SCRIPTVAR + ".useTrigger", true);
qa.refreshMenu(self, TOOL_PROMPT, TOOL_TITLE, MAIN_TOOL_MENU, "handleRebelPilotMainMenuOptions", true, SCRIPTVAR + ".pid", SCRIPTVAR + ".mainMenu");
}
public void cleanAllScriptVars(obj_id self) throws InterruptedException
{
qa.removeScriptVars(self, SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
public void detachAndcleanAllScriptVars(obj_id self) throws InterruptedException
{
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
}
@@ -1,702 +0,0 @@
// ======================================================================
// qa_pilot_roadmap_tatooine_rebel.script
//
// QA Tatooine Rebel Pilot Roadmap Tool
//
// ======================================================================
//
// Intent:
// This script is intended to provide the tester with the ability to move from
// a non-pilot test character to a valid Master Pilot in a rapid method.
// This tool also should provide the means to test the pilot roadmap itself.
//
// ======================================================================
//
// ======================================================================
// Library Includes
// ======================================================================
include library.factions;
include library.prose;
include library.qa;
include library.skill;
include library.space_flags;
include library.space_quest;
include library.static_item;
include library.sui;
include library.trainerlocs;
include library.utils;
/********* CONSTANTS *****************************************/
const string TOOL_TITLE = "Tatooine Rebel Pilot";
const string TOOL_PROMPT = "Tatooine Rebel Pilot\nSelect the pilot roadmap quest or function to complete."; //NO QUEST REWARDS ARE GIVEN FOR QUESTS YOU COMPLETE USING THIS TOOL. To get a specific reward you need to complete the quest previous to the reward, complete the quest normally and visit the quest NPC.";
const string SCRIPTVAR = "pilotrebtat";
const string[][] MAIN_TOOL_MENU =
{
{
"Get Novice Tatooine Rebel Pilot and ship", //GET_NOVICE_PILOT_AND_SHIP
"Complete First Mission Set (spacequest/patrol/tatooine_rebel_1)", //COMPLETE_FIRST_MISSION
"Complete Second Mission (spacequest/destroy/tatooine_rebel_3)", //COMPLETE_SECOND_MISSION
"Complete Third Mission Set (spacequest/patrol/tatooine_rebel_2)", //COMPLETE_THIRD_MISSION
"Complete Fourth Mission (spacequest/assassinate/tatooine_rebel_4)", //COMPLETE_FOURTH_MISSION
"Get First Tier Pilot Skills", //GET_FIRST_TIER_SKILLS
"Get Starships Tier 2", //TRAIN_NAVAL_STARSHIPS_2
"Complete Fifth Mission (spacequest/escort/yavin_rebel_13)", //COMPLETE_FIFTH_MISSION
"Get Pilot Weapons Tier 2", //TRAIN_NAVAL_WEAPONS_2
"Complete Sixth Mission (spacequest/inspect/yavin_rebel_14)", //COMPLETE_SIXTH_MISSION
"Train Pilot Procedures Tier 2", //TRAIN_NAVAL_PROCEDURES_2
"Complete Seventh Mission Set (spacequest/inspect/yavin_rebel_15)", //COMPLETE_SEVENTH_MISSION
"Train Droid Tier 2", //TRAIN_NAVAL_DROID_2
"Complete Eighth Mission (spacequest/escort/yavin_rebel_16)", //COMPLETE_EIGHTH_MISSION
"Complete Tier 3_1 missions", //COMPLETE_TIER_3_1
"Train Pilot Tier 3", //TRAIN_NAVAL_STARSHIPS_3
"Complete Tier 3_2 missions", //COMPLETE_TIER_3_2
"Train Naval Weapons Tier 3", //TRAIN_NAVAL_WEAPONS_3
"Complete Tier 3_3 missions", //COMPLETE_TIER_3_3
"Train Naval Procedures Tier 3", //TRAIN_NAVAL_PROCEDURES_3
"Complete Tier 3_4 missions", //COMPLETE_TIER_3_4
"Train Droid Tier 3", //TRAIN_NAVAL_DROIDS_3
"Train Pilot Tier 4", //TRAIN_NAVAL_STARSHIPS_4
"Complete Tier 4_1 missions", //COMPLETE_TIER_4_1
"Get Pilot Weapons Tier 4", //TRAIN_NAVAL_WEAPONS_4
"Complete Tier 4_2 missions", //COMPLETE_TIER_4_2
"Train Pilot Procedures Tier 4", //TRAIN_NAVAL_PROCEDURES_4
"Complete Tier 4_3 missions", //COMPLETE_TIER_4_3
"Train Droid Tier 4", //TRAIN_NAVAL_DROID_4
"Complete Tier 4_4 missions", //COMPLETE_TIER_4_4
"Complete Master Mission 1 (spacequest/destroy/master_rebel_1)", //COMPLETE_MASTER_1
"Complete Master Mission 1 (spacequest/destroy/master_rebel_2)", //COMPLETE_MASTER_2
}
,
{
"pilot_rebel_navy_novice", //GET_NOVICE_PILOT_AND_SHIP
"spacequest/patrol/tatooine_rebel_1;spacequest/destroy_surpriseattack/tatooine_rebel_1", //COMPLETE_FIRST_MISSION
"spacequest/destroy/tatooine_rebel_3", //COMPLETE_SECOND_MISSION
"spacequest/patrol/tatooine_rebel_2;spacequest/escort/tatooine_rebel_2", //COMPLETE_THIRD_MISSION
"spacequest/assassinate/tatooine_rebel_4", //COMPLETE_FOURTH_MISSION
"pilot_rebel_navy_starships_01;pilot_rebel_navy_weapons_01;pilot_rebel_navy_procedures_01;pilot_rebel_navy_droid_01", //GET_FIRST_TIER_SKILLS
"pilot_rebel_navy_starships_02", //TRAIN_NAVAL_STARSHIPS_2
"spacequest/escort/yavin_rebel_13", //COMPLETE_FIFTH_MISSION
"pilot_rebel_navy_weapons_02", //TRAIN_NAVAL_WEAPONS_2
"spacequest/inspect/yavin_rebel_14", //COMPLETE_SIXTH_MISSION
"pilot_rebel_navy_procedures_02", //TRAIN_NAVAL_PROCEDURES_2
"spacequest/inspect/yavin_rebel_15;spacequest/destroy_surpriseattack/yavin_rebel_15", //COMPLETE_SEVENTH_MISSION
"pilot_rebel_navy_droid_02", //TRAIN_NAVAL_DROID_2
"spacequest/escort/yavin_rebel_16", //COMPLETE_EIGHTH_MISSION
"spacequest/recovery/tatooine_rebel_tier3_1;spacequest/delivery/tatooine_rebel_tier3_1_a;spacequest/survival/tatooine_rebel_tier3_1_b;spacequest/escort/tatooine_rebel_tier3_1_c",
//COMPLETE_TIER_3_1
"pilot_rebel_navy_starships_03", //TRAIN_NAVAL_STARSHIPS_3
"spacequest/inspect/tatooine_rebel_tier3_2;spacequest/destroy_surpriseattack/tatooine_rebel_tier3_2_a;spacequest/assassinate/tatooine_rebel_tier3_2_b;spacequest/space_battle/tatooine_rebel_tier3_2_c",
//COMPLETE_TIER_3_2
"pilot_rebel_navy_weapons_03", //TRAIN_NAVAL_WEAPONS_3
"spacequest/delivery/tatooine_rebel_tier3_3;spacequest/space_battle/tatooine_rebel_tier3_3_a;spacequest/escort/tatooine_rebel_tier3_3_b;spacequest/survival/tatooine_rebel_tier3_3_c",
//COMPLETE_TIER_3_3
"pilot_rebel_navy_procedures_03", //TRAIN_NAVAL_PROCEDURES_3
"spacequest/assassinate/tatooine_rebel_tier3_4;spacequest/patrol/tatooine_rebel_tier3_4_a;spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b;spacequest/delivery_no_pickup/tatooine_rebel_tier3_4_c;spacequest/space_battle/tatooine_rebel_tier3_4_d",
//COMPLETE_TIER_3_4
"pilot_rebel_navy_droid_03", //TRAIN_NAVAL_DROIDS_3
"pilot_rebel_navy_starships_04", //TRAIN_NAVAL_STARSHIPS_4
"spacequest/space_battle/tatooine_rebel_tier4_1;spacequest/assassinate/tatooine_rebel_tier4_1_a;spacequest/patrol/tatooine_rebel_tier4_1_b;spacequest/destroy_surpriseattack/tatooine_rebel_tier4_1_c",
//COMPLETE_TIER_4_1
"pilot_rebel_navy_weapons_04", //TRAIN_NAVAL_WEAPONS_4
"spacequest/recovery/tatooine_rebel_tier4_2;spacequest/delivery/tatooine_rebel_tier4_2_a;spacequest/survival/tatooine_rebel_tier4_2_b",
//COMPLETE_TIER_4_2
"pilot_rebel_navy_procedures_04", //TRAIN_NAVAL_PROCEDURES_4
"spacequest/space_battle/tatooine_rebel_tier4_3;spacequest/assassinate/tatooine_rebel_tier4_3_a;spacequest/assassinate/tatooine_rebel_tier4_3_b",
//COMPLETE_TIER_4_3
"pilot_rebel_navy_droid_04", //TRAIN_NAVAL_DROID_4
"spacequest/assassinate/tatooine_rebel_tier4_4;spacequest/survival/tatooine_rebel_tier4_4_a;spacequest/space_battle/tatooine_rebel_tier4_4_b",
//COMPLETE_TIER_4_4
"spacequest/destroy/master_rebel_1", //COMPLETE_MASTER_1
"spacequest/destroy/master_rebel_2", //COMPLETE_MASTER_2
}
};
const int GET_NOVICE_PILOT_AND_SHIP = 0;
const int COMPLETE_FIRST_MISSION = 1;
const int COMPLETE_SECOND_MISSION = 2;
const int COMPLETE_THIRD_MISSION = 3;
const int COMPLETE_FOURTH_MISSION = 4;
const int GET_FIRST_TIER_SKILLS = 5;
const int TRAIN_NAVAL_STARSHIPS_2 = 6;
const int COMPLETE_FIFTH_MISSION = 7;
const int TRAIN_NAVAL_WEAPONS_2 = 8;
const int COMPLETE_SIXTH_MISSION = 9;
const int TRAIN_NAVAL_PROCEDURES_2 = 10;
const int COMPLETE_SEVENTH_MISSION = 11;
const int TRAIN_NAVAL_DROID_2 = 12;
const int COMPLETE_EIGHTH_MISSION = 13;
const int COMPLETE_TIER_3_1 = 14;
const int TRAIN_NAVAL_STARSHIPS_3 = 15;
const int COMPLETE_TIER_3_2 = 16;
const int TRAIN_NAVAL_WEAPONS_3 = 17;
const int COMPLETE_TIER_3_3 = 18;
const int TRAIN_NAVAL_PROCEDURES_3 = 19;
const int COMPLETE_TIER_3_4 = 20;
const int TRAIN_NAVAL_DROIDS_3 = 21;
const int TRAIN_NAVAL_STARSHIPS_4 = 22;
const int COMPLETE_TIER_4_1 = 23;
const int TRAIN_NAVAL_WEAPONS_4 = 24;
const int COMPLETE_TIER_4_2 = 25;
const int TRAIN_NAVAL_PROCEDURES_4 = 26;
const int COMPLETE_TIER_4_3 = 27;
const int TRAIN_NAVAL_DROID_4 = 28;
const int COMPLETE_TIER_4_4 = 29;
const int COMPLETE_MASTER_1 = 30;
const int COMPLETE_MASTER_2 = 31;
/***** TRIGGERS *******************************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_rebel");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_pilot_roadmap_tatooine_rebel");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if (toLower(text).equals(SCRIPTVAR))
{
//Function to show the main menu of the tool
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
//This trigger handles the Recursive/iterative functionality with the Space Quest Tier content
//When a quest is activated, we compare it to the recursive space content quests. When/if found,
//the quest is completed, triggering yet another function.
trigger OnQuestActivated(int questId)
{
//One script var keeps the trigger from firing off everytime the tester receives a quest
if (utils.hasScriptVar(self, SCRIPTVAR + ".useTrigger") && isGod(self))
{
//TIER 3_1
int questidDelivery3_1_a = questGetQuestId("spacequest/delivery/tatooine_rebel_tier3_1_a");
int questidSurvival3_1_b = questGetQuestId("spacequest/survival/tatooine_rebel_tier3_1_b");
int questidEscort3_1_c = questGetQuestId("spacequest/escort/tatooine_rebel_tier3_1_c");
//TIER 3_1 QUESTS
if (questId == questidDelivery3_1_a)
{
qa.completeActiveQuest(self, "spacequest/delivery/tatooine_rebel_tier3_1_a");
//sendSystemMessageTestingOnly(self, "******************** tatooine_rebel_tier3_1_a completed");
}
else if (questId == questidSurvival3_1_b)
{
qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier3_1_b");
//sendSystemMessageTestingOnly(self, "******************** tatooine_rebel_tier3_1_b completed");
}
else if (questId == questidEscort3_1_c)
{
//sendSystemMessageTestingOnly(self, "******************** questidEscort3_1_c recieved");
boolean successCompleteEscort = qa.completeActiveQuest(self, "spacequest/escort/tatooine_rebel_tier3_1_c");
if (successCompleteEscort)
{
//sendSystemMessageTestingOnly(self, "******************** questidEscort3_1_c completed");
space_quest.giveReward(self, "recovery", "tatooine_rebel_tier3_1", 25000, "object/tangible/ship/components/armor/arm_mission_reward_rebel_corellian_triplate.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f );
}
else
{
//sendSystemMessageTestingOnly(self, "******************** questidEscort3_1_c failed");
}
}
//TIER 3_2
int questidDestroy_surpriseattack3_2_a = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_rebel_tier3_2_a");
int questidAssassinate3_2_b = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier3_2_b");
int questidSpace_battle3_2_c = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier3_2_c");
//TIER 3_2 QUESTS
if (questId == questidDestroy_surpriseattack3_2_a)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier3_2_a");
}
else if (questId == questidAssassinate3_2_b)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier3_2_b");
//}
//else if (questId == questidSpace_battle3_2_c)
//{
//boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_rebel_tier3_2_c", "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "tatooine_rebel_tier3_2", 25000, "object/tangible/ship/components/weapon_capacitor/cap_mission_reward_rebel_qualdex_battery_array.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f );
}
}
//TIER 3_3
int questidSpace_battle3_3_a = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier3_3_a");
int questidEscort3_3_b = questGetQuestId("spacequest/escort/tatooine_rebel_tier3_3_b");
int questidSurvival3_3_c = questGetQuestId("spacequest/survival/tatooine_rebel_tier3_3_c");
//TIER 3_3 QUESTS
if (questId == questidSpace_battle3_3_a)
{
qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_rebel_tier3_3_a");
}
else if (questId == questidEscort3_3_b)
{
qa.completeActiveQuest(self, "spacequest/escort/tatooine_rebel_tier3_3_b");
}
else if (questId == questidSurvival3_3_c)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier3_3_c");
if (successGrant)
{
space_quest.giveReward(self, "delivery", "tatooine_rebel_tier3_3", 25000, "object/tangible/ship/components/engine/eng_mission_reward_rebel_incom_military.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f );
}
}
//TIER 3_4
int questidPatrol3_4_a = questGetQuestId("spacequest/patrol/tatooine_rebel_tier3_4_a");
int questidDestroy_surpriseattack3_4_b = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b");
int questidDelivery_no_pickup3_4_c = questGetQuestId("spacequest/delivery_no_pickup/tatooine_rebel_tier3_4_c");
int questidSpace_battle3_4_d = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier3_4_d");
//TIER 3_4 QUESTS
if (questId == questidPatrol3_4_a)
{
qa.completeActiveQuest(self, "spacequest/patrol/tatooine_rebel_tier3_4_a");
//the 2nd quest will not fire off automatically
qa.grantOrClearSpaceQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b", "grant");
}
else if (questId == questidDestroy_surpriseattack3_4_b)
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier3_4_b");
}
else if (questId == questidDelivery_no_pickup3_4_c)
{
qa.completeActiveQuest(self, "spacequest/delivery_no_pickup/tatooine_rebel_tier3_4_c");
}
else if (questId == questidSpace_battle3_4_d)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_rebel_tier3_4_d");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_rebel_tier3_4", 25000, "object/tangible/ship/components/reactor/rct_mission_reward_rebel_slayn_hypervortex.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 100.0f);
}
}
//TIER 4_1
int questidAssassinate4_1_a = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier4_1_a");
int questidDestroy_surpriseattack4_1_c = questGetQuestId("spacequest/destroy_surpriseattack/tatooine_rebel_tier4_1_c");
//TIER 4_1 QUESTS
if (questId == questidDestroy_surpriseattack4_1_c) //This quest is skipped??
{
qa.completeActiveQuest(self, "spacequest/destroy_surpriseattack/tatooine_rebel_tier4_1_c");
}
else if (questId == questidAssassinate4_1_a)
{
boolean successComplete = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_1_a");
if (successComplete)
{
space_quest.giveReward(self, "space_battle", "tatooine_rebel_tier4_1", 10000, "object/tangible/ship/components/shield_generator/shd_mission_reward_rebel_taim_military_grade.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f);
}
}
//TIER 4_2
int questidDelivery4_2_a = questGetQuestId("spacequest/delivery/tatooine_rebel_tier4_2_a");
int questidSurvival4_2_b = questGetQuestId("spacequest/survival/tatooine_rebel_tier4_2_b");
//TIER 4_2 QUESTS
if (questId == questidSurvival4_2_b)
{
qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier4_2_b"); //Skipped??
}
else if (questId == questidDelivery4_2_a)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/delivery/tatooine_rebel_tier4_2_a");
if (successGrant)
{
space_quest.giveReward(self, "recovery", "tatooine_rebel_tier4_2", 10000, "object/tangible/ship/components/droid_interface/ddi_mission_reward_rebel_novaldex_low_latency.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f );
}
}
//TIER 4_3
int questidAssassinate4_3_a = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier4_3_a");
int questidAssassinate4_3_b = questGetQuestId("spacequest/assassinate/tatooine_rebel_tier4_3_b");
//TIER 4_3 QUESTS
if (questId == questidAssassinate4_3_b)//not used? Skipped??
{
qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_3_b");
//the 2nd quest will not fire off automatically
//qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_3_b", "grant");
}
else if (questId == questidAssassinate4_3_a)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_3_a");
if (successGrant)
{
space_quest.giveReward(self, "space_battle", "tatooine_rebel_tier4_3", 10000, "object/tangible/ship/components/booster/bst_mission_reward_rebel_qualdex_halcyon.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f );
}
}
//TIER 4_4
int questidSurvival4_4_a = questGetQuestId("spacequest/survival/tatooine_rebel_tier4_4_a");
int questidSpace_battle4_4_b = questGetQuestId("spacequest/space_battle/tatooine_rebel_tier4_4_b");
//TIER 4_4 QUESTS
if (questId == questidSpace_battle4_4_b) //Skipped?
{
qa.completeActiveQuest(self, "spacequest/space_battle/tatooine_rebel_tier4_4_b");
}
else if (questId == questidSurvival4_4_a)
{
boolean successGrant = qa.completeActiveQuest(self, "spacequest/survival/tatooine_rebel_tier4_4_a");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_rebel_tier4_4", 10000, "object/tangible/ship/components/weapon/wpn_mission_reward_rebel_incom_tricannon.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 150.0f );
}
}
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler handleRebelPilotMainMenuOptions()
{
if (isGod(self))
{
//static script var
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//check for cancel button
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
detachAndcleanAllScriptVars(self);
string[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu( self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
return SCRIPT_CONTINUE;
}
//build the next sui
else
{
//if has pilot skill, revoke it:
if (hasSkill(self, "pilot_imperial_navy_novice") || hasSkill(self, "pilot_rebel_navy_novice") || hasSkill(self, "pilot_neutral_novice"))
{
qa.revokePilotingSkills(self);
qa.blowOutObjVars(self, "space");
}
boolean successStep = stepThroughPilot(self, idx);
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
boolean stepThroughPilot(obj_id self, int step)
{
if (step >= 0)
{
if (step >= GET_NOVICE_PILOT_AND_SHIP)
{
space_flags.setSpaceTrack(self, space_flags.REBEL_TATOOINE);
qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][GET_NOVICE_PILOT_AND_SHIP]);
if (space_quest.canGrantNewbieShip(self) && hasSkill(self, MAIN_TOOL_MENU[1][GET_NOVICE_PILOT_AND_SHIP]))
{
// valid factions:"imperial", "rebel", "neutral"
space_quest.grantNewbieShip(self, "rebel");
}
}
if (step >= COMPLETE_FIRST_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIRST_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy_surpriseattack", "tatooine_rebel_1", 100 );
factions.addFactionStanding(self, factions.FACTION_REBEL, 25.0f );
}
}
if (step >= COMPLETE_SECOND_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SECOND_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "tatooine_rebel_3", 200 );
factions.addFactionStanding(self, factions.FACTION_REBEL, 50.0f );
}
}
if (step >= COMPLETE_THIRD_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_THIRD_MISSION], "grant");
if (successGrant)
{
factions.addFactionStanding(self, factions.FACTION_REBEL, 50.0f );
space_quest.giveReward(self, "escort", "tatooine_rebel_2", 500, "object/tangible/wearables/bodysuit/rebel_bodysuit_s14.iff");
space_quest.giveReward(self, "escort", "tatooine_rebel_2", 500, "object/tangible/wearables/bandolier/ith_multipocket_bandolier.iff");
space_quest.giveReward(self, "escort", "tatooine_rebel_2", 500, "object/tangible/wearables/bandolier/multipocket_bandolier.iff");
}
}
if (step >= COMPLETE_FOURTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FOURTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "assassinate", "tatooine_rebel_4", 1000, "object/tangible/ship/components/armor/arm_mission_reward_rebel_incom_ultralight.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f );
}
}
if (step >= GET_FIRST_TIER_SKILLS)
{
//sendSystemMessageTestingOnly(self, "GET_FIRST_TIER_SKILLS: " + GET_FIRST_TIER_SKILLS);
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][GET_FIRST_TIER_SKILLS]);
}
if (step >= TRAIN_NAVAL_STARSHIPS_2)
{
//sendSystemMessageTestingOnly(self, "GET_FIRST_TIER_SKILLS: " + GET_FIRST_TIER_SKILLS);
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_2]);
}
if (step >= COMPLETE_FIFTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_FIFTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "escort", "yavin_rebel_13", 5000, "object/tangible/ship/components/shield_generator/shd_mission_reward_rebel_incom_k77.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f );
}
}
if (step >= TRAIN_NAVAL_WEAPONS_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_2]);
}
if (step >= COMPLETE_SIXTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SIXTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "inspect", "yavin_rebel_14", 5000, "object/tangible/ship/components/droid_interface/ddi_mission_reward_rebel_moncal_d22.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f );
}
}
if (step >= TRAIN_NAVAL_PROCEDURES_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_2]);
}
if (step >= COMPLETE_SEVENTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_SEVENTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy_surpriseattack", "yavin_rebel_15", 5000, "object/tangible/ship/components/booster/bst_mission_reward_rebel_novaldex_hypernova.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f );
}
}
if (step >= TRAIN_NAVAL_DROID_2)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROID_2]);
}
if (step >= COMPLETE_EIGHTH_MISSION)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_EIGHTH_MISSION], "grant");
if (successGrant)
{
space_quest.giveReward(self, "escort", "yavin_rebel_16", 5000, "object/tangible/ship/components/weapon/wpn_mission_reward_rebel_taim_ion_driver.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 75.0f );
space_flags.setSpaceFlag(self, "ekerPilot", 3);
}
}
if (step >= COMPLETE_TIER_3_1)
{
boolean successGrantEscort = qa.grantOrClearSpaceQuest(self, "spacequest/recovery/tatooine_rebel_tier3_1", "grant");
//The tier3_1 quests are handled by the trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_STARSHIPS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_3]);
}
if (step >= COMPLETE_TIER_3_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/inspect/tatooine_rebel_tier3_2", "grant");
//The tier3_2 quests are handled by the trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_WEAPONS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_3]);
}
if (step >= COMPLETE_TIER_3_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/delivery/tatooine_rebel_tier3_3", "grant");
//Tier3_3 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_PROCEDURES_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_3]);
}
if (step >= COMPLETE_TIER_3_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_rebel_tier3_4", "grant");
//Tier3_3 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_DROIDS_3)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROIDS_3]);
}
if (step >= TRAIN_NAVAL_STARSHIPS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_STARSHIPS_4]);
}
if (step >= COMPLETE_TIER_4_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_rebel_tier4_1", "grant");
//The rest of Tier4_1 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_WEAPONS_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_WEAPONS_4]);
}
if (step >= COMPLETE_TIER_4_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/recovery/tatooine_rebel_tier4_2", "grant");
//Tier4_2 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_PROCEDURES_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_PROCEDURES_4]);
}
if (step >= COMPLETE_TIER_4_3)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/space_battle/tatooine_rebel_tier4_3", "grant");
//Tier4_3 quests handled by trigger OnQuestActivated
}
if (step >= TRAIN_NAVAL_DROID_4)
{
boolean successGrant = qa.grantPilotSkill(self, MAIN_TOOL_MENU[1][TRAIN_NAVAL_DROID_4]);
}
if (step >= COMPLETE_TIER_4_4)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, "spacequest/assassinate/tatooine_rebel_tier4_4", "grant");
//Tier4_4 quests handled by trigger OnQuestActivated
}
if (step >= COMPLETE_MASTER_1)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_1], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_rebel_1", 25000, "object/tangible/wearables/jacket/jacket_ace_rebel.iff");
factions.addFactionStanding(self, factions.FACTION_REBEL, 200.0f );
}
}
if (step >= COMPLETE_MASTER_2)
{
boolean successGrant = qa.grantOrClearSpaceQuest(self, MAIN_TOOL_MENU[1][COMPLETE_MASTER_2], "grant");
if (successGrant)
{
space_quest.giveReward(self, "destroy", "master_rebel_2", 50000, "object/tangible/wearables/helmet/helmet_fighter_rebel_ace.iff" );
factions.addFactionStanding(self, factions.FACTION_REBEL, 400.0f );
if (getGender(self) == GENDER_MALE)
{
if (getSpecies(self) == SPECIES_ITHORIAN )
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_m.iff", self);
setBioLink(medal, self);
}
else if (getSpecies(self) == SPECIES_WOOKIEE)
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_ace_pilot_rebel_wke_m.iff", self);
setBioLink(medal, self);
}
else
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_ace_pilot_rebel_m.iff", self);
setBioLink(medal, self);
}
}
else
{
if (getSpecies(self) == SPECIES_ITHORIAN )
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/ith_necklace_ace_pilot_rebel_f.iff", self);
setBioLink(medal, self);
}
else if (getSpecies(self) == SPECIES_WOOKIEE)
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_trando_ace_pilot_rebel_f.iff", self);
setBioLink(medal, self);
}
else
{
obj_id medal = createObjectInInventoryAllowOverload("object/tangible/wearables/necklace/necklace_trando_ace_pilot_rebel_f.iff", self);
setBioLink(medal, self);
}
}
skill.noisyGrantSkill(self, "pilot_rebel_navy_master");
space_flags.setSpaceFlag(self, "master_pilot_medal_recieved", true);
}
}
return true;
}
return false;
}
/******** All Functions ********************************************/
//This Function builds the main tool menu. It sniffs out all completed and/or active quests
//that are then displayed to the tester. If no quests are found, the tester is provided a
//base menu called the MAIN_TOOL_MENU
void showToolMainMenu(obj_id self)
{
utils.setScriptVar(self, SCRIPTVAR + ".useTrigger", true);
qa.refreshMenu(self, TOOL_PROMPT, TOOL_TITLE, MAIN_TOOL_MENU, "handleRebelPilotMainMenuOptions", true, SCRIPTVAR + ".pid", SCRIPTVAR + ".mainMenu");
}
//This function is called when the tool is canceled or exited so all script variables are removed
void cleanAllScriptVars(obj_id self)
{
qa.removeScriptVars(self, SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
//This function is called when the tool SUI revert option is selected
void detachAndcleanAllScriptVars(obj_id self)
{
utils.removeScriptVarTree(self, SCRIPTVAR);
detachScript(self, "test.qa_pilot_roadmap_tatooine_imperial");
}
@@ -0,0 +1,632 @@
package script.test;
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.qa;
import script.library.space_quest;
import script.library.sui;
import script.library.utils;
public class qa_quest_skipper extends script.base_script
{
public qa_quest_skipper()
{
}
public static final String QUEST_TOOL_TITLE = "QA Quest Tool";
public static final String QUEST_TOOL_PROMPT = "Select a Quest or menu item.\n\n(A) Active Quest\n(C) Completed Quest";
public static final String QUEST_TOOL_SUBPROMPT = "Be sure to select the correct option. The quest will be modified per your selection without any additional verification.";
public static final String MANUAL_ADD_GROUND_PROMPT = "Add Ground Quest Manually: Type the quest string in the area provided. When you select OK the quest will be added like you just received the quest.";
public static final String MANUAL_ADD_GROUND_TITLE = "Add Ground Manually";
public static final String MANUAL_ADD_SPACE_PROMPT = "Add Space Quest Manually: Type the quest string in the area provided. When you select OK the quest will be added like you just received the quest.";
public static final String MANUAL_ADD_SPACE_TITLE = "Add Space Manually";
public static final String[] QUEST_TOOL_MENU =
{
"Add a ground quest manually",
"Add a space quest manually",
"Attain test quests",
"Bulk Grant/Complete Tool",
"Bulk Grant Tool"
};
public static final String[] QUEST_MAIN_MENU =
{
"Complete this quest",
"Remove this quest"
};
public static final String[] QUEST_ALT_MENU =
{
"Remove this quest"
};
public static final String[] QUEST_DEMO_QUESTS =
{
"quest/event_cantina_bossk_1",
"quest/borvos_guard_dagorel",
"quest/borvo_acklay_find_armorer ",
"quest/build_speeder_quest",
"quest/tatooine_eisley_gototrehla",
"quest/ep3_stren_dorn_bounty_belga",
"quest/c_newbie_start",
"quest/build_speeder",
"spacequest/destroy_surpriseattack/corellia_imperial_1"
};
public static final String[] SPACE_QUEST_TYPES =
{
"assassinate",
"delivery",
"delivery_no_pickup",
"destroy",
"destroy_duty",
"destroy_surpriseattack",
"escort",
"escort_duty",
"inspect",
"patrol",
"recovery",
"recovery_duty",
"rescue",
"rescue_duty",
"space_battle",
"survival"
};
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_quest_skipper");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_quest_skipper");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals("qaquest"))
{
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handleMainMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
String[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu(self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(self, "qaquest");
return SCRIPT_CONTINUE;
}
else
{
String[] previousMainMenuArray = utils.getStringArrayScriptVar(self, "qaquest.qaquestMenu");
String previousSelection = previousMainMenuArray[idx];
if (previousSelection.equals(QUEST_TOOL_MENU[0]))
{
qa.createInputBox(self, MANUAL_ADD_GROUND_PROMPT, MANUAL_ADD_GROUND_TITLE, "handleAddGroundQuestManually", "qaquest.pid");
}
else if (previousSelection.equals(QUEST_TOOL_MENU[1]))
{
qa.createInputBox(self, MANUAL_ADD_SPACE_PROMPT, MANUAL_ADD_SPACE_TITLE, "handleAddSpaceQuestManually", "qaquest.pid");
}
else if (previousSelection.equals(QUEST_TOOL_MENU[2]))
{
boolean receivedTestQuests = getTestQuests(self);
if (receivedTestQuests)
{
sendSystemMessageTestingOnly(self, "Test quests received.");
}
else
{
sendSystemMessageTestingOnly(self, "There was a problem giving the test character test quests.");
}
showToolMainMenu(self);
}
else if (previousSelection.equals(QUEST_TOOL_MENU[3]))
{
sendSystemMessageTestingOnly(self, "Type or paste quests into the window separated with a semicolon (;).");
if (!utils.hasScriptVar(self, "qaquest.textData"))
{
bulkGrantAndCompleteQuestUi(self, "");
}
else
{
String textData = utils.getStringScriptVar(self, "qaquest.textData");
bulkGrantAndCompleteQuestUi(self, textData);
}
}
else if (previousSelection.equals(QUEST_TOOL_MENU[4]))
{
sendSystemMessageTestingOnly(self, "Type or paste quests into the window separated with a semicolon (;).");
if (!utils.hasScriptVar(self, "qaquest.textData"))
{
bulkGrantQuestUi(self, "");
}
else
{
String textData = utils.getStringScriptVar(self, "qaquest.textData");
bulkGrantQuestUi(self, textData);
}
}
else
{
utils.setScriptVar(self, "qaquest.questString", previousSelection);
String[] subMenu = getCorrectMenu(self, previousSelection);
utils.setScriptVar(self, "qaquest.menu", subMenu);
qa.refreshMenu(self, QUEST_TOOL_SUBPROMPT, QUEST_TOOL_TITLE, subMenu, "handleQuestOptions", true, "qaquest.pid", "qaquest.qaquestSubMenu");
}
}
}
}
return SCRIPT_CONTINUE;
}
public int handleQuestOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
showToolMainMenu(self);
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
showToolMainMenu(self);
return SCRIPT_CONTINUE;
}
else
{
String[] previousMainMenuArray = utils.getStringArrayScriptVar(self, "qaquest.qaquestSubMenu");
String previousSelection = previousMainMenuArray[idx];
if (previousSelection.equals("Complete this quest"))
{
String questString = getQuestString(self);
if (!questString.equals(""))
{
boolean completeCorrectly = qa.completeActiveQuest(self, questString);
if (!completeCorrectly)
{
sendSystemMessageTestingOnly(self, "Something went wrong when completing the quest.");
}
showToolMainMenu(self);
}
}
else if (previousSelection.equals("Remove this quest"))
{
String questString = getQuestString(self);
if (!questString.equals("") && !questString.equals("Error"))
{
boolean clearCorrectly = qa.clearQuest(self, questString);
if (!clearCorrectly)
{
sendSystemMessageTestingOnly(self, "Something went wrong when attempting to clear the quest.");
}
showToolMainMenu(self);
}
}
else
{
sendSystemMessageTestingOnly(self, "There was an error with the tool.");
}
}
}
}
return SCRIPT_CONTINUE;
}
public int handleAddGroundQuestManually(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
String stringEntry = sui.getInputBoxText(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
if (stringEntry.equals("") || stringEntry == null)
{
qa.createInputBox(self, MANUAL_ADD_GROUND_PROMPT, MANUAL_ADD_GROUND_TITLE, "handleAddQuestManually", "qaquest.pid");
return SCRIPT_CONTINUE;
}
else
{
qa.grantGroundQuest(self, stringEntry);
sendSystemMessageTestingOnly(self, "If the Quest wasn't added, check the spelling of the quest string");
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
public int handleAddSpaceQuestManually(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
String stringEntry = sui.getInputBoxText(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
if (stringEntry.equals("") || stringEntry == null)
{
qa.createInputBox(self, MANUAL_ADD_SPACE_PROMPT, MANUAL_ADD_SPACE_TITLE, "handleAddQuestManually", "qaquest.pid");
return SCRIPT_CONTINUE;
}
else
{
String questType = qa.getSpaceQuestType(self, stringEntry);
if (!questType.equals("Error"))
{
sendSystemMessageTestingOnly(self, "questType: " + questType);
String questName = qa.getSpaceQuestName(self, stringEntry);
if (!questName.equals("Error"))
{
sendSystemMessageTestingOnly(self, "questType: " + questName);
qa.grantSpaceQuest(self, questType, questName);
sendSystemMessageTestingOnly(self, "If the Quest wasn't added, check the spelling of the quest string");
}
else
{
sendSystemMessageTestingOnly(self, "The space quest string usually starts with spacequest/<questType>/");
}
}
else
{
sendSystemMessageTestingOnly(self, "The space quest string usually starts with spacequest/");
}
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
public int revokeQuestHandler(obj_id self, dictionary params) throws InterruptedException
{
String textData = params.getString("Prompt.lblPrompt.LocalText");
sendSystemMessageTestingOnly(self, "" + params);
forceCloseSUIPage(params.getInt("pageId"));
if (!textData.equals(""))
{
textData = textData.trim();
utils.setScriptVar(self, "qaquest.textData", textData);
String[] allData = split(textData, ';');
for (int i = 0; i < allData.length; i++)
{
allData[i] = allData[i].trim();
}
if (allData.length > 0)
{
iterateClearQuestStrings(self, allData);
showToolMainMenu(self);
}
else
{
sendSystemMessageTestingOnly(self, "No arguments received. Cancelling macro.");
showToolMainMenu(self);
}
}
return SCRIPT_CONTINUE;
}
public int grantQuestHandler(obj_id self, dictionary params) throws InterruptedException
{
String widgetName = params.getString("eventWidgetName");
String textData = params.getString("Prompt.lblPrompt.LocalText");
if (widgetName.equalsIgnoreCase("%button0%"))
{
showToolMainMenu(self);
}
else if (widgetName.equalsIgnoreCase("%button1%"))
{
textData = textData.trim();
utils.setScriptVar(self, "qaquest.textData", textData);
String[] allData = split(textData, ';');
for (int i = 0; i < allData.length; i++)
{
allData[i] = allData[i].trim();
}
if (allData.length > 0)
{
iterateGrantQuestStrings(self, allData, false);
showToolMainMenu(self);
}
else
{
sendSystemMessageTestingOnly(self, "No arguments received. Cancelling macro.");
showToolMainMenu(self);
}
}
return SCRIPT_CONTINUE;
}
public int grantAndCompleteQuestHandler(obj_id self, dictionary params) throws InterruptedException
{
String widgetName = params.getString("eventWidgetName");
String textData = params.getString("Prompt.lblPrompt.LocalText");
if (widgetName.equalsIgnoreCase("%button0%"))
{
showToolMainMenu(self);
}
else if (widgetName.equalsIgnoreCase("%button1%"))
{
textData = textData.trim();
utils.setScriptVar(self, "qaquest.textData", textData);
String[] allData = split(textData, ';');
for (int i = 0; i < allData.length; i++)
{
allData[i] = allData[i].trim();
}
if (allData.length > 0)
{
iterateGrantQuestStrings(self, allData, true);
showToolMainMenu(self);
}
else
{
sendSystemMessageTestingOnly(self, "No arguments received. Cancelling macro.");
showToolMainMenu(self);
}
}
return SCRIPT_CONTINUE;
}
public int delay(obj_id self, dictionary params) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public void showToolMainMenu(obj_id self) throws InterruptedException
{
try
{
String[] allQuests = qa.getAllQuests(self);
String[] combinedMenu = new String[allQuests.length + QUEST_TOOL_MENU.length];
System.arraycopy(allQuests, 0, combinedMenu, 0, allQuests.length);
System.arraycopy(QUEST_TOOL_MENU, 0, combinedMenu, allQuests.length, QUEST_TOOL_MENU.length);
qa.refreshMenu(self, QUEST_TOOL_PROMPT, QUEST_TOOL_TITLE, combinedMenu, "handleMainMenuOptions", true, "qaquest.pid", "qaquest.qaquestMenu");
}
catch(Exception e)
{
qa.refreshMenu(self, QUEST_TOOL_PROMPT + "\n\nNo quests found on character", QUEST_TOOL_TITLE, QUEST_TOOL_MENU, "handleMainMenuOptions", true, "qaquest.pid", "qaquest.qaquestMenu");
}
}
public void cleanAllScriptVars(obj_id self) throws InterruptedException
{
utils.removeScriptVarTree(self, "qaquest");
}
public boolean getTestQuests(obj_id self) throws InterruptedException
{
for (int i = 0; i < QUEST_DEMO_QUESTS.length; i++)
{
if (QUEST_DEMO_QUESTS[i].indexOf("spacequest/") == 0)
{
boolean successGrant = qa.evalSpaceQuestThenGrant(self, QUEST_DEMO_QUESTS[i]);
}
else
{
qa.grantGroundQuest(self, QUEST_DEMO_QUESTS[i]);
}
}
return true;
}
public String getQuestString(obj_id self) throws InterruptedException
{
if (utils.hasScriptVar(self, "qaquest.questString"))
{
String questStringAndName = utils.getStringScriptVar(self, "qaquest.questString");
if (!questStringAndName.equals(""))
{
int whiteSpaceIndex = questStringAndName.indexOf(" -");
String questCodeString = questStringAndName.substring(4, whiteSpaceIndex);
return questCodeString;
}
}
return "Error";
}
public String[] getCorrectMenu(obj_id self, String questStringAndName) throws InterruptedException
{
if (!questStringAndName.equals(""))
{
if (questStringAndName.indexOf("(C") == 0)
{
return QUEST_ALT_MENU;
}
else
{
return QUEST_MAIN_MENU;
}
}
return QUEST_MAIN_MENU;
}
public void bulkGrantAndCompleteQuestUi(obj_id self, String textData) throws InterruptedException
{
String uiTitle = "Quest Macro";
int page = createSUIPage("/Script.messageBox", self, self);
if (!textData.equals(""))
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", textData);
}
else
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", "");
}
setSUIProperty(page, "bg.caption.lblTitle", "Text", uiTitle);
setSUIProperty(page, "Prompt.lblPrompt", "Editable", "true");
setSUIProperty(page, "Prompt.lblPrompt", "GetsInput", "true");
setSUIProperty(page, "Prompt.lblPrompt", "Paste", "true");
setSUIProperty(page, "btnCancel", "Visible", "true");
setSUIProperty(page, "btnRevert", "Visible", "true");
setSUIProperty(page, "btnRevert", sui.PROP_TEXT, "Bulk Clear");
setSUIProperty(page, "btnOk", sui.PROP_TEXT, "Bulk Complete");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "Prompt.lblPrompt", "LocalText");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onButton, "btnRevert", "Prompt.lblPrompt", "LocalText");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "grantAndCompleteQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onButton, "btnRevert", "revokeQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedCancel, "%button0%", "grantAndCompleteQuestHandler");
showSUIPage(page);
flushSUIPage(page);
}
public void bulkGrantQuestUi(obj_id self, String textData) throws InterruptedException
{
String uiTitle = "Quest Macro";
int page = createSUIPage("/Script.messageBox", self, self);
if (!textData.equals(""))
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", textData);
}
else
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", "");
}
setSUIProperty(page, "bg.caption.lblTitle", "Text", uiTitle);
setSUIProperty(page, "Prompt.lblPrompt", "Editable", "true");
setSUIProperty(page, "Prompt.lblPrompt", "GetsInput", "true");
setSUIProperty(page, "Prompt.lblPrompt", "Paste", "true");
setSUIProperty(page, "btnCancel", "Visible", "true");
setSUIProperty(page, "btnRevert", "Visible", "true");
setSUIProperty(page, "btnRevert", sui.PROP_TEXT, "Bulk Clear");
setSUIProperty(page, "btnOk", sui.PROP_TEXT, "Bulk Grant");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "Prompt.lblPrompt", "LocalText");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onButton, "btnRevert", "Prompt.lblPrompt", "LocalText");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "grantQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onButton, "btnRevert", "revokeQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedCancel, "%button0%", "grantQuestHandler");
showSUIPage(page);
flushSUIPage(page);
}
public void iterateGrantQuestStrings(obj_id self, String[] allData, boolean completeFlag) throws InterruptedException
{
if (allData.length > 0)
{
for (int i = 0; i < allData.length; i++)
{
if (!allData[i].equals(""))
{
if (allData[i].indexOf("spacequest/") == 0)
{
boolean questAttained = qa.evalSpaceQuestThenGrant(self, allData[i]);
if (!questAttained)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be granted.");
}
if (completeFlag)
{
messageTo(self, "delay", null, 1, false);
boolean completed = qa.completeActiveQuest(self, allData[i]);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be completed.");
}
}
}
else if (allData[i].indexOf("quest/") == 0)
{
qa.grantGroundQuest(self, allData[i]);
if (completeFlag)
{
messageTo(self, "delay", null, 1, false);
boolean completed = qa.completeActiveQuest(self, allData[i]);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be granted.");
}
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
}
}
}
public void iterateClearQuestStrings(obj_id self, String[] allData) throws InterruptedException
{
if (allData.length > 0)
{
for (int i = 0; i < allData.length; i++)
{
if (!allData[i].equals(""))
{
if (allData[i].indexOf("spacequest/") == 0)
{
String questName = qa.getSpaceQuestName(self, allData[i]);
if (!questName.equals(""))
{
String questType = qa.getSpaceQuestType(self, allData[i]);
if (!questType.equals(""))
{
boolean completed = qa.clearQuest(self, allData[i]);
messageTo(self, "delay", null, 1, false);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be cleared.");
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
else if (allData[i].indexOf("quest/") == 0)
{
boolean completed = qa.clearQuest(self, allData[i]);
messageTo(self, "delay", null, 1, false);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be cleared.");
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
}
}
}
}
@@ -1,705 +0,0 @@
// ======================================================================
// qa_quest_skipper.script
//
// QA Quest Tool
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.groundquests;
include library.qa;
include library.space_quest;
include library.sui;
include library.utils;
/********* CONSTANTS *****************************************/
const string QUEST_TOOL_TITLE = "QA Quest Tool";
const string QUEST_TOOL_PROMPT = "Select a Quest or menu item.\n\n(A) Active Quest\n(C) Completed Quest";
const string QUEST_TOOL_SUBPROMPT = "Be sure to select the correct option. The quest will be modified per your selection without any additional verification.";
const string MANUAL_ADD_GROUND_PROMPT = "Add Ground Quest Manually: Type the quest string in the area provided. When you select OK the quest will be added like you just received the quest.";
const string MANUAL_ADD_GROUND_TITLE = "Add Ground Manually";
const string MANUAL_ADD_SPACE_PROMPT = "Add Space Quest Manually: Type the quest string in the area provided. When you select OK the quest will be added like you just received the quest.";
const string MANUAL_ADD_SPACE_TITLE = "Add Space Manually";
const string[] QUEST_TOOL_MENU =
{
"Add a ground quest manually",
"Add a space quest manually",
"Attain test quests",
"Bulk Grant/Complete Tool",
"Bulk Grant Tool"
};
const string[] QUEST_MAIN_MENU =
{
"Complete this quest",
"Remove this quest"
};
const string[] QUEST_ALT_MENU =
{
"Remove this quest"
};
const string[] QUEST_DEMO_QUESTS =
{
"quest/event_cantina_bossk_1",
"quest/borvos_guard_dagorel",
"quest/borvo_acklay_find_armorer ",
"quest/build_speeder_quest",
"quest/tatooine_eisley_gototrehla",
"quest/ep3_stren_dorn_bounty_belga",
"quest/c_newbie_start",
"quest/build_speeder",
"spacequest/destroy_surpriseattack/corellia_imperial_1"
};
const string[] SPACE_QUEST_TYPES =
{
"assassinate",
"delivery",
"delivery_no_pickup",
"destroy",
"destroy_duty",
"destroy_surpriseattack",
"escort",
"escort_duty",
"inspect",
"patrol",
"recovery",
"recovery_duty",
"rescue",
"rescue_duty",
"space_battle",
"survival"
};
/***** TRIGGERS *******************************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_quest_skipper");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_quest_skipper");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if (toLower(text).equals("qaquest"))
{
//Function to show the main menu of the tool
showToolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler handleMainMenuOptions()
{
if (isGod(self))
{
//static script var
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//check for cancel button
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
string[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu( self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(self,"qaquest");
return SCRIPT_CONTINUE;
}
//build the next sui
else
{
//Place the previous scriptvar array into a usable array
string[] previousMainMenuArray = utils.getStringArrayScriptVar( self, "qaquest.qaquestMenu" );
//Find the selection made from the array above
string previousSelection = previousMainMenuArray[idx];
if (previousSelection == QUEST_TOOL_MENU[0])
{
qa.createInputBox (self, MANUAL_ADD_GROUND_PROMPT, MANUAL_ADD_GROUND_TITLE, "handleAddGroundQuestManually", "qaquest.pid");
}
else if (previousSelection == QUEST_TOOL_MENU[1])
{
qa.createInputBox (self, MANUAL_ADD_SPACE_PROMPT, MANUAL_ADD_SPACE_TITLE, "handleAddSpaceQuestManually", "qaquest.pid");
}
else if (previousSelection == QUEST_TOOL_MENU[2])
{
boolean receivedTestQuests = getTestQuests(self);
if (receivedTestQuests)
{
sendSystemMessageTestingOnly(self, "Test quests received.");
}
else
{
sendSystemMessageTestingOnly(self, "There was a problem giving the test character test quests.");
}
showToolMainMenu(self);
}
else if (previousSelection == QUEST_TOOL_MENU[3])
{
sendSystemMessageTestingOnly(self, "Type or paste quests into the window separated with a semicolon (;).");
if (!utils.hasScriptVar(self, "qaquest.textData"))
{
bulkGrantAndCompleteQuestUi(self, "");
}
else
{
string textData = utils.getStringScriptVar(self, "qaquest.textData");
bulkGrantAndCompleteQuestUi(self, textData);
}
}
else if (previousSelection == QUEST_TOOL_MENU[4])
{
sendSystemMessageTestingOnly(self, "Type or paste quests into the window separated with a semicolon (;).");
if (!utils.hasScriptVar(self, "qaquest.textData"))
{
bulkGrantQuestUi(self, "");
}
else
{
string textData = utils.getStringScriptVar(self, "qaquest.textData");
bulkGrantQuestUi(self, textData);
}
}
else
{
utils.setScriptVar(self, "qaquest.questString", previousSelection);
string[] subMenu = getCorrectMenu(self, previousSelection);
utils.setScriptVar(self, "qaquest.menu", subMenu);
qa.refreshMenu(self, QUEST_TOOL_SUBPROMPT, QUEST_TOOL_TITLE, subMenu, "handleQuestOptions", true, "qaquest.pid", "qaquest.qaquestSubMenu");
}
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleQuestOptions()
{
if (isGod(self))
{
//static script var
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//check for cancel button
if (btn == sui.BP_CANCEL)
{
cleanAllScriptVars(self);
showToolMainMenu(self);
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
showToolMainMenu(self);
return SCRIPT_CONTINUE;
}
//build the next sui
else
{
//Place the previous scriptvar array into a usable array
string[] previousMainMenuArray = utils.getStringArrayScriptVar( self, "qaquest.qaquestSubMenu" );
//Find the selection made from the array above
string previousSelection = previousMainMenuArray[idx];
if (previousSelection == "Complete this quest")
{
string questString = getQuestString(self);
if (questString != "")
{
boolean completeCorrectly = qa.completeActiveQuest(self, questString);
if (!completeCorrectly)
{
sendSystemMessageTestingOnly(self, "Something went wrong when completing the quest.");
}
showToolMainMenu(self);
}
}
else if (previousSelection == "Remove this quest")
{
string questString = getQuestString(self);
if (questString != "" && questString != "Error")
{
boolean clearCorrectly = qa.clearQuest(self, questString);
if (!clearCorrectly)
{
sendSystemMessageTestingOnly(self, "Something went wrong when attempting to clear the quest.");
}
showToolMainMenu(self);
}
}
else
{
sendSystemMessageTestingOnly(self, "There was an error with the tool.");
}
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleAddGroundQuestManually()
{
if (isGod(self))
{
//static script var
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
string stringEntry = sui.getInputBoxText(params);
int btn = sui.getIntButtonPressed( params );
if ( btn == sui.BP_CANCEL )
{
cleanAllScriptVars(self);
showToolMainMenu ( self );
return SCRIPT_OVERRIDE;
}
if ( stringEntry == "" || stringEntry == null )
{
qa.createInputBox (self, MANUAL_ADD_GROUND_PROMPT, MANUAL_ADD_GROUND_TITLE, "handleAddQuestManually", "qaquest.pid");
return SCRIPT_CONTINUE;
}
else
{
qa.grantGroundQuest(self, stringEntry);
sendSystemMessageTestingOnly(self, "If the Quest wasn't added, check the spelling of the quest string");
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleAddSpaceQuestManually()
{
if (isGod(self))
{
//static script var
if (utils.hasScriptVar(self, "qaquest.pid"))
{
qa.checkParams(params, "qaquest");
string stringEntry = sui.getInputBoxText(params);
int btn = sui.getIntButtonPressed( params );
if ( btn == sui.BP_CANCEL )
{
cleanAllScriptVars(self);
showToolMainMenu (self);
return SCRIPT_OVERRIDE;
}
if ( stringEntry == "" || stringEntry == null )
{
qa.createInputBox (self, MANUAL_ADD_SPACE_PROMPT, MANUAL_ADD_SPACE_TITLE, "handleAddQuestManually", "qaquest.pid");
return SCRIPT_CONTINUE;
}
else
{
string questType = qa.getSpaceQuestType(self, stringEntry);
if (questType != "Error")
{
sendSystemMessageTestingOnly(self, "questType: " + questType);
string questName = qa.getSpaceQuestName(self, stringEntry);
if (questName != "Error")
{
sendSystemMessageTestingOnly(self, "questType: " + questName);
qa.grantSpaceQuest(self, questType, questName);
sendSystemMessageTestingOnly(self, "If the Quest wasn't added, check the spelling of the quest string");
}
else
{
sendSystemMessageTestingOnly(self, "The space quest string usually starts with spacequest/<questType>/");
}
}
else
{
sendSystemMessageTestingOnly(self, "The space quest string usually starts with spacequest/");
}
showToolMainMenu(self);
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler revokeQuestHandler()
{
string textData = params.getString("Prompt.lblPrompt.LocalText");
sendSystemMessageTestingOnly(self, ""+params);
forceCloseSUIPage(params.getInt("pageId"));
if (textData != "")
{
textData = textData.trim();
utils.setScriptVar(self,"qaquest.textData", textData);
string[] allData = split(textData, ';');
for (int i = 0; i < allData.length; i++)
{
allData[i] = allData[i].trim();
}
if (allData.length > 0)
{
iterateClearQuestStrings(self, allData);
showToolMainMenu(self);
}
else
{
sendSystemMessageTestingOnly(self, "No arguments received. Cancelling macro.");
showToolMainMenu(self);
}
}
//sendSystemMessageTestingOnly(self, textData);
return SCRIPT_CONTINUE;
}
messageHandler grantQuestHandler()
{
string widgetName = params.getString("eventWidgetName");
string textData = params.getString("Prompt.lblPrompt.LocalText");
if(widgetName.equalsIgnoreCase("%button0%"))
{
showToolMainMenu(self);
}
else if(widgetName.equalsIgnoreCase("%button1%"))
{
textData = textData.trim();
utils.setScriptVar(self,"qaquest.textData", textData);
string[] allData = split(textData, ';');
for (int i = 0; i < allData.length; i++)
{
allData[i] = allData[i].trim();
}
if (allData.length > 0)
{
iterateGrantQuestStrings(self, allData, false);
showToolMainMenu(self);
}
else
{
sendSystemMessageTestingOnly(self, "No arguments received. Cancelling macro.");
showToolMainMenu(self);
}
}
return SCRIPT_CONTINUE;
}
messageHandler grantAndCompleteQuestHandler()
{
string widgetName = params.getString("eventWidgetName");
string textData = params.getString("Prompt.lblPrompt.LocalText");
if(widgetName.equalsIgnoreCase("%button0%"))
{
showToolMainMenu(self);
}
else if(widgetName.equalsIgnoreCase("%button1%"))
{
textData = textData.trim();
utils.setScriptVar(self,"qaquest.textData", textData);
string[] allData = split(textData, ';');
for (int i = 0; i < allData.length; i++)
{
allData[i] = allData[i].trim();
}
if (allData.length > 0)
{
iterateGrantQuestStrings(self, allData, true);
showToolMainMenu(self);
}
else
{
sendSystemMessageTestingOnly(self, "No arguments received. Cancelling macro.");
showToolMainMenu(self);
}
}
return SCRIPT_CONTINUE;
}
messageHandler delay()
{
//sendSystemMessageTestingOnly(self, "delay 1 second.");
return SCRIPT_CONTINUE;
}
/******** All Functions ********************************************/
//This Function builds the main tool menu. It sniffs out all completed and/or active quests
//that are then displayed to the tester. If no quests are found, the tester is provided a
//base menu called the QUEST_TOOL_MENU
void showToolMainMenu(obj_id self)
{
try
{
string[] allQuests = qa.getAllQuests(self);
string[] combinedMenu = new string[allQuests.length + QUEST_TOOL_MENU.length];
System.arraycopy(allQuests, 0, combinedMenu, 0, allQuests.length);
System.arraycopy(QUEST_TOOL_MENU, 0, combinedMenu, allQuests.length, QUEST_TOOL_MENU.length);
qa.refreshMenu(self, QUEST_TOOL_PROMPT, QUEST_TOOL_TITLE, combinedMenu, "handleMainMenuOptions", true, "qaquest.pid", "qaquest.qaquestMenu");
}
catch (Exception e)
{
qa.refreshMenu(self, QUEST_TOOL_PROMPT + "\n\nNo quests found on character", QUEST_TOOL_TITLE, QUEST_TOOL_MENU, "handleMainMenuOptions", true, "qaquest.pid", "qaquest.qaquestMenu");
}
}
//This function is called when the tool is canceled or exited so all script variables are removed
void cleanAllScriptVars(obj_id self)
{
utils.removeScriptVarTree(self,"qaquest");
}
//This function cycles through a list of predefined quests for testing various things
boolean getTestQuests(obj_id self)
{
for (int i = 0; i < QUEST_DEMO_QUESTS.length; i++)
{
if (QUEST_DEMO_QUESTS[i].indexOf("spacequest/") == 0)
{
boolean successGrant = qa.evalSpaceQuestThenGrant(self, QUEST_DEMO_QUESTS[i]);
}
else
{
qa.grantGroundQuest(self, QUEST_DEMO_QUESTS[i]);
}
}
return true;
}
//This function parses the quest string and quest string name to extract just the code string for the quest
string getQuestString(obj_id self)
{
if (utils.hasScriptVar(self, "qaquest.questString"))
{
string questStringAndName = utils.getStringScriptVar(self, "qaquest.questString");
if (questStringAndName != "")
{
//This function returns only the quest string, everything before and after is stripped.
int whiteSpaceIndex = questStringAndName.indexOf(" -");
string questCodeString = questStringAndName.substring(4,whiteSpaceIndex);
return questCodeString;
}
}
return "Error";
}
//This function switches the sub menu based on the completed or active status of the quest selected.
string[] getCorrectMenu(obj_id self, string questStringAndName)
{
if (questStringAndName != "")
{
if (questStringAndName.indexOf("(C") == 0)
{
return QUEST_ALT_MENU;
}
else
{
return QUEST_MAIN_MENU;
}
}
return QUEST_MAIN_MENU;
}
void bulkGrantAndCompleteQuestUi(obj_id self, string textData)
{
string uiTitle = "Quest Macro";
int page = createSUIPage("/Script.messageBox", self, self);
if (textData != "")
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", textData);
}
else
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", "");
}
setSUIProperty(page, "bg.caption.lblTitle", "Text", uiTitle);
setSUIProperty(page, "Prompt.lblPrompt", "Editable", "true");
setSUIProperty(page, "Prompt.lblPrompt", "GetsInput", "true");
setSUIProperty(page, "Prompt.lblPrompt", "Paste", "true");
setSUIProperty(page, "btnCancel", "Visible", "true");
setSUIProperty(page, "btnRevert", "Visible", "true");
setSUIProperty(page, "btnRevert", sui.PROP_TEXT, "Bulk Clear");
setSUIProperty(page, "btnOk", sui.PROP_TEXT, "Bulk Complete");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "Prompt.lblPrompt", "LocalText");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onButton, "btnRevert", "Prompt.lblPrompt", "LocalText");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "grantAndCompleteQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onButton, "btnRevert", "revokeQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedCancel, "%button0%", "grantAndCompleteQuestHandler");
showSUIPage(page);
flushSUIPage(page);
}
void bulkGrantQuestUi(obj_id self, string textData)
{
string uiTitle = "Quest Macro";
int page = createSUIPage("/Script.messageBox", self, self);
if (textData != "")
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", textData);
}
else
{
setSUIProperty(page, "Prompt.lblPrompt", "LocalText", "");
}
setSUIProperty(page, "bg.caption.lblTitle", "Text", uiTitle);
setSUIProperty(page, "Prompt.lblPrompt", "Editable", "true");
setSUIProperty(page, "Prompt.lblPrompt", "GetsInput", "true");
setSUIProperty(page, "Prompt.lblPrompt", "Paste", "true");
setSUIProperty(page, "btnCancel", "Visible", "true");
setSUIProperty(page, "btnRevert", "Visible", "true");
setSUIProperty(page, "btnRevert", sui.PROP_TEXT, "Bulk Clear");
setSUIProperty(page, "btnOk", sui.PROP_TEXT, "Bulk Grant");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "Prompt.lblPrompt", "LocalText");
subscribeToSUIPropertyForEvent(page, sui_event_type.SET_onButton, "btnRevert", "Prompt.lblPrompt", "LocalText");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedOk, "%button1%", "grantQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onButton, "btnRevert", "revokeQuestHandler");
subscribeToSUIEvent(page, sui_event_type.SET_onClosedCancel, "%button0%", "grantQuestHandler");
showSUIPage(page);
flushSUIPage(page);
}
void iterateGrantQuestStrings(obj_id self, string[] allData, boolean completeFlag)
{
if (allData.length > 0)
{
for (int i = 0; i < allData.length; i++)
{
if (allData[i] != "")
{
if (allData[i].indexOf("spacequest/") == 0)
{
boolean questAttained = qa.evalSpaceQuestThenGrant(self, allData[i]);
if (!questAttained)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be granted.");
//break;
}
if (completeFlag)
{
messageTo(self, "delay", null, 1, false);
boolean completed = qa.completeActiveQuest(self, allData[i]);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be completed.");
//break;
}
}
}
else if (allData[i].indexOf("quest/") == 0)
{
qa.grantGroundQuest(self, allData[i]);
if (completeFlag)
{
messageTo(self, "delay", null, 1, false);
boolean completed = qa.completeActiveQuest(self, allData[i]);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be granted.");
//break;
}
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
}
}
}
void iterateClearQuestStrings(obj_id self, string[] allData)
{
if (allData.length > 0)
{
for (int i = 0; i < allData.length; i++)
{
if (allData[i] != "")
{
if (allData[i].indexOf("spacequest/") == 0)
{
string questName = qa.getSpaceQuestName(self, allData[i]);
if (questName != "")
{
string questType = qa.getSpaceQuestType(self, allData[i]);
if (questType != "")
{
boolean completed = qa.clearQuest(self, allData[i]);
messageTo(self, "delay", null, 1, false);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be cleared.");
//break;
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
else if (allData[i].indexOf("quest/") == 0)
{
boolean completed = qa.clearQuest(self, allData[i]);
messageTo(self, "delay", null, 1, false);
if (!completed)
{
sendSystemMessageTestingOnly(self, "Quest " + allData[i] + " could not be cleared.");
//break;
}
}
else
{
sendSystemMessageTestingOnly(self, "Unknown quest string: " + allData[i]);
}
}
}
}
}
@@ -0,0 +1,396 @@
package script.test;
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.sui;
import script.library.utils;
import script.library.veteran_deprecated;
import script.library.qa;
public class qa_resource_reward extends script.base_script
{
public qa_resource_reward()
{
}
public static final int RESOURCE_AMOUNT = 100000;
public static final String ROOT_RESOURCE_CLASS = "resource";
public static final String ROOT_ORGANIC_CLASS = "organic";
public static final String ROOT_INORGANIC_CLASS = "inorganic";
public static final String RESOURCE_REWARD_TITLE = "QA Resource Reward Tool";
public static final String SCRIPTVAR_BASE_CLASS = "resource.base";
public static final String SCRIPTVAR_SUB_CLASSES = "resource.subclass";
public static final String SCRIPTVAR_TYPES = "resource.types";
public static final String SCRIPTVAR_RESOURCECHOSEN = "resource.resoucechosen";
public static final string_id SID_CHOOSE_CLASS = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "choose_class");
public static final string_id SID_CHOOSE_SUB_CLASS = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "choose_sub_class");
public static final string_id SID_CHOOSE_TYPE = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "choose_type");
public static final string_id SID_RESOURCE_NAME = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "resource_name");
public int OnAttach(obj_id self) throws InterruptedException
{
if (!isGod(self))
{
detachScript(self, "test.qa_resource_reward");
}
else if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_resource_reward");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if (((toLower(text)).equals("qarewardresource")) || ((toLower(text)).equals("qarewardresources")))
{
chooseResourceClass(self, ROOT_RESOURCE_CLASS, true);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handleQATool(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, "qarewardresource");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, "qarewardresource");
return SCRIPT_CONTINUE;
}
else
{
chooseResourceClass(self, ROOT_RESOURCE_CLASS, true);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
public int handleChooseResourceClass(obj_id self, dictionary params) throws InterruptedException
{
int bp = sui.getIntButtonPressed(params);
switch (bp)
{
case sui.BP_OK:
{
String[] resourceClasses = (self.getScriptVars()).getStringArray(SCRIPTVAR_SUB_CLASSES);
int rowSelected = sui.getListboxSelectedRow(params);
if (rowSelected >= 0 && rowSelected < resourceClasses.length)
{
chooseResourceClass(sui.getPlayerId(params), resourceClasses[rowSelected]);
}
else
{
String resourceClass = (self.getScriptVars()).getString(SCRIPTVAR_BASE_CLASS);
chooseResourceClass(sui.getPlayerId(params), resourceClass);
}
}
break;
case sui.BP_CANCEL:
{
String resourceClass = (self.getScriptVars()).getString(SCRIPTVAR_BASE_CLASS);
if (!resourceClass.equals(ROOT_ORGANIC_CLASS) && !resourceClass.equals(ROOT_INORGANIC_CLASS))
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass));
qa.qaToolMainMenu(self);
}
else
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass), true);
}
}
break;
default:
cleanup();
removePlayer(self, "");
break;
}
return SCRIPT_CONTINUE;
}
public int handleChooseResourceType(obj_id self, dictionary params) throws InterruptedException
{
int bp = sui.getIntButtonPressed(params);
switch (bp)
{
case sui.BP_OK:
{
obj_id[] resourceTypes = (self.getScriptVars()).getObjIdArray(SCRIPTVAR_TYPES);
int rowSelected = sui.getListboxSelectedRow(params);
if (rowSelected >= 0 && rowSelected < resourceTypes.length)
{
showResourceStats(sui.getPlayerId(params), resourceTypes[rowSelected]);
}
else
{
String resourceClass = (self.getScriptVars()).getString(SCRIPTVAR_BASE_CLASS);
chooseResourceClass(sui.getPlayerId(params), resourceClass);
}
}
break;
case sui.BP_CANCEL:
{
String resourceClass = (self.getScriptVars()).getString(SCRIPTVAR_BASE_CLASS);
if (!resourceClass.equals(ROOT_RESOURCE_CLASS))
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass));
break;
}
}
default:
cleanup();
removePlayer(self, "");
break;
}
return SCRIPT_CONTINUE;
}
public int handleChooseResourceTypeStats(obj_id self, dictionary params) throws InterruptedException
{
int bp = sui.getIntButtonPressed(params);
switch (bp)
{
case sui.BP_OK:
{
obj_id resourceChosen = (self.getScriptVars()).getObjId(SCRIPTVAR_RESOURCECHOSEN);
if (isIdValid(resourceChosen))
{
obj_id player = sui.getPlayerId(params);
obj_id crate = createResourceCrate(resourceChosen, RESOURCE_AMOUNT, utils.getInventoryContainer(player));
if (isIdValid(crate))
{
sendSystemMessageTestingOnly(self, "The selected resource has been placed in your inventory");
}
cleanup();
removePlayer(self, "");
}
else
{
String resourceClass = (self.getScriptVars()).getString(SCRIPTVAR_BASE_CLASS);
chooseResourceClass(sui.getPlayerId(params), resourceClass);
}
}
break;
case sui.BP_CANCEL:
{
String resourceClass = (self.getScriptVars()).getString(SCRIPTVAR_BASE_CLASS);
if (!resourceClass.equals(ROOT_RESOURCE_CLASS))
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass));
break;
}
}
default:
cleanup();
removePlayer(self, "");
break;
}
return SCRIPT_CONTINUE;
}
public void showResourceStats(obj_id player, obj_id resource) throws InterruptedException
{
if (!isIdValid(player))
{
cleanup();
removePlayer(player, "");
return;
}
if (!isIdValid(resource))
{
cleanup();
removePlayer(player, "");
return;
}
obj_id self = getSelf();
resource_attribute[] resourceAttribs = getResourceAttributes(resource);
Vector attribStrings = new Vector();
attribStrings.setSize(0);
if (resourceAttribs == null)
{
cleanup();
removePlayer(player, "");
return;
}
attribStrings = utils.addElement(attribStrings, "@" + SID_RESOURCE_NAME + " = " + getResourceName(resource));
for (int i = 0; i < resourceAttribs.length; ++i)
{
string_id temp = new string_id("obj_attr_n", resourceAttribs[i].getName());
attribStrings = utils.addElement(attribStrings, "@" + temp + " = " + resourceAttribs[i].getValue());
}
int pid = sui.listbox(getSelf(), player, "Selecting this resource will create 100k units in your inventory.", sui.OK_CANCEL, getResourceName(resource), attribStrings, "handleChooseResourceTypeStats", false, false);
if (pid >= 0)
{
sui.setSUIProperty(pid, sui.LISTBOX_BTN_CANCEL, sui.PROP_TEXT, "@back");
sui.showSUIPage(pid);
((getSelf()).getScriptVars()).put(SCRIPTVAR_RESOURCECHOSEN, resource);
}
else
{
cleanup();
removePlayer(player, "");
}
}
public void chooseResourceClass(obj_id player, String parentClass) throws InterruptedException
{
chooseResourceClass(player, parentClass, false);
}
public void chooseResourceClass(obj_id player, String parentClass, boolean topLevel) throws InterruptedException
{
String[] resourceClasses = null;
if (topLevel)
{
resourceClasses = filterTopLevelResourceList(parentClass);
}
else
{
resourceClasses = getImmediateResourceChildClasses(parentClass);
}
if (resourceClasses == null)
{
cleanup();
removePlayer(player, "");
return;
}
if (resourceClasses.length == 0)
{
chooseResourceType(player, parentClass);
return;
}
int goodResources = 0;
for (int i = 0; i < resourceClasses.length; ++i)
{
if (!hasResourceType(resourceClasses[i]))
{
resourceClasses[i] = null;
}
else
{
++goodResources;
}
}
String[] temp = new String[goodResources];
goodResources = 0;
for (int i = 0; i < resourceClasses.length; ++i)
{
if (resourceClasses[i] != null)
{
temp[goodResources++] = resourceClasses[i];
}
}
resourceClasses = temp;
temp = null;
String[] resourceClassNames = getResourceClassNames(resourceClasses);
if (resourceClassNames == null)
{
cleanup();
removePlayer(player, "");
return;
}
String prompt;
if (parentClass.equals(ROOT_RESOURCE_CLASS))
{
prompt = "@" + SID_CHOOSE_CLASS;
}
else
{
prompt = "@" + SID_CHOOSE_SUB_CLASS + " " + getResourceClassName(parentClass);
}
int pid = sui.listbox(getSelf(), player, prompt, sui.OK_CANCEL, RESOURCE_REWARD_TITLE, resourceClassNames, "handleChooseResourceClass", false, false);
if (!parentClass.equals(ROOT_RESOURCE_CLASS) && pid >= 0)
{
sui.setSUIProperty(pid, sui.LISTBOX_BTN_CANCEL, sui.PROP_TEXT, "@back");
}
if (pid >= 0)
{
sui.showSUIPage(pid);
((getSelf()).getScriptVars()).put(SCRIPTVAR_BASE_CLASS, parentClass);
((getSelf()).getScriptVars()).put(SCRIPTVAR_SUB_CLASSES, resourceClasses);
}
else
{
cleanup();
}
removePlayer(player, "");
}
public void chooseResourceType(obj_id player, String parentClass) throws InterruptedException
{
obj_id[] resourceTypes = getResourceTypes(parentClass);
if (resourceTypes == null || resourceTypes.length == 0)
{
cleanup();
removePlayer(player, "");
return;
}
String[] typeNames = getResourceNames(resourceTypes);
if (typeNames == null || typeNames.length == 0)
{
cleanup();
removePlayer(player, "");
return;
}
int pid = sui.listbox(getSelf(), player, "@" + SID_CHOOSE_TYPE + " " + getResourceClassName(parentClass), sui.OK_CANCEL, RESOURCE_REWARD_TITLE, typeNames, "handleChooseResourceType", false, false);
if (pid >= 0)
{
sui.setSUIProperty(pid, sui.LISTBOX_BTN_CANCEL, sui.PROP_TEXT, "@back");
sui.showSUIPage(pid);
((getSelf()).getScriptVars()).put(SCRIPTVAR_BASE_CLASS, parentClass);
((getSelf()).getScriptVars()).put(SCRIPTVAR_TYPES, resourceTypes);
}
else
{
cleanup();
removePlayer(player, "");
}
}
public void cleanup() throws InterruptedException
{
((getSelf()).getScriptVars()).remove(SCRIPTVAR_BASE_CLASS);
((getSelf()).getScriptVars()).remove(SCRIPTVAR_SUB_CLASSES);
((getSelf()).getScriptVars()).remove(SCRIPTVAR_TYPES);
((getSelf()).getScriptVars()).remove(SCRIPTVAR_RESOURCECHOSEN);
}
public void removePlayer(obj_id player, String err) throws InterruptedException
{
sendSystemMessageTestingOnly(player, err);
qa.removeScriptVars(player, "qarewardresource");
}
public String[] filterTopLevelResourceList(String parentClass) throws InterruptedException
{
String[] resourceClasses = null;
String[] tempResourceClass = getImmediateResourceChildClasses(parentClass);
Vector tempResourceClassTwo = null;
for (int x = 0; x < tempResourceClass.length; ++x)
{
if (!tempResourceClass[x].equals("energy") && !tempResourceClass[x].equals("space_resource"))
{
tempResourceClassTwo = utils.addElement(tempResourceClassTwo, tempResourceClass[x]);
}
}
resourceClasses = new String[tempResourceClassTwo.size()];
tempResourceClassTwo.toArray(resourceClasses);
return resourceClasses;
}
}
@@ -1,439 +0,0 @@
/* Title: test.qa_resource_reward.script
* Description: Allows a tester to access the Resource Veteran Reward to get various resources for crafting.
Most of the code for this script was borrowed from script/systems/veteran_reward/resource
*/
include library.sui;
include library.utils;
include library.veteran_deprecated;
include library.qa;
/***** CONSTANTS *******************************************************/
const int RESOURCE_AMOUNT = 100000;
const string ROOT_RESOURCE_CLASS = "resource";
const string ROOT_ORGANIC_CLASS = "organic";
const string ROOT_INORGANIC_CLASS = "inorganic";
const string RESOURCE_REWARD_TITLE = "QA Resource Reward Tool";
const string SCRIPTVAR_BASE_CLASS = "resource.base";
const string SCRIPTVAR_SUB_CLASSES = "resource.subclass";
const string SCRIPTVAR_TYPES = "resource.types";
const string SCRIPTVAR_RESOURCECHOSEN = "resource.resoucechosen";
const string_id SID_CHOOSE_CLASS = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "choose_class");
const string_id SID_CHOOSE_SUB_CLASS = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "choose_sub_class");
const string_id SID_CHOOSE_TYPE = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "choose_type");
const string_id SID_RESOURCE_NAME = new string_id(veteran_deprecated.VETERAN_STRING_TABLE, "resource_name");
/***** TRIGGERS ********************************************************/
trigger OnAttach()
{
if(!isGod(self))
{
detachScript(self, "test.qa_resource_reward");
}
else if(isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_resource_reward");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if ((toLower(text).equals("qarewardresource")) || (toLower(text).equals("qarewardresources")))
{
chooseResourceClass(self, ROOT_RESOURCE_CLASS, true);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/***************** Messagehandlers *********************/
messageHandler handleQATool()
{
if(isGod(self))
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, "qarewardresource");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, "qarewardresource");
return SCRIPT_CONTINUE;
}
else
{
chooseResourceClass(self, ROOT_RESOURCE_CLASS, true);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleChooseResourceClass()
{
int bp = sui.getIntButtonPressed(params);
switch (bp)
{
case sui.BP_OK :
{
string[] resourceClasses = self.getScriptVars().getStringArray(SCRIPTVAR_SUB_CLASSES);
int rowSelected = sui.getListboxSelectedRow(params);
if ( rowSelected >= 0 && rowSelected < resourceClasses.length)
{
chooseResourceClass(sui.getPlayerId(params), resourceClasses[rowSelected]);
}
else
{
// re display UI since they didn't select anything (or we got an invalid selection)
string resourceClass = self.getScriptVars().getString(SCRIPTVAR_BASE_CLASS);
chooseResourceClass(sui.getPlayerId(params), resourceClass);
}
}
break;
case sui.BP_CANCEL :
{
string resourceClass = self.getScriptVars().getString(SCRIPTVAR_BASE_CLASS);
if( !resourceClass.equals(ROOT_ORGANIC_CLASS) && !resourceClass.equals(ROOT_INORGANIC_CLASS))
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass));
qa.qaToolMainMenu(self);
}
else
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass), true);
}
}
break;
default:
cleanup();
removePlayer(self,"");
break;
}
return SCRIPT_CONTINUE;
}
messageHandler handleChooseResourceType()
{
int bp = sui.getIntButtonPressed(params);
switch (bp)
{
case sui.BP_OK :
{
obj_id[] resourceTypes = self.getScriptVars().getObjIdArray(SCRIPTVAR_TYPES);
int rowSelected = sui.getListboxSelectedRow(params);
if ( rowSelected >= 0 && rowSelected < resourceTypes.length)
{
// display a SUI that shows resource stats
showResourceStats(sui.getPlayerId(params), resourceTypes[rowSelected] );
}
else
{
// re display UI since they didn't select anything (or we got an invalid selection)
string resourceClass = self.getScriptVars().getString(SCRIPTVAR_BASE_CLASS);
chooseResourceClass(sui.getPlayerId(params), resourceClass);
}
}
break;
case sui.BP_CANCEL :
{
// go to previous screen unless we are at the first screen.
// if it's the first screen, fallthrough to cleanup
string resourceClass = self.getScriptVars().getString(SCRIPTVAR_BASE_CLASS);
if( resourceClass != ROOT_RESOURCE_CLASS )
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass));
break;
}
}
default:
cleanup();
removePlayer(self,"");
break;
}
return SCRIPT_CONTINUE;
}
messageHandler handleChooseResourceTypeStats()
{
int bp = sui.getIntButtonPressed(params);
switch (bp)
{
case sui.BP_OK :
{
obj_id resourceChosen = self.getScriptVars().getObjId(SCRIPTVAR_RESOURCECHOSEN);
if (isIdValid(resourceChosen))
{
obj_id player = sui.getPlayerId(params);
obj_id crate = createResourceCrate(resourceChosen, RESOURCE_AMOUNT, utils.getInventoryContainer(player));
if (isIdValid(crate))
{
sendSystemMessageTestingOnly(self, "The selected resource has been placed in your inventory");
}
cleanup();
removePlayer(self,"");
}
else
{
// resource ID was invalid for some reason. Try redisplaying
string resourceClass = self.getScriptVars().getString(SCRIPTVAR_BASE_CLASS);
chooseResourceClass(sui.getPlayerId(params), resourceClass);
}
}
break;
case sui.BP_CANCEL :
{
// go to previous screen unless we are at the first screen.
// if it's the first screen, fallthrough to cleanup
string resourceClass = self.getScriptVars().getString(SCRIPTVAR_BASE_CLASS);
if(resourceClass != ROOT_RESOURCE_CLASS)
{
chooseResourceClass(sui.getPlayerId(params), getResourceParentClass(resourceClass));
break;
}
}
default:
cleanup();
removePlayer(self,"");
break;
}
return SCRIPT_CONTINUE;
}
/*****************************FUNCTIONS***********************************/
// Displays the stats of the resource and allows player to confirm resource selection or go back to previous
// script listing resource types based on parentClass
void showResourceStats(obj_id player, obj_id resource)
{
if(!isIdValid(player))
{
cleanup();
removePlayer(player,"");
return;
}
if(!isIdValid(resource))
{
cleanup();
removePlayer(player,"");
return;
}
obj_id self = getSelf();
// get resource attributes array
resource_attribute[] resourceAttribs = getResourceAttributes(resource);
// setup a string array which will be filled with string elements that look like name = value pairs
resizeable String[] attribStrings = new String[0];
// make sure we have something
if(resourceAttribs == null)
{
cleanup();
removePlayer(player,"");
return;
}
attribStrings = utils.addElement(attribStrings, "@"+SID_RESOURCE_NAME + " = " + getResourceName(resource));
// create readable strings that look like name = value pairs to fill listbox to display resource attributes
for(int i=0; i<resourceAttribs.length; ++i)
{
string_id temp = new string_id("obj_attr_n", resourceAttribs[i].getName());
attribStrings = utils.addElement( attribStrings, "@" + temp + " = " + resourceAttribs[i].getValue());
}
int pid = sui.listbox(getSelf(), player, "Selecting this resource will create 100k units in your inventory.",
sui.OK_CANCEL, getResourceName(resource), attribStrings, "handleChooseResourceTypeStats", false, false);
if ( pid >= 0 )
{
// redefine cancel as back
sui.setSUIProperty(pid, sui.LISTBOX_BTN_CANCEL, sui.PROP_TEXT,"@back");
sui.showSUIPage(pid);
getSelf().getScriptVars().put(SCRIPTVAR_RESOURCECHOSEN, resource);
}
else
{
cleanup();
removePlayer(player,"");
}
}
void chooseResourceClass(obj_id player, String parentClass)
{
chooseResourceClass(player, parentClass, false);
}
/**
* Shows a list of resource classes or types to the player, and lets them choose which one they want.
*/
void chooseResourceClass(obj_id player, String parentClass, boolean topLevel)
{
String[] resourceClasses = null;
//did we come from the main menu? If so no more space resources or energy for you!
if(topLevel)
resourceClasses = filterTopLevelResourceList(parentClass);
else
resourceClasses = getImmediateResourceChildClasses(parentClass);
if(resourceClasses == null)
{
cleanup();
removePlayer(player,"");
return;
}
if(resourceClasses.length == 0)
{
//cleanup();
chooseResourceType(player, parentClass);
return;
}
// filter out the resource classes with no resource type
int goodResources = 0;
for(int i = 0; i < resourceClasses.length; ++i)
{
if(!hasResourceType(resourceClasses[i]))
resourceClasses[i] = null;
else
++goodResources;
}
string[] temp = new string[goodResources];
goodResources = 0;
for(int i = 0; i < resourceClasses.length; ++i)
{
if(resourceClasses[i] != null)
temp[goodResources++] = resourceClasses[i];
}
resourceClasses = temp;
temp = null;
String[] resourceClassNames = getResourceClassNames(resourceClasses);
if(resourceClassNames == null)
{
cleanup();
removePlayer(player,"");
return;
}
string prompt;
if(parentClass == ROOT_RESOURCE_CLASS)
prompt = "@" + SID_CHOOSE_CLASS;
else
prompt = "@" + SID_CHOOSE_SUB_CLASS + " " + getResourceClassName(parentClass);
int pid = sui.listbox(getSelf(), player, prompt, sui.OK_CANCEL, RESOURCE_REWARD_TITLE, resourceClassNames, "handleChooseResourceClass", false, false);
if(parentClass != ROOT_RESOURCE_CLASS && pid >= 0)
{
// set a back button
sui.setSUIProperty(pid, sui.LISTBOX_BTN_CANCEL, sui.PROP_TEXT,"@back");
}
if (pid >= 0)
{
sui.showSUIPage(pid);
getSelf().getScriptVars().put(SCRIPTVAR_BASE_CLASS, parentClass);
getSelf().getScriptVars().put(SCRIPTVAR_SUB_CLASSES, resourceClasses);
}
else
cleanup();
removePlayer(player,"");
}
/**
* Shows a list of types to the player, and lets them choose which one they want.
*/
void chooseResourceType(obj_id player, String parentClass)
{
obj_id[] resourceTypes = getResourceTypes(parentClass);
if(resourceTypes == null || resourceTypes.length == 0)
{
cleanup();
removePlayer(player,"");
return;
}
string[] typeNames = getResourceNames(resourceTypes);
if(typeNames == null || typeNames.length == 0)
{
cleanup();
removePlayer(player,"");
return;
}
int pid = sui.listbox(getSelf(), player, "@" + SID_CHOOSE_TYPE + " " + getResourceClassName(parentClass),
sui.OK_CANCEL, RESOURCE_REWARD_TITLE, typeNames, "handleChooseResourceType", false, false);
if(pid >= 0)
{
// redefine cancel as back
sui.setSUIProperty(pid, sui.LISTBOX_BTN_CANCEL, sui.PROP_TEXT,"@back");
sui.showSUIPage(pid);
getSelf().getScriptVars().put(SCRIPTVAR_BASE_CLASS, parentClass);
getSelf().getScriptVars().put(SCRIPTVAR_TYPES, resourceTypes);
}
else
{
cleanup();
removePlayer(player,"");
}
}
/**
* Remove the scriptvars we use
*/
void cleanup()
{
getSelf().getScriptVars().remove(SCRIPTVAR_BASE_CLASS);
getSelf().getScriptVars().remove(SCRIPTVAR_SUB_CLASSES);
getSelf().getScriptVars().remove(SCRIPTVAR_TYPES);
getSelf().getScriptVars().remove(SCRIPTVAR_RESOURCECHOSEN);
}
void removePlayer(obj_id player, string err)
{
sendSystemMessageTestingOnly(player, err);
qa.removeScriptVars(player, "qarewardresource");
}
string [] filterTopLevelResourceList(String parentClass)
{
String[] resourceClasses = null;
//Syntax Nightmare
String [] tempResourceClass = getImmediateResourceChildClasses(parentClass);
Vector tempResourceClassTwo = null;
for(int x = 0; x < tempResourceClass.length; ++x)
{
if(tempResourceClass[x] != "energy" && tempResourceClass[x] != "space_resource")
tempResourceClassTwo = utils.addElement(tempResourceClassTwo, tempResourceClass[x]);
}
resourceClasses = new String[tempResourceClassTwo.size()];
tempResourceClassTwo.toArray (resourceClasses);
return resourceClasses;
}
@@ -0,0 +1,333 @@
package script.test;
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.craftinglib;
import script.library.utils;
import script.library.qa;
import script.library.sui;
public class qa_resources extends script.base_script
{
public qa_resources()
{
}
public static final String SCRIPTVAR = "resource";
public static final String[] MAIN_MENU =
{
"Recycled Resources",
"Space Resources"
};
public static final String[] RECYCLED_MAIN =
{
"Chemical",
"Creature",
"Flora",
"Metal",
"Ore"
};
public static final String[] RECYCLED_CHEMICAL =
{
"chemical",
"fuel_petrochem_solid",
"radioactive",
"water"
};
public static final String[] RECYCLED_CREATURE =
{
"bone",
"bone_horn",
"hide",
"meat",
"milk",
"seafood"
};
public static final String[] RECYCLED_FLORA =
{
"cereal",
"fruit",
"vegetable",
"wood"
};
public static final String[] RECYCLED_METAL =
{
"metal_ferrous",
"metal_nonferrous"
};
public static final String[] RECYCLED_ORE =
{
"ore_igneous",
"ore_sedimentary",
"gemstone"
};
public static final String[] SPACE_RESOURCE_CONST =
{
"space_chemical_acid",
"space_chemical_cyanomethanic",
"space_chemical_petrochem",
"space_chemical_sulfuric",
"space_gas_methane",
"space_gas_organometallic",
"space_gem_crystal",
"space_gem_diamond",
"space_metal_carbonaceous",
"space_metal_ice",
"space_metal_iron",
"space_metal_obsidian",
"space_metal_silicaceous"
};
public static final String RESOURCE_TOOL_DESCRIPTION = "This Tool will automatically spawn the space resources selected into the tester inventory.";
public static final String TITLE = "QA Resource Tool";
public static final int RECYCLED_AMOUNT = 100000;
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_resources");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_resources");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if (((toLower(text)).equals("qaresource")) || ((toLower(text)).equals("qaresources")))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu");
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int startingMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "resource.pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
else
{
String[] previousMainMenuArray = utils.getStringArrayScriptVar(self, "resource.mainMenu");
String previousSelection = previousMainMenuArray[idx];
if (previousSelection.equals("Recycled Resources"))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, RECYCLED_MAIN, "recycledMenuOptions", false, "resource.pid", "resource.recycledMain");
return SCRIPT_OVERRIDE;
}
else if (previousSelection.equals("Space Resources"))
{
qa.refreshMenu(player, "Select a Resource Type", TITLE, SPACE_RESOURCE_CONST, "spaceResourceHandler", false, "resource.pid", "resource.spaceResource");
}
else if (previousSelection.equals("Common Resources"))
{
craftinglib.makeBestResource(self, "steel", 1000000);
craftinglib.makeBestResource(self, "iron", 1000000);
craftinglib.makeBestResource(self, "copper", 1000000);
craftinglib.makeBestResource(self, "fuel_petrochem_solid", 1000000);
craftinglib.makeBestResource(self, "radioactive", 1000000);
craftinglib.makeBestResource(self, "aluminum", 1000000);
craftinglib.makeBestResource(self, "ore_extrusive", 1000000);
craftinglib.makeBestResource(self, "petrochem_inert", 1000000);
craftinglib.makeBestResource(self, "fiberplast", 1000000);
craftinglib.makeBestResource(self, "gas_inert", 1000000);
craftinglib.makeBestResource(self, "gas_reactive", 1000000);
debugSpeakMsg(self, "Completed.");
return SCRIPT_CONTINUE;
}
else
{
sendSystemMessageTestingOnly(player, "Tool Failed.");
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
public int recycledMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "resource.pid"))
{
qa.checkParams(params, "resource");
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu");
return SCRIPT_OVERRIDE;
}
else
{
String[] previousMainMenuArray = utils.getStringArrayScriptVar(self, "resource.recycledMain");
String previousSelection = previousMainMenuArray[idx];
if (previousSelection.equals("Chemical"))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, RECYCLED_CHEMICAL, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled");
return SCRIPT_OVERRIDE;
}
else if (previousSelection.equals("Creature"))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, RECYCLED_CREATURE, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled");
return SCRIPT_OVERRIDE;
}
else if (previousSelection.equals("Flora"))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, RECYCLED_FLORA, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled");
return SCRIPT_OVERRIDE;
}
else if (previousSelection.equals("Metal"))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, RECYCLED_METAL, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled");
return SCRIPT_OVERRIDE;
}
else if (previousSelection.equals("Ore"))
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, RECYCLED_ORE, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled");
return SCRIPT_OVERRIDE;
}
else
{
sendSystemMessageTestingOnly(player, "Tool Failed.");
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
public int allRecycledMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "resource.pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu");
return SCRIPT_OVERRIDE;
}
else
{
String[] previousMainMenuArray = utils.getStringArrayScriptVar(self, "resource.allRecycled");
String previousSelection = previousMainMenuArray[idx];
createResourceInInventory(player, previousSelection);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has spawned " + previousSelection + " (a recycled resource) using the QA Resource Tool.");
qa.refreshMenu(self, "Select a Resource Type", TITLE, previousMainMenuArray, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled");
return SCRIPT_OVERRIDE;
}
}
}
return SCRIPT_CONTINUE;
}
public int spaceResourceHandler(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "resource.pid"))
{
qa.checkParams(params, "resource");
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String previousMainMenuArray[] = utils.getStringArrayScriptVar(self, "resource.spaceResource");
if (btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu");
}
else
{
String previousSelection = previousMainMenuArray[idx];
if (previousSelection.equals(""))
{
sendSystemMessageTestingOnly(player, "There was a menu index error. Script failed.");
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
else
{
obj_id[] rtypes = getResourceTypes(previousSelection);
obj_id rtype = rtypes[0];
if (!isIdValid(rtype))
{
sendSystemMessageTestingOnly(self, "No id found");
sendSystemMessageTestingOnly(self, "Space Resource " + previousSelection + " could not be spawned. Report this to the tools team.");
return SCRIPT_CONTINUE;
}
String crateTemplate = getResourceContainerForType(rtype);
if (!crateTemplate.equals(""))
{
obj_id pInv = utils.getInventoryContainer(player);
if (!isIdNull(pInv))
{
obj_id crate = createObject(crateTemplate, pInv, "");
if (addResourceToContainer(crate, rtype, 100000, self))
{
sendSystemMessageTestingOnly(self, "Resource of class " + previousSelection + " placed in inventory.");
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has spawned " + previousSelection + " (a space resource) using the QA Resource Tool.");
qa.refreshMenu(player, RESOURCE_TOOL_DESCRIPTION, TITLE, SPACE_RESOURCE_CONST, "spaceResourceHandler", false, "resource.pid", "resource.spaceResource");
return SCRIPT_CONTINUE;
}
}
}
}
}
}
}
return SCRIPT_CONTINUE;
}
public void createResourceInInventory(obj_id player, String resourceTypeName) throws InterruptedException
{
obj_id resourceId = pickRandomNonDepeletedResource(resourceTypeName);
sendSystemMessageTestingOnly(player, "resourceId " + resourceId);
if (!isIdNull(resourceId))
{
obj_id recycle = getRecycledVersionOfResourceType(resourceId);
obj_id inv = utils.getInventoryContainer(player);
obj_id generic = createResourceCrate(recycle, RECYCLED_AMOUNT, inv);
sendSystemMessageTestingOnly(player, "Resource placed in inventory.");
}
else
{
sendSystemMessageTestingOnly(player, "The function failed because there were no resources of this type found on the server.");
}
qa.removePlayer(player, SCRIPTVAR, "");
}
}
@@ -1,400 +0,0 @@
// ======================================================================
// qa_resources.script
// [internal]
// QA Tool - QA Resource Tool
// [public]
// not for public consumption
// [testplan]
// Attach the test.qa_resources script to the test character and use the spatial command 'qaresource'.
// A SUI will instantiate and give the tester options.
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.craftinglib;
include library.utils;
include library.qa;
include library.sui;
/********* CONSTANTS *****************************************/
const string SCRIPTVAR = "resource";
const string[] MAIN_MENU =
{
"Recycled Resources",
"Space Resources"
};
const string[] RECYCLED_MAIN =
{
"Chemical",
"Creature",
"Flora",
"Metal",
"Ore"
};
const string[] RECYCLED_CHEMICAL =
{
"chemical",
"fuel_petrochem_solid",
"radioactive",
"water"
};
const string[] RECYCLED_CREATURE =
{
"bone",
"bone_horn",
"hide",
"meat",
"milk",
"seafood"
};
const string[] RECYCLED_FLORA =
{
"cereal",
"fruit",
"vegetable",
"wood"
};
const string[] RECYCLED_METAL =
{
"metal_ferrous",
"metal_nonferrous"
};
const string[] RECYCLED_ORE =
{
"ore_igneous",
"ore_sedimentary",
"gemstone"
};
const string[] SPACE_RESOURCE_CONST =
{
"space_chemical_acid",
"space_chemical_cyanomethanic",
"space_chemical_petrochem",
"space_chemical_sulfuric",
"space_gas_methane",
"space_gas_organometallic",
"space_gem_crystal",
"space_gem_diamond",
"space_metal_carbonaceous",
"space_metal_ice",
"space_metal_iron",
"space_metal_obsidian",
"space_metal_silicaceous"
};
const string RESOURCE_TOOL_DESCRIPTION = "This Tool will automatically spawn the space resources selected into the tester inventory.";
const string TITLE = "QA Resource Tool";
const int RECYCLED_AMOUNT = 100000;
/***** TRIGGERS *******************************************************/
trigger OnAttach()
{
if(isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_resources");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_resources");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if ((toLower(text).equals("qaresource")) || (toLower(text).equals("qaresources")))
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu" );
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler startingMenuOptions()
{
if (isGod(self))
{
//STATIC SCRIPT VARIBLE
if (utils.hasScriptVar(self, "resource.pid"))
{
//sendSystemMessageTestingOnly(self, "startingMenuOptions");
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//CHECK FOR CANCEL BUTTON
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(player);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
//BUILD THE NEXT SUI
else
{
//PLACE THE PREVIOUS SCRIPTVAR ARRAY INTO A REAL ARRAY
string[] previousMainMenuArray = utils.getStringArrayScriptVar( self, "resource.mainMenu" );
//FIND THE SELECTION MADE FROM THE ARRAY ABOVE
string previousSelection = previousMainMenuArray[idx];
if (previousSelection == "Recycled Resources")
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, RECYCLED_MAIN, "recycledMenuOptions", false, "resource.pid", "resource.recycledMain" );
return SCRIPT_OVERRIDE;
}
else if (previousSelection == "Space Resources")
{
qa.refreshMenu ( player, "Select a Resource Type", TITLE, SPACE_RESOURCE_CONST, "spaceResourceHandler", false, "resource.pid", "resource.spaceResource" );
}
else if(previousSelection == "Common Resources")
{
craftinglib.makeBestResource(self, "steel", 1000000);
craftinglib.makeBestResource(self, "iron", 1000000);
craftinglib.makeBestResource(self, "copper", 1000000);
craftinglib.makeBestResource(self, "fuel_petrochem_solid", 1000000);
craftinglib.makeBestResource(self, "radioactive", 1000000);
craftinglib.makeBestResource(self, "aluminum", 1000000);
craftinglib.makeBestResource(self, "ore_extrusive", 1000000);
craftinglib.makeBestResource(self, "petrochem_inert", 1000000);
craftinglib.makeBestResource(self, "fiberplast", 1000000);
craftinglib.makeBestResource(self, "gas_inert", 1000000);
craftinglib.makeBestResource(self, "gas_reactive", 1000000);
debugSpeakMsg(self, "Completed.");
return SCRIPT_CONTINUE;
}
else
{
sendSystemMessageTestingOnly(player, "Tool Failed.");
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler recycledMenuOptions()
{
if(isGod(self))
{
//STATIC SCRIPT VARIBLE
if(utils.hasScriptVar( self, "resource.pid"))
{
//sendSystemMessageTestingOnly(self, "recycledMenuOptions");
qa.checkParams(params, "resource");
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//CHECK FOR CANCEL BUTTON
if(btn == sui.BP_CANCEL)
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu" );
return SCRIPT_OVERRIDE;
}
//BUILD THE NEXT SUI
else
{
//PLACE THE PREVIOUS SCRIPTVAR ARRAY INTO A REAL ARRAY
string[] previousMainMenuArray = utils.getStringArrayScriptVar( self, "resource.recycledMain" );
//FIND THE SELECTION MADE FROM THE ARRAY ABOVE
string previousSelection = previousMainMenuArray[idx];
if (previousSelection == "Chemical")
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, RECYCLED_CHEMICAL, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled" );
return SCRIPT_OVERRIDE;
}
else if (previousSelection == "Creature")
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, RECYCLED_CREATURE, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled" );
return SCRIPT_OVERRIDE;
}
else if (previousSelection == "Flora")
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, RECYCLED_FLORA, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled" );
return SCRIPT_OVERRIDE;
}
else if (previousSelection == "Metal")
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, RECYCLED_METAL, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled" );
return SCRIPT_OVERRIDE;
}
else if (previousSelection == "Ore")
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, RECYCLED_ORE, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled" );
return SCRIPT_OVERRIDE;
}
else
{
sendSystemMessageTestingOnly(player, "Tool Failed.");
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler allRecycledMenuOptions()
{
if(isGod(self))
{
//STATIC SCRIPT VARIBLE
if(utils.hasScriptVar(self, "resource.pid"))
{
//sendSystemMessageTestingOnly(self, "allRecycledMenuOptions");
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//CHECK FOR CANCEL BUTTON
if(btn == sui.BP_CANCEL)
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu" );
return SCRIPT_OVERRIDE;
}
//BUILD THE NEXT SUI
else
{
//PLACE THE PREVIOUS SCRIPTVAR ARRAY INTO A REAL ARRAY
string[] previousMainMenuArray = utils.getStringArrayScriptVar(self, "resource.allRecycled");
//FIND THE SELECTION MADE FROM THE ARRAY ABOVE
string previousSelection = previousMainMenuArray[idx];
//SPAWN THE RECYCLED RESOURCE IN INVENTORY
createResourceInInventory(player, previousSelection);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has spawned " + previousSelection + " (a recycled resource) using the QA Resource Tool.");
//INSTANTIATE THE SAME SUI JUST USED
qa.refreshMenu ( self, "Select a Resource Type", TITLE, previousMainMenuArray, "allRecycledMenuOptions", false, "resource.pid", "resource.allRecycled" );
return SCRIPT_OVERRIDE;
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler spaceResourceHandler()
{
if(isGod(self))
{
if(utils.hasScriptVar( self, "resource.pid"))
{
qa.checkParams(params, "resource");
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string previousMainMenuArray[] = utils.getStringArrayScriptVar( self, "resource.spaceResource" );
if(btn == sui.BP_CANCEL)
{
qa.refreshMenu ( self, "Select a Resource Type", TITLE, MAIN_MENU, "startingMenuOptions", true, "resource.pid", "resource.mainMenu" );
}
else
{
string previousSelection = previousMainMenuArray[idx];
if(previousSelection == "")
{
sendSystemMessageTestingOnly(player, "There was a menu index error. Script failed.");
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
else
{
obj_id[] rtypes = getResourceTypes(previousSelection);
obj_id rtype = rtypes[0];
if(!isIdValid(rtype))
{
sendSystemMessageTestingOnly(self, "No id found");
sendSystemMessageTestingOnly(self, "Space Resource "+previousSelection+" could not be spawned. Report this to the tools team.");
return SCRIPT_CONTINUE;
}
string crateTemplate = getResourceContainerForType(rtype);
if(!crateTemplate.equals(""))
{
obj_id pInv = utils.getInventoryContainer(player);
if(!isIdNull(pInv))
{
obj_id crate = createObject(crateTemplate, pInv, "");
if( addResourceToContainer (crate, rtype, 100000, self) )
{
sendSystemMessageTestingOnly(self, "Resource of class "+previousSelection+" placed in inventory.");
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has spawned " + previousSelection + " (a space resource) using the QA Resource Tool.");
qa.refreshMenu(player, RESOURCE_TOOL_DESCRIPTION, TITLE, SPACE_RESOURCE_CONST, "spaceResourceHandler", false, "resource.pid", "resource.spaceResource");
return SCRIPT_CONTINUE;
}
}
}
}
}
}
}
return SCRIPT_CONTINUE;
}
/*------------- ALL FUNCTIONS ----------------------------------------------*/
void createResourceInInventory(obj_id player, string resourceTypeName)
{
obj_id resourceId = pickRandomNonDepeletedResource(resourceTypeName);
sendSystemMessageTestingOnly(player, "resourceId "+resourceId);
if(!isIdNull(resourceId))
{
obj_id recycle = getRecycledVersionOfResourceType(resourceId);
obj_id inv = utils.getInventoryContainer (player);
obj_id generic = createResourceCrate(recycle, RECYCLED_AMOUNT, inv);
sendSystemMessageTestingOnly(player, "Resource placed in inventory.");
}
else
{
sendSystemMessageTestingOnly(player, "The function failed because there were no resources of this type found on the server.");
}
qa.removePlayer(player, SCRIPTVAR, "");
}
@@ -0,0 +1,64 @@
package script.test;
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;
public class qa_stealth extends script.base_script
{
public qa_stealth()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qa_stealth");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_stealth");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals("qa_hide") || (toLower(text)).equals("qahide"))
{
sendSystemMessageTestingOnly(self, "Your character has been hidden from other clients.");
hideFromClient(self, true);
}
else if ((toLower(text)).equals("qa_unhide") || (toLower(text)).equals("qaunhide"))
{
sendSystemMessageTestingOnly(self, "Your character is now visible to other clients.");
hideFromClient(self, false);
}
}
return SCRIPT_CONTINUE;
}
public int OnLogout(obj_id self) throws InterruptedException
{
hideFromClient(self, false);
detachScript(self, "test.qa_stealth");
return SCRIPT_CONTINUE;
}
public int OnLogin(obj_id self) throws InterruptedException
{
if (hasScript(self, "test.qa_stealth"))
{
hideFromClient(self, false);
detachScript(self, "test.qa_stealth");
}
return SCRIPT_CONTINUE;
}
}
@@ -1,58 +0,0 @@
//************************************************************/
// Title: qa_stealth.script
// Description: Test Script for observing clientside effects of trackable/non-trackable objects.
//************************************************************/
/********* Triggers ******************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qa_stealth");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qa_stealth");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if(toLower(text).equals("qa_hide") || toLower(text).equals("qahide"))
{
sendSystemMessageTestingOnly(self, "Your character has been hidden from other clients.");
hideFromClient(self, true);
}
else if(toLower(text).equals("qa_unhide") || toLower(text).equals("qaunhide"))
{
sendSystemMessageTestingOnly(self, "Your character is now visible to other clients.");
hideFromClient(self, false);
}
}
return SCRIPT_CONTINUE;
}
trigger OnLogout()
{
hideFromClient(self, false);
detachScript(self, "test.qa_stealth");
return SCRIPT_CONTINUE;
}
trigger OnLogin()
{
if(hasScript(self, "test.qa_stealth"))
{
hideFromClient(self, false);
detachScript(self, "test.qa_stealth");
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,82 @@
package script.test;
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.qa;
import script.library.sui;
import script.library.utils;
public class qabackpack extends script.base_script
{
public qabackpack()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qabackpack");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qabackpack");
}
sendSystemMessage(self, "QA Backpack script attached.\nAny item received will be moved into a QA backpack.\nAny items moved from the backpack should not be automatically moved into the backpack.\nDetach script test.qabackpack to remove qabackpack automatic inventory functions.", null);
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
obj_id player = self;
if (isGod(player))
{
if ((toLower(text)).equals("qabackpack stop"))
{
sendSystemMessage(self, "Not yet implemented. QA Backpack automatic inventory functions DISABLED.", null);
return SCRIPT_OVERRIDE;
}
if ((toLower(text)).equals("qabackpack start"))
{
sendSystemMessage(self, "Not yet implemented. QA Backpack automatic inventory functions ENABLED.", null);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int OnContainerChildGainItem(obj_id self, obj_id item, obj_id source, obj_id transferer) throws InterruptedException
{
putInQaBackpack(item, self, source);
return SCRIPT_CONTINUE;
}
public void putInQaBackpack(obj_id item, obj_id player, obj_id source) throws InterruptedException
{
obj_id testerInventoryId = utils.getInventoryContainer(player);
qa.findOrCreateAndEquipQABag(player, testerInventoryId, false);
obj_id myBag = getObjectInSlot(player, "back");
if (!isValidId(myBag) && isValidId(testerInventoryId))
{
sendSystemMessage(player, "Error: Something bad happened in test.qabackpack", null);
return;
}
obj_id itemContainer = getContainedBy(item);
if (itemContainer != testerInventoryId)
{
return;
}
if (myBag == source)
{
return;
}
putInOverloaded(item, myBag);
return;
}
}
@@ -1,95 +0,0 @@
//**********************************************************
// Title: qabackpack.script
// Description: QA Backpack functions
//***********************************************************
/********* Includes ******************************************/
include library.qa;
include library.sui;
include library.utils;
/********* Triggers ******************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qabackpack");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qabackpack");
}
sendSystemMessage(self, "QA Backpack script attached.\nAny item received will be moved into a QA backpack.\nAny items moved from the backpack should not be automatically moved into the backpack.\nDetach script test.qabackpack to remove qabackpack automatic inventory functions.", null);
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
obj_id player = self;
if(isGod(player))
{
if (toLower(text).equals("qabackpack stop") )
{
sendSystemMessage(self, "Not yet implemented. QA Backpack automatic inventory functions DISABLED.", null);
return SCRIPT_OVERRIDE;
}
if (toLower(text).equals("qabackpack start") )
{
sendSystemMessage(self, "Not yet implemented. QA Backpack automatic inventory functions ENABLED.", null);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
trigger OnContainerChildGainItem(obj_id item, obj_id source, obj_id transferer)
{
putInQaBackpack(item, self, source);
return SCRIPT_CONTINUE;
}
void putInQaBackpack(obj_id item, obj_id player, obj_id source)
{
obj_id testerInventoryId = utils.getInventoryContainer(player);
qa.findOrCreateAndEquipQABag(player, testerInventoryId, false);
obj_id myBag = getObjectInSlot(player, "back");
//check to make sure everything is valid; break if not
if (!isValidId(myBag) && isValidId(testerInventoryId))
{
sendSystemMessage(player, "Error: Something bad happened in test.qabackpack", null);
return;
}
//if item is received in a container already, do not move it (e.g. a fish contains fish food and chum)
obj_id itemContainer = getContainedBy(item);
if (itemContainer != testerInventoryId)
{
return;
}
//if player is moving object from qabackpack into inventory, do not move that item back into qabackpack
if (myBag == source)
{
return;
}
putInOverloaded(item, myBag);
return;
}
@@ -0,0 +1,296 @@
package script.test;
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.badge;
import script.library.sui;
import script.library.utils;
import java.util.HashSet;
import script.library.qa;
public class qabadge extends script.base_script
{
public qabadge()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qabadge");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qabadge");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
obj_id player = self;
if (isGod(player))
{
if ((toLower(text)).equals("qabadges"))
{
Vector vectorMenuArray = new Vector();
vectorMenuArray.addElement("*Add All Badges*");
vectorMenuArray.addElement("*Remove All Badges*");
String[] badgePages = getAllCollectionPagesInBook("badge_book");
if ((badgePages != null) && (badgePages.length > 0))
{
for (int i = 0; i < badgePages.length; ++i)
{
if (!badgePages[i].equals("bdg_accumulation"))
{
vectorMenuArray.addElement(badgePages[i]);
}
}
}
String[] mainMenuArray = new String[vectorMenuArray.size()];
vectorMenuArray.toArray(mainMenuArray);
utils.setScriptVar(self, "qabadge.mainMenu", mainMenuArray);
if (mainMenuArray.length < 1)
{
sendSystemMessageTestingOnly(player, "Badge UI creation failed.");
}
else
{
utils.setScriptVar(player, "qabadge.mainMenu", mainMenuArray);
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", true, "qabadge.pid");
}
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int mainMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "qabadge.pid"))
{
String previousBadgeArray[] = utils.getStringArrayScriptVar(self, "qabadge.mainMenu");
obj_id player = sui.getPlayerId(params);
if ((params == null) || (params.isEmpty()))
{
sendSystemMessageTestingOnly(player, "Failing, params empty");
utils.removeScriptVarTree(player, "qabadge");
utils.removeScriptVarTree(player, "qatool");
return SCRIPT_CONTINUE;
}
int btn = sui.getIntButtonPressed(params);
int idx = sui.getListboxSelectedRow(params);
if (btn == sui.BP_CANCEL)
{
utils.removeScriptVarTree(player, "qabadge");
utils.removeScriptVarTree(player, "qatool");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
String[] options = utils.getStringArrayScriptVar(player, "qatool.toolMainMenu");
String mainTitle = utils.getStringScriptVar(player, "qatool.title");
String mainPrompt = utils.getStringScriptVar(player, "qatool.prompt");
if (options == null)
{
sendSystemMessageTestingOnly(player, "You didn't start from the main tool menu");
String[] mainMenuArray = utils.getStringArrayScriptVar(player, "qabadge.mainMenu");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", true, "qabadge.pid");
return SCRIPT_CONTINUE;
}
else
{
qa.refreshMenu(self, mainPrompt, mainTitle, options, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qabadge");
return SCRIPT_CONTINUE;
}
}
if (idx < 0)
{
utils.removeScriptVarTree(player, "qabadge");
utils.removeScriptVarTree(player, "qatool");
sendSystemMessageTestingOnly(player, "You didnt have anything selected");
return SCRIPT_CONTINUE;
}
String badgeChoice = previousBadgeArray[idx];
if (badgeChoice.equals("*Add All Badges*"))
{
String[] allBadges = getAllCollectionSlotsInBook("badge_book");
if ((allBadges != null) && (allBadges.length > 0))
{
for (int i = 0; i < allBadges.length; i++)
{
badge.grantBadge(player, allBadges[i]);
}
}
String[] mainMenuArray = utils.getStringArrayScriptVar(player, "qabadge.mainMenu");
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has added all in game badges from their current character using the QA Badge Tool.");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
if (badgeChoice.equals("*Remove All Badges*"))
{
String[] allBadges = getAllCollectionSlotsInBook("badge_book");
if ((allBadges != null) && (allBadges.length > 0))
{
for (int i = 0; i < allBadges.length; i++)
{
badge.revokeBadge(player, allBadges[i], true);
}
}
String[] mainMenuArray = utils.getStringArrayScriptVar(player, "qabadge.mainMenu");
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has removed all their badges from their current character using the QA Badge Tool.");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
String[] menuArray = getAllCollectionSlotsInPage(badgeChoice);
if ((menuArray == null) || (menuArray.length < 1))
{
sendSystemMessageTestingOnly(player, "Badge UI creation failed.");
}
else
{
qa.refreshMenu(self, "Choose the Badge", "Badge Granter", menuArray, "assignMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
utils.setScriptVar(self, "qabadge.Menu", menuArray);
utils.setScriptVar(self, "qabadge.Main_choice", badgeChoice);
}
}
}
return SCRIPT_CONTINUE;
}
public int assignMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, "qabadge.pid"))
{
String previousBadgeArray[] = utils.getStringArrayScriptVar(self, "qabadge.Menu");
obj_id player = sui.getPlayerId(params);
if ((params == null) || (params.isEmpty()))
{
sendSystemMessageTestingOnly(player, "Failing, params empty");
utils.removeScriptVarTree(player, "qabadge");
utils.removeScriptVarTree(player, "qatool");
return SCRIPT_CONTINUE;
}
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
utils.removeScriptVarTree(player, "qabadge");
utils.removeScriptVarTree(player, "qatool");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
String[] mainMenuArray = utils.getStringArrayScriptVar(player, "qabadge.mainMenu");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if (idx < 0)
{
utils.removeScriptVarTree(player, "qabadge");
utils.removeScriptVarTree(player, "qatool");
sendSystemMessageTestingOnly(player, "You didnt have anything selected");
return SCRIPT_CONTINUE;
}
String badgeChoice = previousBadgeArray[idx];
badgeAssign(player, badgeChoice);
String refreshBadge = utils.getStringScriptVar(player, "qabadge.Main_choice");
String[] menuArray = getAllCollectionSlotsInPage(refreshBadge);
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", menuArray, "assignMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
public void badgeAssign(obj_id player, String badgeName) throws InterruptedException
{
if (isGod(player))
{
boolean hasBadge = badge.hasBadge(player, badgeName);
if (hasBadge != true)
{
badge.grantBadge(player, badgeName);
sendSystemMessageTestingOnly(player, "Badge granted");
badge.checkBadgeCount(player);
CustomerServiceLog("qaTool", "User: (" + player + ") " + getName(player) + " has added a badge to their current character using the QA Badge Tool.");
explorerBadge(player);
}
else
{
badge.revokeBadge(player, badgeName, true);
sendSystemMessageTestingOnly(player, "Badge revoked");
badge.checkBadgeCount(player);
CustomerServiceLog("qaTool", "User: (" + player + ") " + getName(player) + " has removed a badge to their current character using the QA Badge Tool.");
explorerBadge(player);
}
}
}
public void explorerBadge(obj_id self) throws InterruptedException
{
if (isGod(self))
{
int[] intExplorerBadges = dataTableGetIntColumn("datatables/badge/exploration_badges.iff", "intIndex");
int intExplBadgeCount = 0;
for (int intI = 0; intI < intExplorerBadges.length; intI++)
{
String badgeName = getCollectionSlotName(intExplorerBadges[intI]);
if ((badgeName != null) && (badgeName.length() > 0) && badge.hasBadge(self, badgeName))
{
intExplBadgeCount = intExplBadgeCount + 1;
}
}
if (intExplBadgeCount >= 10)
{
if (!badge.hasBadge(self, "bdg_exp_10_badges"))
{
badge.grantBadge(self, "bdg_exp_10_badges");
return;
}
}
if (intExplBadgeCount >= 20)
{
if (!badge.hasBadge(self, "bdg_exp_20_badges"))
{
badge.grantBadge(self, "bdg_exp_20_badges");
return;
}
}
if (intExplBadgeCount >= 30)
{
if (!badge.hasBadge(self, "bdg_exp_30_badges"))
{
badge.grantBadge(self, "bdg_exp_30_badges");
return;
}
}
if (intExplBadgeCount >= 40)
{
if (!badge.hasBadge(self, "bdg_exp_40_badges"))
{
badge.grantBadge(self, "bdg_exp_40_badges");
return;
}
}
if (intExplBadgeCount >= 45)
{
if (!badge.hasBadge(self, "bdg_exp_45_badges"))
{
badge.grantBadge(self, "bdg_exp_45_badges");
return;
}
}
}
}
}
@@ -1,340 +0,0 @@
/*
Title: qabadge.script
Description: QA script used to grant and revoke specific badges via SUI element
*/
/***** INCLUDES ********************************************************/
include library.badge;
include library.sui;
include library.utils;
include java.util.HashSet;
include library.qa;
/***** TRIGGERS & FUNCTIONS *******************************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qabadge");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qabadge");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
obj_id player = self;
if(isGod(player))
{
if (toLower(text).equals("qabadges") )
{
// Create a String array that has all badge types in it, with no duplications
Vector vectorMenuArray = new Vector();
vectorMenuArray.addElement("*Add All Badges*");
vectorMenuArray.addElement("*Remove All Badges*");
string[] badgePages = getAllCollectionPagesInBook("badge_book");
if ((badgePages != null) && (badgePages.length > 0))
{
for (int i = 0; i < badgePages.length; ++i)
{
if (!badgePages[i].equals("bdg_accumulation"))
vectorMenuArray.addElement(badgePages[i]);
}
}
String[] mainMenuArray = new String[vectorMenuArray.size()];
vectorMenuArray.toArray(mainMenuArray);
utils.setScriptVar( self, "qabadge.mainMenu", mainMenuArray );
if (mainMenuArray.length < 1)
sendSystemMessageTestingOnly(player, "Badge UI creation failed.");
else
{
//save off array options so we can search later
utils.setScriptVar( player, "qabadge.mainMenu", mainMenuArray );
//create SUI with the options you added to the array
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", true, "qabadge.pid");
}
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/***** Message Handlers *******************************************************/
//Main Menu, this is populated Dynamically from the datatable
//******************************************************************************
messageHandler mainMenuOptions()
{
if(isGod(self))
{
if ( utils.hasScriptVar( self, "qabadge.pid"))
{
//get previous menu array
string previousBadgeArray[] = utils.getStringArrayScriptVar( self, "qabadge.mainMenu" );
obj_id player = sui.getPlayerId(params);
if ( (params == null) || (params.isEmpty()) )
{
sendSystemMessageTestingOnly(player,"Failing, params empty");
utils.removeScriptVarTree(player,"qabadge");
utils.removeScriptVarTree(player,"qatool");
return SCRIPT_CONTINUE;
}
int btn = sui.getIntButtonPressed(params);
int idx = sui.getListboxSelectedRow(params);
//used this to add some extra functionality to buttons
if (btn == sui.BP_CANCEL)
{
//this means we are done, and we need to clean the scriptvars
utils.removeScriptVarTree(player,"qabadge");
utils.removeScriptVarTree(player,"qatool");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
//Go back to tool Mainmenu
string[] options = utils.getStringArrayScriptVar(player, "qatool.toolMainMenu");
string mainTitle = utils.getStringScriptVar(player, "qatool.title");
string mainPrompt = utils.getStringScriptVar(player, "qatool.prompt");
if(options == null)
{
sendSystemMessageTestingOnly(player, "You didn't start from the main tool menu");
String[] mainMenuArray = utils.getStringArrayScriptVar(player, "qabadge.mainMenu");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", true, "qabadge.pid");
return SCRIPT_CONTINUE;
}
else
{
qa.refreshMenu( self, mainPrompt, mainTitle, options, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player,"qabadge");
return SCRIPT_CONTINUE;
}
}
if (idx < 0 ) //this means you didnt have anything selected and the window disappeared
{
//cleanScriptVars(player);
utils.removeScriptVarTree(player,"qabadge");
utils.removeScriptVarTree(player,"qatool");
sendSystemMessageTestingOnly(player, "You didnt have anything selected");
return SCRIPT_CONTINUE;
}
//get the previous badge choice
string badgeChoice = previousBadgeArray[idx];
//Determine if add all or remove all were selected
if(badgeChoice == "*Add All Badges*")
{
string[] allBadges = getAllCollectionSlotsInBook("badge_book");
if ((allBadges != null) && (allBadges.length > 0))
{
for(int i =0; i < allBadges.length; i++)
badge.grantBadge(player, allBadges[i]);
}
String[] mainMenuArray = utils.getStringArrayScriptVar(player, "qabadge.mainMenu");
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has added all in game badges from their current character using the QA Badge Tool.");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
if(badgeChoice == "*Remove All Badges*")
{
string[] allBadges = getAllCollectionSlotsInBook("badge_book");
if ((allBadges != null) && (allBadges.length > 0))
{
for(int i =0; i < allBadges.length; i++)
badge.revokeBadge(player, allBadges[i], true);
}
String[] mainMenuArray = utils.getStringArrayScriptVar( player, "qabadge.mainMenu");
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has removed all their badges from their current character using the QA Badge Tool.");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
string[] menuArray = getAllCollectionSlotsInPage(badgeChoice);
if ((menuArray == null) || (menuArray.length < 1))
sendSystemMessageTestingOnly(player, "Badge UI creation failed.");
else
{
//setting show boolean to false so I can change the name of the cancel button
qa.refreshMenu(self, "Choose the Badge", "Badge Granter", menuArray, "assignMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
//setting scriptvars needed to go back to main menu and to refresh the current menu
utils.setScriptVar( self, "qabadge.Menu", menuArray );
utils.setScriptVar( self, "qabadge.Main_choice", badgeChoice);
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler assignMenuOptions()
{
if(isGod(self))
{
if ( utils.hasScriptVar( self, "qabadge.pid"))
{
//get scriptvar array needed to know what the persons choice was
string previousBadgeArray[] = utils.getStringArrayScriptVar( self, "qabadge.Menu" );
obj_id player = sui.getPlayerId(params);
if ( (params == null) || (params.isEmpty()) )
{
sendSystemMessageTestingOnly(player,"Failing, params empty");
utils.removeScriptVarTree(player,"qabadge");
utils.removeScriptVarTree(player,"qatool");
return SCRIPT_CONTINUE;
}
int btn = sui.getIntButtonPressed(params);
//adding additional functionality to ok and cancel buttons
if(btn == sui.BP_CANCEL)
{
//this means we are done, and we need to clean the scriptvars
utils.removeScriptVarTree(player,"qabadge");
utils.removeScriptVarTree(player,"qatool");
return SCRIPT_CONTINUE;
}
//in this case cancel means back, so I redraw the main menu
if(btn == sui.BP_REVERT)
{
String[] mainMenuArray = utils.getStringArrayScriptVar( player, "qabadge.mainMenu");
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", mainMenuArray, "mainMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
//here we have picked a badge and are going to assign it
if (idx < 0 ) //this means you didnt have anything selected and the window disappeared
{
utils.removeScriptVarTree(player,"qabadge");
utils.removeScriptVarTree(player,"qatool");
sendSystemMessageTestingOnly(player, "You didnt have anything selected");
return SCRIPT_CONTINUE;
}
//get the choice made
string badgeChoice = previousBadgeArray[idx];
//assign the badge chosen
badgeAssign(player, badgeChoice);
//need to know what the chcice from the main menu was so we can redraw the current menu
string refreshBadge = utils.getStringScriptVar(player, "qabadge.Main_choice");
//redrawing current menu
string[] menuArray = getAllCollectionSlotsInPage(refreshBadge);
qa.refreshMenu(player, "Choose the Badge", "Badge Granter", menuArray, "assignMenuOptions", "qabadge.pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
//******** Misc Functions *************************************************************
//********* Badge Assign **************************************************************
// checks to see if you have badge yet, if so, it is revoked if not, granted
//*************************************************************************************
void badgeAssign(obj_id player, string badgeName)
{
if(isGod(player))
{
//does the player have the badge already?
boolean hasBadge = badge.hasBadge(player,badgeName);
//if not, give it to them
if (hasBadge != true)
{
badge.grantBadge(player, badgeName);
sendSystemMessageTestingOnly(player, "Badge granted");
badge.checkBadgeCount(player);
CustomerServiceLog("qaTool","User: (" + player + ") " + getName(player) + " has added a badge to their current character using the QA Badge Tool.");
explorerBadge(player);
}
//if so, take it away
else
{
badge.revokeBadge(player, badgeName, true);
sendSystemMessageTestingOnly(player, "Badge revoked");
badge.checkBadgeCount(player);
CustomerServiceLog("qaTool","User: (" + player + ") " + getName(player) + " has removed a badge to their current character using the QA Badge Tool.");
explorerBadge(player);
}
}
}
void explorerBadge(obj_id self)
{
if(isGod(self))
{
int[] intExplorerBadges = dataTableGetIntColumn("datatables/badge/exploration_badges.iff", "intIndex");
int intExplBadgeCount = 0;
for(int intI = 0; intI<intExplorerBadges.length; intI++)
{
string badgeName = getCollectionSlotName(intExplorerBadges[intI]);
if((badgeName != null) && (badgeName.length() > 0) && badge.hasBadge(self, badgeName))
intExplBadgeCount = intExplBadgeCount + 1;
}
if(intExplBadgeCount>=10)
if(!badge.hasBadge(self, "bdg_exp_10_badges"))
{
// you get the 10 badge
badge.grantBadge(self, "bdg_exp_10_badges");
return;
}
if(intExplBadgeCount>=20)
if(!badge.hasBadge(self, "bdg_exp_20_badges"))
{
// you get the 20 badge
badge.grantBadge(self, "bdg_exp_20_badges");
return;
}
if(intExplBadgeCount>=30)
if(!badge.hasBadge(self, "bdg_exp_30_badges"))
{
// you get a badge
badge.grantBadge(self, "bdg_exp_30_badges");
return;
}
if (intExplBadgeCount>=40)
if(!badge.hasBadge(self, "bdg_exp_40_badges"))
{
// you get a badge
badge.grantBadge(self, "bdg_exp_40_badges");
return;
}
if(intExplBadgeCount>=45)
if(!badge.hasBadge(self, "bdg_exp_45_badges"))
{
// you get a badge
badge.grantBadge(self, "bdg_exp_45_badges");
return;
}
}
}
@@ -0,0 +1,83 @@
package script.test;
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.sui;
import script.library.qa;
import script.library.utils;
public class qabuff extends script.base_script
{
public qabuff()
{
}
public static final String MY_SCRIPTVAR = "qabuff";
public static final String BUFF_TABLE = "datatables/buff/buff.iff";
public static final String BUFF_TOOL_PROMPT = "Select Spacial Attack or Buff to be performed on your test character.\n\nTo remove all buffs use the command:\n\n/qatool buff clear";
public static final String BUFF_TOOL_TITLE = "Special Attack & Buff Tool";
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qabuff");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qabuff");
}
return SCRIPT_CONTINUE;
}
public int buffOptionHandler(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, MY_SCRIPTVAR + ".pid"))
{
qa.checkParams(params, "bufftool");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String previousMainMenuArray[] = utils.getStringArrayScriptVar(self, MY_SCRIPTVAR + ".buffMenu");
if (btn == sui.BP_CANCEL)
{
utils.removeScriptVarTree(self, MY_SCRIPTVAR);
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
utils.removeScriptVarTree(self, MY_SCRIPTVAR);
String[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu(self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
return SCRIPT_CONTINUE;
}
else
{
String buffArg = previousMainMenuArray[idx];
String buffName = qa.getClientBuffName(self, buffArg);
if (!buffName.equals("null"))
{
qa.applyBuffOption(self, buffArg, buffName);
createMainMenu(self);
}
}
}
}
return SCRIPT_CONTINUE;
}
public void createMainMenu(obj_id self) throws InterruptedException
{
String[] allBuffs = dataTableGetStringColumn(BUFF_TABLE, "NAME");
Arrays.sort(allBuffs);
utils.setScriptVar(self, "qabuff.buffMenu", allBuffs);
qa.refreshMenu(self, BUFF_TOOL_PROMPT, BUFF_TOOL_TITLE, allBuffs, "buffOptionHandler", "qabuff.pid", sui.OK_CANCEL_REFRESH);
}
}
@@ -1,90 +0,0 @@
/*
Title: qabuff.script
Description: QA script used to test buffs
*/
/**********************************************************
* Inlcudes
**********************************************************/
include library.sui;
include library.qa;
include library.utils;
/***********************************************************
* Constants
***********************************************************/
const string MY_SCRIPTVAR = "qabuff";
const string BUFF_TABLE = "datatables/buff/buff.iff";
const string BUFF_TOOL_PROMPT = "Select Spacial Attack or Buff to be performed on your test character.\n\nTo remove all buffs use the command:\n\n/qatool buff clear";
const string BUFF_TOOL_TITLE = "Special Attack & Buff Tool";
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qabuff");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qabuff");
}
return SCRIPT_CONTINUE;
}
messageHandler buffOptionHandler()
{
if (isGod(self))
{
if (utils.hasScriptVar( self, MY_SCRIPTVAR + ".pid"))
{
qa.checkParams(params, "bufftool");
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string previousMainMenuArray[] = utils.getStringArrayScriptVar( self, MY_SCRIPTVAR + ".buffMenu" );
if (btn == sui.BP_CANCEL)
{
utils.removeScriptVarTree(self, MY_SCRIPTVAR);
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
utils.removeScriptVarTree(self, MY_SCRIPTVAR);
string[] tool_options = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
qa.refreshMenu(self, "Choose the tool you want to use", "QA Tools", tool_options, "toolMainMenu", true, "qatool.pid");
return SCRIPT_CONTINUE;
}
else
{
string buffArg = previousMainMenuArray[idx];
string buffName = qa.getClientBuffName(self, buffArg);
if (buffName != "null")
{
qa.applyBuffOption(self, buffArg, buffName);
createMainMenu(self);
}
}
}
}
return SCRIPT_CONTINUE;
}
void createMainMenu(obj_id self)
{
string[] allBuffs = dataTableGetStringColumn(BUFF_TABLE, "NAME");
Arrays.sort(allBuffs);
utils.setScriptVar(self, "qabuff.buffMenu", allBuffs);
qa.refreshMenu (self, BUFF_TOOL_PROMPT, BUFF_TOOL_TITLE, allBuffs, "buffOptionHandler", "qabuff.pid", sui.OK_CANCEL_REFRESH );
}
@@ -0,0 +1,278 @@
package script.test;
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.qa;
import script.library.sui;
public class qadatapad extends script.base_script
{
public qadatapad()
{
}
public static final String SCRIPTVAR = "qadatapad";
public static final String DATAPAD_TOOL_TITLE = "QA DATAPAD TOOL";
public static final String DATAPAD_TOOL_PROMPT = "This tool allows the tester to view, warp, export and import into the datapad";
public static final int FILL_WAYPOINTS = 0;
public static final int CONTROL_DEVICES = 1;
public static final String[] DATAPAD_TOOL_MENU =
{
"Warp to Waypoints",
"Export Waypoints"
};
public static final String[] ADD_ON_DATAPAD_MENU =
{
"FILL WAYPOINTS",
"CLEAR ALL WAYPOINTS"
};
public static final String[][] WAYPOINT_STRING_MULTIARRAY =
{
{
"yavin4",
"space_yavin4",
"kashyyyk_main",
"mustafar",
"mustafar",
"tatooine",
"tatooine",
"yavin4",
"yavin4",
"endor",
"naboo",
"tatooine",
"yavin4",
"dathomir",
"rori",
"corellia"
},
{
"Beach",
"Yavin 4 Station",
"Kachirho",
"New Mining Facility",
"Old Mining Facility",
"Lt. Akal Colzet (Imperial Pilot Trainer)",
"Commander Oberhaur",
"Field Commander Alozen",
"Captain Denner",
"Admiral Kilnstrider",
"Grand Admiral Nial Declann",
"Commander Da'la Socuna",
"Major Eker",
"Arnecio Ulvaw'op",
"General Ufwol",
"Admiral Wilham Burke"
}
};
public static final float[][] WAYPOINT_FLOAT_MULTIARRAY =
{
{
6495f,
-5552f,
-568f,
-2530f,
-1850f,
-1132f,
-1127f,
3998f,
4000f,
3227f,
-5524f,
-3002f,
-6966f,
-115f,
3690f,
3082f
},
{
0.0f,
-7065f,
0.0f,
0.0f,
0.0f,
13.32f,
15f,
37f,
37f,
24f,
29f,
4f,
73f,
18f,
96f,
301f
},
{
4490f,
-5121f,
-100f,
1650f,
820f,
-3542f,
-3589f,
-6195f,
-6196f,
-3436f,
4618f,
2201f,
-5660,
-1579f,
-6463f,
-5203f
}
};
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qadatapad");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qadatapad");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals(SCRIPTVAR))
{
toolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handleWarpScriptOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(self, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
String previousMainMenuArray[] = utils.getStringArrayScriptVar(self, SCRIPTVAR + ".warpMenu");
String previousSelection = previousMainMenuArray[idx];
if (utils.hasScriptVar(self, SCRIPTVAR + ".warpPoints") && !addOnSelection(self, previousSelection))
{
location waypointWarpLocationArray[] = utils.getLocationArrayScriptVar(self, SCRIPTVAR + ".warpPoints");
location warpSelection = waypointWarpLocationArray[idx];
goWarpLocation(player, warpSelection);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has warped to (" + warpSelection + ") using a QA Datapad Tool.");
qa.removePlayer(player, SCRIPTVAR, "");
}
else
{
if (previousSelection.equals(ADD_ON_DATAPAD_MENU[0]))
{
testWaypointLocations(self);
toolMainMenu(self);
}
else if (previousSelection.equals(ADD_ON_DATAPAD_MENU[1]))
{
deleteAllWaypoints(self);
toolMainMenu(self);
}
}
}
}
return SCRIPT_CONTINUE;
}
public void toolMainMenu(obj_id self) throws InterruptedException
{
obj_id[] waypointArray = qa.getAllValidWaypoints(self);
String[] waypointMenu = qa.getMenuList(self, waypointArray, "waypoint menu");
if (waypointMenu.length > 0)
{
location[] waypointWarpLocations = qa.getLocationList(self, waypointArray);
utils.setScriptVar(self, SCRIPTVAR + ".warpPoints", waypointWarpLocations);
String[] combinedMenu = new String[waypointMenu.length + ADD_ON_DATAPAD_MENU.length];
System.arraycopy(waypointMenu, 0, combinedMenu, 0, waypointMenu.length);
System.arraycopy(ADD_ON_DATAPAD_MENU, 0, combinedMenu, waypointMenu.length, ADD_ON_DATAPAD_MENU.length);
qa.refreshMenu(self, DATAPAD_TOOL_PROMPT, DATAPAD_TOOL_TITLE, combinedMenu, "handleWarpScriptOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".warpMenu", sui.OK_CANCEL_REFRESH);
}
else
{
qa.refreshMenu(self, DATAPAD_TOOL_PROMPT, DATAPAD_TOOL_TITLE, ADD_ON_DATAPAD_MENU, "handleWarpScriptOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".warpMenu", sui.OK_CANCEL_REFRESH);
}
}
public void goWarpLocation(obj_id player, location selectedLocation) throws InterruptedException
{
sendSystemMessageTestingOnly(player, "Waypoint data received, warping now.");
warpPlayer(player, selectedLocation.area, selectedLocation.x, selectedLocation.y, selectedLocation.z, null, 0.0f, 0.0f, 0.0f);
}
public boolean createWaypoint(obj_id self, String planetArea, float locationX, float locationY, float locationZ, String waypointName) throws InterruptedException
{
location locationVar = new location();
locationVar.area = planetArea;
locationVar.x = locationX;
locationVar.y = locationY;
locationVar.z = locationZ;
String waypName = waypointName;
qa.createAQaWaypointInDataPad(self, locationVar, waypName);
return true;
}
public void testWaypointLocations(obj_id self) throws InterruptedException
{
for (int i = 0; i < WAYPOINT_STRING_MULTIARRAY[0].length; i++)
{
String planetArea = WAYPOINT_STRING_MULTIARRAY[0][i];
String waypointName = WAYPOINT_STRING_MULTIARRAY[1][i];
float locationX = WAYPOINT_FLOAT_MULTIARRAY[0][i];
float locationY = WAYPOINT_FLOAT_MULTIARRAY[1][i];
float locationZ = WAYPOINT_FLOAT_MULTIARRAY[2][i];
boolean response = createWaypoint(self, planetArea, locationX, locationY, locationZ, waypointName);
}
}
public boolean deleteAllWaypoints(obj_id self) throws InterruptedException
{
obj_id[] waypoints = getWaypointsInDatapad(self);
for (int i = 0; i < waypoints.length; i++)
{
destroyWaypointInDatapad(waypoints[i], self);
}
return true;
}
public boolean addOnSelection(obj_id self, String previousSelection) throws InterruptedException
{
for (int i = 0; i < ADD_ON_DATAPAD_MENU.length; i++)
{
if (previousSelection.equals(ADD_ON_DATAPAD_MENU[i]))
{
return true;
}
}
return false;
}
}
@@ -1,298 +0,0 @@
// qadatapad.script
// Library Includes
include library.utils;
include library.qa;
include library.sui;
/********* CONSTANTS *****************************************/
const string SCRIPTVAR = "qadatapad";
const string DATAPAD_TOOL_TITLE = "QA DATAPAD TOOL";
const string DATAPAD_TOOL_PROMPT = "This tool allows the tester to view, warp, export and import into the datapad";
const int FILL_WAYPOINTS = 0;
const int CONTROL_DEVICES = 1;
const string[] DATAPAD_TOOL_MENU =
{
"Warp to Waypoints",
"Export Waypoints"
};
const string[] ADD_ON_DATAPAD_MENU =
{
"FILL WAYPOINTS",
"CLEAR ALL WAYPOINTS"
};
const string[][] WAYPOINT_STRING_MULTIARRAY =
{
{
"yavin4",
"space_yavin4",
"kashyyyk_main",
"mustafar",
"mustafar",
"tatooine",
"tatooine",
"yavin4",
"yavin4",
"endor",
"naboo",
"tatooine",
"yavin4",
"dathomir",
"rori",
"corellia"
}
,
{
"Beach",
"Yavin 4 Station",
"Kachirho",
"New Mining Facility",
"Old Mining Facility",
"Lt. Akal Colzet (Imperial Pilot Trainer)",
"Commander Oberhaur",
"Field Commander Alozen",
"Captain Denner",
"Admiral Kilnstrider",
"Grand Admiral Nial Declann",
"Commander Da'la Socuna",
"Major Eker",
"Arnecio Ulvaw'op",
"General Ufwol",
"Admiral Wilham Burke"
}
};
const float[][] WAYPOINT_FLOAT_MULTIARRAY =
{
{
6495f,
-5552f,
-568f,
-2530f,
-1850f,
-1132f,
-1127f,
3998f,
4000f,
3227f,
-5524f,
-3002f,
-6966f,
-115f,
3690f,
3082f
}
,
{
0.0f,
-7065f,
0.0f,
0.0f,
0.0f,
13.32f,
15f,
37f,
37f,
24f,
29f,
4f,
73f,
18f,
96f,
301f
}
,
{
4490f,
-5121f,
-100f,
1650f,
820f,
-3542f,
-3589f,
-6195f,
-6196f,
-3436f,
4618f,
2201f,
-5660,
-1579f,
-6463f,
-5203f
}
};
/***** TRIGGERS *******************************************************/
trigger OnAttach()
{
if(isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qadatapad");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if(!isGod(self))
{
detachScript(self, "test.qadatapad");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if(toLower(text).equals(SCRIPTVAR))
{
//FUNCTION TO SHOW THE MAIN MENU OF THE TOOL
toolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/******** Message Handlers *************************************/
messageHandler handleWarpScriptOptions()
{
if(isGod(self))
{
//STATIC SCRIPT VARIBLE
if(utils.hasScriptVar( self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//CHECK FOR CANCEL BUTTON
if(btn == sui.BP_CANCEL)
{
qa.removePlayer(player, SCRIPTVAR, "");
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(self, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
//ATTAINING THE PREVIOUS MENU AND PLACING IT INTO AN ARRAY
string previousMainMenuArray[] = utils.getStringArrayScriptVar(self, SCRIPTVAR+".warpMenu");
//FINDING THE SPECIFIC SELECTION MADE BY USER (IF NEEDED)
string previousSelection = previousMainMenuArray[idx];
if(utils.hasScriptVar(self, SCRIPTVAR+".warpPoints") && !addOnSelection(self, previousSelection))
{
location waypointWarpLocationArray[] = utils.getLocationArrayScriptVar( self, SCRIPTVAR+".warpPoints" );
location warpSelection = waypointWarpLocationArray[idx];
goWarpLocation (player, warpSelection);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has warped to (" + warpSelection + ") using a QA Datapad Tool.");
qa.removePlayer(player, SCRIPTVAR, "");
}
else
{
//Add new Add-On menu item conditions as the need arises
//sendSystemMessageTestingOnly(self, "add on menu");
if(previousSelection == ADD_ON_DATAPAD_MENU[0])
{
testWaypointLocations(self);
toolMainMenu(self);
}
else if(previousSelection == ADD_ON_DATAPAD_MENU[1])
{
deleteAllWaypoints(self);
toolMainMenu(self);
}
}
}
}
return SCRIPT_CONTINUE;
}
/*------------- ALL FUNCTIONS ----------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
//BUILDS THE WARP MENU
void toolMainMenu(obj_id self)
{
obj_id[] waypointArray = qa.getAllValidWaypoints(self);
string[] waypointMenu = qa.getMenuList(self, waypointArray, "waypoint menu");
if(waypointMenu.length > 0)
{
location[] waypointWarpLocations = qa.getLocationList(self, waypointArray);
utils.setScriptVar(self, SCRIPTVAR+".warpPoints", waypointWarpLocations);
string[] combinedMenu = new string[waypointMenu.length + ADD_ON_DATAPAD_MENU.length];
System.arraycopy(waypointMenu, 0, combinedMenu, 0, waypointMenu.length);
System.arraycopy(ADD_ON_DATAPAD_MENU, 0, combinedMenu, waypointMenu.length, ADD_ON_DATAPAD_MENU.length);
qa.refreshMenu(self, DATAPAD_TOOL_PROMPT, DATAPAD_TOOL_TITLE, combinedMenu, "handleWarpScriptOptions", SCRIPTVAR+".pid", SCRIPTVAR+".warpMenu", sui.OK_CANCEL_REFRESH);
}
else
{
qa.refreshMenu(self, DATAPAD_TOOL_PROMPT, DATAPAD_TOOL_TITLE, ADD_ON_DATAPAD_MENU, "handleWarpScriptOptions", SCRIPTVAR+".pid", SCRIPTVAR+".warpMenu", sui.OK_CANCEL_REFRESH);
}
}
void goWarpLocation(obj_id player, location selectedLocation)
{
sendSystemMessageTestingOnly(player, "Waypoint data received, warping now.");
warpPlayer(player, selectedLocation.area, selectedLocation.x, selectedLocation.y, selectedLocation.z, null, 0.0f, 0.0f, 0.0f);
}
boolean createWaypoint(obj_id self, string planetArea, float locationX, float locationY, float locationZ, string waypointName)
{
location locationVar = new location();
locationVar.area = planetArea;
locationVar.x = locationX;
locationVar.y = locationY;
locationVar.z = locationZ;
string waypName = waypointName;
qa.createAQaWaypointInDataPad(self, locationVar, waypName);
return true;
}
void testWaypointLocations(obj_id self)
{
for(int i=0; i < WAYPOINT_STRING_MULTIARRAY[0].length; i++)
{
string planetArea = WAYPOINT_STRING_MULTIARRAY[0][i];
string waypointName = WAYPOINT_STRING_MULTIARRAY[1][i];
float locationX = WAYPOINT_FLOAT_MULTIARRAY[0][i];
float locationY = WAYPOINT_FLOAT_MULTIARRAY[1][i];
float locationZ = WAYPOINT_FLOAT_MULTIARRAY[2][i];
boolean response = createWaypoint(self, planetArea, locationX, locationY, locationZ, waypointName);
}
}
boolean deleteAllWaypoints(obj_id self)
{
obj_id[] waypoints = getWaypointsInDatapad(self);
for(int i=0; i < waypoints.length; i++)
{
destroyWaypointInDatapad(waypoints[i], self);
}
return true;
}
boolean addOnSelection(obj_id self, string previousSelection)
{
for(int i=0; i < ADD_ON_DATAPAD_MENU.length; i++)
{
if(previousSelection == ADD_ON_DATAPAD_MENU[i])
return true;
}
return false;
}
@@ -0,0 +1,205 @@
package script.test;
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.sui;
import script.library.utils;
import script.library.incubator;
import script.library.qa;
import script.library.beast_lib;
public class qadna extends script.base_script
{
public qadna()
{
}
public static final String INCUBATOR_TEMPLATES = "datatables/beast/incubator_templates.iff";
public static final String SCRIPTVAR = "qadna";
public static final String DNA_PROMPT = "Choose the creature you want to get DNA from. \nThe chosen DNA will be created in your inventory.";
public static final String DNA_TITLE = "QA DNA Tool";
public static final String[] QATOOL_MAIN_MENU = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
public static final String QATOOL_TITLE = "QA Tools";
public static final String QATOOL_PROMPT = "Choose the tool you want to use";
public int OnAttach(obj_id self) throws InterruptedException
{
if (!isGod(self))
{
detachScript(self, "test.qadna");
}
else if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qadna");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (isGod(self))
{
if ((toLower(text)).equals("qadna"))
{
getCreatureList(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int handlePetOptionsTool(obj_id self, dictionary params) throws InterruptedException
{
if (!isGod(self))
{
return SCRIPT_CONTINUE;
}
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
else
{
switch (idx)
{
case 0:
getCreatureList(self);
break;
case 1:
sendSystemMessageTestingOnly(self, "These pet options are not yet available.");
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
break;
default:
removePlayer(player, "Default Option on Switch");
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
public int handleDnaOptions(obj_id self, dictionary params) throws InterruptedException
{
if (!isGod(self))
{
return SCRIPT_CONTINUE;
}
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
else if (btn == sui.BP_REVERT)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
else if (idx < 0)
{
removePlayer(player, "Index less than zero");
return SCRIPT_CONTINUE;
}
else
{
String chosenDnaItem = dataTableGetString(INCUBATOR_TEMPLATES, idx, "initial_template");
String creature = getDisplayName(chosenDnaItem);
setUpDnaWithDummyData(self, chosenDnaItem, creature);
}
}
return SCRIPT_CONTINUE;
}
public void toolMainMenu(obj_id self, String[] dnaCreatureArray) throws InterruptedException
{
qa.refreshMenu(self, DNA_PROMPT, DNA_TITLE, dnaCreatureArray, "handleDnaOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".mainMenu", sui.OK_CANCEL_REFRESH);
}
public void getCreatureList(obj_id self) throws InterruptedException
{
Vector dnaCreatures = new Vector();
String[] dnaCreatureStringColumn = dataTableGetStringColumn(INCUBATOR_TEMPLATES, "initial_template");
if (dnaCreatureStringColumn.length > -1)
{
for (int i = 0; i < dnaCreatureStringColumn.length; i++)
{
String creatureDisplayName = getDisplayName(dnaCreatureStringColumn[i]);
dnaCreatures.add(creatureDisplayName);
}
if (dnaCreatures.size() >= 1)
{
String[] dnaCreatureArray = new String[dnaCreatures.size()];
dnaCreatures.toArray(dnaCreatureArray);
toolMainMenu(self, dnaCreatureArray);
}
else
{
sendSystemMessageTestingOnly(self, "There is an error with this tool, if the issue persists, please contact the tool team.");
removePlayer(self, "");
}
}
else
{
sendSystemMessageTestingOnly(self, "There is an error with this tool, if the issue persists, please contact the tool team.");
removePlayer(self, "");
}
}
public String getDisplayName(String creatureName) throws InterruptedException
{
if (creatureName.indexOf("/") > -1)
{
String[] splitType = split(creatureName, '/');
creatureName = splitType[3];
}
if (creatureName.indexOf(".") > -1)
{
String[] splitAtDot = split(creatureName, '.');
creatureName = splitAtDot[0];
}
creatureName = beast_lib.stripBmFromType(creatureName);
return creatureName;
}
public void setUpDnaWithDummyData(obj_id self, String creatureTemplate, String creature) throws InterruptedException
{
obj_id pInv = utils.getInventoryContainer(self);
obj_id dnaContainer = createObjectOverloaded("object/tangible/loot/beast/dna_container.iff", pInv);
incubator.initializeDna(dnaContainer, self);
setObjVar(dnaContainer, incubator.DNA_PARENT_TEMPLATE, creature);
int row = dataTableSearchColumnForString(creatureTemplate, "initial_template", INCUBATOR_TEMPLATES);
int hashTemplate = dataTableGetInt(INCUBATOR_TEMPLATES, row, "hash_initial_template");
setObjVar(dnaContainer, incubator.DNA_TEMPLATE_OBJVAR, hashTemplate);
sendSystemMessageTestingOnly(self, "A " + creature + " DNA sample has been placed in your inventory.");
removePlayer(self, "");
}
public void removePlayer(obj_id self, String err) throws InterruptedException
{
sendSystemMessageTestingOnly(self, err);
qa.removeScriptVars(self, SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
}
}
@@ -1,229 +0,0 @@
//************************************************************//
// Title: qadna.script
// Description: Creates valid test sample DNA for testers.
//************************************************************/
/********* Includes ******************************************/
include library.sui;
include library.utils;
include library.incubator;
include library.qa;
include library.beast_lib;
/********** Constants ****************************************/
const string INCUBATOR_TEMPLATES = "datatables/beast/incubator_templates.iff";
const string SCRIPTVAR = "qadna";
const string DNA_PROMPT = "Choose the creature you want to get DNA from. \nThe chosen DNA will be created in your inventory.";
const string DNA_TITLE = "QA DNA Tool";
const string[] QATOOL_MAIN_MENU = dataTableGetStringColumn( "datatables/test/qa_tool_menu.iff", "main_tool" );
const string QATOOL_TITLE = "QA Tools";
const string QATOOL_PROMPT = "Choose the tool you want to use";
/********** Triggers *****************************************/
trigger OnAttach()
{
if (!isGod(self))
{
detachScript(self, "test.qadna");
}
else if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qadna");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if (toLower(text).equals("qadna") )
{
getCreatureList(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/********** MessageHandlers ********************************/
messageHandler handlePetOptionsTool()
{
if(!isGod(self))
{
return SCRIPT_CONTINUE;
}
if(utils.hasScriptVar(self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
else
{
switch(idx)
{
case 0: //QA DNA Creature List
getCreatureList(self);
break;
case 1: //Not Available
sendSystemMessageTestingOnly(self, "These pet options are not yet available.");
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
break;
default:
removePlayer(player, "Default Option on Switch");
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleDnaOptions()
{
if(!isGod(self))
{
return SCRIPT_CONTINUE;
}
if(utils.hasScriptVar(self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
//CHECK FOR CANCEL BUTTON
if(btn == sui.BP_CANCEL)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
else if(btn == sui.BP_REVERT)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, "qadna");
return SCRIPT_CONTINUE;
}
else if(idx < 0)
{
removePlayer(player, "Index less than zero");
return SCRIPT_CONTINUE;
}
else
{
//retrieve chosen item string
string chosenDnaItem = dataTableGetString(INCUBATOR_TEMPLATES, idx, "initial_template");
//get the creature name - this is used to accurately set the parent_creature_template objvar
string creature = getDisplayName(chosenDnaItem);
//sendSystemMessageTestingOnly(self, ""+params);
setUpDnaWithDummyData(self, chosenDnaItem, creature);
}
}
return SCRIPT_CONTINUE;
}
/*************** Functions *********************************/
//BUILDS THE MAIN TOOL MENU
void toolMainMenu(obj_id self, string[] dnaCreatureArray)
{
qa.refreshMenu(self, DNA_PROMPT, DNA_TITLE, dnaCreatureArray, "handleDnaOptions", SCRIPTVAR+".pid", SCRIPTVAR+".mainMenu", sui.OK_CANCEL_REFRESH);
}
void getCreatureList(obj_id self)
{
//create vector
Vector dnaCreatures = new Vector();
//get datatable column
string[] dnaCreatureStringColumn = dataTableGetStringColumn(INCUBATOR_TEMPLATES, "initial_template");
if(dnaCreatureStringColumn.length > -1)
{
for(int i = 0; i < dnaCreatureStringColumn.length; i++)
{
string creatureDisplayName = getDisplayName(dnaCreatureStringColumn[i]);
//add parsed string to vector
dnaCreatures.add(creatureDisplayName);
}
//make sure the Vector is populated
if(dnaCreatures.size() >= 1)
{
//convert the Vector to an Array
string[] dnaCreatureArray = new string[dnaCreatures.size()];
dnaCreatures.toArray(dnaCreatureArray);
toolMainMenu(self, dnaCreatureArray);
}
else
{
sendSystemMessageTestingOnly(self, "There is an error with this tool, if the issue persists, please contact the tool team.");
removePlayer(self, "");
}
}
else
{
sendSystemMessageTestingOnly(self, "There is an error with this tool, if the issue persists, please contact the tool team.");
removePlayer(self, "");
}
}
string getDisplayName(string creatureName)
{
//remove 'object/mobile/beast_master/'
if(creatureName.indexOf("/") > -1)
{
string[] splitType = split(creatureName, '/');
creatureName = splitType[3];
}
//remove '.iff'
if(creatureName.indexOf(".") > -1)
{
string[] splitAtDot= split(creatureName, '.');
creatureName = splitAtDot[0];
}
//remove 'bm_'
creatureName = beast_lib.stripBmFromType(creatureName);
return creatureName;
}
void setUpDnaWithDummyData (obj_id self, string creatureTemplate, string creature)
{
//player inventory
obj_id pInv = utils.getInventoryContainer(self);
//create dnaContainer
obj_id dnaContainer = createObjectOverloaded("object/tangible/loot/beast/dna_container.iff", pInv);
incubator.initializeDna(dnaContainer, self);
setObjVar(dnaContainer, incubator.DNA_PARENT_TEMPLATE, creature);
int row = dataTableSearchColumnForString(creatureTemplate, "initial_template", INCUBATOR_TEMPLATES);
int hashTemplate = dataTableGetInt(INCUBATOR_TEMPLATES, row, "hash_initial_template");
setObjVar(dnaContainer, incubator.DNA_TEMPLATE_OBJVAR, hashTemplate);
sendSystemMessageTestingOnly(self, "A "+creature+" DNA sample has been placed in your inventory.");
removePlayer(self, "");
}
//THIS FUNCTION IS A GENERIC SCRIPT REMOVAL FUNCTION
void removePlayer(obj_id self, string err)
{
sendSystemMessageTestingOnly(self, err);
qa.removeScriptVars(self, SCRIPTVAR);
utils.removeScriptVarTree(self, SCRIPTVAR);
}
@@ -0,0 +1,130 @@
package script.test;
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;
public class qadroid extends script.base_script
{
public qadroid()
{
}
public static final String[] DROID_TEMPLATE_ARRAY =
{
"object/tangible/deed/pet_deed/deed_mse_advanced_basic.iff"
};
public static final String[] STRING_ARRAY =
{
"ai.diction",
"creature_attribs.type"
};
public static final String[] STRING_VALUES =
{
"droid_default",
"mouse_droid_crafted"
};
public static final String[] ATTRIB_ARRAY =
{
"combatModule",
"crafting.creator.xpType",
"crafting.repair_type",
"creature_attribs.defenseValue",
"creature_attribs.general_protection",
"creature_attribs.level",
"creature_attribs.maxConstitution",
"creature_attribs.maxDamage",
"creature_attribs.maxHealth",
"creature_attribs.minDamage",
"creature_attribs.toHitChance",
"mechanism_quality",
"module_data.bomb_level",
"module_data.bomb_level_bonus",
"pet.nonCombatDroid"
};
public static final int[] INT_VALUES =
{
0,
43,
32,
80,
6000,
30,
0,
205,
4000,
135,
80,
82,
14,
20,
1
};
public static final String[] ATTRIB_DOUBLE_ARRAY =
{
"crafting_components.decayRate",
"creature_attribs.aggroBonus",
"creature_attribs.critChance",
"creature_attribs.critSave",
"creature_attribs.scale",
"creature_attribs.stateResist"
};
public static final String[] DOUBLE_VALUES =
{
"46.740349",
"0.000000",
"0.000000",
"0.000000",
"1.000000",
"0.000000"
};
public static final String SOURCE_SCHEMATIC = "crafting.source_schematic";
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
obj_id player = self;
if (isGod(player))
{
if ((toLower(text)).equals("qadroid"))
{
obj_id inventory = utils.getInventoryContainer(player);
obj_id[] invItems = getContents(inventory);
if (invItems.length > 89)
{
sendSystemMessageTestingOnly(player, "You do not have enough space for this droid.");
return SCRIPT_CONTINUE;
}
else
{
for (int i = 0; i < DROID_TEMPLATE_ARRAY.length; i++)
{
obj_id newObj = createObject(DROID_TEMPLATE_ARRAY[i], inventory, "");
int SourceSchematic = 0;
attachScript(newObj, "npc.pet_deed.droid_deed");
boolean myBool = utils.setScriptVar(newObj, "crafting.creator.xp", 90);
sendSystemMessageTestingOnly(player, toString(newObj));
for (int j = 0; j < STRING_ARRAY.length; j++)
{
setObjVar(newObj, STRING_ARRAY[j], STRING_VALUES[j]);
}
for (int k = 0; k < ATTRIB_ARRAY.length; k++)
{
setObjVar(newObj, ATTRIB_ARRAY[k], INT_VALUES[k]);
}
for (int m = 0; m < ATTRIB_DOUBLE_ARRAY.length; m++)
{
setObjVar(newObj, ATTRIB_DOUBLE_ARRAY[m], DOUBLE_VALUES[m]);
}
setObjVar(newObj, SOURCE_SCHEMATIC, SourceSchematic);
}
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,157 +0,0 @@
//************************************************************/
// Title: qadroid.script
// Description: Droid Deed Creation
//************************************************************/
/********* Includes ******************************************/
include library.utils;
/********* CONSTANTS *****************************************/
// blank droid deeds
const string[] DROID_TEMPLATE_ARRAY =
{
"object/tangible/deed/pet_deed/deed_mse_advanced_basic.iff"
};
// object variables array to be attached.
const string[] STRING_ARRAY =
{
"ai.diction", // droid_default
"creature_attribs.type" // mouse_droid_crafted
};
// objvar values to be attached.
const string[] STRING_VALUES =
{
"droid_default", // ai.diction
"mouse_droid_crafted" // creature_attribs.type
};
const string[] ATTRIB_ARRAY =
{
"combatModule", // 0
"crafting.creator.xpType", // 43
"crafting.repair_type", // 32
"creature_attribs.defenseValue", // 80
"creature_attribs.general_protection", // 6000
"creature_attribs.level", // 30
"creature_attribs.maxConstitution", // 0
"creature_attribs.maxDamage", // 205
"creature_attribs.maxHealth", // 4000
"creature_attribs.minDamage", // 135
"creature_attribs.toHitChance", // 80
"mechanism_quality", // 82
"module_data.bomb_level", // 14
"module_data.bomb_level_bonus", // 20
"pet.nonCombatDroid", // 1
};
const int[] INT_VALUES =
{
0,
43,
32,
80,
6000,
30,
0,
205,
4000,
135,
80,
82,
14,
20,
1
};
const string[] ATTRIB_DOUBLE_ARRAY =
{
// could not get double values to set in the setObjVar function, float errored out a loss of precision(7 digits)
"crafting_components.decayRate", // 46.740349
"creature_attribs.aggroBonus", // 0.000000
"creature_attribs.critChance", // 0.000000
"creature_attribs.critSave", // 0.000000
"creature_attribs.scale", // 1.000000
"creature_attribs.stateResist", // 0.000000
};
const string[] DOUBLE_VALUES =
{
"46.740349",
"0.000000",
"0.000000",
"0.000000",
"1.000000",
"0.000000"
};
const string SOURCE_SCHEMATIC = "crafting.source_schematic";
/********* Triggers ******************************************/
trigger OnSpeaking(string text)
{
obj_id player = self;
if(isGod(player))
{
if (toLower(text).equals("qadroid") )
{
// get player inventory
obj_id inventory = utils.getInventoryContainer(player);
// get array of items in player inventory
obj_id[] invItems = getContents(inventory);
// test for room in backpack
if(invItems.length > 89)
{
// system message: no room in inventory
sendSystemMessageTestingOnly(player, "You do not have enough space for this droid.");
return SCRIPT_CONTINUE;
}
else
{
// create droid deeds listed in ITEM_ARRAY -- currently only 1 droid
for(int i = 0; i < DROID_TEMPLATE_ARRAY.length; i++)
{
obj_id newObj = createObject(DROID_TEMPLATE_ARRAY[i], inventory, "");
int SourceSchematic = 0;
// attach script to deed
attachScript (newObj, "npc.pet_deed.droid_deed");
// attach scriptvar to deed
boolean myBool = utils.setScriptVar(newObj, "crafting.creator.xp", 90);
// sendSystemMessageTestingOnly(player, ""+myBool);
// debug message - system message newObj objID
sendSystemMessageTestingOnly(player, toString(newObj));
// attach and set object variables to deed
for(int j = 0; j < STRING_ARRAY.length; j++)
{
setObjVar(newObj, STRING_ARRAY[j], STRING_VALUES[j]);
}
for(int k = 0; k < ATTRIB_ARRAY.length; k++)
{
setObjVar(newObj, ATTRIB_ARRAY[k], INT_VALUES[k]);
}
for(int m = 0; m < ATTRIB_DOUBLE_ARRAY.length; m++)
{
setObjVar(newObj, ATTRIB_DOUBLE_ARRAY[m], DOUBLE_VALUES[m]);
}
setObjVar(newObj, SOURCE_SCHEMATIC, SourceSchematic);
}
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,353 @@
package script.test;
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.qa;
import script.library.sui;
import script.library.utils;
import script.library.factions;
import java.util.HashSet;
public class qafaction extends script.base_script
{
public qafaction()
{
}
public static final String NPC_PROMPT = "Choose a faction option\n" + "NOTE: Some factions are not really available to players, so occasionally if you select one and try to " + "add or remove the faction, it will not work";
public static final String PROMPT = "Choose a faction option";
public static final String TITLE = "QA Faction Tool";
public static final int XP_AMOUNT = 1000000;
public static final String[] FACTIONS =
{
"Rebel",
"Imperial"
};
public static final String[] MIN_MAX =
{
"Max faction",
"Min Faction",
"Zero Faction"
};
public static final String[] MAIN_MENU_CONST =
{
"Join a faction",
"Go Covert (Combatant)",
"Go Overt (Special Forces)",
"Go On Leave",
"Go Neutral",
"GCW Faction Points",
"Manipulate NPC Factions"
};
public static final String[] GCW_MENU =
{
"Check Lambda Shuttles"
};
public static final String SCRIPTVAR = "qafac";
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qafaction");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qafaction");
}
return SCRIPT_CONTINUE;
}
public int mainMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String faction = factions.getFaction(player);
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
switch (idx)
{
case 0:
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "joinFactions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 1:
if (!factions.isRebel(player) && !factions.isImperial(player))
{
sendSystemMessageTestingOnly(player, "You have to be part of a faction to go Covert!!!");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
setObjVar(player, "intChangingFactionStatus", 1);
factions.goCovert(player);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character to Imperial or Rebel Covert (Combatant) status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 2:
if (!factions.isRebel(player) && !factions.isImperial(player))
{
sendSystemMessageTestingOnly(player, "You have to be part of a faction to go Overt!!!");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
setObjVar(player, "intChangingFactionStatus", 1);
factions.goOvert(player);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character to Imperial or Rebel Overt (Special Forces) status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 3:
sendSystemMessageTestingOnly(player, faction);
if (!factions.isRebel(player) && !factions.isImperial(player))
{
sendSystemMessageTestingOnly(player, "You have to be part of a faction to go on Leave!!!");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
setObjVar(player, "intChangingFactionStatus", 1);
factions.goOnLeave(player);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character to Imperial or Rebel Leave status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 4:
pvpMakeNeutral(player);
pvpSetAlignedFaction(player, 0);
sendSystemMessageTestingOnly(player, "You are now Neutral.");
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character to Neutral non-faction status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 5:
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "getFactionPoints", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 6:
String[] menuArray = new String[47];
String[] factionArray = qa.populateArray(player, "factionName", "datatables/faction/faction.iff", "Neutral");
int i = 0;
for (i = 0; i <= 45; i++)
{
menuArray[i] = factionArray[i];
}
menuArray[i++] = "*MORE*";
Arrays.sort(menuArray);
utils.setScriptVar(player, SCRIPTVAR + ".menu", menuArray);
utils.setScriptVar(player, SCRIPTVAR + ".factionMenu", factionArray);
utils.setScriptVar(player, SCRIPTVAR + ".index", i);
qa.refreshMenu(player, NPC_PROMPT, TITLE, menuArray, "npcFactions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
default:
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
public int getFactionPoints(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
switch (idx)
{
case 0:
sendSystemMessageTestingOnly(player, "Option 1.");
utils.setScriptVar(player, SCRIPTVAR + ".factionType", factions.FACTION_REBEL);
sui.transfer(player, player, PROMPT, "Rebel Faction", "Available", XP_AMOUNT, "Amount", 0, "handleFactionAdd");
break;
case 1:
sendSystemMessageTestingOnly(player, "Option 2.");
utils.setScriptVar(player, SCRIPTVAR + ".factionType", factions.FACTION_IMPERIAL);
sui.transfer(player, player, PROMPT, "Imperial Faction", "Available", XP_AMOUNT, "Amount", 0, "handleFactionAdd");
break;
default:
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
public int handleFactionAdd(obj_id self, dictionary params) throws InterruptedException
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
float amt = sui.getTransferInputTo(params);
String factionType = utils.getStringScriptVar(player, SCRIPTVAR + ".factionType");
if (btn == sui.BP_CANCEL)
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
factions.addFactionStanding(player, factionType, amt);
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "getFactionPoints", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
public int joinFactions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int faction = 0;
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
faction = factions.getFactionNumber(FACTIONS[idx]);
int factionHashCode = dataTableGetInt(factions.FACTION_TABLE, faction, "pvpFaction");
if (factionHashCode != factions.AD_HOC_FACTION && factionHashCode != 0)
{
pvpSetAlignedFaction(player, factionHashCode);
sendSystemMessageTestingOnly(player, "Faction Changed.");
}
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "joinFactions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
}
}
return SCRIPT_CONTINUE;
}
public int npcFactions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String prevMenuArray[] = utils.getStringArrayScriptVar(self, SCRIPTVAR + ".menu");
String factionArray[] = utils.getStringArrayScriptVar(self, SCRIPTVAR + ".factionMenu");
int lastIndex = utils.getIntScriptVar(self, SCRIPTVAR + ".index");
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
String choice = prevMenuArray[idx];
if (choice.equals("*MORE*"))
{
HashSet theSet = new HashSet();
int nextLastIndex = lastIndex + 45;
int i = lastIndex;
if (i >= factionArray.length)
{
sendSystemMessageTestingOnly(player, "There are no more");
qa.refreshMenu(player, PROMPT, TITLE, prevMenuArray, "npcFactions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
for (i = lastIndex; i < nextLastIndex && i < factionArray.length; i++)
{
theSet.add(factionArray[i]);
}
theSet.add("*MORE*");
String[] menuArray = new String[theSet.size()];
theSet.toArray(menuArray);
Arrays.sort(menuArray);
utils.setScriptVar(player, SCRIPTVAR + ".menu", menuArray);
utils.setScriptVar(player, SCRIPTVAR + ".index", nextLastIndex);
qa.refreshMenu(player, PROMPT, TITLE, menuArray, "npcFactions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
utils.setScriptVar(player, SCRIPTVAR + ".choice", choice);
qa.refreshMenu(player, PROMPT, TITLE, MIN_MAX, "minMaxFaction", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
}
}
return SCRIPT_CONTINUE;
}
public int minMaxFaction(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
String lastChoice = utils.getStringScriptVar(player, SCRIPTVAR + ".choice");
String prevMenuArray[] = utils.getStringArrayScriptVar(player, SCRIPTVAR + ".menu");
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
switch (idx)
{
case 0:
factions.setFactionStanding(player, lastChoice, factions.FACTION_RATING_MAX);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character faction for " + lastChoice + " to " + factions.FACTION_RATING_MAX + " using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 1:
factions.setFactionStanding(player, lastChoice, factions.FACTION_RATING_MIN);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character faction for " + lastChoice + " to " + factions.FACTION_RATING_MIN + " using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 2:
factions.setFactionStanding(player, lastChoice, factions.FACTION_RATING_INVALID);
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has set their character faction for " + lastChoice + " to " + factions.FACTION_RATING_INVALID + " using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
default:
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,371 +0,0 @@
//**********************************************************
// Title: qafaction.script
// Description: Faction functions
//***********************************************************/
/********* Includes ******************************************/
include library.qa;
include library.sui;
include library.utils;
include library.factions;
include java.util.HashSet;
/********* CONSTANTS *****************************************/
const string NPC_PROMPT = "Choose a faction option\n"+
"NOTE: Some factions are not really available to players, so occasionally if you select one and try to "+
"add or remove the faction, it will not work";
const string PROMPT = "Choose a faction option";
const string TITLE = "QA Faction Tool";
const int XP_AMOUNT = 1000000;
const string[] FACTIONS =
{
"Rebel",
"Imperial"
};
const string[] MIN_MAX =
{
"Max faction",
"Min Faction",
"Zero Faction"
};
const string[] MAIN_MENU_CONST =
{
"Join a faction",
"Go Covert (Combatant)",
"Go Overt (Special Forces)",
"Go On Leave",
"Go Neutral",
"GCW Faction Points",
"Manipulate NPC Factions",
};
const string[] GCW_MENU =
{
"Check Lambda Shuttles"
};
const string SCRIPTVAR = "qafac";
/***** TRIGGER *******************************************************/
trigger OnAttach()
{
if(isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qafaction");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if(!isGod(self))
{
detachScript(self, "test.qafaction");
}
return SCRIPT_CONTINUE;
}
/********* Command Handlers **********************************/
messageHandler mainMenuOptions()
{
if(isGod(self))
{
if(utils.hasScriptVar(self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string faction = factions.getFaction(player);
if(btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
//Go back to tool Mainmenu
qa.qaToolMainMenu(self);
utils.removeScriptVarTree(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
switch(idx)
{
case 0: //Join a faction
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "joinFactions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 1: //Go Covert
if(!factions.isRebel(player) && !factions.isImperial(player))
{
sendSystemMessageTestingOnly(player, "You have to be part of a faction to go Covert!!!");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
setObjVar(player, "intChangingFactionStatus", 1);
factions.goCovert(player);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character to Imperial or Rebel Covert (Combatant) status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 2: //Go Overt
if(!factions.isRebel(player) && !factions.isImperial(player))
{
sendSystemMessageTestingOnly(player, "You have to be part of a faction to go Overt!!!");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
setObjVar(player, "intChangingFactionStatus", 1);
factions.goOvert(player);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character to Imperial or Rebel Overt (Special Forces) status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 3: //Go On Leave
sendSystemMessageTestingOnly(player, faction);
if(!factions.isRebel(player) && !factions.isImperial(player))
{
sendSystemMessageTestingOnly(player, "You have to be part of a faction to go on Leave!!!");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
setObjVar(player, "intChangingFactionStatus", 1);
factions.goOnLeave(player);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character to Imperial or Rebel Leave status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 4: //Go Neutral
pvpMakeNeutral(player);
pvpSetAlignedFaction(player, 0);
sendSystemMessageTestingOnly(player, "You are now Neutral.");
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character to Neutral non-faction status using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 5: //Get Faction Points
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "getFactionPoints", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 6: //Manipulate NPC Factions
string[] menuArray = new string[47];
string[] factionArray = qa.populateArray(player, "factionName", "datatables/faction/faction.iff", "Neutral");
int i = 0;
for(i = 0; i <= 45; i++)
menuArray[i] = factionArray[i];
menuArray[i++] = "*MORE*";
Arrays.sort(menuArray);
utils.setScriptVar(player, SCRIPTVAR+".menu", menuArray);
utils.setScriptVar(player, SCRIPTVAR+".factionMenu", factionArray);
utils.setScriptVar(player, SCRIPTVAR+".index", i);
qa.refreshMenu(player, NPC_PROMPT, TITLE, menuArray, "npcFactions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
default:
qa.removeScriptVars(player, SCRIPTVAR);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler getFactionPoints()
{
if(isGod(self))
{
if(utils.hasScriptVar(self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
switch(idx)
{
case 0: //Add Rebel Faction
sendSystemMessageTestingOnly(player, "Option 1.");
utils.setScriptVar(player, SCRIPTVAR+".factionType", factions.FACTION_REBEL);
sui.transfer(player, player, PROMPT, "Rebel Faction", "Available", XP_AMOUNT, "Amount", 0, "handleFactionAdd");
break;
case 1: //Add Imperial Faction
sendSystemMessageTestingOnly(player, "Option 2.");
utils.setScriptVar(player, SCRIPTVAR+".factionType", factions.FACTION_IMPERIAL);
sui.transfer(player, player, PROMPT, "Imperial Faction", "Available", XP_AMOUNT, "Amount", 0, "handleFactionAdd");
break;
default:
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
messageHandler handleFactionAdd()
{
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
float amt = sui.getTransferInputTo(params);
string factionType = utils.getStringScriptVar(player, SCRIPTVAR+".factionType");
if(btn == sui.BP_CANCEL)
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
factions.addFactionStanding(player, factionType, amt);
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "getFactionPoints", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
messageHandler joinFactions()
{
if(isGod(self))
{
if(utils.hasScriptVar(self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
int faction = 0;
if(btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
faction = factions.getFactionNumber(FACTIONS[idx]);
int factionHashCode = dataTableGetInt(factions.FACTION_TABLE, faction, "pvpFaction");
if(factionHashCode != factions.AD_HOC_FACTION && factionHashCode != 0)
{
pvpSetAlignedFaction(player, factionHashCode);
sendSystemMessageTestingOnly(player, "Faction Changed.");
}
qa.refreshMenu(player, PROMPT, TITLE, FACTIONS, "joinFactions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
}
}
return SCRIPT_CONTINUE;
}
messageHandler npcFactions()
{
if(isGod(self))
{
if(utils.hasScriptVar( self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string prevMenuArray[] = utils.getStringArrayScriptVar(self, SCRIPTVAR+".menu");
string factionArray[] = utils.getStringArrayScriptVar(self, SCRIPTVAR+".factionMenu");
int lastIndex = utils.getIntScriptVar(self, SCRIPTVAR+".index");
if(btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU_CONST, "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
string choice = prevMenuArray[idx];
if(choice == "*MORE*")
{
HashSet theSet = new HashSet();
int nextLastIndex = lastIndex + 45;
int i = lastIndex;
if(i >= factionArray.length)
{
sendSystemMessageTestingOnly(player, "There are no more");
qa.refreshMenu(player, PROMPT, TITLE, prevMenuArray, "npcFactions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
for(i = lastIndex; i < nextLastIndex && i < factionArray.length; i++)
theSet.add(factionArray[i]);
theSet.add("*MORE*");
string[] menuArray = new string[theSet.size()];
theSet.toArray(menuArray);
Arrays.sort(menuArray);
utils.setScriptVar(player, SCRIPTVAR+".menu", menuArray);
utils.setScriptVar(player, SCRIPTVAR+".index", nextLastIndex);
qa.refreshMenu(player, PROMPT, TITLE, menuArray, "npcFactions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
utils.setScriptVar(player, SCRIPTVAR+".choice", choice);
qa.refreshMenu(player, PROMPT, TITLE, MIN_MAX, "minMaxFaction", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
}
}
return SCRIPT_CONTINUE;
}
messageHandler minMaxFaction()
{
if(isGod(self))
{
if(utils.hasScriptVar(self, SCRIPTVAR+".pid"))
{
qa.checkParams(params, SCRIPTVAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
string lastChoice = utils.getStringScriptVar(player, SCRIPTVAR+".choice");
string prevMenuArray[] = utils.getStringArrayScriptVar(player, SCRIPTVAR+".menu");
if(btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
return SCRIPT_CONTINUE;
}
switch(idx)
{
case 0: //Max
factions.setFactionStanding(player, lastChoice, factions.FACTION_RATING_MAX);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character faction for " + lastChoice + " to " + factions.FACTION_RATING_MAX + " using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 1: //min
factions.setFactionStanding(player, lastChoice, factions.FACTION_RATING_MIN);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character faction for " + lastChoice + " to " + factions.FACTION_RATING_MIN + " using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 2: //zero faction
factions.setFactionStanding(player, lastChoice, factions.FACTION_RATING_INVALID);
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has set their character faction for " + lastChoice + " to " + factions.FACTION_RATING_INVALID + " using the QA Faction Tool.");
qa.refreshMenu(player, PROMPT, TITLE, qa.populateArrayDoNotSort(self, "faction_tool", "datatables/test/qa_tool_menu.iff"), "mainMenuOptions", SCRIPTVAR+".pid", sui.OK_CANCEL_REFRESH);
break;
default:
qa.removeScriptVars(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
@@ -0,0 +1,141 @@
package script.test;
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 java.util.StringTokenizer;
public class qaham extends script.base_script
{
public qaham()
{
}
public static final String QA_REGEN_OBJVAR = "test.qaham.OriginalActionRegen";
public static final float QA_MASSIVE_REGEN_RATE = 10000;
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qaham");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
else
{
helpMessage(self);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qaham");
}
return SCRIPT_CONTINUE;
}
public int OnDetach(obj_id self) throws InterruptedException
{
restoreActionRegenRate(self);
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
obj_id player = self;
if (isGod(player))
{
StringTokenizer st = new java.util.StringTokenizer(text);
int tokens = st.countTokens();
String command = null;
if (st.hasMoreTokens())
{
command = st.nextToken();
}
if (command.equals("stop_action_regen"))
{
stopActionRegenRate(player);
}
if (command.equals("restore_action_regen"))
{
restoreActionRegenRate(player);
}
if (command.equals("max_action_regen"))
{
setActionRegenRate(player, QA_MASSIVE_REGEN_RATE);
}
if (command.equals("qaham") || command.equals("test.qaham"))
{
helpMessage(player);
}
}
return SCRIPT_CONTINUE;
}
public void restoreActionRegenRate(obj_id player) throws InterruptedException
{
if (!isIdValid(player))
{
return;
}
if (!hasObjVar(player, QA_REGEN_OBJVAR))
{
return;
}
float myStoredRegen = getFloatObjVar(player, QA_REGEN_OBJVAR);
getActionRegenRate(player, myStoredRegen);
removeObjVar(player, QA_REGEN_OBJVAR);
if (!hasObjVar(player, QA_REGEN_OBJVAR))
{
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been restored");
}
else
{
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not restored!");
sendSystemMessageTestingOnly(player, "Contact the QA Tool Team about this character immediately.");
}
}
public void stopActionRegenRate(obj_id player) throws InterruptedException
{
if (!isIdValid(player))
{
return;
}
setActionRegenRate(player, 0f);
}
public void setActionRegenRate(obj_id player, float rate) throws InterruptedException
{
if (!isIdValid(player))
{
return;
}
float currentRegenRate = getActionRegenRate(player);
if (!hasObjVar(player, QA_REGEN_OBJVAR))
{
setObjVar(player, QA_REGEN_OBJVAR, currentRegenRate);
}
getActionRegenRate(player, rate);
if (hasObjVar(player, QA_REGEN_OBJVAR))
{
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been set to " + rate);
}
else
{
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not set correctly!");
sendSystemMessageTestingOnly(player, "Contact the QA Tool Team about this character immediately.");
}
}
public void helpMessage(obj_id player) throws InterruptedException
{
if (!isIdValid(player))
{
return;
}
sendSystemMessageTestingOnly(player, "Qaham Script Help Message");
sendSystemMessageTestingOnly(player, "Say any the following commands in chat:");
sendSystemMessageTestingOnly(player, "stop_action_regen");
sendSystemMessageTestingOnly(player, "restore_action_regen");
sendSystemMessageTestingOnly(player, "max_action_regen");
}
}
@@ -1,186 +0,0 @@
//************************************************************/
// Title: qaham.script
// Description: Health and Action Script - keeps testers full of Health and Action
//************************************************************/
include java.util.StringTokenizer;
/********* Constants *****************************************/
const string QA_REGEN_OBJVAR = "test.qaham.OriginalActionRegen";
const float QA_MASSIVE_REGEN_RATE = 10000;
/********* Triggers ******************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qaham");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
else
{
helpMessage(self);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qaham");
}
return SCRIPT_CONTINUE;
}
trigger OnDetach()
{
restoreActionRegenRate(self);
return SCRIPT_CONTINUE;
}
/*
trigger OnLogout()
{
detachScript(self, "test.qaham");
return SCRIPT_CONTINUE;
}
*/
trigger OnSpeaking(string text)
{
obj_id player = self;
if(isGod(player))
{
StringTokenizer st = new java.util.StringTokenizer(text);
int tokens = st.countTokens();
string command = null;
if (st.hasMoreTokens())
command = st.nextToken();
//Lists player's buffs in system messages.
if(command.equals("stop_action_regen"))
{
stopActionRegenRate(player);
}
if(command.equals("restore_action_regen"))
{
restoreActionRegenRate(player);
}
if(command.equals("max_action_regen"))
{
setActionRegenRate(player, QA_MASSIVE_REGEN_RATE);
}
if(command.equals("qaham") || command.equals("test.qaham"))
{
helpMessage(player);
}
}
return SCRIPT_CONTINUE;
}
void restoreActionRegenRate(obj_id player)
{
if(!isIdValid(player))
{
return;
}
if(!hasObjVar(player, QA_REGEN_OBJVAR))
{
return;
}
float myStoredRegen = getFloatObjVar(player, QA_REGEN_OBJVAR);
getActionRegenRate(player, myStoredRegen);
removeObjVar(player, QA_REGEN_OBJVAR);
if(!hasObjVar(player, QA_REGEN_OBJVAR))
{
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been restored");
}
else
{
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not restored!");
sendSystemMessageTestingOnly(player, "Contact the QA Tool Team about this character immediately.");
}
}
void stopActionRegenRate(obj_id player)
{
if(!isIdValid(player))
{
return;
}
setActionRegenRate(player, 0f);
}
void setActionRegenRate(obj_id player, float rate)
{
if(!isIdValid(player))
{
return;
}
//get the tester's original regen rate
float currentRegenRate = getActionRegenRate(player);
//place the original regen rate as an objvar
//if player has objvar, assume the orignal rate has already been stored
if (!hasObjVar(player, QA_REGEN_OBJVAR))
{
setObjVar(player, QA_REGEN_OBJVAR, currentRegenRate);
}
//set the tester's regen rate
getActionRegenRate(player, rate);
if(hasObjVar(player, QA_REGEN_OBJVAR))
{
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been set to " + rate);
}
else
{
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not set correctly!");
sendSystemMessageTestingOnly(player, "Contact the QA Tool Team about this character immediately.");
}
}
void helpMessage(obj_id player)
{
if(!isIdValid(player))
{
return;
}
//help messages are triggered in spatial chat by saying the name of the script that is attached
//messages should include:
//script name
//all commands related to script
//any other useful information
//TODO: Consider switching from system mesages to pop-up window with save to text button like qatool dumptarget
sendSystemMessageTestingOnly(player, "Qaham Script Help Message");
sendSystemMessageTestingOnly(player, "Say any the following commands in chat:");
sendSystemMessageTestingOnly(player, "stop_action_regen");
sendSystemMessageTestingOnly(player, "restore_action_regen");
sendSystemMessageTestingOnly(player, "max_action_regen");
}
@@ -0,0 +1,133 @@
package script.test;
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.qa;
import script.library.sui;
import script.library.utils;
public class qainventory extends script.base_script
{
public qainventory()
{
}
public static final String PROMPT = "Choose an Option";
public static final String TITLE = "QA Inventory Tool";
public static final String[] MAIN_MENU =
{
"Delete all in inventory",
"Fill inventory with Junk"
};
public static final String SCRIPT_VAR = "qainv";
public static final String FROG_STRING = "object/tangible/terminal/terminal_character_builder.iff";
public static final String KASHYYYK_FROG_STRING = "object/tangible/terminal/terminal_kashyyyk_content.iff";
public int OnAttach(obj_id self) throws InterruptedException
{
if (isGod(self))
{
if (getGodLevel(self) < 10)
{
detachScript(self, "test.qainventory");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qainventory");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
obj_id player = self;
if (isGod(player))
{
if ((toLower(text)).equals("qainventory"))
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", true, SCRIPT_VAR + ".pid");
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int mainMenuOptions(obj_id self, dictionary params) throws InterruptedException
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPT_VAR + ".pid"))
{
qa.checkParams(params, SCRIPT_VAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
obj_id inventory = utils.getInventoryContainer(player);
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player, SCRIPT_VAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
String[] options = utils.getStringArrayScriptVar(player, "qatool.toolMainMenu");
String mainTitle = utils.getStringScriptVar(player, "qatool.title");
String mainPrompt = utils.getStringScriptVar(player, "qatool.prompt");
if (options == null)
{
sendSystemMessageTestingOnly(player, "You didn't start from the main tool menu");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", true, SCRIPT_VAR + ".pid");
return SCRIPT_CONTINUE;
}
else
{
qa.refreshMenu(self, mainPrompt, mainTitle, options, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player, SCRIPT_VAR);
return SCRIPT_CONTINUE;
}
}
switch (idx)
{
case 0:
obj_id[] items = getContents(inventory);
for (int i = 0; i < items.length; i++)
{
String templateName = getTemplateName(items[i]);
if (templateName.equals(FROG_STRING))
{
sendSystemMessageTestingOnly(player, "The Frog will not be destroyed");
}
else if (templateName.equals(KASHYYYK_FROG_STRING))
{
sendSystemMessageTestingOnly(player, "The Kashyyyk Frog will not be destroyed");
}
else
{
destroyObject(items[i]);
}
}
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has deleted the entire contents of their inventory (less any Character Builder Terminals) using the QA Inventory Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", SCRIPT_VAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
case 1:
int freeSpace = getVolumeFree(inventory);
for (int i = 0; i < freeSpace; i++)
{
createObject("object/tangible/food/fruit_melon.iff", inventory, "");
}
CustomerServiceLog("qaTool", "User: (" + self + ") " + getName(self) + " has filled the entire contents of their inventory using the QA Inventory Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", SCRIPT_VAR + ".pid", sui.OK_CANCEL_REFRESH);
break;
default:
qa.removeScriptVars(player, SCRIPT_VAR);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}
}
@@ -1,137 +0,0 @@
//**********************************************************
// Title: qainventory.script
// Description: Inventory functions
//***********************************************************
/********* Includes ******************************************/
include library.qa;
include library.sui;
include library.utils;
/********* CONSTANTS *****************************************/
const string PROMPT = "Choose an Option";
const string TITLE = "QA Inventory Tool";
const string[] MAIN_MENU =
{
"Delete all in inventory",
"Fill inventory with Junk"
};
const string SCRIPT_VAR = "qainv";
const string FROG_STRING = "object/tangible/terminal/terminal_character_builder.iff"; // frog template name
const string KASHYYYK_FROG_STRING = "object/tangible/terminal/terminal_kashyyyk_content.iff"; // kashyyyk content tool name
/********* Triggers ******************************************/
trigger OnAttach()
{
if (isGod(self))
{
if(getGodLevel(self) < 10)
{
detachScript(self, "test.qainventory");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
}
}
else if (!isGod(self))
{
detachScript(self, "test.qainventory");
}
return SCRIPT_CONTINUE;
}
trigger OnSpeaking(string text)
{
obj_id player = self;
if(isGod(player))
{
if (toLower(text).equals("qainventory") )
{
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", true, SCRIPT_VAR+".pid");
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/********* Command Handlers **********************************/
messageHandler mainMenuOptions()
{
if (isGod(self))
{
if (utils.hasScriptVar(self, SCRIPT_VAR+".pid"))
{
qa.checkParams(params, SCRIPT_VAR, false);
obj_id player = sui.getPlayerId(params);
int idx = sui.getListboxSelectedRow(params);
int btn = sui.getIntButtonPressed(params);
obj_id inventory = utils.getInventoryContainer(player);
if (btn == sui.BP_CANCEL)
{
qa.removeScriptVars(player,SCRIPT_VAR);
return SCRIPT_CONTINUE;
}
if (btn == sui.BP_REVERT)
{
//Go back to tool Mainmenu
string[] options = utils.getStringArrayScriptVar(player, "qatool.toolMainMenu");
string mainTitle = utils.getStringScriptVar(player, "qatool.title");
string mainPrompt = utils.getStringScriptVar(player, "qatool.prompt");
if (options == null)
{
sendSystemMessageTestingOnly(player, "You didn't start from the main tool menu");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", true, SCRIPT_VAR+".pid");
return SCRIPT_CONTINUE;
}
else
{
qa.refreshMenu( self, mainPrompt, mainTitle, options, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player,SCRIPT_VAR);
return SCRIPT_CONTINUE;
}
}
switch (idx)
{
case 0: //delete all from inventory except the Frog and Kashyyk Content Tool
//get array of items in player's inventory
obj_id[] items = getContents(inventory);
for (int i = 0; i < items.length; i++)
{
// get template names of items in player's inventory
string templateName = getTemplateName(items[i]);
// if -- frog or kashyyyk frog do not delete
if (templateName == FROG_STRING)
{
sendSystemMessageTestingOnly(player, "The Frog will not be destroyed");
}
else if (templateName == KASHYYYK_FROG_STRING)
{
sendSystemMessageTestingOnly(player, "The Kashyyyk Frog will not be destroyed");
}
// delete everything else
else
{
destroyObject(items[i]);
}
}
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has deleted the entire contents of their inventory (less any Character Builder Terminals) using the QA Inventory Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", SCRIPT_VAR+".pid", sui.OK_CANCEL_REFRESH);
break;
case 1: //Fill inventory
int freeSpace = getVolumeFree(inventory);
for (int i = 0; i < freeSpace; i++)
createObject("object/tangible/food/fruit_melon.iff", inventory, "");
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has filled the entire contents of their inventory using the QA Inventory Tool.");
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", SCRIPT_VAR+".pid", sui.OK_CANCEL_REFRESH);
break;
default:
qa.removeScriptVars(player,SCRIPT_VAR);
return SCRIPT_CONTINUE;
}
}
}
return SCRIPT_CONTINUE;
}

Some files were not shown because too many files have changed in this diff Show More