mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-10-17 07:03:10 -04:00
More Java optimizations and code review for library and spawning systems.
This commit is contained in:
Regular → Executable
+205
-308
@@ -1,15 +1,11 @@
|
||||
package script.library;
|
||||
|
||||
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.combat_engine;
|
||||
import script.combat_engine.buff_data;
|
||||
import script.deltadictionary;
|
||||
import script.obj_id;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.beast_lib;
|
||||
import java.util.Vector;
|
||||
|
||||
public class buff extends script.base_script
|
||||
{
|
||||
@@ -109,27 +105,23 @@ public class buff extends script.base_script
|
||||
if (groupOne != 0 || groupTwo != 0)
|
||||
{
|
||||
int priority = bdata.priority;
|
||||
for (int i = 0; i < buffCRCs.length; i++)
|
||||
{
|
||||
buff_data oldBuffData = combat_engine.getBuffData(buffCRCs[i]);
|
||||
if (oldBuffData == null)
|
||||
{
|
||||
buff_data oldBuffData;
|
||||
|
||||
for (int buffCRC : buffCRCs) {
|
||||
oldBuffData = combat_engine.getBuffData(buffCRC);
|
||||
if (oldBuffData == null) {
|
||||
continue;
|
||||
}
|
||||
obj_id effectOwner = getBuffOwner(target, buffCRCs[i]);
|
||||
int oldPriority = oldBuffData.priority;
|
||||
if (priority < oldPriority)
|
||||
{
|
||||
if (priority < oldPriority) {
|
||||
int[] oldGroups = getGroups(oldBuffData);
|
||||
if (oldGroups == null || oldGroups.length != 3)
|
||||
{
|
||||
if (oldGroups == null || oldGroups.length != 3) {
|
||||
continue;
|
||||
}
|
||||
int oldGroupOne = oldGroups[0];
|
||||
int oldGroupTwo = oldGroups[1];
|
||||
int oldBlockGroup = oldGroups[2];
|
||||
if ((groupOne != 0 && (groupOne == oldGroupOne || groupOne == oldGroupTwo)) || (groupTwo != 0 && (groupTwo == oldGroupOne || groupTwo == oldGroupTwo)) || (oldBlockGroup != 0 && (groupOne == oldBlockGroup || groupTwo == oldBlockGroup)))
|
||||
{
|
||||
if ((groupOne != 0 && (groupOne == oldGroupOne || groupOne == oldGroupTwo)) || (groupTwo != 0 && (groupTwo == oldGroupOne || groupTwo == oldGroupTwo)) || (oldBlockGroup != 0 && (groupOne == oldBlockGroup || groupTwo == oldBlockGroup))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -256,29 +248,21 @@ public class buff extends script.base_script
|
||||
boolean isStackable = bdata.maxStacks > 1;
|
||||
if (discarded != null && discarded.length > 0)
|
||||
{
|
||||
for (int i = 0; i < discarded.length; i++)
|
||||
{
|
||||
obj_id caster = getBuffCaster(target, discarded[i]);
|
||||
if (nameCrc == discarded[i])
|
||||
{
|
||||
float oldBuffTime = getBuffTimeRemaining(target, discarded[i]);
|
||||
if (!isStackable)
|
||||
{
|
||||
if (oldBuffTime <= duration)
|
||||
{
|
||||
_removeBuff(target, discarded[i]);
|
||||
obj_id caster;
|
||||
for (int aDiscarded : discarded) {
|
||||
caster = getBuffCaster(target, aDiscarded);
|
||||
if (nameCrc == aDiscarded) {
|
||||
float oldBuffTime = getBuffTimeRemaining(target, aDiscarded);
|
||||
if (!isStackable) {
|
||||
if (oldBuffTime <= duration) {
|
||||
_removeBuff(target, aDiscarded);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (owner != caster && isStackable)
|
||||
{
|
||||
} else {
|
||||
if (owner != caster && isStackable) {
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_removeBuff(target, discarded[i]);
|
||||
} else {
|
||||
_removeBuff(target, aDiscarded);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,10 +326,8 @@ public class buff extends script.base_script
|
||||
public static boolean removeBuffs(obj_id target, Vector names) throws InterruptedException
|
||||
{
|
||||
boolean success = true;
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
{
|
||||
if (!removeBuff(target, ((String)names.get(i))))
|
||||
{
|
||||
for (Object name : names) {
|
||||
if (!removeBuff(target, ((String) name))) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
@@ -354,10 +336,8 @@ public class buff extends script.base_script
|
||||
public static boolean removeBuffs(obj_id target, String[] names) throws InterruptedException
|
||||
{
|
||||
boolean success = true;
|
||||
for (int i = 0; i < names.length; i++)
|
||||
{
|
||||
if (!removeBuff(target, names[i]))
|
||||
{
|
||||
for (String name : names) {
|
||||
if (!removeBuff(target, name)) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
@@ -407,33 +387,28 @@ public class buff extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
buff_data bdata = combat_engine.getBuffData(buffs[i]);
|
||||
if (bdata == null)
|
||||
{
|
||||
buff_data bdata;
|
||||
for (int buff : buffs) {
|
||||
bdata = combat_engine.getBuffData(buff);
|
||||
if (bdata == null) {
|
||||
LOG("buff.scriptlib", "removeAllBuffs bdata is null");
|
||||
continue;
|
||||
}
|
||||
int removeOnDeath = bdata.removeOnDeath;
|
||||
int removeOnRespec = bdata.removeOnRespec;
|
||||
if (removeOnDeath == 0 && fromDeath)
|
||||
{
|
||||
if (removeOnDeath == 0 && fromDeath) {
|
||||
continue;
|
||||
}
|
||||
if (removeOnRespec == 0 && fromRespec)
|
||||
{
|
||||
if (removeOnRespec == 0 && fromRespec) {
|
||||
continue;
|
||||
}
|
||||
if (isMob(target))
|
||||
{
|
||||
if (isMob(target)) {
|
||||
int removeOnCombatEnd = bdata.aiRemoveOnCombatEnd;
|
||||
if (removeOnCombatEnd == 0 && !isDead(target) && !isIncapacitated(target))
|
||||
{
|
||||
if (removeOnCombatEnd == 0 && !isDead(target) && !isIncapacitated(target)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
_removeBuff(target, buffs[i]);
|
||||
_removeBuff(target, buff);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -452,13 +427,10 @@ public class buff extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
buff_data bdata = combat_engine.getBuffData(buffs[i]);
|
||||
String curBuff = bdata.buffName;
|
||||
if (bdata.debuff == 1 && getBuffOwner(target, buffs[i]) == owner)
|
||||
{
|
||||
removeBuff(target, buffs[i]);
|
||||
for (int buff : buffs) {
|
||||
buff_data bdata = combat_engine.getBuffData(buff);
|
||||
if (bdata.debuff == 1 && getBuffOwner(target, buff) == owner) {
|
||||
removeBuff(target, buff);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -476,17 +448,16 @@ public class buff extends script.base_script
|
||||
}
|
||||
Vector matchedBuffs = new Vector();
|
||||
matchedBuffs.setSize(0);
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
buff_data bdata;
|
||||
String tempEffect;
|
||||
for (int buff : buffs) {
|
||||
int j = 1;
|
||||
buff_data bdata = combat_engine.getBuffData(buffs[i]);
|
||||
String tempEffect = getEffectParam(bdata, 1);
|
||||
bdata = combat_engine.getBuffData(buff);
|
||||
tempEffect = getEffectParam(bdata, 1);
|
||||
boolean matched = false;
|
||||
while (!matched && j < 6 && tempEffect != null && tempEffect.length() > 0)
|
||||
{
|
||||
if (tempEffect.equals(effect))
|
||||
{
|
||||
utils.addElement(matchedBuffs, buffs[i]);
|
||||
while (!matched && j < 6 && tempEffect != null && tempEffect.length() > 0) {
|
||||
if (tempEffect.equals(effect)) {
|
||||
utils.addElement(matchedBuffs, buff);
|
||||
matched = true;
|
||||
}
|
||||
j++;
|
||||
@@ -497,15 +468,11 @@ public class buff extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int[] _matchedBuffs = new int[0];
|
||||
if (matchedBuffs != null)
|
||||
{
|
||||
_matchedBuffs = new int[matchedBuffs.size()];
|
||||
for (int _i = 0; _i < matchedBuffs.size(); ++_i)
|
||||
{
|
||||
_matchedBuffs[_i] = ((Integer)matchedBuffs.get(_i)).intValue();
|
||||
}
|
||||
}
|
||||
int[] _matchedBuffs = new int[matchedBuffs.size()];
|
||||
for (int _i = 0; _i < matchedBuffs.size(); ++_i)
|
||||
{
|
||||
_matchedBuffs[_i] = (Integer) matchedBuffs.get(_i);
|
||||
}
|
||||
return _matchedBuffs;
|
||||
}
|
||||
public static int[] getAllBuffs(obj_id target) throws InterruptedException
|
||||
@@ -540,10 +507,8 @@ public class buff extends script.base_script
|
||||
public static boolean hasAnyBuffInList(obj_id target, String buffList) throws InterruptedException
|
||||
{
|
||||
String[] buffs = split(buffList, ',');
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
if (hasBuff(target, buffs[i]))
|
||||
{
|
||||
for (String buff : buffs) {
|
||||
if (hasBuff(target, buff)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -551,10 +516,8 @@ public class buff extends script.base_script
|
||||
}
|
||||
public static boolean hasAnyBuffInList(obj_id target, String[] buffList) throws InterruptedException
|
||||
{
|
||||
for (int i = 0; i < buffList.length; i++)
|
||||
{
|
||||
if (hasBuff(target, buffList[i]))
|
||||
{
|
||||
for (String aBuffList : buffList) {
|
||||
if (hasBuff(target, aBuffList)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -576,13 +539,14 @@ public class buff extends script.base_script
|
||||
}
|
||||
removeAllBuffs(target, true);
|
||||
boolean success = true;
|
||||
obj_id owner;
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
if (buffs_d[i] <= 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj_id owner = getBuffOwner(target, buffs[i]);
|
||||
owner = getBuffOwner(target, buffs[i]);
|
||||
if (isIdValid(owner) && owner != target)
|
||||
{
|
||||
continue;
|
||||
@@ -733,18 +697,14 @@ public class buff extends script.base_script
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
int[] groups = getGroups(buffs[i]);
|
||||
if (groups == null || groups.length == 0)
|
||||
{
|
||||
for (int buff : buffs) {
|
||||
int[] groups = getGroups(buff);
|
||||
if (groups == null || groups.length == 0) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < groups.length; j++)
|
||||
{
|
||||
if (groups[j] == groupCrc)
|
||||
{
|
||||
return buffs[i];
|
||||
for (int group : groups) {
|
||||
if (group == groupCrc) {
|
||||
return buff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -759,23 +719,19 @@ public class buff extends script.base_script
|
||||
}
|
||||
Vector allGroupBuffs = new Vector();
|
||||
allGroupBuffs.setSize(0);
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
String tempGroupName = getStringGroupTwo(buffs[i]);
|
||||
if (tempGroupName.startsWith(groupName))
|
||||
{
|
||||
utils.addElement(allGroupBuffs, buffs[i]);
|
||||
String tempGroupName;
|
||||
for (int buff : buffs) {
|
||||
tempGroupName = getStringGroupTwo(buff);
|
||||
if (tempGroupName.startsWith(groupName)) {
|
||||
utils.addElement(allGroupBuffs, buff);
|
||||
}
|
||||
}
|
||||
int[] _allGroupBuffs = new int[0];
|
||||
if (allGroupBuffs != null)
|
||||
{
|
||||
_allGroupBuffs = new int[allGroupBuffs.size()];
|
||||
for (int _i = 0; _i < allGroupBuffs.size(); ++_i)
|
||||
{
|
||||
_allGroupBuffs[_i] = ((Integer)allGroupBuffs.get(_i)).intValue();
|
||||
}
|
||||
}
|
||||
_allGroupBuffs = new int[allGroupBuffs.size()];
|
||||
for (int _i = 0; _i < allGroupBuffs.size(); ++_i)
|
||||
{
|
||||
_allGroupBuffs[_i] = (Integer) allGroupBuffs.get(_i);
|
||||
}
|
||||
return _allGroupBuffs;
|
||||
}
|
||||
public static int getPriority(String name) throws InterruptedException
|
||||
@@ -882,17 +838,18 @@ public class buff extends script.base_script
|
||||
switch (effNum)
|
||||
{
|
||||
case 1:
|
||||
return bdata.effect1Param;
|
||||
return bdata.effect1Param;
|
||||
case 2:
|
||||
return bdata.effect2Param;
|
||||
return bdata.effect2Param;
|
||||
case 3:
|
||||
return bdata.effect3Param;
|
||||
return bdata.effect3Param;
|
||||
case 4:
|
||||
return bdata.effect4Param;
|
||||
return bdata.effect4Param;
|
||||
case 5:
|
||||
return bdata.effect5Param;
|
||||
return bdata.effect5Param;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static float getEffectValue(String name, int effNum) throws InterruptedException
|
||||
{
|
||||
@@ -912,17 +869,18 @@ public class buff extends script.base_script
|
||||
switch (effNum)
|
||||
{
|
||||
case 1:
|
||||
return bdata.effect1Value;
|
||||
return bdata.effect1Value;
|
||||
case 2:
|
||||
return bdata.effect2Value;
|
||||
return bdata.effect2Value;
|
||||
case 3:
|
||||
return bdata.effect3Value;
|
||||
return bdata.effect3Value;
|
||||
case 4:
|
||||
return bdata.effect4Value;
|
||||
return bdata.effect4Value;
|
||||
case 5:
|
||||
return bdata.effect5Value;
|
||||
return bdata.effect5Value;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static boolean isDebuff(String name) throws InterruptedException
|
||||
{
|
||||
@@ -957,9 +915,10 @@ public class buff extends script.base_script
|
||||
}
|
||||
public static boolean isGroupBuff(int nameCrc) throws InterruptedException
|
||||
{
|
||||
String effect;
|
||||
for (int i = 1; i <= MAX_EFFECTS; i++)
|
||||
{
|
||||
String effect = getEffectParam(nameCrc, i);
|
||||
effect = getEffectParam(nameCrc, i);
|
||||
if (effect != null && effect.equals("group"))
|
||||
{
|
||||
return true;
|
||||
@@ -974,7 +933,7 @@ public class buff extends script.base_script
|
||||
public static boolean isAuraBuff(int nameCrc) throws InterruptedException
|
||||
{
|
||||
String groupTwo = getStringGroupTwo(nameCrc);
|
||||
return groupTwo.indexOf("aura") > -1;
|
||||
return groupTwo.contains("aura");
|
||||
}
|
||||
public static boolean isOwnedBuff(String name) throws InterruptedException
|
||||
{
|
||||
@@ -1038,40 +997,33 @@ public class buff extends script.base_script
|
||||
if (groupOne != 0 || groupTwo != 0)
|
||||
{
|
||||
int priority = bdata.priority;
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
buff_data oldBuffData = combat_engine.getBuffData(buffs[i]);
|
||||
if (oldBuffData == null)
|
||||
{
|
||||
buff_data oldBuffData;
|
||||
obj_id effectOwner;
|
||||
for (int buff : buffs) {
|
||||
oldBuffData = combat_engine.getBuffData(buff);
|
||||
if (oldBuffData == null) {
|
||||
continue;
|
||||
}
|
||||
obj_id effectOwner = getBuffOwner(target, buffs[i]);
|
||||
if (isIdValid(effectOwner) && effectOwner != target)
|
||||
{
|
||||
effectOwner = getBuffOwner(target, buff);
|
||||
if (isIdValid(effectOwner) && effectOwner != target) {
|
||||
continue;
|
||||
}
|
||||
int oldPriority = oldBuffData.priority;
|
||||
if (priority >= oldPriority)
|
||||
{
|
||||
if (priority >= oldPriority) {
|
||||
int[] oldGroups = getGroups(oldBuffData);
|
||||
if (oldGroups == null || oldGroups.length != 3)
|
||||
{
|
||||
if (oldGroups == null || oldGroups.length != 3) {
|
||||
return null;
|
||||
}
|
||||
int oldGroupOne = oldGroups[0];
|
||||
int oldGroupTwo = oldGroups[1];
|
||||
if ((groupOne != 0 && (groupOne == oldGroupOne || groupOne == oldGroupTwo)) || (groupTwo != 0 && (groupTwo == oldGroupOne || groupTwo == oldGroupTwo)))
|
||||
{
|
||||
discarded[discardCount++] = buffs[i];
|
||||
if ((groupOne != 0 && (groupOne == oldGroupOne || groupOne == oldGroupTwo)) || (groupTwo != 0 && (groupTwo == oldGroupOne || groupTwo == oldGroupTwo))) {
|
||||
discarded[discardCount++] = buff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int[] returnArray = new int[discardCount];
|
||||
for (int i = 0; i < discardCount; ++i)
|
||||
{
|
||||
returnArray[i] = discarded[i];
|
||||
}
|
||||
System.arraycopy(discarded, 0, returnArray, 0, discardCount);
|
||||
return returnArray;
|
||||
}
|
||||
public static obj_id getBuffOwner(obj_id target, String name) throws InterruptedException
|
||||
@@ -1088,8 +1040,7 @@ public class buff extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id owner = utils.getObjIdScriptVar(target, "groupBuff." + nameCrc);
|
||||
return owner;
|
||||
return utils.getObjIdScriptVar(target, "groupBuff." + nameCrc);
|
||||
}
|
||||
public static void addGroupBuffEffect(obj_id target, obj_id owner, int[] buffList, float[] strList, float[] durList) throws InterruptedException
|
||||
{
|
||||
@@ -1125,19 +1076,17 @@ public class buff extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < buffList.length; i++)
|
||||
{
|
||||
obj_id owner = utils.getObjIdScriptVar(target, "groupBuff." + buffList[i]);
|
||||
if (owner != target)
|
||||
{
|
||||
_removeBuff(target, buffList[i]);
|
||||
utils.removeScriptVar(target, "groupBuff." + buffList[i]);
|
||||
if (beast_lib.isBeastMaster(target))
|
||||
{
|
||||
obj_id beast = beast_lib.getBeastOnPlayer(target);
|
||||
if (isIdValid(beast) && !isIdNull(beast))
|
||||
{
|
||||
_removeBuff(beast, buffList[i]);
|
||||
obj_id owner;
|
||||
obj_id beast;
|
||||
for (int aBuffList : buffList) {
|
||||
owner = utils.getObjIdScriptVar(target, "groupBuff." + aBuffList);
|
||||
if (owner != target) {
|
||||
_removeBuff(target, aBuffList);
|
||||
utils.removeScriptVar(target, "groupBuff." + aBuffList);
|
||||
if (beast_lib.isBeastMaster(target)) {
|
||||
beast = beast_lib.getBeastOnPlayer(target);
|
||||
if (isIdValid(beast) && !isIdNull(beast)) {
|
||||
_removeBuff(beast, aBuffList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1156,12 +1105,11 @@ public class buff extends script.base_script
|
||||
}
|
||||
Vector buffList = new Vector();
|
||||
buffList.setSize(0);
|
||||
for (int i = 0; i < buffCrcList.length; i++)
|
||||
{
|
||||
obj_id owner = utils.getObjIdScriptVar(target, "groupBuff." + buffCrcList[i]);
|
||||
if (isIdValid(owner) && owner == target && isGroupBuff(buffCrcList[i]))
|
||||
{
|
||||
buffList = utils.addElement(buffList, buffCrcList[i]);
|
||||
obj_id owner;
|
||||
for (int aBuffCrcList : buffCrcList) {
|
||||
owner = utils.getObjIdScriptVar(target, "groupBuff." + aBuffCrcList);
|
||||
if (isIdValid(owner) && owner == target && isGroupBuff(aBuffCrcList)) {
|
||||
buffList = utils.addElement(buffList, aBuffCrcList);
|
||||
}
|
||||
}
|
||||
int[] _buffList = new int[0];
|
||||
@@ -1170,7 +1118,7 @@ public class buff extends script.base_script
|
||||
_buffList = new int[buffList.size()];
|
||||
for (int _i = 0; _i < buffList.size(); ++_i)
|
||||
{
|
||||
_buffList[_i] = ((Integer)buffList.get(_i)).intValue();
|
||||
_buffList[_i] = (Integer) buffList.get(_i);
|
||||
}
|
||||
}
|
||||
return _buffList;
|
||||
@@ -1188,12 +1136,12 @@ public class buff extends script.base_script
|
||||
}
|
||||
Vector buffList = new Vector();
|
||||
buffList.setSize(0);
|
||||
for (int i = 0; i < buffCrcList.length; i++)
|
||||
{
|
||||
obj_id owner = utils.getObjIdScriptVar(target, "groupBuff." + buffCrcList[i]);
|
||||
if (isIdValid(owner) && owner != target && isGroupBuff(buffCrcList[i]))
|
||||
{
|
||||
buffList = utils.addElement(buffList, buffCrcList[i]);
|
||||
obj_id owner;
|
||||
|
||||
for (int aBuffCrcList : buffCrcList) {
|
||||
owner = utils.getObjIdScriptVar(target, "groupBuff." + aBuffCrcList);
|
||||
if (isIdValid(owner) && owner != target && isGroupBuff(aBuffCrcList)) {
|
||||
buffList = utils.addElement(buffList, aBuffCrcList);
|
||||
}
|
||||
}
|
||||
int[] _buffList = new int[0];
|
||||
@@ -1202,7 +1150,7 @@ public class buff extends script.base_script
|
||||
_buffList = new int[buffList.size()];
|
||||
for (int _i = 0; _i < buffList.size(); ++_i)
|
||||
{
|
||||
_buffList[_i] = ((Integer)buffList.get(_i)).intValue();
|
||||
_buffList[_i] = (Integer) buffList.get(_i);
|
||||
}
|
||||
}
|
||||
return _buffList;
|
||||
@@ -1226,7 +1174,6 @@ public class buff extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
float modifier = squad_leader.getLeadershipMod(player);
|
||||
float[] strengthList = new float[buffList.length];
|
||||
for (int i = 0; i < buffList.length; i++)
|
||||
{
|
||||
@@ -1258,22 +1205,13 @@ public class buff extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
if (isDebuff(buffs[i]) && getState(buffs[i]) == stateType)
|
||||
{
|
||||
_removeBuff(target, buffs[i]);
|
||||
for (int buff : buffs) {
|
||||
if (isDebuff(buff) && getState(buff) == stateType) {
|
||||
_removeBuff(target, buff);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
if (removed)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
public static boolean toggleStance(obj_id player, String attemptedBuff) throws InterruptedException
|
||||
{
|
||||
@@ -1288,20 +1226,19 @@ public class buff extends script.base_script
|
||||
return false;
|
||||
}
|
||||
String groupAtt = attemptedBuffData.buffGroup1;
|
||||
for (int i = 0; i < buffs.length; i++)
|
||||
{
|
||||
buff_data bdata = combat_engine.getBuffData(buffs[i]);
|
||||
if (bdata == null)
|
||||
{
|
||||
buff_data bdata;
|
||||
String curBuff;
|
||||
String groupCur;
|
||||
for (int buff : buffs) {
|
||||
bdata = combat_engine.getBuffData(buff);
|
||||
if (bdata == null) {
|
||||
continue;
|
||||
}
|
||||
String curBuff = bdata.buffName;
|
||||
String groupCur = bdata.buffGroup1;
|
||||
if (groupCur.equals(groupAtt))
|
||||
{
|
||||
curBuff = bdata.buffName;
|
||||
groupCur = bdata.buffGroup1;
|
||||
if (groupCur.equals(groupAtt)) {
|
||||
removeBuff(player, curBuff);
|
||||
if (!curBuff.equals(attemptedBuff.toLowerCase()))
|
||||
{
|
||||
if (!curBuff.equals(attemptedBuff.toLowerCase())) {
|
||||
applyBuff(player, player, attemptedBuff);
|
||||
return false;
|
||||
}
|
||||
@@ -1388,15 +1325,11 @@ public class buff extends script.base_script
|
||||
}
|
||||
public static obj_id getBuffCaster(obj_id target, int nameCrc) throws InterruptedException
|
||||
{
|
||||
obj_id caster = obj_id.NULL_ID;
|
||||
caster = caster.getObjId(_getBuffCaster(target, nameCrc));
|
||||
return caster;
|
||||
return obj_id.getObjId(_getBuffCaster(target, nameCrc));
|
||||
}
|
||||
public static obj_id getBuffCaster(obj_id target, String nameCrc) throws InterruptedException
|
||||
{
|
||||
obj_id caster = obj_id.NULL_ID;
|
||||
caster = caster.getObjId(_getBuffCaster(target, getStringCrc(nameCrc.toLowerCase())));
|
||||
return caster;
|
||||
return obj_id.getObjId(_getBuffCaster(target, getStringCrc(nameCrc.toLowerCase())));
|
||||
}
|
||||
public static float getBuffTimeRemaining(obj_id target, int nameCrc) throws InterruptedException
|
||||
{
|
||||
@@ -1415,23 +1348,19 @@ public class buff extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < allDotBuffs.length; ++i)
|
||||
{
|
||||
String param1 = getEffectParam(allDotBuffs[i], 1);
|
||||
if (param1.equals(type))
|
||||
{
|
||||
utils.addElement(allDotBuffsOfType, allDotBuffs[i]);
|
||||
String param1;
|
||||
for (int allDotBuff : allDotBuffs) {
|
||||
param1 = getEffectParam(allDotBuff, 1);
|
||||
if (param1.equals(type)) {
|
||||
utils.addElement(allDotBuffsOfType, allDotBuff);
|
||||
}
|
||||
}
|
||||
int[] _allDotBuffsOfType = new int[0];
|
||||
if (allDotBuffsOfType != null)
|
||||
{
|
||||
_allDotBuffsOfType = new int[allDotBuffsOfType.size()];
|
||||
for (int _i = 0; _i < allDotBuffsOfType.size(); ++_i)
|
||||
{
|
||||
_allDotBuffsOfType[_i] = ((Integer)allDotBuffsOfType.get(_i)).intValue();
|
||||
}
|
||||
}
|
||||
_allDotBuffsOfType = new int[allDotBuffsOfType.size()];
|
||||
for (int _i = 0; _i < allDotBuffsOfType.size(); ++_i)
|
||||
{
|
||||
_allDotBuffsOfType[_i] = (Integer) allDotBuffsOfType.get(_i);
|
||||
}
|
||||
return _allDotBuffsOfType;
|
||||
}
|
||||
public static boolean performBuffDotImmunity(obj_id target, String dotType) throws InterruptedException
|
||||
@@ -1443,9 +1372,8 @@ public class buff extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < allDotBuffs.length; ++i)
|
||||
{
|
||||
removeBuff(target, allDotBuffs[i]);
|
||||
for (int allDotBuff : allDotBuffs) {
|
||||
removeBuff(target, allDotBuff);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1454,20 +1382,14 @@ public class buff extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < allBuffDotsOfType.length; ++i)
|
||||
{
|
||||
removeBuff(target, allBuffDotsOfType[i]);
|
||||
for (int anAllBuffDotsOfType : allBuffDotsOfType) {
|
||||
removeBuff(target, anAllBuffDotsOfType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static boolean isBuffDot(String buffName) throws InterruptedException
|
||||
{
|
||||
String effectName = buff.getEffectParam(buffName, 2);
|
||||
if (effectName.equals("dot"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return buff.getEffectParam(buffName, 2).equals("dot");
|
||||
}
|
||||
public static void reduceBuffDotStackCount(obj_id target, String dotType, int count) throws InterruptedException
|
||||
{
|
||||
@@ -1476,16 +1398,12 @@ public class buff extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < allBuffsOfType.length; i++)
|
||||
{
|
||||
long stackCount = getBuffStackCount(target, allBuffsOfType[i]);
|
||||
if (stackCount <= count)
|
||||
{
|
||||
removeBuff(target, allBuffsOfType[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
decrementBuffStack(target, allBuffsOfType[i], count);
|
||||
for (int anAllBuffsOfType : allBuffsOfType) {
|
||||
long stackCount = getBuffStackCount(target, anAllBuffsOfType);
|
||||
if (stackCount <= count) {
|
||||
removeBuff(target, anAllBuffsOfType);
|
||||
} else {
|
||||
decrementBuffStack(target, anAllBuffsOfType, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1496,24 +1414,17 @@ public class buff extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < allBuffsOfType.length; i++)
|
||||
{
|
||||
long stackCount = getBuffStackCount(target, allBuffsOfType[i]);
|
||||
if (stackCount <= 1)
|
||||
{
|
||||
removeBuff(target, allBuffsOfType[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
reduction = Math.round((float)stackCount * ((float)reduction / 100.0f));
|
||||
for (int anAllBuffsOfType : allBuffsOfType) {
|
||||
long stackCount = getBuffStackCount(target, anAllBuffsOfType);
|
||||
if (stackCount <= 1) {
|
||||
removeBuff(target, anAllBuffsOfType);
|
||||
} else {
|
||||
reduction = Math.round((float) stackCount * ((float) reduction / 100.0f));
|
||||
reduction = reduction < 1 ? 1 : reduction;
|
||||
if (stackCount <= reduction)
|
||||
{
|
||||
removeBuff(target, allBuffsOfType[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
decrementBuffStack(target, allBuffsOfType[i], reduction);
|
||||
if (stackCount <= reduction) {
|
||||
removeBuff(target, anAllBuffsOfType);
|
||||
} else {
|
||||
decrementBuffStack(target, anAllBuffsOfType, reduction);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1527,11 +1438,9 @@ public class buff extends script.base_script
|
||||
int[] allBuffs = buff.getAllBuffs(player);
|
||||
if (allBuffs != null && allBuffs.length > 0)
|
||||
{
|
||||
for (int i = 0; i < allBuffs.length; ++i)
|
||||
{
|
||||
if (buff.isAuraBuff(allBuffs[i]))
|
||||
{
|
||||
buff.removeBuff(player, allBuffs[i]);
|
||||
for (int allBuff : allBuffs) {
|
||||
if (buff.isAuraBuff(allBuff)) {
|
||||
buff.removeBuff(player, allBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1550,12 +1459,11 @@ public class buff extends script.base_script
|
||||
int[] allBuffs = getAllBuffs(player);
|
||||
if (allBuffs != null && allBuffs.length > 0)
|
||||
{
|
||||
for (int i = 0; i < allBuffs.length; ++i)
|
||||
{
|
||||
String tempEffect = getEffectParam(allBuffs[i], 1);
|
||||
if (effect.equals(tempEffect))
|
||||
{
|
||||
return allBuffs[i];
|
||||
String tempEffect;
|
||||
for (int allBuff : allBuffs) {
|
||||
tempEffect = getEffectParam(allBuff, 1);
|
||||
if (effect.equals(tempEffect)) {
|
||||
return allBuff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1574,14 +1482,12 @@ public class buff extends script.base_script
|
||||
if (isIdValid(groupId))
|
||||
{
|
||||
obj_id[] groupPlayers = getGroupMemberIds(groupId);
|
||||
for (int i = 0; i < groupPlayers.length; i++)
|
||||
{
|
||||
if (isIdValid(groupPlayers[i]) && exists(groupPlayers[i]) && pvpCanHelp(caster, groupPlayers[i]) && getDistance(groupPlayers[i], caster) < 100.0f)
|
||||
{
|
||||
toBuff.add(groupPlayers[i]);
|
||||
obj_id thisBeast = beast_lib.getBeastOnPlayer(groupPlayers[i]);
|
||||
if (isIdValid(thisBeast) && exists(thisBeast))
|
||||
{
|
||||
obj_id thisBeast;
|
||||
for (obj_id groupPlayer : groupPlayers) {
|
||||
if (isIdValid(groupPlayer) && exists(groupPlayer) && pvpCanHelp(caster, groupPlayer) && getDistance(groupPlayer, caster) < 100.0f) {
|
||||
toBuff.add(groupPlayer);
|
||||
thisBeast = beast_lib.getBeastOnPlayer(groupPlayer);
|
||||
if (isIdValid(thisBeast) && exists(thisBeast)) {
|
||||
toBuff.add(thisBeast);
|
||||
}
|
||||
}
|
||||
@@ -1592,11 +1498,8 @@ public class buff extends script.base_script
|
||||
toBuff.add(caster);
|
||||
}
|
||||
obj_id[] buffList = new obj_id[0];
|
||||
if (toBuff != null)
|
||||
{
|
||||
buffList = new obj_id[toBuff.size()];
|
||||
toBuff.toArray(buffList);
|
||||
}
|
||||
buffList = new obj_id[toBuff.size()];
|
||||
toBuff.toArray(buffList);
|
||||
applyBuff(buffList, caster, buffName);
|
||||
}
|
||||
public static boolean decayBuff(obj_id target, String buffName) throws InterruptedException
|
||||
@@ -1638,30 +1541,24 @@ public class buff extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < buffs.length; ++i)
|
||||
{
|
||||
buff_data bdata = combat_engine.getBuffData(buffs[i]);
|
||||
if (bdata == null)
|
||||
{
|
||||
buff_data bdata;
|
||||
for (int buff : buffs) {
|
||||
bdata = combat_engine.getBuffData(buff);
|
||||
if (bdata == null) {
|
||||
LOG("buff.scriptlib", "decayAllBuffsFromPvpDeath bdata is null");
|
||||
continue;
|
||||
}
|
||||
int decayOnPvpDeath = bdata.decayOnPvpDeath;
|
||||
int removalOnDeath = bdata.removeOnDeath;
|
||||
if (decayOnPvpDeath == 0 && removalOnDeath == 0)
|
||||
{
|
||||
if (decayOnPvpDeath == 0 && removalOnDeath == 0) {
|
||||
continue;
|
||||
} else if (decayOnPvpDeath == 0 && removalOnDeath == 1) {
|
||||
_removeBuff(target, buff);
|
||||
continue;
|
||||
} else if (removalOnDeath == 0) {
|
||||
continue;
|
||||
}
|
||||
else if (decayOnPvpDeath == 0 && removalOnDeath == 1)
|
||||
{
|
||||
_removeBuff(target, buffs[i]);
|
||||
continue;
|
||||
}
|
||||
else if (removalOnDeath == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
_decayBuff(target, buffs[i], percent);
|
||||
_decayBuff(target, buff, percent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Regular → Executable
+98
-142
@@ -1,19 +1,10 @@
|
||||
package script.library;
|
||||
|
||||
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.combat_engine.combat_data;
|
||||
import script.combat_engine.weapon_data;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.combat;
|
||||
import script.library.static_item;
|
||||
import script.library.colors;
|
||||
import script.library.buff;
|
||||
import script.library.vehicle;
|
||||
import java.util.Vector;
|
||||
|
||||
public class proc extends script.base_script
|
||||
{
|
||||
@@ -29,7 +20,6 @@ public class proc extends script.base_script
|
||||
}
|
||||
public static void executeProcEffects(obj_id attacker, obj_id defender, combat_data actionData) throws InterruptedException
|
||||
{
|
||||
weapon_data weaponData = getWeaponData(getCurrentWeapon(attacker));
|
||||
String params = "";
|
||||
prose_package pp = new prose_package();
|
||||
if (actionData != null)
|
||||
@@ -47,59 +37,61 @@ public class proc extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
weapon_data weaponData = getWeaponData(getCurrentWeapon(attacker));
|
||||
if (utils.hasScriptVar(attacker, "currentProcList"))
|
||||
{
|
||||
if (actionData.attackType == combat.CONE || actionData.attackType == combat.AREA || actionData.attackType == combat.TARGET_AREA)
|
||||
if (actionData != null && (actionData.attackType == combat.CONE || actionData.attackType == combat.AREA || actionData.attackType == combat.TARGET_AREA))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector procEffects = utils.getResizeableStringArrayScriptVar(attacker, "currentProcList");
|
||||
if (procEffects != null && procEffects.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < procEffects.size(); ++i)
|
||||
{
|
||||
dictionary parms = dataTableGetRow(PROC_TABLE, ((String)procEffects.get(i)));
|
||||
if (parms != null)
|
||||
{
|
||||
dictionary parms;
|
||||
String noSelfProcBuffs;
|
||||
String noTargetProcBuffs;
|
||||
String requiredBuffs;
|
||||
String procCommand;
|
||||
|
||||
for (Object procEffect : procEffects) {
|
||||
parms = dataTableGetRow(PROC_TABLE, ((String) procEffect));
|
||||
if (parms != null) {
|
||||
int procChance = parms.getInt("procChance");
|
||||
int expertiseProcChance = (int)getSkillStatisticModifier(attacker, ((String)procEffects.get(i)));
|
||||
if (expertiseProcChance > 0)
|
||||
{
|
||||
int expertiseProcChance = getSkillStatisticModifier(attacker, ((String) procEffect));
|
||||
if (expertiseProcChance > 0) {
|
||||
procChance = expertiseProcChance;
|
||||
if (((String)procEffects.get(i)).startsWith("kill_meter_"))
|
||||
{
|
||||
if (((String) procEffect).startsWith("kill_meter_")) {
|
||||
procChance *= getKillMeter(attacker);
|
||||
}
|
||||
}
|
||||
String noSelfProcBuffs = parms.getString("noSelfProcBuffs");
|
||||
String noTargetProcBuffs = parms.getString("noTargetProcBuffs");
|
||||
if (isGod(attacker) || isGod(defender))
|
||||
{
|
||||
noSelfProcBuffs = parms.getString("noSelfProcBuffs");
|
||||
noTargetProcBuffs = parms.getString("noTargetProcBuffs");
|
||||
if (isGod(attacker) || isGod(defender)) {
|
||||
LOG("expertise", "Proc: " + parms.getString("procString") + " noSelfProcBuffs: " + noSelfProcBuffs + " noTargetProcBuffs: " + noTargetProcBuffs);
|
||||
}
|
||||
if (buff.hasAnyBuffInList(attacker, noSelfProcBuffs) || buff.hasAnyBuffInList(defender, noTargetProcBuffs))
|
||||
{
|
||||
if (buff.hasAnyBuffInList(attacker, noSelfProcBuffs) || buff.hasAnyBuffInList(defender, noTargetProcBuffs)) {
|
||||
continue;
|
||||
}
|
||||
String requiredBuffs = parms.getString("requiredSelfBuffs");
|
||||
if (requiredBuffs.length() > 0 && !buff.hasAnyBuffInList(attacker, requiredBuffs))
|
||||
{
|
||||
requiredBuffs = parms.getString("requiredSelfBuffs");
|
||||
if (requiredBuffs.length() > 0 && !buff.hasAnyBuffInList(attacker, requiredBuffs)) {
|
||||
continue;
|
||||
}
|
||||
if (procChance != 100)
|
||||
{
|
||||
procChance = Math.round(weaponData.attackSpeed * (float)procChance);
|
||||
if (procChance != 100) {
|
||||
procChance = Math.round(weaponData.attackSpeed * (float) procChance);
|
||||
}
|
||||
if (rand(0, 99) < procChance)
|
||||
{
|
||||
String procCommand = parms.getString("procString");
|
||||
if (procCommand != null)
|
||||
{
|
||||
if (combat.canUseWeaponWithAbility(attacker, weaponData, procCommand, false))
|
||||
{
|
||||
if (rand(0, 99) < procChance) {
|
||||
procCommand = parms.getString("procString");
|
||||
if (procCommand != null) {
|
||||
if (combat.canUseWeaponWithAbility(attacker, weaponData, procCommand, false)) {
|
||||
queueCommand(attacker, getStringCrc(procCommand.toLowerCase()), defender, params, COMMAND_PRIORITY_DEFAULT);
|
||||
pp = prose.setStringId(pp, new string_id("proc/proc", procCommand));
|
||||
showFlyTextPrivateProseWithFlags(attacker, attacker, pp, 1.5f, colors.LEMONCHIFFON, FLY_TEXT_FLAG_IS_CRITICAL_HIT);
|
||||
showFlyTextPrivateProseWithFlags(
|
||||
attacker,
|
||||
attacker,
|
||||
prose.setStringId(pp, new string_id("proc/proc", procCommand)),
|
||||
1.5f,
|
||||
colors.LEMONCHIFFON,
|
||||
FLY_TEXT_FLAG_IS_CRITICAL_HIT
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,58 +112,45 @@ public class proc extends script.base_script
|
||||
Vector reacEffects = utils.getResizeableStringArrayScriptVar(defender, "currentReacList");
|
||||
if (reacEffects != null && reacEffects.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < reacEffects.size(); ++i)
|
||||
{
|
||||
dictionary reacParms = dataTableGetRow(PROC_TABLE, ((String)reacEffects.get(i)));
|
||||
if (reacParms != null)
|
||||
{
|
||||
dictionary reacParms;
|
||||
String reacCommand;
|
||||
String cooldownGroup;
|
||||
|
||||
for (Object reacEffect : reacEffects) {
|
||||
reacParms = dataTableGetRow(PROC_TABLE, ((String) reacEffect));
|
||||
if (reacParms != null) {
|
||||
int reacChance = reacParms.getInt("procChance");
|
||||
int expertiseReacChance = (int)getSkillStatisticModifier(defender, ((String)reacEffects.get(i)));
|
||||
if (expertiseReacChance > 0)
|
||||
{
|
||||
int expertiseReacChance = getSkillStatisticModifier(defender, ((String) reacEffect));
|
||||
if (expertiseReacChance > 0) {
|
||||
reacChance = expertiseReacChance;
|
||||
if (((String)reacEffects.get(i)).startsWith("kill_meter_"))
|
||||
{
|
||||
if (((String) reacEffect).startsWith("kill_meter_")) {
|
||||
reacChance *= getKillMeter(defender);
|
||||
}
|
||||
}
|
||||
String noSelfProcBuffs = reacParms.getString("noSelfProcBuffs");
|
||||
String noTargetProcBuffs = reacParms.getString("noTargetProcBuffs");
|
||||
if (buff.hasAnyBuffInList(defender, noSelfProcBuffs) || buff.hasAnyBuffInList(attacker, noTargetProcBuffs))
|
||||
{
|
||||
if (buff.hasAnyBuffInList(defender, reacParms.getString("noSelfProcBuffs")) || buff.hasAnyBuffInList(attacker, reacParms.getString("noTargetProcBuffs"))) {
|
||||
return;
|
||||
}
|
||||
if (reacChance != 100)
|
||||
{
|
||||
reacChance = Math.round(weaponData.attackSpeed * (float)reacChance);
|
||||
if (reacChance != 100) {
|
||||
reacChance = Math.round(weaponData.attackSpeed * (float) reacChance);
|
||||
}
|
||||
if (rand(0, 99) < reacChance)
|
||||
{
|
||||
String reacCommand = reacParms.getString("procString");
|
||||
if (reacCommand != null)
|
||||
{
|
||||
if (rand(0, 99) < reacChance) {
|
||||
reacCommand = reacParms.getString("procString");
|
||||
if (reacCommand != null) {
|
||||
combat_data abilityData = combat_engine.getCombatData(reacCommand);
|
||||
String cooldownGroup = abilityData.cooldownGroup;
|
||||
float cooldownTime = abilityData.cooldownTime;
|
||||
cooldownGroup = abilityData.cooldownGroup;
|
||||
boolean canProc = false;
|
||||
int timeLapse = -1;
|
||||
if (utils.hasScriptVar(defender, REAC_BASE + cooldownGroup))
|
||||
{
|
||||
if (utils.hasScriptVar(defender, REAC_BASE + cooldownGroup)) {
|
||||
int lastProc = utils.getIntScriptVar(defender, REAC_BASE + cooldownGroup);
|
||||
timeLapse = getGameTime() - lastProc;
|
||||
if (timeLapse >= cooldownTime)
|
||||
{
|
||||
if (timeLapse >= abilityData.cooldownTime) {
|
||||
canProc = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
canProc = true;
|
||||
}
|
||||
if (canProc)
|
||||
{
|
||||
if (queueCommand(defender, getStringCrc(reacCommand.toLowerCase()), attacker, "", COMMAND_PRIORITY_DEFAULT))
|
||||
{
|
||||
if (canProc) {
|
||||
if (queueCommand(defender, getStringCrc(reacCommand.toLowerCase()), attacker, "", COMMAND_PRIORITY_DEFAULT)) {
|
||||
LOG("procCommand", "Reac -- " + reacCommand + " activated");
|
||||
utils.setScriptVar(defender, REAC_BASE + cooldownGroup, getGameTime());
|
||||
}
|
||||
@@ -195,9 +174,8 @@ public class proc extends script.base_script
|
||||
if (procEffect != null && !procEffect.equals(""))
|
||||
{
|
||||
String[] weaponProcEffects = split(procEffect, ',');
|
||||
for (int i = 0; i < weaponProcEffects.length; ++i)
|
||||
{
|
||||
currentProcList.addElement(weaponProcEffects[i]);
|
||||
for (String weaponProcEffect : weaponProcEffects) {
|
||||
currentProcList.addElement(weaponProcEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,42 +184,35 @@ public class proc extends script.base_script
|
||||
if (hasObjVar(weapon, "procEffect"))
|
||||
{
|
||||
String[] weaponProcEffects = getStringArrayObjVar(weapon, "procEffect");
|
||||
for (int i = 0; i < weaponProcEffects.length; ++i)
|
||||
{
|
||||
currentProcList.addElement(weaponProcEffects[i]);
|
||||
for (String weaponProcEffect : weaponProcEffects) {
|
||||
currentProcList.addElement(weaponProcEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (utils.hasScriptVar(player, "procBuffEffects"))
|
||||
{
|
||||
String[] buffProcEffects = utils.getStringArrayScriptVar(player, "procBuffEffects");
|
||||
for (int i = 0; i < buffProcEffects.length; ++i)
|
||||
{
|
||||
currentProcList.addElement(buffProcEffects[i]);
|
||||
for (String buffProcEffect : buffProcEffects) {
|
||||
currentProcList.addElement(buffProcEffect);
|
||||
}
|
||||
}
|
||||
if (utils.hasScriptVar(player, "cyberneticItems"))
|
||||
{
|
||||
String[] installedCybernetics = utils.getStringArrayScriptVar(player, "cyberneticItems");
|
||||
String procString = null;
|
||||
for (int i = 0; i < installedCybernetics.length; ++i)
|
||||
{
|
||||
procString = dataTableGetString(CYBERNETICS_TABLE, installedCybernetics[i], "procEffectString");
|
||||
if (procString != null && !procString.equals(""))
|
||||
{
|
||||
for (String installedCybernetic : installedCybernetics) {
|
||||
procString = dataTableGetString(CYBERNETICS_TABLE, installedCybernetic, "procEffectString");
|
||||
if (procString != null && !procString.equals("")) {
|
||||
currentProcList.addElement(procString);
|
||||
}
|
||||
procString = null;
|
||||
}
|
||||
}
|
||||
if (utils.hasScriptVar(player, "expertiseProcReacList"))
|
||||
{
|
||||
Vector expertiseList = utils.getResizeableStringArrayScriptVar(player, "expertiseProcReacList");
|
||||
for (int i = 0; i < expertiseList.size(); ++i)
|
||||
{
|
||||
if (((String)expertiseList.get(i)).endsWith("_proc"))
|
||||
{
|
||||
currentProcList.addElement(((String)expertiseList.get(i)));
|
||||
for (Object anExpertiseList : expertiseList) {
|
||||
if (((String) anExpertiseList).endsWith("_proc")) {
|
||||
currentProcList.addElement(anExpertiseList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,11 +220,9 @@ public class proc extends script.base_script
|
||||
{
|
||||
Vector tempProcList = new Vector();
|
||||
tempProcList.setSize(0);
|
||||
for (int i = 0; i < currentProcList.size(); ++i)
|
||||
{
|
||||
if (!tempProcList.contains(((String)currentProcList.get(i))))
|
||||
{
|
||||
tempProcList.addElement(((String)currentProcList.get(i)));
|
||||
for (Object aCurrentProcList : currentProcList) {
|
||||
if (!tempProcList.contains(aCurrentProcList)) {
|
||||
tempProcList.addElement(aCurrentProcList);
|
||||
}
|
||||
}
|
||||
utils.setScriptVar(player, "currentProcList", tempProcList);
|
||||
@@ -287,32 +256,24 @@ public class proc extends script.base_script
|
||||
"utility_belt",
|
||||
"shoes"
|
||||
};
|
||||
for (int intI = 0; intI < strWear.length; intI++)
|
||||
{
|
||||
obj_id wearable = getObjectInSlot(player, strWear[intI]);
|
||||
if (!isIdNull(wearable))
|
||||
{
|
||||
if (static_item.isStaticItem(wearable))
|
||||
{
|
||||
dictionary wearableData = null;
|
||||
String wearableName = static_item.getStaticItemName(wearable);
|
||||
if (static_item.getStaticObjectType(wearableName) == 2)
|
||||
{
|
||||
obj_id wearable;
|
||||
dictionary wearableData;
|
||||
String reacEffect;
|
||||
|
||||
for (String aStrWear : strWear) {
|
||||
wearable = getObjectInSlot(player, aStrWear);
|
||||
if (!isIdNull(wearable)) {
|
||||
if (static_item.isStaticItem(wearable)) {
|
||||
if (static_item.getStaticObjectType(static_item.getStaticItemName(wearable)) == 2) {
|
||||
wearableData = static_item.getStaticArmorDictionary(wearable);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
wearableData = static_item.getStaticItemDictionary(wearable);
|
||||
}
|
||||
if (wearableData != null)
|
||||
{
|
||||
String reacEffect = wearableData.getString("reactive_effect");
|
||||
if (reacEffect != null && !reacEffect.equals(""))
|
||||
{
|
||||
String[] wearableReacEffects = split(reacEffect, ',');
|
||||
for (int i = 0; i < wearableReacEffects.length; ++i)
|
||||
{
|
||||
currentReacList.addElement(wearableReacEffects[i]);
|
||||
if (wearableData != null) {
|
||||
reacEffect = wearableData.getString("reactive_effect");
|
||||
if (reacEffect != null && !reacEffect.equals("")) {
|
||||
for (String wearableReacEffect : split(reacEffect, ',')) {
|
||||
currentReacList.addElement(wearableReacEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -322,20 +283,17 @@ public class proc extends script.base_script
|
||||
if (utils.hasScriptVar(player, "reacBuffEffects"))
|
||||
{
|
||||
String[] buffReacEffects = utils.getStringArrayScriptVar(player, "reacBuffEffects");
|
||||
for (int i = 0; i < buffReacEffects.length; ++i)
|
||||
{
|
||||
currentReacList.addElement(buffReacEffects[i]);
|
||||
for (String buffReacEffect : buffReacEffects) {
|
||||
currentReacList.addElement(buffReacEffect);
|
||||
}
|
||||
}
|
||||
if (utils.hasScriptVar(player, "cyberneticItems"))
|
||||
{
|
||||
String[] installedCybernetics = utils.getStringArrayScriptVar(player, "cyberneticItems");
|
||||
String reacString = null;
|
||||
for (int i = 0; i < installedCybernetics.length; ++i)
|
||||
{
|
||||
reacString = dataTableGetString(CYBERNETICS_TABLE, installedCybernetics[i], "reacEffectString");
|
||||
if (reacString != null && !reacString.equals(""))
|
||||
{
|
||||
String reacString;
|
||||
for (String installedCybernetic : installedCybernetics) {
|
||||
reacString = dataTableGetString(CYBERNETICS_TABLE, installedCybernetic, "reacEffectString");
|
||||
if (reacString != null && !reacString.equals("")) {
|
||||
currentReacList.addElement(reacString);
|
||||
}
|
||||
reacString = null;
|
||||
@@ -344,11 +302,9 @@ public class proc extends script.base_script
|
||||
if (utils.hasScriptVar(player, "expertiseProcReacList"))
|
||||
{
|
||||
Vector expertiseList = utils.getResizeableStringArrayScriptVar(player, "expertiseProcReacList");
|
||||
for (int i = 0; i < expertiseList.size(); ++i)
|
||||
{
|
||||
if (((String)expertiseList.get(i)).endsWith("_reac"))
|
||||
{
|
||||
currentReacList.addElement(((String)expertiseList.get(i)));
|
||||
for (Object anExpertiseList : expertiseList) {
|
||||
if (((String) anExpertiseList).endsWith("_reac")) {
|
||||
currentReacList.addElement(anExpertiseList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+3
-7
@@ -1,12 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.obj_id;
|
||||
import script.prose_package;
|
||||
import script.string_id;
|
||||
|
||||
public class prose extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+136
-244
@@ -1,23 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.colors;
|
||||
import script.library.factions;
|
||||
import script.library.force_rank;
|
||||
import script.library.pet_lib;
|
||||
import script.library.prose;
|
||||
import script.library.sui;
|
||||
import script.library.trace;
|
||||
import script.library.utils;
|
||||
import java.lang.Math;
|
||||
import java.util.Vector;
|
||||
|
||||
public class pvp extends script.base_script
|
||||
{
|
||||
@@ -123,7 +108,7 @@ public class pvp extends script.base_script
|
||||
{
|
||||
damArray[i] = new obj_var(attackerList[i].toString(), utils.getIntScriptVar(victim, VAR_ATTACKER_LIST + "." + attackerList[i] + ".damage"));
|
||||
}
|
||||
if (damArray == null || damArray.length == 0)
|
||||
if (damArray.length == 0)
|
||||
{
|
||||
trace.log("pvp_rating", "pvp.scriptlib._packageCombatWinners:-> damArray is bunk. Bailing..", victim, trace.TL_WARNING);
|
||||
return null;
|
||||
@@ -157,11 +142,9 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static prose_package getPvPRatedProsePackage(obj_id winner, obj_id loser, boolean winnerPackage) throws InterruptedException
|
||||
{
|
||||
String stringId = "";
|
||||
String stringFile = "pvp_rating";
|
||||
String[] phrases = null;
|
||||
obj_id actor = null;
|
||||
obj_id target = null;
|
||||
String[] phrases;
|
||||
obj_id actor;
|
||||
obj_id target;
|
||||
if (winnerPackage)
|
||||
{
|
||||
actor = winner;
|
||||
@@ -206,9 +189,8 @@ public class pvp extends script.base_script
|
||||
phrases[2] = "win3";
|
||||
}
|
||||
}
|
||||
stringId = phrases[rand(0, phrases.length - 1)];
|
||||
prose_package pp_msg = new prose_package();
|
||||
pp_msg.stringId = new string_id(stringFile, stringId);
|
||||
pp_msg.stringId = new string_id("pvp_rating", phrases[rand(0, phrases.length - 1)]);
|
||||
pp_msg.actor.set(actor);
|
||||
pp_msg.target.set(utils.getRealPlayerFirstName(target));
|
||||
pp_msg.digitInteger = getCurrentPvPRating(actor);
|
||||
@@ -216,10 +198,9 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static prose_package getPvPThrottleProsePackage(obj_id winner, obj_id loser, boolean winnerPackage) throws InterruptedException
|
||||
{
|
||||
String stringId = "";
|
||||
String stringFile = "pvp_rating";
|
||||
obj_id actor = null;
|
||||
obj_id target = null;
|
||||
String stringId;
|
||||
obj_id actor;
|
||||
obj_id target;
|
||||
if (winnerPackage)
|
||||
{
|
||||
actor = winner;
|
||||
@@ -253,7 +234,7 @@ public class pvp extends script.base_script
|
||||
}
|
||||
}
|
||||
prose_package pp_msg = new prose_package();
|
||||
pp_msg.stringId = new string_id(stringFile, stringId);
|
||||
pp_msg.stringId = new string_id("pvp_rating", stringId);
|
||||
pp_msg.actor.set(actor);
|
||||
pp_msg.target.set(utils.getRealPlayerFirstName(target));
|
||||
pp_msg.digitInteger = getCurrentPvPRating(actor);
|
||||
@@ -261,10 +242,9 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static prose_package getPvPRatingFloorProsePackage(obj_id winner, obj_id loser, boolean winnerPackage) throws InterruptedException
|
||||
{
|
||||
String stringId = "";
|
||||
String stringFile = "pvp_rating";
|
||||
obj_id actor = null;
|
||||
obj_id target = null;
|
||||
String stringId;
|
||||
obj_id actor;
|
||||
obj_id target;
|
||||
if (winnerPackage)
|
||||
{
|
||||
actor = winner;
|
||||
@@ -298,7 +278,7 @@ public class pvp extends script.base_script
|
||||
}
|
||||
}
|
||||
prose_package pp_msg = new prose_package();
|
||||
pp_msg.stringId = new string_id(stringFile, stringId);
|
||||
pp_msg.stringId = new string_id("pvp_rating", stringId);
|
||||
pp_msg.actor.set(actor);
|
||||
pp_msg.target.set(utils.getRealPlayerFirstName(target));
|
||||
pp_msg.digitInteger = getCurrentPvPRating(actor);
|
||||
@@ -309,7 +289,7 @@ public class pvp extends script.base_script
|
||||
int totalDamageTally = 0;
|
||||
if (utils.hasScriptVar(victim, VAR_TOTAL_DAMAGE_TALLY))
|
||||
{
|
||||
totalDamageTally = (int)utils.getIntScriptVar(victim, VAR_TOTAL_DAMAGE_TALLY);
|
||||
totalDamageTally = utils.getIntScriptVar(victim, VAR_TOTAL_DAMAGE_TALLY);
|
||||
}
|
||||
if (totalDamageTally < 0)
|
||||
{
|
||||
@@ -320,7 +300,6 @@ public class pvp extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
boolean victimDeathCountsForPoints = false;
|
||||
boolean onlyThrottledAttackers = true;
|
||||
obj_id messageWinner = null;
|
||||
int victimRatingDelta = 0;
|
||||
@@ -331,78 +310,56 @@ public class pvp extends script.base_script
|
||||
dictionary darkJediPvPAction = new dictionary();
|
||||
darkJediPvPAction.put("victim", victim);
|
||||
darkJediPvPAction.put("totalDamageToVictim", totalDamageTally);
|
||||
for (int i = 0; i < winners.length; i++)
|
||||
{
|
||||
obj_var winnerVar = winners[i];
|
||||
obj_id winner;
|
||||
|
||||
for (obj_var winnerVar : winners) {
|
||||
int dam = winnerVar.getIntData();
|
||||
obj_id winner = utils.stringToObjId(winnerVar.getName());
|
||||
float percentContribution = ((float)dam / totalDamageTally);
|
||||
winner = utils.stringToObjId(winnerVar.getName());
|
||||
float percentContribution = ((float) dam / totalDamageTally);
|
||||
trace.log("pvp_rating", "Calculating point exchange for winner " + winnerVar.getName(), victim, trace.TL_DEBUG);
|
||||
if ((!isIdValid(winner)) || (!winner.isLoaded()) || (winner.isBeingDestroyed()) || (winner == victim))
|
||||
{
|
||||
if ((!isIdValid(winner)) || (!winner.isLoaded()) || (winner.isBeingDestroyed()) || (winner == victim)) {
|
||||
trace.log("pvp_rating", "pvp.scriptlib.adjustPvPRatings: killer is invalid, !isLoaded, or isBeingDestroyed. ignoring...", winner, trace.TL_WARNING);
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageWinner = winner;
|
||||
if (!hasKilledVictimRecently(winner, victim))
|
||||
{
|
||||
onlyThrottledAttackers = false;
|
||||
if (getDistance(winner, victim) > MAX_DISTANCE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!pvpCanAttack(victim, winner))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (canAffectForceRankXPChange(victim, winner))
|
||||
{
|
||||
if (force_rank.getCouncilAffiliation(victim) == force_rank.DARK_COUNCIL && force_rank.getCouncilAffiliation(winner) == force_rank.DARK_COUNCIL)
|
||||
{
|
||||
darkJediXPRequests.put(winner, percentContribution);
|
||||
darkJediPvPAction.put(winner, percentContribution);
|
||||
}
|
||||
else
|
||||
{
|
||||
int xpAdjustment = getAdjustedForceRankXPDelta(victim, winner, percentContribution, false);
|
||||
if (xpAdjustment != 0)
|
||||
{
|
||||
force_rank.adjustForceRankXP(winner, xpAdjustment);
|
||||
}
|
||||
victimXPDelta += getAdjustedForceRankXPDelta(victim, winner, percentContribution, true);
|
||||
trace.log("force_rank", "Winner " + utils.getRealPlayerFirstName(winner) + "(" + winner + ") was awarded " + xpAdjustment + " Council XP for their " + percentContribution * 100 + "% contribution to the death of %TU", victim, trace.TL_CS_LOG | trace.TL_DEBUG);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (force_rank.getCouncilAffiliation(victim) == force_rank.DARK_COUNCIL && force_rank.getCouncilAffiliation(winner) == force_rank.DARK_COUNCIL)
|
||||
{
|
||||
darkJediPvPAction.put(winner, percentContribution);
|
||||
}
|
||||
}
|
||||
int winnerDelta = getAdjustedPvPRatingDelta(victim, winner, percentContribution, false);
|
||||
int winnerCur = getCurrentPvPRating(winner);
|
||||
trace.log(PVP_CS_LOG, "Winner " + utils.getRealPlayerFirstName(winner) + "(" + winner + ") was awarded " + winnerDelta + " PvP Rating Points for their " + percentContribution * 100 + "% contribution to the death of %TU", victim, trace.TL_CS_LOG | trace.TL_DEBUG);
|
||||
setCurrentPvPRating(winner, winnerCur + winnerDelta);
|
||||
victimRatingDelta += getAdjustedPvPRatingDelta(victim, winner, percentContribution, true);
|
||||
prose_package ppr = getPvPRatedProsePackage(winner, victim, true);
|
||||
sendSystemMessageProse(winner, ppr);
|
||||
registerPlayerKill(winner, victim);
|
||||
messageWinner = winner;
|
||||
if (!hasKilledVictimRecently(winner, victim)) {
|
||||
onlyThrottledAttackers = false;
|
||||
if (getDistance(winner, victim) > MAX_DISTANCE) {
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (force_rank.getCouncilAffiliation(victim) == force_rank.DARK_COUNCIL && force_rank.getCouncilAffiliation(winner) == force_rank.DARK_COUNCIL)
|
||||
{
|
||||
if (!pvpCanAttack(victim, winner)) {
|
||||
continue;
|
||||
}
|
||||
if (canAffectForceRankXPChange(victim, winner)) {
|
||||
if (force_rank.getCouncilAffiliation(victim) == force_rank.DARK_COUNCIL && force_rank.getCouncilAffiliation(winner) == force_rank.DARK_COUNCIL) {
|
||||
darkJediXPRequests.put(winner, percentContribution);
|
||||
darkJediPvPAction.put(winner, percentContribution);
|
||||
} else {
|
||||
int xpAdjustment = getAdjustedForceRankXPDelta(victim, winner, percentContribution, false);
|
||||
if (xpAdjustment != 0) {
|
||||
force_rank.adjustForceRankXP(winner, xpAdjustment);
|
||||
}
|
||||
victimXPDelta += getAdjustedForceRankXPDelta(victim, winner, percentContribution, true);
|
||||
trace.log("force_rank", "Winner " + utils.getRealPlayerFirstName(winner) + "(" + winner + ") was awarded " + xpAdjustment + " Council XP for their " + percentContribution * 100 + "% contribution to the death of %TU", victim, trace.TL_CS_LOG | trace.TL_DEBUG);
|
||||
}
|
||||
} else {
|
||||
if (force_rank.getCouncilAffiliation(victim) == force_rank.DARK_COUNCIL && force_rank.getCouncilAffiliation(winner) == force_rank.DARK_COUNCIL) {
|
||||
darkJediPvPAction.put(winner, percentContribution);
|
||||
}
|
||||
else
|
||||
{
|
||||
prose_package pp = getPvPThrottleProsePackage(winner, victim, true);
|
||||
sendSystemMessageProse(winner, pp);
|
||||
trace.log(PVP_CS_LOG, "PvP points not awarded to " + utils.getRealPlayerFirstName(winner) + "(" + winner + ") for participation in death of %TU - recently killed.", victim, trace.TL_CS_LOG | trace.TL_DEBUG);
|
||||
}
|
||||
}
|
||||
int winnerDelta = getAdjustedPvPRatingDelta(victim, winner, percentContribution, false);
|
||||
trace.log(PVP_CS_LOG, "Winner " + utils.getRealPlayerFirstName(winner) + "(" + winner + ") was awarded " + winnerDelta + " PvP Rating Points for their " + percentContribution * 100 + "% contribution to the death of %TU", victim, trace.TL_CS_LOG | trace.TL_DEBUG);
|
||||
setCurrentPvPRating(winner, getCurrentPvPRating(winner) + winnerDelta);
|
||||
victimRatingDelta += getAdjustedPvPRatingDelta(victim, winner, percentContribution, true);
|
||||
sendSystemMessageProse(winner, getPvPRatedProsePackage(winner, victim, true));
|
||||
registerPlayerKill(winner, victim);
|
||||
} else {
|
||||
if (force_rank.getCouncilAffiliation(victim) == force_rank.DARK_COUNCIL && force_rank.getCouncilAffiliation(winner) == force_rank.DARK_COUNCIL) {
|
||||
darkJediPvPAction.put(winner, percentContribution);
|
||||
} else {
|
||||
prose_package pp = getPvPThrottleProsePackage(winner, victim, true);
|
||||
sendSystemMessageProse(winner, pp);
|
||||
trace.log(PVP_CS_LOG, "PvP points not awarded to " + utils.getRealPlayerFirstName(winner) + "(" + winner + ") for participation in death of %TU - recently killed.", victim, trace.TL_CS_LOG | trace.TL_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,15 +372,12 @@ public class pvp extends script.base_script
|
||||
{
|
||||
trace.log(PVP_CS_LOG, "%TU lost a total of " + victimRatingDelta + " PvP rating points to normal pvp for this death.", victim, trace.TL_CS_LOG);
|
||||
setCurrentPvPRating(victim, getCurrentPvPRating(victim) + victimRatingDelta);
|
||||
prose_package pp = getPvPRatedProsePackage(messageWinner, victim, false);
|
||||
sendSystemMessageProse(victim, pp);
|
||||
sendSystemMessageProse(victim, getPvPRatedProsePackage(messageWinner, victim, false));
|
||||
}
|
||||
else if (onlyThrottledAttackers && isIdValid(messageWinner))
|
||||
{
|
||||
prose_package pp = getPvPThrottleProsePackage(messageWinner, victim, false);
|
||||
sendSystemMessageProse(victim, pp);
|
||||
sendSystemMessageProse(victim, getPvPThrottleProsePackage(messageWinner, victim, false));
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean canAffectForceRankXPChange(obj_id victim, obj_id winner) throws InterruptedException
|
||||
{
|
||||
@@ -457,16 +411,13 @@ public class pvp extends script.base_script
|
||||
public static int getRawForceRankXPDelta(obj_id player, boolean playerWon, obj_id opponent) throws InterruptedException
|
||||
{
|
||||
int playerRank = force_rank.getForceRank(player);
|
||||
int opponentRank = force_rank.getForceRank(opponent);
|
||||
if (playerRank < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
String columnName = "";
|
||||
String rowName = "";
|
||||
String rowPrefix = "";
|
||||
String rowSuffix = "";
|
||||
columnName = "rank" + playerRank;
|
||||
if (isInOpposingPvPFactions(player, opponent))
|
||||
{
|
||||
rowPrefix = FRS_DT_ROW_NONJEDI_PREFIX;
|
||||
@@ -475,6 +426,7 @@ public class pvp extends script.base_script
|
||||
{
|
||||
rowPrefix = FRS_DT_ROW_PADAWAN_PREFIX;
|
||||
}
|
||||
int opponentRank = force_rank.getForceRank(opponent);
|
||||
if (opponentRank > -1)
|
||||
{
|
||||
rowPrefix = FRS_DT_RANKED_JEDI_PREFIX + opponentRank;
|
||||
@@ -492,7 +444,7 @@ public class pvp extends script.base_script
|
||||
rowSuffix = FRS_DT_ROW_LOSS_SUFFIX;
|
||||
}
|
||||
rowName = rowPrefix + rowSuffix;
|
||||
int xpDelta = dataTableGetInt(FRS_XP_DATATABLE, rowName, columnName);
|
||||
int xpDelta = dataTableGetInt(FRS_XP_DATATABLE, rowName, "rank" + playerRank);
|
||||
if (xpDelta == -1)
|
||||
{
|
||||
return 0;
|
||||
@@ -506,13 +458,9 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static int getAdjustedForceRankXPDelta(obj_id victim, obj_id killer, double percentContribution, boolean gettingVictimsDelta) throws InterruptedException
|
||||
{
|
||||
String wonlost = "winning the battle against";
|
||||
if (gettingVictimsDelta)
|
||||
{
|
||||
wonlost = "losing the battle to";
|
||||
}
|
||||
obj_id targetPlayer = null;
|
||||
obj_id opponent = null;
|
||||
String wonlost = (gettingVictimsDelta ? "losing the battle to" : "winning the battle against");
|
||||
obj_id targetPlayer;
|
||||
obj_id opponent;
|
||||
if (gettingVictimsDelta)
|
||||
{
|
||||
targetPlayer = victim;
|
||||
@@ -531,7 +479,7 @@ public class pvp extends script.base_script
|
||||
disparity = MAX_RATING_DISPARITY;
|
||||
}
|
||||
trace.log("pvp_rating", "Target " + utils.getRealPlayerFirstName(targetPlayer) + "'s PvP rating is " + targetRat + "; Opponent " + utils.getRealPlayerFirstName(opponent) + "'s rating is " + opponentRat + " for a final disparity of " + disparity, opponent, trace.TL_DEBUG);
|
||||
float pvpRatingXPAdjustment = ((float)disparity / (float)MAX_RATING_DISPARITY) * (float)MAX_RATING_AFFECT_ON_XP;
|
||||
float pvpRatingXPAdjustment = ((float)disparity / (float)MAX_RATING_DISPARITY) * MAX_RATING_AFFECT_ON_XP;
|
||||
trace.log("pvp_rating", "Rating Disparity is " + disparity + ", creating an XP mod of " + (pvpRatingXPAdjustment * 100) + "% (" + pvpRatingXPAdjustment + ")", null, trace.TL_DEBUG);
|
||||
int targetDelta = getRawForceRankXPDelta(targetPlayer, !gettingVictimsDelta, opponent);
|
||||
trace.log("pvp_rating", utils.getRealPlayerFirstName(targetPlayer) + "'s raw target player XP Delta for " + wonlost + " opponent " + utils.getRealPlayerFirstName(opponent) + " is " + targetDelta, targetPlayer, trace.TL_DEBUG);
|
||||
@@ -558,8 +506,8 @@ public class pvp extends script.base_script
|
||||
trace.log("pvp_rating", "pvp.scriptlib.getAdjustedPvPRatingDelta:-> percentInvolvement > 1.0 (" + percentInvolvement + "). Bailing.", loser, trace.TL_WARNING | trace.TL_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
obj_id targetPlayer = null;
|
||||
obj_id opponent = null;
|
||||
obj_id targetPlayer;
|
||||
obj_id opponent;
|
||||
if (gettingVictimsDelta)
|
||||
{
|
||||
targetPlayer = loser;
|
||||
@@ -570,9 +518,7 @@ public class pvp extends script.base_script
|
||||
targetPlayer = winner;
|
||||
opponent = loser;
|
||||
}
|
||||
int targetRating = getCurrentPvPRating(targetPlayer);
|
||||
int opponentRating = getCurrentPvPRating(opponent);
|
||||
int targetDelta = getPvPRatingDelta(targetRating, opponentRating, (!gettingVictimsDelta));
|
||||
int targetDelta = getPvPRatingDelta(getCurrentPvPRating(targetPlayer), getCurrentPvPRating(opponent), (!gettingVictimsDelta));
|
||||
trace.log("pvp_rating", utils.getRealPlayerFirstName(targetPlayer) + "'s raw RATING DELTA, based on a battle against " + utils.getRealPlayerFirstName(opponent) + " is " + targetDelta, targetPlayer, trace.TL_DEBUG);
|
||||
targetDelta = _massageDeltaWithRules(targetDelta, !gettingVictimsDelta);
|
||||
trace.log("pvp_rating", "After adjusting " + utils.getRealPlayerFirstName(targetPlayer) + "'s raw RATING DELTA, based on Min/Max loss/gain rules, the adjusted delta is " + targetDelta, targetPlayer, trace.TL_DEBUG);
|
||||
@@ -647,26 +593,12 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static void updateDamageContributorList(obj_id target, obj_id attackr, int dam) throws InterruptedException
|
||||
{
|
||||
obj_id realAttacker = attackr;
|
||||
if (!isIdValid(target) || (!isIdValid(realAttacker)))
|
||||
if (!isIdValid(target) || (!isIdValid(attackr)))
|
||||
{
|
||||
trace.log("pvp_rating.scriptlib", "updateDamageContributorList:-> Target or Attacker is invalid. Bailing.", target, trace.TL_WARNING | trace.TL_DEBUG);
|
||||
return;
|
||||
}
|
||||
if (pet_lib.isPet(realAttacker))
|
||||
{
|
||||
if (!COUNT_PET_DAMAGE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!pet_lib.hasMaster(realAttacker))
|
||||
{
|
||||
return;
|
||||
}
|
||||
realAttacker = getMaster(attackr);
|
||||
dam = (int)((float)dam * COUNT_PET_DAMAGE_PERCENT);
|
||||
}
|
||||
else if (!isPlayer(realAttacker))
|
||||
if (pet_lib.isPet(attackr) || !isPlayer(attackr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -679,23 +611,21 @@ public class pvp extends script.base_script
|
||||
Vector attackerList = utils.getResizeableObjIdBatchScriptVar(target, VAR_ATTACKER_LIST);
|
||||
if (attackerList != null && attackerList.size() > 0)
|
||||
{
|
||||
if (utils.getElementPositionInArray(attackerList, realAttacker) == -1)
|
||||
if (utils.getElementPositionInArray(attackerList, attackr) == -1)
|
||||
{
|
||||
attackerList = utils.addElement(attackerList, realAttacker);
|
||||
attackerList = utils.addElement(attackerList, attackr);
|
||||
utils.setBatchScriptVar(target, VAR_ATTACKER_LIST, attackerList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attackerList = utils.addElement(attackerList, realAttacker);
|
||||
attackerList = utils.addElement(attackerList, attackr);
|
||||
utils.setBatchScriptVar(target, VAR_ATTACKER_LIST, attackerList);
|
||||
}
|
||||
String basePath = VAR_ATTACKER_LIST + "." + realAttacker;
|
||||
String damPath = basePath + ".damage";
|
||||
String damPath = VAR_ATTACKER_LIST + "." + attackr + ".damage";
|
||||
int totalDamage = dam + utils.getIntScriptVar(target, damPath);
|
||||
utils.setScriptVar(target, damPath, totalDamage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean hasKilledVictimRecently(obj_id attacker, obj_id victim) throws InterruptedException
|
||||
{
|
||||
@@ -744,7 +674,6 @@ public class pvp extends script.base_script
|
||||
utils.setResizeableBatchObjVar(attacker, VAR_PVP_LAST_KILLS, victimList);
|
||||
}
|
||||
setObjVar(attacker, VAR_PVP_LAST_UPDATE, getGameTime() + PVP_TRACKING_INTERVAL);
|
||||
return;
|
||||
}
|
||||
public static boolean cleanupCreditForPvPKills(obj_id whichPlayer) throws InterruptedException
|
||||
{
|
||||
@@ -752,8 +681,7 @@ public class pvp extends script.base_script
|
||||
utils.removeScriptVarTree(whichPlayer, "creditForPvPKillsTracking");
|
||||
if (hasObjVar(whichPlayer, VAR_PVP_LAST_UPDATE))
|
||||
{
|
||||
int last_update = getIntObjVar(whichPlayer, VAR_PVP_LAST_UPDATE);
|
||||
if (last_update < getGameTime())
|
||||
if (getIntObjVar(whichPlayer, VAR_PVP_LAST_UPDATE) < getGameTime())
|
||||
{
|
||||
removeObjVar(whichPlayer, VAR_PVP_LAST_KILLS);
|
||||
removeObjVar(whichPlayer, VAR_PVP_LAST_UPDATE);
|
||||
@@ -763,10 +691,8 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static void updatePvPDamageTimeStamp(obj_id player) throws InterruptedException
|
||||
{
|
||||
int now = getGameTime();
|
||||
setupClearPvPDamageCallback(player);
|
||||
utils.setScriptVar(player, VAR_LAST_PVP_DAMAGE_TIME, now);
|
||||
return;
|
||||
utils.setScriptVar(player, VAR_LAST_PVP_DAMAGE_TIME, getGameTime());
|
||||
}
|
||||
public static void setupClearPvPDamageCallback(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -776,7 +702,6 @@ public class pvp extends script.base_script
|
||||
}
|
||||
messageTo(player, "checkPvPDamageTime", null, CONTRIB_CLEAR_INTERVAL, false);
|
||||
utils.setScriptVar(player, VAR_LAST_PVP_DAMAGE_MSG_SENT, true);
|
||||
return;
|
||||
}
|
||||
public static boolean isBountyHunter(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -788,18 +713,10 @@ public class pvp extends script.base_script
|
||||
}
|
||||
public static boolean isInOpposingPvPFactions(obj_id player1, obj_id player2) throws InterruptedException
|
||||
{
|
||||
if (isPlayer(player1) && pvpGetType(player1) == PVPTYPE_NEUTRAL)
|
||||
{
|
||||
if (isPlayer(player1) && pvpGetType(player1) == PVPTYPE_NEUTRAL) {
|
||||
return false;
|
||||
}
|
||||
else if (isPlayer(player2) && pvpGetType(player2) == PVPTYPE_NEUTRAL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (pvpAreFactionsOpposed(pvpGetAlignedFaction(player1), pvpGetAlignedFaction(player2)));
|
||||
}
|
||||
} else
|
||||
return !(isPlayer(player2) && pvpGetType(player2) == PVPTYPE_NEUTRAL) && (pvpAreFactionsOpposed(pvpGetAlignedFaction(player1), pvpGetAlignedFaction(player2)));
|
||||
}
|
||||
public static boolean updatePlayerDamageTracking(obj_id player, obj_id attacker, obj_id wpn, int[] damage) throws InterruptedException
|
||||
{
|
||||
@@ -812,9 +729,8 @@ public class pvp extends script.base_script
|
||||
return false;
|
||||
}
|
||||
long tmpTotal = 0;
|
||||
for (int i = 0; i < damage.length; i++)
|
||||
{
|
||||
tmpTotal += damage[i];
|
||||
for (int aDamage : damage) {
|
||||
tmpTotal += aDamage;
|
||||
}
|
||||
if (tmpTotal > Integer.MAX_VALUE)
|
||||
{
|
||||
@@ -823,8 +739,7 @@ public class pvp extends script.base_script
|
||||
int totalDamage = (int)tmpTotal;
|
||||
if (isPvpDamageSource(player, attacker))
|
||||
{
|
||||
int currentDamage = utils.getIntScriptVar(player, SCRIPTVAR_PVP_DAMAGE);
|
||||
long newTotal = currentDamage + totalDamage;
|
||||
long newTotal = utils.getIntScriptVar(player, SCRIPTVAR_PVP_DAMAGE) + totalDamage;
|
||||
if (newTotal > Integer.MAX_VALUE)
|
||||
{
|
||||
newTotal = Integer.MAX_VALUE;
|
||||
@@ -834,8 +749,7 @@ public class pvp extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
int currentDamage = utils.getIntScriptVar(player, SCRIPTVAR_PVE_DAMAGE);
|
||||
long newTotal = currentDamage + totalDamage;
|
||||
long newTotal = utils.getIntScriptVar(player, SCRIPTVAR_PVE_DAMAGE) + totalDamage;
|
||||
if (newTotal > Integer.MAX_VALUE)
|
||||
{
|
||||
newTotal = Integer.MAX_VALUE;
|
||||
@@ -874,9 +788,7 @@ public class pvp extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
int now = getGameTime();
|
||||
int stamp = utils.getIntScriptVar(player, SCRIPTVAR_PVP_STAMP);
|
||||
int delta = now - stamp;
|
||||
int delta = getGameTime() - utils.getIntScriptVar(player, SCRIPTVAR_PVP_STAMP);
|
||||
if (delta < BUFFER_TIME)
|
||||
{
|
||||
return;
|
||||
@@ -905,9 +817,7 @@ public class pvp extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int now = getGameTime();
|
||||
int stamp = utils.getIntScriptVar(player, SCRIPTVAR_PVP_STAMP);
|
||||
int delta = now - stamp;
|
||||
int delta = getGameTime() - utils.getIntScriptVar(player, SCRIPTVAR_PVP_STAMP);
|
||||
if (delta >= BUFFER_TIME)
|
||||
{
|
||||
return false;
|
||||
@@ -964,16 +874,13 @@ public class pvp extends script.base_script
|
||||
{
|
||||
players = utils.getResizeableObjIdBatchScriptVar(controller, BATTLEFIELD_ACTIVE_PLAYERS);
|
||||
}
|
||||
dictionary params = new dictionary();
|
||||
if (players != null && players.size() > 0)
|
||||
{
|
||||
for (int i = 0, j = players.size(); i < j; i++)
|
||||
{
|
||||
if (!isIdValid(((obj_id)players.get(i))) || !exists(((obj_id)players.get(i))))
|
||||
{
|
||||
for (Object player : players) {
|
||||
if (!isIdValid(((obj_id) player)) || !exists(((obj_id) player))) {
|
||||
continue;
|
||||
}
|
||||
sendSystemMessage(((obj_id)players.get(i)), announcement);
|
||||
sendSystemMessage(((obj_id) player), announcement);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -987,20 +894,19 @@ public class pvp extends script.base_script
|
||||
}
|
||||
if (players != null && players.size() > 0)
|
||||
{
|
||||
for (int i = 0, j = players.size(); i < j; i++)
|
||||
{
|
||||
if (((String)players.get(i)) == null || ((String)players.get(i)).length() < 1)
|
||||
{
|
||||
String[] playerInfo;
|
||||
obj_id player;
|
||||
|
||||
for (Object player1 : players) {
|
||||
if (player1 == null || ((String) player1).length() < 1) {
|
||||
continue;
|
||||
}
|
||||
String[] playerInfo = split(((String)players.get(i)), '^');
|
||||
if (playerInfo == null || playerInfo.length < 1)
|
||||
{
|
||||
playerInfo = split(((String) player1), '^');
|
||||
if (playerInfo == null || playerInfo.length < 1) {
|
||||
continue;
|
||||
}
|
||||
obj_id player = utils.stringToObjId(playerInfo[0]);
|
||||
if (!isIdValid(player))
|
||||
{
|
||||
player = utils.stringToObjId(playerInfo[0]);
|
||||
if (!isIdValid(player)) {
|
||||
continue;
|
||||
}
|
||||
messageTo(player, message, params, 1.0f, false);
|
||||
@@ -1017,20 +923,19 @@ public class pvp extends script.base_script
|
||||
}
|
||||
if (players != null && players.size() > 0)
|
||||
{
|
||||
for (int i = 0, j = players.size(); i < j; i++)
|
||||
{
|
||||
if (((String)players.get(i)) == null || ((String)players.get(i)).length() < 1)
|
||||
{
|
||||
String[] playerInfo;
|
||||
obj_id player;
|
||||
|
||||
for (Object player1 : players) {
|
||||
if (player1 == null || ((String) player1).length() < 1) {
|
||||
continue;
|
||||
}
|
||||
String[] playerInfo = split(((String)players.get(i)), '^');
|
||||
if (playerInfo == null || playerInfo.length < 1)
|
||||
{
|
||||
playerInfo = split(((String) player1), '^');
|
||||
if (playerInfo == null || playerInfo.length < 1) {
|
||||
continue;
|
||||
}
|
||||
obj_id player = utils.stringToObjId(playerInfo[0]);
|
||||
if (!isIdValid(player) || !exists(player))
|
||||
{
|
||||
player = utils.stringToObjId(playerInfo[0]);
|
||||
if (!isIdValid(player) || !exists(player)) {
|
||||
continue;
|
||||
}
|
||||
messageTo(player, message, params, 1.0f, false);
|
||||
@@ -1052,26 +957,22 @@ public class pvp extends script.base_script
|
||||
if (activelTeam != null && activelTeam.size() > 0)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0, j = activelTeam.size(); i < j; i++)
|
||||
{
|
||||
if (((String)activelTeam.get(i)) == null || ((String)activelTeam.get(i)).length() < 1)
|
||||
{
|
||||
String[] activeMember;
|
||||
dictionary member;
|
||||
for (Object anActivelTeam : activelTeam) {
|
||||
if (anActivelTeam == null || ((String) anActivelTeam).length() < 1) {
|
||||
continue;
|
||||
}
|
||||
String[] activeMember = split(((String)activelTeam.get(i)), '^');
|
||||
if (activeMember.length < 9)
|
||||
{
|
||||
activeMember = split(((String) anActivelTeam), '^');
|
||||
if (activeMember.length < 9) {
|
||||
continue;
|
||||
}
|
||||
dictionary member = new dictionary();
|
||||
member = new dictionary();
|
||||
member.put("player", utils.stringToObjId(activeMember[0]));
|
||||
member.put("name", activeMember[2]);
|
||||
if (scriptVar.equals(BATTLEFIELD_ACTIVE_REBEL_PLAYERS))
|
||||
{
|
||||
if (scriptVar.equals(BATTLEFIELD_ACTIVE_REBEL_PLAYERS)) {
|
||||
member.put("faction", factions.FACTION_FLAG_REBEL);
|
||||
}
|
||||
else if (scriptVar.equals(BATTLEFIELD_ACTIVE_IMPERIAL_PLAYERS))
|
||||
{
|
||||
} else if (scriptVar.equals(BATTLEFIELD_ACTIVE_IMPERIAL_PLAYERS)) {
|
||||
member.put("faction", factions.FACTION_FLAG_IMPERIAL);
|
||||
}
|
||||
member.put("kills", utils.stringToInt(activeMember[3]));
|
||||
@@ -1108,11 +1009,15 @@ public class pvp extends script.base_script
|
||||
return null;
|
||||
}
|
||||
String[][] scoreData = new String[battlefieldPlayers.size()][8];
|
||||
String color;
|
||||
String factionName;
|
||||
String name;
|
||||
|
||||
for (int i = 0, j = battlefieldPlayers.size(); i < j; i++)
|
||||
{
|
||||
int faction = ((dictionary)battlefieldPlayers.get(i)).getInt("faction");
|
||||
String color = COLOR_IMPERIALS;
|
||||
String factionName = "Imperial";
|
||||
color = COLOR_IMPERIALS;
|
||||
factionName = "Imperial";
|
||||
if (faction == factions.FACTION_FLAG_REBEL)
|
||||
{
|
||||
color = COLOR_REBELS;
|
||||
@@ -1123,7 +1028,7 @@ public class pvp extends script.base_script
|
||||
color = "";
|
||||
}
|
||||
scoreData[i][1] = color + factionName;
|
||||
String name = ((dictionary)battlefieldPlayers.get(i)).getString("name");
|
||||
name = ((dictionary) battlefieldPlayers.get(i)).getString("name");
|
||||
if (name == null || name.length() < 1)
|
||||
{
|
||||
name = "Unknown";
|
||||
@@ -1279,14 +1184,11 @@ public class pvp extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0, j = terminals.size(); i < j; i++)
|
||||
{
|
||||
if (!isIdValid(((obj_id)terminals.get(i))) || !exists(((obj_id)terminals.get(i))))
|
||||
{
|
||||
for (Object terminal1 : terminals) {
|
||||
if (!isIdValid(((obj_id) terminal1)) || !exists(((obj_id) terminal1))) {
|
||||
continue;
|
||||
}
|
||||
if (((obj_id)terminals.get(i)) == terminal)
|
||||
{
|
||||
if (terminal1 == terminal) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1322,14 +1224,11 @@ public class pvp extends script.base_script
|
||||
utils.setBatchScriptVar(controller, "battlefield.terminals", terminals);
|
||||
return;
|
||||
}
|
||||
for (int i = 0, j = terminals.size(); i < j; i++)
|
||||
{
|
||||
if (!isIdValid(((obj_id)terminals.get(i))) || !exists(((obj_id)terminals.get(i))))
|
||||
{
|
||||
for (Object terminal1 : terminals) {
|
||||
if (!isIdValid(((obj_id) terminal1)) || !exists(((obj_id) terminal1))) {
|
||||
continue;
|
||||
}
|
||||
if (((obj_id)terminals.get(i)) == terminal)
|
||||
{
|
||||
if (terminal1 == terminal) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1366,19 +1265,16 @@ public class pvp extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int terminalCount = getIntObjVar(controller, "battlefield.terminalCount");
|
||||
if (terminalCount != terminals.size())
|
||||
if (getIntObjVar(controller, "battlefield.terminalCount") != terminals.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0, j = terminals.size(); i < j; i++)
|
||||
{
|
||||
if (!isIdValid(((obj_id)terminals.get(i))) || !exists(((obj_id)terminals.get(i))))
|
||||
{
|
||||
for (Object terminal : terminals) {
|
||||
if (!isIdValid(((obj_id) terminal)) || !exists(((obj_id) terminal))) {
|
||||
continue;
|
||||
}
|
||||
utils.removeScriptVar(((obj_id)terminals.get(i)), "battlefield.captured");
|
||||
messageTo(((obj_id)terminals.get(i)), "receiveBattlefieldReset", null, 1.0f, false);
|
||||
utils.removeScriptVar(((obj_id) terminal), "battlefield.captured");
|
||||
messageTo(((obj_id) terminal), "receiveBattlefieldReset", null, 1.0f, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1437,11 +1333,7 @@ public class pvp extends script.base_script
|
||||
return false;
|
||||
}
|
||||
obj_id runner = utils.getObjIdScriptVar(controller, "battlefield.runner");
|
||||
if (isIdValid(runner) && exists(runner))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isIdValid(runner) && exists(runner);
|
||||
}
|
||||
public static void bfActiveWarpPlayerToStart(obj_id controller, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1450,7 +1342,7 @@ public class pvp extends script.base_script
|
||||
return;
|
||||
}
|
||||
int battlefieldState = utils.getIntScriptVar(controller, "battlefield.state");
|
||||
location loc = null;
|
||||
location loc;
|
||||
if (factions.isRebel(player))
|
||||
{
|
||||
loc = utils.getLocationScriptVar(controller, "battlefieldRebelSpawn");
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.battlefield;
|
||||
import script.library.regions;
|
||||
import script.library.group;
|
||||
import script.library.badge;
|
||||
import java.util.Vector;
|
||||
|
||||
public class quests extends script.base_script
|
||||
{
|
||||
@@ -32,14 +23,7 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static boolean hasQuest(obj_id player, String QUEST_ID) throws InterruptedException
|
||||
{
|
||||
if (getQuestStatus(player, QUEST_ID) == IS_ON_QUEST)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return getQuestStatus(player, QUEST_ID) == IS_ON_QUEST;
|
||||
}
|
||||
public static void removeQuestStatus(obj_id player, String questId) throws InterruptedException
|
||||
{
|
||||
@@ -142,7 +126,6 @@ public class quests extends script.base_script
|
||||
destroyObject(waypoint);
|
||||
removeLocationTarget(name);
|
||||
removeObjVar(player, questId + ".waypoint." + name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
public static void clearAllWaypoints(obj_id player, String questId) throws InterruptedException
|
||||
@@ -157,10 +140,12 @@ public class quests extends script.base_script
|
||||
return;
|
||||
}
|
||||
int count = waypointList.getNumItems();
|
||||
obj_var waypointVar;
|
||||
obj_id waypoint;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
obj_var waypointVar = waypointList.getObjVar(i);
|
||||
obj_id waypoint = waypointVar.getObjIdData();
|
||||
waypointVar = waypointList.getObjVar(i);
|
||||
waypoint = waypointVar.getObjIdData();
|
||||
setWaypointVisible(waypoint, false);
|
||||
setWaypointActive(waypoint, false);
|
||||
destroyObject(waypoint);
|
||||
@@ -177,15 +162,15 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static obj_id spawnAttacker(String template, location loc, obj_id target) throws InterruptedException
|
||||
{
|
||||
obj_id attacker = createObject(template, loc);
|
||||
return attacker;
|
||||
return createObject(template, loc);
|
||||
}
|
||||
public static obj_id[] spawnAttackers(String msgHandlerName, int number, String template, location loc, obj_id target) throws InterruptedException
|
||||
{
|
||||
obj_id[] attackers = new obj_id[number];
|
||||
location newloc;
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
location newloc = new location(loc);
|
||||
newloc = new location(loc);
|
||||
newloc.x = loc.x + rand(-2, +2);
|
||||
newloc.z = loc.z + rand(-2, +2);
|
||||
attackers[i] = spawnAttacker(msgHandlerName, template, newloc, target);
|
||||
@@ -195,9 +180,10 @@ public class quests extends script.base_script
|
||||
public static obj_id[] spawnAttackers(int number, String template, location loc, obj_id target) throws InterruptedException
|
||||
{
|
||||
obj_id[] attackers = new obj_id[number];
|
||||
location newloc;
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
location newloc = new location(loc);
|
||||
newloc = new location(loc);
|
||||
newloc.x = loc.x + rand(-2, +2);
|
||||
newloc.z = loc.z + rand(-2, +2);
|
||||
attackers[i] = spawnAttacker(template, newloc, target);
|
||||
@@ -226,14 +212,12 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static location getTargetLocation(obj_id self) throws InterruptedException
|
||||
{
|
||||
obj_id containedBy = getTopMostContainer(self);
|
||||
location target = new location();
|
||||
location target = null;
|
||||
int x = 0;
|
||||
location questLoc;
|
||||
while (x < 10)
|
||||
{
|
||||
location here = getLocation(self);
|
||||
region quest = locations.getCityRegion(here);
|
||||
location questLoc = locations.getGoodLocationOutsideOfRegion(quest, 100f, 100f, 100f);
|
||||
questLoc = locations.getGoodLocationOutsideOfRegion(locations.getCityRegion(getLocation(self)), 100f, 100f, 100f);
|
||||
if (questLoc != null)
|
||||
{
|
||||
target = questLoc;
|
||||
@@ -244,27 +228,26 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static String getConvoType(obj_id self) throws InterruptedException
|
||||
{
|
||||
String convoType = "npc_mission/static_businessman_deliver";
|
||||
String convoType;
|
||||
String type = "businessman";
|
||||
if (checkForSerendipity(self) == false)
|
||||
if (!checkForSerendipity(self))
|
||||
{
|
||||
if (!hasObjVar(self, "questType"))
|
||||
{
|
||||
int questType = rand(1, 4);
|
||||
switch (questType)
|
||||
switch (rand(1, 4))
|
||||
{
|
||||
case 1:
|
||||
type = "businessman";
|
||||
break;
|
||||
type = "businessman";
|
||||
break;
|
||||
case 2:
|
||||
type = "criminal";
|
||||
break;
|
||||
type = "criminal";
|
||||
break;
|
||||
case 3:
|
||||
type = "noble";
|
||||
break;
|
||||
type = "noble";
|
||||
break;
|
||||
case 4:
|
||||
type = "scientist";
|
||||
break;
|
||||
type = "scientist";
|
||||
break;
|
||||
}
|
||||
convoType = "npc_mission/static_" + type + "_deliver";
|
||||
}
|
||||
@@ -286,27 +269,26 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static String getDataTableName(obj_id self) throws InterruptedException
|
||||
{
|
||||
String datatable = "datatables/npc/static_quest/businessman_deliveries.iff";
|
||||
String datatable;
|
||||
String type = "businessman";
|
||||
if (checkForSerendipity(self) == false)
|
||||
if (!checkForSerendipity(self))
|
||||
{
|
||||
if (!hasObjVar(self, "questType"))
|
||||
{
|
||||
int questType = rand(1, 4);
|
||||
switch (questType)
|
||||
switch (rand(1, 4))
|
||||
{
|
||||
case 1:
|
||||
type = "businessman";
|
||||
break;
|
||||
type = "businessman";
|
||||
break;
|
||||
case 2:
|
||||
type = "criminal";
|
||||
break;
|
||||
type = "criminal";
|
||||
break;
|
||||
case 3:
|
||||
type = "noble";
|
||||
break;
|
||||
type = "noble";
|
||||
break;
|
||||
case 4:
|
||||
type = "scientist";
|
||||
break;
|
||||
type = "scientist";
|
||||
break;
|
||||
}
|
||||
datatable = "datatables/npc/static_quest/" + type + "_deliveries.iff";
|
||||
}
|
||||
@@ -329,25 +311,24 @@ public class quests extends script.base_script
|
||||
public static String getType(obj_id self) throws InterruptedException
|
||||
{
|
||||
String type = "businessman";
|
||||
if (checkForSerendipity(self) == false)
|
||||
if (!checkForSerendipity(self))
|
||||
{
|
||||
if (!hasObjVar(self, "questType"))
|
||||
{
|
||||
int questType = rand(1, 4);
|
||||
switch (questType)
|
||||
switch (rand(1, 4))
|
||||
{
|
||||
case 1:
|
||||
type = "businessman";
|
||||
break;
|
||||
type = "businessman";
|
||||
break;
|
||||
case 2:
|
||||
type = "criminal";
|
||||
break;
|
||||
type = "criminal";
|
||||
break;
|
||||
case 3:
|
||||
type = "noble";
|
||||
break;
|
||||
type = "noble";
|
||||
break;
|
||||
case 4:
|
||||
type = "scientist";
|
||||
break;
|
||||
type = "scientist";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -376,17 +357,11 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static boolean checkForItem(obj_id inv) throws InterruptedException
|
||||
{
|
||||
String datatable = quests.getDataTableName(getSelf());
|
||||
int questNum = getIntObjVar(getSelf(), "quest");
|
||||
String giveMe = dataTableGetString(datatable, 0, questNum);
|
||||
String giveMe = dataTableGetString(quests.getDataTableName(getSelf()), 0, getIntObjVar(getSelf(), "quest"));
|
||||
boolean hadIt = false;
|
||||
obj_id[] contents = getContents(inv);
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
String itemInInventory = getTemplateName(contents[i]);
|
||||
if (itemInInventory.equals(giveMe))
|
||||
{
|
||||
destroyObject(contents[i]);
|
||||
for (obj_id content : getContents(inv)) {
|
||||
if (getTemplateName(content).equals(giveMe)) {
|
||||
destroyObject(content);
|
||||
hadIt = true;
|
||||
}
|
||||
}
|
||||
@@ -395,20 +370,27 @@ public class quests extends script.base_script
|
||||
public static location getThemeParkLocation(obj_id self) throws InterruptedException
|
||||
{
|
||||
location target = null;
|
||||
|
||||
obj_id bldg;
|
||||
location building;
|
||||
location questLoc;
|
||||
region[] rgnFoos;
|
||||
region[] rgnTest;
|
||||
region quest;
|
||||
|
||||
int x = 0;
|
||||
while (x < 10)
|
||||
{
|
||||
location here = getLocation(self);
|
||||
obj_id bldg = getTopMostContainer(self);
|
||||
bldg = getTopMostContainer(self);
|
||||
if (bldg == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
location building = getLocation(bldg);
|
||||
region[] rgnFoos = getRegionsWithGeographicalAtPoint(building, regions.GEO_CITY);
|
||||
building = getLocation(bldg);
|
||||
rgnFoos = getRegionsWithGeographicalAtPoint(building, regions.GEO_CITY);
|
||||
if (rgnFoos == null)
|
||||
{
|
||||
region[] rgnTest = getRegionsAtPoint(building);
|
||||
rgnTest = getRegionsAtPoint(building);
|
||||
if (rgnTest == null)
|
||||
{
|
||||
return null;
|
||||
@@ -418,7 +400,7 @@ public class quests extends script.base_script
|
||||
rgnFoos = rgnTest;
|
||||
}
|
||||
}
|
||||
region quest = rgnFoos[0];
|
||||
quest = rgnFoos[0];
|
||||
if (quest == null)
|
||||
{
|
||||
quest = locations.getCityRegion(building);
|
||||
@@ -427,30 +409,27 @@ public class quests extends script.base_script
|
||||
return null;
|
||||
}
|
||||
}
|
||||
location questLoc = locations.getGoodLocationOutsideOfRegion(quest, 64f, 64f, 100f, false, true);
|
||||
questLoc = locations.getGoodLocationOutsideOfRegion(quest, 64f, 64f, 100f, false, true);
|
||||
if (questLoc != null)
|
||||
{
|
||||
target = questLoc;
|
||||
}
|
||||
x = x + 1;
|
||||
x++;
|
||||
}
|
||||
if (target != null)
|
||||
{
|
||||
float xCoord = target.x;
|
||||
float zCoord = target.z;
|
||||
float newY = getHeightAtLocation(xCoord, zCoord);
|
||||
target.y = newY;
|
||||
target.y = getHeightAtLocation(xCoord, zCoord);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
public static void giveThemeParkReward(obj_id self, obj_id player, int questNum) throws InterruptedException
|
||||
{
|
||||
String datatable = getStringObjVar(self, "quest_table");
|
||||
datatable = "datatables/theme_park/" + datatable + ".iff";
|
||||
String datatable = "datatables/theme_park/" + getStringObjVar(self, "quest_table") + ".iff";
|
||||
String questID = dataTableGetString(datatable, questNum, "temp_objvar");
|
||||
String gatingString = dataTableGetString(datatable, questNum, "overall_objvar");
|
||||
String playerScript = dataTableGetString(datatable, questNum, "player_script");
|
||||
String CONVO = dataTableGetString(datatable, questNum, "convo");
|
||||
String messageCONVO = "theme_park/messages";
|
||||
int gating = getIntObjVar(player, gatingString);
|
||||
if (group.isGrouped(player))
|
||||
@@ -523,7 +502,7 @@ public class quests extends script.base_script
|
||||
setObjVar(rewardObject2, objvar2, value2);
|
||||
}
|
||||
}
|
||||
if (reward3 != null && !reward3.equals("") && !reward2.equals("none"))
|
||||
if (reward3 != null && !reward3.equals("") && reward2 != null && !reward2.equals("none"))
|
||||
{
|
||||
obj_id rewardObject3 = createObject(reward3, playerInv, "");
|
||||
string_id gift3 = new string_id(messageCONVO, "theme_park_reward");
|
||||
@@ -535,7 +514,7 @@ public class quests extends script.base_script
|
||||
setObjVar(rewardObject3, objvar3, value3);
|
||||
}
|
||||
}
|
||||
if (reward4 != null && !reward4.equals("") && !reward2.equals("none"))
|
||||
if (reward4 != null && !reward4.equals("") && reward2 != null && !reward2.equals("none"))
|
||||
{
|
||||
obj_id rewardObject4 = createObject(reward4, playerInv, "");
|
||||
string_id gift4 = new string_id(messageCONVO, "theme_park_reward");
|
||||
@@ -604,7 +583,6 @@ public class quests extends script.base_script
|
||||
{
|
||||
detachScript(player, playerScript);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static int getQuestId(String questName) throws InterruptedException
|
||||
{
|
||||
@@ -853,21 +831,17 @@ public class quests extends script.base_script
|
||||
}
|
||||
}
|
||||
String[] _result = new String[0];
|
||||
if (result != null)
|
||||
{
|
||||
_result = new String[result.size()];
|
||||
result.toArray(_result);
|
||||
}
|
||||
_result = new String[result.size()];
|
||||
result.toArray(_result);
|
||||
return _result;
|
||||
}
|
||||
public static String getDataEntry(String questName, String columnName) throws InterruptedException
|
||||
{
|
||||
String result = null;
|
||||
String datatable = "datatables/player/quests.iff";
|
||||
int questRow = getQuestId(questName);
|
||||
if (questRow > -1)
|
||||
{
|
||||
result = dataTableGetString(datatable, questRow, columnName);
|
||||
result = dataTableGetString("datatables/player/quests.iff", questRow, columnName);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -942,7 +916,7 @@ public class quests extends script.base_script
|
||||
}
|
||||
if (havePlanet)
|
||||
{
|
||||
if (tokens[0].indexOf(".iff") < 0)
|
||||
if (!tokens[0].contains(".iff"))
|
||||
{
|
||||
planet = tokens[0];
|
||||
}
|
||||
@@ -973,7 +947,7 @@ public class quests extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!havePlanet && haveParameter)
|
||||
else if (!havePlanet)
|
||||
{
|
||||
int attempts = 0;
|
||||
while (result == null && attempts < 15)
|
||||
@@ -990,7 +964,7 @@ public class quests extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (havePlanet && haveParameter)
|
||||
else if (haveParameter)
|
||||
{
|
||||
String currentScene = getCurrentSceneName();
|
||||
if (currentScene != null && currentScene.equals(planet))
|
||||
@@ -1016,8 +990,7 @@ public class quests extends script.base_script
|
||||
waitForPlanetWarp = new location(0.0f, 0.0f, 0.0f, planet);
|
||||
}
|
||||
}
|
||||
else if (havePlanet && !haveParameter)
|
||||
{
|
||||
else {
|
||||
String currentScene = getCurrentSceneName();
|
||||
if (currentScene != null && currentScene.equals(planet))
|
||||
{
|
||||
@@ -1171,12 +1144,12 @@ public class quests extends script.base_script
|
||||
LOG("newquests", "location generating a random location about 1 kilometer away " + result);
|
||||
}
|
||||
}
|
||||
else if (!haveTarget && haveParameter)
|
||||
else if (!haveTarget)
|
||||
{
|
||||
result = locations.getRandomGoodLocation(getLocation(self), parameter - 100.0f, parameter + 100.0f, 32.0f);
|
||||
LOG("newquests", "location generating a random location between " + (parameter - 100.0f) + " and " + (parameter + 100.0f) + " meters away");
|
||||
}
|
||||
else if (planetName != null && !haveX && !haveZ && !haveCell && haveParameter)
|
||||
else if (planetName != null && !haveX && haveParameter)
|
||||
{
|
||||
String currentScene = getCurrentSceneName();
|
||||
if (currentScene != null && currentScene.equals(planetName))
|
||||
@@ -1190,7 +1163,7 @@ public class quests extends script.base_script
|
||||
LOG("newquests", "location generating a random location on " + planetName + " between " + (parameter - 100.0f) + " and " + (parameter + 100.0f) + " meters away");
|
||||
}
|
||||
}
|
||||
else if (planetName != null && !haveX && !haveZ && !haveCell && !haveParameter)
|
||||
else if (planetName != null && !haveX)
|
||||
{
|
||||
String currentScene = getCurrentSceneName();
|
||||
if (currentScene != null && currentScene.equals(planetName))
|
||||
@@ -1204,7 +1177,7 @@ public class quests extends script.base_script
|
||||
LOG("newquests", "location a location will be generated when the player travels to " + planetName);
|
||||
}
|
||||
}
|
||||
else if (planetName != null && haveX && haveZ && !haveCell && !haveParameter)
|
||||
else if (planetName != null && !haveCell && !haveParameter)
|
||||
{
|
||||
result = new location();
|
||||
result.x = x;
|
||||
@@ -1212,7 +1185,7 @@ public class quests extends script.base_script
|
||||
result.area = planetName;
|
||||
LOG("newquests", "location generating a location at " + result);
|
||||
}
|
||||
else if (planetName != null && haveX && haveZ && !haveCell && haveParameter)
|
||||
else if (planetName != null && !haveCell)
|
||||
{
|
||||
result = new location();
|
||||
result.x = x;
|
||||
@@ -1221,7 +1194,7 @@ public class quests extends script.base_script
|
||||
radius = parameter;
|
||||
LOG("newquests", "location generating a location at " + result);
|
||||
}
|
||||
else if (planetName != null && haveX && haveZ && haveCell && !haveParameter)
|
||||
else if (planetName != null && !haveParameter)
|
||||
{
|
||||
result = new location();
|
||||
result.x = x;
|
||||
@@ -1230,7 +1203,7 @@ public class quests extends script.base_script
|
||||
result.cell = cell;
|
||||
LOG("newquests", "location generating a location at " + result);
|
||||
}
|
||||
else if (planetName != null && haveX && haveZ && haveCell && haveParameter)
|
||||
else if (planetName != null)
|
||||
{
|
||||
result = new location();
|
||||
result.x = x;
|
||||
@@ -1247,7 +1220,7 @@ public class quests extends script.base_script
|
||||
addLocationTarget(questName, result, radius);
|
||||
LOG("newquests", "location adding location target at " + result);
|
||||
}
|
||||
else if (waitForPlanetWarp == true)
|
||||
else if (waitForPlanetWarp)
|
||||
{
|
||||
setObjVar(self, "quest." + questName + ".generate", waitForPlanetWarp);
|
||||
}
|
||||
@@ -1266,9 +1239,8 @@ public class quests extends script.base_script
|
||||
}
|
||||
public static obj_id getTargetForQuest(obj_id self, String questName) throws InterruptedException
|
||||
{
|
||||
deltadictionary scriptVars = self.getScriptVars();
|
||||
String objvarname = "encounter.target." + questName;
|
||||
obj_id result = scriptVars.getObjId(objvarname);
|
||||
obj_id result = self.getScriptVars().getObjId(objvarname);
|
||||
LOG("newquests", "quest target " + objvarname + "=" + result + " self=" + self);
|
||||
return result;
|
||||
}
|
||||
@@ -1477,10 +1449,6 @@ public class quests extends script.base_script
|
||||
public static boolean safeHasObjVar(obj_id self, String objvarName) throws InterruptedException
|
||||
{
|
||||
obj_var ov = getObjVar(self, objvarName);
|
||||
if (ov != null && ((ov.getName()).equals(objvarName)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ov != null && ((ov.getName()).equals(objvarName));
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+70
-137
@@ -1,14 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.gcw;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.region;
|
||||
|
||||
public class regions extends script.base_script
|
||||
{
|
||||
@@ -170,129 +164,69 @@ public class regions extends script.base_script
|
||||
}
|
||||
public static int getDeliverMissionRegionType(String strRegionName) throws InterruptedException
|
||||
{
|
||||
if (strRegionName.equals("anchorhead"))
|
||||
{
|
||||
return MISSION_TATOOINE_ANCHORHEAD;
|
||||
}
|
||||
else if (strRegionName.equals("bestine"))
|
||||
{
|
||||
return MISSION_TATOOINE_BESTINE;
|
||||
}
|
||||
else if (strRegionName.equals("mos_eisley"))
|
||||
{
|
||||
return MISSION_TATOOINE_MOS_EISLEY;
|
||||
}
|
||||
else if (strRegionName.equals("mos_entha"))
|
||||
{
|
||||
return MISSION_TATOOINE_MOS_ENTHA;
|
||||
}
|
||||
else if (strRegionName.equals("mos_espa"))
|
||||
{
|
||||
return MISSION_TATOOINE_MOS_ESPA;
|
||||
}
|
||||
else if (strRegionName.equals("mos_taike"))
|
||||
{
|
||||
return MISSION_TATOOINE_MOS_TAIKE;
|
||||
}
|
||||
else if (strRegionName.equals("wayfar"))
|
||||
{
|
||||
return MISSION_TATOOINE_WAYFAR;
|
||||
}
|
||||
else if (strRegionName.equals("deeja_peak"))
|
||||
{
|
||||
return MISSION_NABOO_DEEJA_PEAK;
|
||||
}
|
||||
else if (strRegionName.equals("theed"))
|
||||
{
|
||||
return MISSION_NABOO_THEED;
|
||||
}
|
||||
else if (strRegionName.equals("keren"))
|
||||
{
|
||||
return MISSION_NABOO_KEREN;
|
||||
}
|
||||
else if (strRegionName.equals("kaadara"))
|
||||
{
|
||||
return MISSION_NABOO_KAADARA;
|
||||
}
|
||||
else if (strRegionName.equals("moenia"))
|
||||
{
|
||||
return MISSION_NABOO_MOENIA;
|
||||
}
|
||||
else if (strRegionName.equals("coronet"))
|
||||
{
|
||||
return MISSION_CORELLIA_CORONET;
|
||||
}
|
||||
else if (strRegionName.equals("tyrena"))
|
||||
{
|
||||
return MISSION_CORELLIA_TYRENA;
|
||||
}
|
||||
else if (strRegionName.equals("bela_vistal"))
|
||||
{
|
||||
return MISSION_CORELLIA_BELA_VISTAL;
|
||||
}
|
||||
else if (strRegionName.equals("vreni_island"))
|
||||
{
|
||||
return MISSION_CORELLIA_VRENI_ISLAND;
|
||||
}
|
||||
else if (strRegionName.equals("kor_vella"))
|
||||
{
|
||||
return MISSION_CORELLIA_KOR_VELLA;
|
||||
}
|
||||
else if (strRegionName.equals("daoba_guerfel"))
|
||||
{
|
||||
return MISSION_CORELLIA_DAOBA_GUERFEL;
|
||||
}
|
||||
else if (strRegionName.equals("doaba_guerfel"))
|
||||
{
|
||||
return MISSION_CORELLIA_DAOBA_GUERFEL;
|
||||
}
|
||||
else if (strRegionName.equals("narmle"))
|
||||
{
|
||||
return MISSION_RORI_NARMLE;
|
||||
}
|
||||
else if (strRegionName.equals("restuss"))
|
||||
{
|
||||
return MISSION_RORI_RESTUSS;
|
||||
}
|
||||
else if (strRegionName.equals("dearic"))
|
||||
{
|
||||
return MISSION_TALUS_DEARIC;
|
||||
}
|
||||
else if (strRegionName.equals("nashal"))
|
||||
{
|
||||
return MISSION_TALUS_NASHAL;
|
||||
}
|
||||
else if (strRegionName.equals("yavin4_labor_outpost"))
|
||||
{
|
||||
return MISSION_YAVIN4_LABOR_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("yavin4_mining_outpost"))
|
||||
{
|
||||
return MISSION_YAVIN4_MINING_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("endor_neutral_outpost"))
|
||||
{
|
||||
return MISSION_ENDOR_NEUTRAL_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("dantooine_mining_outpost"))
|
||||
{
|
||||
return MISSION_DANTOOINE_MINING_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("dantooine_pirate_outpost"))
|
||||
{
|
||||
return MISSION_DANTOOINE_PIRATE_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("dathomir_trade_outpost"))
|
||||
{
|
||||
return MISSION_DATHOMIR_TRADE_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("dathomir_survey_outpost"))
|
||||
{
|
||||
return MISSION_DATHOMIR_SURVEY_OUTPOST;
|
||||
}
|
||||
else if (strRegionName.equals("lok_nyms_stronghold"))
|
||||
{
|
||||
return MISSION_LOK_NYMS_STRONGHOLD;
|
||||
switch (strRegionName) {
|
||||
case "anchorhead":
|
||||
return MISSION_TATOOINE_ANCHORHEAD;
|
||||
case "bestine":
|
||||
return MISSION_TATOOINE_BESTINE;
|
||||
case "mos_eisley":
|
||||
return MISSION_TATOOINE_MOS_EISLEY;
|
||||
case "mos_entha":
|
||||
return MISSION_TATOOINE_MOS_ENTHA;
|
||||
case "mos_espa":
|
||||
return MISSION_TATOOINE_MOS_ESPA;
|
||||
case "mos_taike":
|
||||
return MISSION_TATOOINE_MOS_TAIKE;
|
||||
case "wayfar":
|
||||
return MISSION_TATOOINE_WAYFAR;
|
||||
case "deeja_peak":
|
||||
return MISSION_NABOO_DEEJA_PEAK;
|
||||
case "theed":
|
||||
return MISSION_NABOO_THEED;
|
||||
case "keren":
|
||||
return MISSION_NABOO_KEREN;
|
||||
case "kaadara":
|
||||
return MISSION_NABOO_KAADARA;
|
||||
case "moenia":
|
||||
return MISSION_NABOO_MOENIA;
|
||||
case "coronet":
|
||||
return MISSION_CORELLIA_CORONET;
|
||||
case "tyrena":
|
||||
return MISSION_CORELLIA_TYRENA;
|
||||
case "bela_vistal":
|
||||
return MISSION_CORELLIA_BELA_VISTAL;
|
||||
case "vreni_island":
|
||||
return MISSION_CORELLIA_VRENI_ISLAND;
|
||||
case "kor_vella":
|
||||
return MISSION_CORELLIA_KOR_VELLA;
|
||||
case "daoba_guerfel":
|
||||
return MISSION_CORELLIA_DAOBA_GUERFEL;
|
||||
case "doaba_guerfel":
|
||||
return MISSION_CORELLIA_DAOBA_GUERFEL;
|
||||
case "narmle":
|
||||
return MISSION_RORI_NARMLE;
|
||||
case "restuss":
|
||||
return MISSION_RORI_RESTUSS;
|
||||
case "dearic":
|
||||
return MISSION_TALUS_DEARIC;
|
||||
case "nashal":
|
||||
return MISSION_TALUS_NASHAL;
|
||||
case "yavin4_labor_outpost":
|
||||
return MISSION_YAVIN4_LABOR_OUTPOST;
|
||||
case "yavin4_mining_outpost":
|
||||
return MISSION_YAVIN4_MINING_OUTPOST;
|
||||
case "endor_neutral_outpost":
|
||||
return MISSION_ENDOR_NEUTRAL_OUTPOST;
|
||||
case "dantooine_mining_outpost":
|
||||
return MISSION_DANTOOINE_MINING_OUTPOST;
|
||||
case "dantooine_pirate_outpost":
|
||||
return MISSION_DANTOOINE_PIRATE_OUTPOST;
|
||||
case "dathomir_trade_outpost":
|
||||
return MISSION_DATHOMIR_TRADE_OUTPOST;
|
||||
case "dathomir_survey_outpost":
|
||||
return MISSION_DATHOMIR_SURVEY_OUTPOST;
|
||||
case "lok_nyms_stronghold":
|
||||
return MISSION_LOK_NYMS_STRONGHOLD;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -369,11 +303,10 @@ public class regions extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < regions.length; i++)
|
||||
{
|
||||
String regionName = regions[i].getName();
|
||||
if (isIdValid(gcw.getPvpRegionControllerIdByName(object, regionName)))
|
||||
{
|
||||
String regionName;
|
||||
for (script.region region : regions) {
|
||||
regionName = region.getName();
|
||||
if (isIdValid(gcw.getPvpRegionControllerIdByName(object, regionName))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+83
-115
@@ -1,16 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.utils;
|
||||
import java.util.Vector;
|
||||
|
||||
public class resource extends script.base_script
|
||||
{
|
||||
@@ -212,7 +204,7 @@ public class resource extends script.base_script
|
||||
{
|
||||
containerTemplate = DEFAULT_CONTAINER;
|
||||
}
|
||||
int chunks = (int)(amt / CONTAINER_VOLUME_MAX);
|
||||
int chunks = amt / CONTAINER_VOLUME_MAX;
|
||||
if (amt % CONTAINER_VOLUME_MAX > 0)
|
||||
{
|
||||
chunks++;
|
||||
@@ -222,11 +214,7 @@ public class resource extends script.base_script
|
||||
if (total > 0)
|
||||
{
|
||||
obj_id crate = createObject(containerTemplate, targetContainer, "");
|
||||
if ((crate == null) || (crate == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((crate != null) && (crate != obj_id.NULL_ID)) {
|
||||
int containerAmount = CONTAINER_VOLUME_MAX;
|
||||
if (total < CONTAINER_VOLUME_MAX)
|
||||
{
|
||||
@@ -242,12 +230,8 @@ public class resource extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] _ret = new obj_id[0];
|
||||
if (ret != null)
|
||||
{
|
||||
_ret = new obj_id[ret.size()];
|
||||
ret.toArray(_ret);
|
||||
}
|
||||
obj_id[] _ret = new obj_id[ret.size()];
|
||||
ret.toArray(_ret);
|
||||
return _ret;
|
||||
}
|
||||
public static obj_id[] create(obj_id resourceId, int amt, obj_id targetContainer) throws InterruptedException
|
||||
@@ -277,7 +261,7 @@ public class resource extends script.base_script
|
||||
return null;
|
||||
}
|
||||
obj_id resourceId = null;
|
||||
if ((loc == null || loc.compareTo(new location()) == 0 || (loc.cell != null && loc.cell != obj_id.NULL_ID)) && isIdValid(targetContainer))
|
||||
if ((loc.compareTo(new location()) == 0 || (loc.cell != null && loc.cell != obj_id.NULL_ID)) && isIdValid(targetContainer))
|
||||
{
|
||||
obj_id topmost = getTopMostContainer(targetContainer);
|
||||
if (topmost != targetContainer)
|
||||
@@ -358,7 +342,6 @@ public class resource extends script.base_script
|
||||
{
|
||||
rangeVal = 1;
|
||||
}
|
||||
int resVal = getSkillStatMod(user, "surveying") / 20;
|
||||
int range_min = getIntObjVar(tool, VAR_SURVEY_RANGE_MIN);
|
||||
int range_max = getIntObjVar(tool, VAR_SURVEY_RANGE_MAX);
|
||||
int res_min = getIntObjVar(tool, VAR_SURVEY_RESOLUTION_MIN);
|
||||
@@ -415,8 +398,7 @@ public class resource extends script.base_script
|
||||
}
|
||||
if (!isResourceDerivedFrom(typeId, resource_class))
|
||||
{
|
||||
prose_package pp = prose.getPackage(SID_WRONG_TOOL, type);
|
||||
sendSystemMessageProse(user, pp);
|
||||
sendSystemMessageProse(user, prose.getPackage(SID_WRONG_TOOL, type));
|
||||
return SAMPLE_STOP_LOOP;
|
||||
}
|
||||
float density = getResourceEfficiency(typeId, getLocation(user));
|
||||
@@ -426,8 +408,7 @@ public class resource extends script.base_script
|
||||
}
|
||||
else if (density < 0.1f)
|
||||
{
|
||||
prose_package proseFailed = prose.getPackage(SID_EFFICIENCY_TOO_LOW, type);
|
||||
sendSystemMessageProse(user, proseFailed);
|
||||
sendSystemMessageProse(user, prose.getPackage(SID_EFFICIENCY_TOO_LOW, type));
|
||||
return SAMPLE_STOP_LOOP;
|
||||
}
|
||||
int modVal = getSkillStatMod(user, "surveying");
|
||||
@@ -438,8 +419,7 @@ public class resource extends script.base_script
|
||||
float famt = BASE_SAMPLE_AMOUNT * deltaDensity;
|
||||
if (famt < 1)
|
||||
{
|
||||
prose_package proseFailed = prose.getPackage(SID_TRACE_AMOUNT, type);
|
||||
sendSystemMessageProse(user, proseFailed);
|
||||
sendSystemMessageProse(user, prose.getPackage(SID_TRACE_AMOUNT, type));
|
||||
return SAMPLE_STOP_LOOP;
|
||||
}
|
||||
location nodecritloc = null;
|
||||
@@ -528,7 +508,6 @@ public class resource extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
int critRoll = rand(1, 100);
|
||||
int rollResult = 10;
|
||||
if (isGod(user))
|
||||
{
|
||||
@@ -536,7 +515,7 @@ public class resource extends script.base_script
|
||||
}
|
||||
if (roll <= rollResult)
|
||||
{
|
||||
critRoll = rand(1, 100);
|
||||
int critRoll = rand(1, 100);
|
||||
if (critRoll <= 50)
|
||||
{
|
||||
sendSystemMessage(user, SID_CRITICAL_SUCCESS);
|
||||
@@ -602,10 +581,10 @@ public class resource extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
int expertiseResourceIncrease = (int)getSkillStatisticModifier(user, "expertise_resource_sampling_increase");
|
||||
int expertiseResourceIncrease = getSkillStatisticModifier(user, "expertise_resource_sampling_increase");
|
||||
if (expertiseResourceIncrease > 0)
|
||||
{
|
||||
amt += (int)(amt * (float)(expertiseResourceIncrease / 100.0f));
|
||||
amt += (int)(amt * expertiseResourceIncrease / 100.0f);
|
||||
}
|
||||
if (buff.hasBuff(user, "tcg_series4_falleens_fist"))
|
||||
{
|
||||
@@ -636,29 +615,28 @@ public class resource extends script.base_script
|
||||
merriam.put("resource", typeId);
|
||||
messageTo(user, "forceSensitiveQuestInfo", merriam, 1, false);
|
||||
}
|
||||
prose_package proseSuccess = prose.getPackage(SID_SAMPLE_LOCATED, type, amt);
|
||||
sendSystemMessageProse(user, proseSuccess);
|
||||
sendSystemMessageProse(user, prose.getPackage(SID_SAMPLE_LOCATED, type, amt));
|
||||
if (isResourceDerivedFrom(typeId, "radioactive"))
|
||||
{
|
||||
int pe = resource.getResourceAttribute(typeId, "res_potential_energy");
|
||||
if (pe > 500)
|
||||
{
|
||||
int pe = resource.getResourceAttribute(typeId, "res_potential_energy");
|
||||
if (pe > 500)
|
||||
int damage = (pe - 500) / 2;
|
||||
if (damage < 1)
|
||||
{
|
||||
int damage = (pe - 500) / 2;
|
||||
if (damage < 1)
|
||||
{
|
||||
damage = 1;
|
||||
}
|
||||
int current = getAttrib(user, HEALTH);
|
||||
if (damage > current)
|
||||
{
|
||||
damage = (current - 1);
|
||||
}
|
||||
addAttribModifier(user, HEALTH, (damage * -1), 0, 0, MOD_POOL);
|
||||
int fatigue = damage / 4;
|
||||
addShockWound(user, fatigue);
|
||||
sendSystemMessage(user, SID_EFFECTS_OF_RADIATION_SICKNESS);
|
||||
damage = 1;
|
||||
}
|
||||
int current = getAttrib(user, HEALTH);
|
||||
if (damage > current)
|
||||
{
|
||||
damage = (current - 1);
|
||||
}
|
||||
addAttribModifier(user, HEALTH, (damage * -1), 0, 0, MOD_POOL);
|
||||
int fatigue = damage / 4;
|
||||
addShockWound(user, fatigue);
|
||||
sendSystemMessage(user, SID_EFFECTS_OF_RADIATION_SICKNESS);
|
||||
}
|
||||
}
|
||||
return SAMPLE_CONTINUE_LOOP;
|
||||
}
|
||||
else
|
||||
@@ -674,13 +652,11 @@ public class resource extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
prose_package proseFailed = prose.getPackage(SID_DENSITY_BELOW_THESHOLD, type);
|
||||
sendSystemMessageProse(user, proseFailed);
|
||||
sendSystemMessageProse(user, prose.getPackage(SID_DENSITY_BELOW_THESHOLD, type));
|
||||
return SAMPLE_STOP_LOOP;
|
||||
}
|
||||
setObjVar(user, VAR_SAMPLE_STAMP, getGameTime() - TIME_FAIL_BONUS);
|
||||
prose_package proseFailed = prose.getPackage(SID_SAMPLE_FAILED, type);
|
||||
sendSystemMessageProse(user, proseFailed);
|
||||
sendSystemMessageProse(user, prose.getPackage(SID_SAMPLE_FAILED, type));
|
||||
return SAMPLE_CONTINUE_LOOP_NOSAMPLE;
|
||||
}
|
||||
public static String getResourceContainerTemplate(obj_id typeId) throws InterruptedException
|
||||
@@ -704,38 +680,48 @@ public class resource extends script.base_script
|
||||
}
|
||||
Vector dsrc = new Vector();
|
||||
dsrc.setSize(0);
|
||||
String resource_class = getStringObjVar(tool, resource.VAR_SURVEY_CLASS);
|
||||
|
||||
dsrc = utils.addElement(dsrc, utils.packStringId(SID_SUI_SURVEY_TOOL_PROPERTIES_RESOURCE_HEADER));
|
||||
|
||||
prose_package ppResource = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RESOURCE);
|
||||
prose.setTO(ppResource, resource_class);
|
||||
prose.setTO(ppResource, getStringObjVar(tool, resource.VAR_SURVEY_CLASS));
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppResource));
|
||||
dsrc = utils.addElement(dsrc, " ");
|
||||
|
||||
int res_min = getIntObjVar(tool, resource.VAR_SURVEY_RESOLUTION_MIN);
|
||||
int res_max = getIntObjVar(tool, resource.VAR_SURVEY_RESOLUTION_MAX);
|
||||
int res_val = getIntObjVar(tool, resource.VAR_SURVEY_RESOLUTION_VALUE);
|
||||
dsrc = utils.addElement(dsrc, utils.packStringId(SID_SUI_SURVEY_TOOL_PROPERTIES_RESOLUTION));
|
||||
|
||||
prose_package ppResMin = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RESOLUTION_MIN);
|
||||
prose.setDI(ppResMin, res_min);
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppResMin));
|
||||
|
||||
prose_package ppResMax = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RESOLUTION_MAX);
|
||||
prose.setDI(ppResMax, res_max);
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppResMax));
|
||||
|
||||
prose_package ppResVal = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RESOLUTION_VAL);
|
||||
prose.setDI(ppResVal, res_val);
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppResVal));
|
||||
dsrc = utils.addElement(dsrc, " ");
|
||||
|
||||
int range_min = getIntObjVar(tool, resource.VAR_SURVEY_RANGE_MIN);
|
||||
int range_max = getIntObjVar(tool, resource.VAR_SURVEY_RANGE_MAX);
|
||||
int range_val = getIntObjVar(tool, resource.VAR_SURVEY_RANGE_VALUE);
|
||||
|
||||
dsrc = utils.addElement(dsrc, utils.packStringId(SID_SUI_SURVEY_TOOL_PROPERTIES_RANGE));
|
||||
prose_package ppRangeMin = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RANGE_MIN);
|
||||
prose.setDI(ppRangeMin, range_min);
|
||||
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppRangeMin));
|
||||
prose_package ppRangeMax = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RANGE_MAX);
|
||||
prose.setDI(ppRangeMax, range_max);
|
||||
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppRangeMax));
|
||||
prose_package ppRangeVal = prose.getPackage(SID_SUI_SURVEY_TOOL_PROPERTIES_RANGE_VAL);
|
||||
prose.setDI(ppRangeVal, range_val);
|
||||
|
||||
dsrc = utils.addElement(dsrc, " \0" + packOutOfBandProsePackage(null, ppRangeVal));
|
||||
if ((dsrc != null) && (dsrc.size() > 0))
|
||||
{
|
||||
@@ -953,12 +939,12 @@ public class resource extends script.base_script
|
||||
{
|
||||
return "";
|
||||
}
|
||||
dictionary row = dataTableGetRow(DATATABLE_RESOURCES, rowNum);
|
||||
int i = 0;
|
||||
String res = null;
|
||||
while ((res == null) || (res.equals("")))
|
||||
int numRows = dataTableGetNumRows(DATATABLE_RESOURCES);
|
||||
while ((res == null) || (res.equals("")) || i > numRows)
|
||||
{
|
||||
res = row.getString("CLASS " + i++);
|
||||
res = dataTableGetRow(DATATABLE_RESOURCES, rowNum).getString("CLASS " + i++);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -972,16 +958,13 @@ public class resource extends script.base_script
|
||||
obj_id[] items = getInventoryAndEquipment(target);
|
||||
if ((items != null) && (items.length > 0))
|
||||
{
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (isGameObjectTypeOf(getGameObjectType(items[i]), GOT_resource_container))
|
||||
{
|
||||
obj_id rId = getResourceContainerResourceType(items[i]);
|
||||
if (isIdValid(rId))
|
||||
{
|
||||
if (isResourceDerivedFrom(rId, "energy") || isResourceDerivedFrom(rId, "radioactive"))
|
||||
{
|
||||
cnt += getPotentialEnergyValue(items[i]);
|
||||
obj_id rId;
|
||||
for (obj_id item : items) {
|
||||
if (isGameObjectTypeOf(getGameObjectType(item), GOT_resource_container)) {
|
||||
rId = getResourceContainerResourceType(item);
|
||||
if (isIdValid(rId)) {
|
||||
if (isResourceDerivedFrom(rId, "energy") || isResourceDerivedFrom(rId, "radioactive")) {
|
||||
cnt += getPotentialEnergyValue(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1005,8 +988,7 @@ public class resource extends script.base_script
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
float ratio = getEnergyPowerRatio(rType);
|
||||
return Math.round(ratio * amt);
|
||||
return Math.round(getEnergyPowerRatio(rType) * amt);
|
||||
}
|
||||
public static float getEnergyPowerRatio(obj_id rType) throws InterruptedException
|
||||
{
|
||||
@@ -1047,24 +1029,19 @@ public class resource extends script.base_script
|
||||
dictionary resourceInfo = new dictionary();
|
||||
if ((items != null) && (items.length > 0))
|
||||
{
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (isGameObjectTypeOf(getGameObjectType(items[i]), GOT_resource_container))
|
||||
{
|
||||
obj_id resourceType = getResourceContainerResourceType(items[i]);
|
||||
if (isIdValid(resourceType))
|
||||
{
|
||||
if (isResourceDerivedFrom(resourceType, "energy_renewable_site_limited_geothermal"))
|
||||
{
|
||||
if (tempListUniqueList.size() == 0)
|
||||
{
|
||||
obj_id resourceType;
|
||||
for (obj_id item : items) {
|
||||
if (isGameObjectTypeOf(getGameObjectType(item), GOT_resource_container)) {
|
||||
resourceType = getResourceContainerResourceType(item);
|
||||
if (isIdValid(resourceType)) {
|
||||
if (isResourceDerivedFrom(resourceType, "energy_renewable_site_limited_geothermal")) {
|
||||
if (tempListUniqueList.size() == 0) {
|
||||
tempListUniqueList.addElement(resourceType);
|
||||
resourceName = getResourceName(resourceType);
|
||||
resourceQuality = getResourceAttribute(resourceType, "res_quality");
|
||||
}
|
||||
if (tempListUniqueList.contains(resourceType))
|
||||
{
|
||||
cnt += getResourceContainerQuantity(items[i]);
|
||||
if (tempListUniqueList.contains(resourceType)) {
|
||||
cnt += getResourceContainerQuantity(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1099,29 +1076,25 @@ public class resource extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0, j = contents.length; i < j; i++)
|
||||
{
|
||||
if (!isIdValid(contents[i]) || !exists(contents[i]))
|
||||
{
|
||||
obj_id container;
|
||||
String parent;
|
||||
|
||||
for (obj_id content : contents) {
|
||||
if (!isIdValid(content) || !exists(content)) {
|
||||
continue;
|
||||
}
|
||||
if (!isResourceContainer(contents[i]))
|
||||
{
|
||||
if (!isResourceContainer(content)) {
|
||||
continue;
|
||||
}
|
||||
obj_id container = getResourceContainerResourceType(contents[i]);
|
||||
if (!isIdValid(container))
|
||||
{
|
||||
container = getResourceContainerResourceType(content);
|
||||
if (!isIdValid(container)) {
|
||||
continue;
|
||||
}
|
||||
String name = getResourceClass(container);
|
||||
String typeName = getResourceName(container);
|
||||
String parent = getResourceParentClass(name);
|
||||
parent = getResourceParentClass(getResourceClass(container));
|
||||
parent = getResourceParentClass(parent);
|
||||
parent = getResourceParentClass(parent);
|
||||
if (resource.equals(parent) && getResourceContainerQuantity(contents[i]) >= quantity)
|
||||
{
|
||||
removeResourceFromContainer(contents[i], getResourceContainerResourceType(contents[i]), quantity);
|
||||
if (resource.equals(parent) && getResourceContainerQuantity(content) >= quantity) {
|
||||
removeResourceFromContainer(content, getResourceContainerResourceType(content), quantity);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1134,28 +1107,23 @@ public class resource extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0, j = contents.length; i < j; i++)
|
||||
{
|
||||
if (!isIdValid(contents[i]) || !exists(contents[i]))
|
||||
{
|
||||
obj_id container;
|
||||
String parent;
|
||||
for (obj_id content : contents) {
|
||||
if (!isIdValid(content) || !exists(content)) {
|
||||
continue;
|
||||
}
|
||||
if (!isResourceContainer(contents[i]))
|
||||
{
|
||||
if (!isResourceContainer(content)) {
|
||||
continue;
|
||||
}
|
||||
obj_id container = getResourceContainerResourceType(contents[i]);
|
||||
if (!isIdValid(container))
|
||||
{
|
||||
container = getResourceContainerResourceType(content);
|
||||
if (!isIdValid(container)) {
|
||||
continue;
|
||||
}
|
||||
String name = getResourceClass(container);
|
||||
String typeName = getResourceName(container);
|
||||
String parent = getResourceParentClass(name);
|
||||
parent = getResourceParentClass(getResourceClass(container));
|
||||
parent = getResourceParentClass(parent);
|
||||
parent = getResourceParentClass(parent);
|
||||
if (resource.equals(parent) && getResourceContainerQuantity(contents[i]) >= quantity)
|
||||
{
|
||||
if (resource.equals(parent) && getResourceContainerQuantity(content) >= quantity) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+52
-111
@@ -1,20 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.bounty_hunter;
|
||||
import script.library.buff;
|
||||
import script.library.performance;
|
||||
import script.library.pet_lib;
|
||||
import script.library.static_item;
|
||||
import script.library.trace;
|
||||
import script.library.xp;
|
||||
import java.util.Enumeration;
|
||||
|
||||
public class respec extends script.base_script
|
||||
{
|
||||
@@ -114,7 +102,6 @@ public class respec extends script.base_script
|
||||
{
|
||||
attachScript(player, "systems.respec.click_combat_respec");
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void handleNpcRespec(obj_id player, String skillTemplateName) throws InterruptedException
|
||||
{
|
||||
@@ -140,11 +127,10 @@ public class respec extends script.base_script
|
||||
String msg = "NPC_RESPEC: %TU has initiated a respec via NPC for " + cost + " credits. Current combat level is " + getLevel(player) + "; current skill template is " + oldTemplate;
|
||||
trace.log("respec", msg, player, trace.TL_CS_LOG);
|
||||
pet_lib.destroyOfficerPets(player);
|
||||
obj_id inv = utils.getInventoryContainer(player);
|
||||
obj_id weapon = getCurrentWeapon(player);
|
||||
if (isIdValid(weapon))
|
||||
{
|
||||
putInOverloaded(weapon, inv);
|
||||
putInOverloaded(weapon, utils.getInventoryContainer(player));
|
||||
}
|
||||
if (cost > 0)
|
||||
{
|
||||
@@ -180,13 +166,6 @@ public class respec extends script.base_script
|
||||
{
|
||||
targetLevel = getTraderLevel(player);
|
||||
}
|
||||
obj_id respecHandler = getObjIdObjVar(player, "npcRespec.tokenId");
|
||||
if (!isMob(respecHandler))
|
||||
{
|
||||
int count = getCount(respecHandler);
|
||||
int newCount = count - 1;
|
||||
boolean adjustedCount = newCount > 0 ? setCount(respecHandler, newCount) : destroyObject(respecHandler);
|
||||
}
|
||||
earnProfessionSkillsViaNpc(player, skillTemplateName, true, targetLevel);
|
||||
int numBought = 0;
|
||||
if (hasObjVar(player, "respecsBought"))
|
||||
@@ -212,7 +191,6 @@ public class respec extends script.base_script
|
||||
{
|
||||
messageTo(player, "removeSmugglingBonuses", null, 1.0f, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void earnProfessionSkillsViaNpc(obj_id player, String skillTemplateName, boolean withItems, int level) throws InterruptedException
|
||||
{
|
||||
@@ -220,11 +198,10 @@ public class respec extends script.base_script
|
||||
callable.storeCallables(player);
|
||||
revokeAllSkillsAndExperience(player);
|
||||
buff.removeAllBuffs(player, true, true);
|
||||
obj_id inv = utils.getInventoryContainer(player);
|
||||
obj_id weapon = getCurrentWeapon(player);
|
||||
if (isIdValid(weapon))
|
||||
{
|
||||
putInOverloaded(weapon, inv);
|
||||
putInOverloaded(weapon, utils.getInventoryContainer(player));
|
||||
}
|
||||
if (level > 0)
|
||||
{
|
||||
@@ -326,13 +303,11 @@ public class respec extends script.base_script
|
||||
{
|
||||
if (!hasObjVar(player, PROF_LEVEL_ARRAY))
|
||||
{
|
||||
int[] newArray =
|
||||
{
|
||||
return new int[]{
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
};
|
||||
return newArray;
|
||||
}
|
||||
return getIntArrayObjVar(player, PROF_LEVEL_ARRAY);
|
||||
}
|
||||
@@ -417,7 +392,6 @@ public class respec extends script.base_script
|
||||
{
|
||||
messageTo(player, "removeSmugglingBonuses", null, 1.0f, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static int getReallocationCost(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -430,12 +404,7 @@ public class respec extends script.base_script
|
||||
}
|
||||
public static boolean hasFreeReallocation(obj_id player) throws InterruptedException
|
||||
{
|
||||
int numFreeRemain = numFreeAllocations(player);
|
||||
if (0 > numFreeRemain)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return 0 <= numFreeAllocations(player);
|
||||
}
|
||||
public static int numFreeAllocations(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -456,19 +425,20 @@ public class respec extends script.base_script
|
||||
int level = 0;
|
||||
if ((skillList != null) && (skillList.length != 0))
|
||||
{
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
dictionary xpReqs = getSkillPrerequisiteExperience(skillList[i]);
|
||||
if ((xpReqs == null) || (xpReqs.isEmpty()))
|
||||
{
|
||||
dictionary xpReqs;
|
||||
Enumeration e;
|
||||
String xpType;
|
||||
|
||||
for (String aSkillList : skillList) {
|
||||
xpReqs = getSkillPrerequisiteExperience(aSkillList);
|
||||
if ((xpReqs == null) || (xpReqs.isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
java.util.Enumeration e = xpReqs.keys();
|
||||
String xpType = (String)(e.nextElement());
|
||||
e = xpReqs.keys();
|
||||
xpType = (String) (e.nextElement());
|
||||
int xpCost = xpReqs.getInt(xpType);
|
||||
int idx = utils.getElementPositionInArray(xpTypes, xpType);
|
||||
if (idx > -1)
|
||||
{
|
||||
if (idx > -1) {
|
||||
totalXp += (xpCost * xpMults[idx]);
|
||||
}
|
||||
}
|
||||
@@ -476,14 +446,10 @@ public class respec extends script.base_script
|
||||
int[] levelList = dataTableGetIntColumn("datatables/player/old_player_level.iff", "xp_required");
|
||||
if ((levelList != null) && (levelList.length != 0))
|
||||
{
|
||||
for (int i = 0; i < levelList.length; i++)
|
||||
{
|
||||
if (levelList[i] <= totalXp)
|
||||
{
|
||||
for (int xpAmountForLevel : levelList) {
|
||||
if (xpAmountForLevel <= totalXp) {
|
||||
level++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -499,16 +465,16 @@ public class respec extends script.base_script
|
||||
{
|
||||
CustomerServiceLog("click_respec", "Player %TU :: *** Skill List ***", player);
|
||||
String[] skillList = getSkillListingForPlayer(player);
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
CustomerServiceLog("click_respec", "Player %TU :: " + skillList[i], player);
|
||||
for (String aSkillList : skillList) {
|
||||
CustomerServiceLog("click_respec", "Player %TU :: " + aSkillList, player);
|
||||
}
|
||||
CustomerServiceLog("click_respec", "Player %TU :: *** Experience List ***", player);
|
||||
dictionary xpList = getExperiencePoints(player);
|
||||
java.util.Enumeration e = xpList.keys();
|
||||
String xpType;
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String xpType = (String)(e.nextElement());
|
||||
xpType = (String) (e.nextElement());
|
||||
int xpCost = xpList.getInt(xpType);
|
||||
CustomerServiceLog("click_respec", "Player %TU :: " + xpType + " = " + xpCost, player);
|
||||
}
|
||||
@@ -536,24 +502,18 @@ public class respec extends script.base_script
|
||||
if (newXpAmount > oldXpAmount)
|
||||
{
|
||||
setWorkingSkill(player, skillList[0]);
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
int skillCost = getSkillXpCost(player, skillList[i]);
|
||||
if (skillCost <= newXpAmount)
|
||||
{
|
||||
for (String aSkillList : skillList) {
|
||||
int skillCost = getSkillXpCost(player, aSkillList);
|
||||
if (skillCost <= newXpAmount) {
|
||||
newXpAmount -= skillCost;
|
||||
if (!hasSkill(player, skillList[i]))
|
||||
{
|
||||
grantSkill(player, skillList[i]);
|
||||
if (withItems)
|
||||
{
|
||||
if (!hasSkill(player, aSkillList)) {
|
||||
grantSkill(player, aSkillList);
|
||||
if (withItems) {
|
||||
skill_template.grantRoadmapItem(player);
|
||||
}
|
||||
}
|
||||
setWorkingSkill(player, skill_template.getNextWorkingSkill(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -601,8 +561,7 @@ public class respec extends script.base_script
|
||||
}
|
||||
java.util.Enumeration e = xpReqs.keys();
|
||||
String xpType = (String)(e.nextElement());
|
||||
int xpCost = xpReqs.getInt(xpType);
|
||||
return xpCost;
|
||||
return xpReqs.getInt(xpType);
|
||||
}
|
||||
public static int getCurrentXpTotal(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -623,12 +582,9 @@ public class respec extends script.base_script
|
||||
{
|
||||
xp_type = "crafting";
|
||||
}
|
||||
String workingSkill = skillList[skillList.length - 1];
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
if (hasSkill(player, skillList[i]))
|
||||
{
|
||||
totalXp += getSkillXpCost(player, skillList[i]);
|
||||
for (String aSkillList : skillList) {
|
||||
if (hasSkill(player, aSkillList)) {
|
||||
totalXp += getSkillXpCost(player, aSkillList);
|
||||
}
|
||||
}
|
||||
totalXp += getExperiencePoints(player, xp_type);
|
||||
@@ -733,15 +689,12 @@ public class respec extends script.base_script
|
||||
String templateSkills = dataTableGetString(skill_template.TEMPLATE_TABLE, skillTemplateName, "template");
|
||||
String[] skillList = split(templateSkills, ',');
|
||||
setWorkingSkill(player, skillList[0]);
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
if (workingSkill != null && skillList[i].equals(workingSkill))
|
||||
{
|
||||
for (String aSkillList : skillList) {
|
||||
if (workingSkill != null && aSkillList.equals(workingSkill)) {
|
||||
break;
|
||||
}
|
||||
grantSkill(player, skillList[i]);
|
||||
if (withItems)
|
||||
{
|
||||
grantSkill(player, aSkillList);
|
||||
if (withItems) {
|
||||
skill_template.grantRoadmapItem(player);
|
||||
}
|
||||
setWorkingSkill(player, skill_template.getNextWorkingSkill(player));
|
||||
@@ -803,22 +756,18 @@ public class respec extends script.base_script
|
||||
"entertainer",
|
||||
"crafting"
|
||||
};
|
||||
for (int i = 0; i < xpTypes.length; i++)
|
||||
{
|
||||
curXp = getExperiencePoints(player, xpTypes[i]);
|
||||
grantExperiencePoints(player, xpTypes[i], -curXp);
|
||||
for (String xpType : xpTypes) {
|
||||
curXp = getExperiencePoints(player, xpType);
|
||||
grantExperiencePoints(player, xpType, -curXp);
|
||||
}
|
||||
String[] skillList = getSkillListingForPlayer(player);
|
||||
int attempts = skillList.length;
|
||||
if ((skillList != null) && (skillList.length != 0))
|
||||
if ((skillList.length != 0))
|
||||
{
|
||||
while (skillList.length > 0 && attempts > 0)
|
||||
{
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
String skillName = skillList[i];
|
||||
if (!skillName.startsWith("costume") && !skillName.startsWith("class_chronicles") && !skillName.startsWith("species_") && !skillName.startsWith("social_language_") && !skillName.startsWith("social_politician_") && !skillName.startsWith("pilot_") && !skillName.startsWith("swg_") && !skillName.startsWith("utility_") && !skillName.startsWith("common_") && !skillName.startsWith("pvp_") && !skillName.startsWith("internal_expertise_") && !skillName.equals("expertise"))
|
||||
{
|
||||
for (String skillName : skillList) {
|
||||
if (!skillName.startsWith("costume") && !skillName.startsWith("class_chronicles") && !skillName.startsWith("species_") && !skillName.startsWith("social_language_") && !skillName.startsWith("social_politician_") && !skillName.startsWith("pilot_") && !skillName.startsWith("swg_") && !skillName.startsWith("utility_") && !skillName.startsWith("common_") && !skillName.startsWith("pvp_") && !skillName.startsWith("internal_expertise_") && !skillName.equals("expertise")) {
|
||||
skill.revokeSkillSilent(player, skillName);
|
||||
}
|
||||
}
|
||||
@@ -835,16 +784,18 @@ public class respec extends script.base_script
|
||||
public static void contentPathHandoff(obj_id self) throws InterruptedException
|
||||
{
|
||||
location origin = getLocation(self);
|
||||
location fighting = new location(3521f, 0.0f, -4821f, origin.area);
|
||||
location crafty = new location(3309.0f, 6.0f, -4785.0f, origin.area);
|
||||
String profession = getSkillTemplate(self);
|
||||
obj_id objInv = utils.getInventoryContainer(self);
|
||||
|
||||
String questNewbieStart = "quest/speeder_quest";
|
||||
String questNewbieStartBH = "quest/speeder_quest";
|
||||
String questCrafterEntertainer = "quest/tatooine_eisley_noncombat";
|
||||
|
||||
int crafter = profession.indexOf("trader");
|
||||
int entertainer = profession.indexOf("entertainer");
|
||||
int bountyhunter = profession.indexOf("bounty_hunter");
|
||||
|
||||
if (crafter > -1 || entertainer > -1)
|
||||
{
|
||||
if (!groundquests.isQuestActiveOrComplete(self, questCrafterEntertainer))
|
||||
@@ -888,7 +839,7 @@ public class respec extends script.base_script
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
float oldSkillPct = 0.0f;
|
||||
float oldSkillPct;
|
||||
if (template.startsWith("trader") || template.startsWith("entertainer"))
|
||||
{
|
||||
String oldSkills = dataTableGetString(skill_template.TEMPLATE_TABLE, template, "template");
|
||||
@@ -898,10 +849,8 @@ public class respec extends script.base_script
|
||||
return 0.0f;
|
||||
}
|
||||
int oldSkillCount = 0;
|
||||
for (int i = 0; i < oldSkillList.length; i++)
|
||||
{
|
||||
if (hasSkill(self, oldSkillList[i]))
|
||||
{
|
||||
for (String anOldSkillList : oldSkillList) {
|
||||
if (hasSkill(self, anOldSkillList)) {
|
||||
oldSkillCount++;
|
||||
}
|
||||
}
|
||||
@@ -1088,8 +1037,7 @@ public class respec extends script.base_script
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int version = dataTableGetInt(EXPERTISE_VERSION_TABLE, row, "version");
|
||||
return version;
|
||||
return dataTableGetInt(EXPERTISE_VERSION_TABLE, row, "version");
|
||||
}
|
||||
public static boolean checkRespecDecay(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1160,15 +1108,8 @@ public class respec extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int timeTillNextDecayOnPlayer = 0;
|
||||
if (hasObjVar(player, OBJVAR_RESPEC_DECAY_TIME))
|
||||
{
|
||||
timeTillNextDecayOnPlayer = getIntObjVar(player, OBJVAR_RESPEC_DECAY_TIME);
|
||||
}
|
||||
int timeTillNextDecay = 0;
|
||||
int now = getCalendarTime();
|
||||
int secondsUntil = secondsUntilNextMonthlyTime(1, 10, 0, 0);
|
||||
timeTillNextDecay = now + secondsUntil;
|
||||
|
||||
int timeTillNextDecay = getCalendarTime() + secondsUntilNextMonthlyTime(1, 10, 0, 0);
|
||||
setObjVar(player, OBJVAR_RESPEC_DECAY_TIME, timeTillNextDecay);
|
||||
return true;
|
||||
}
|
||||
|
||||
Regular → Executable
+40
-69
@@ -56,11 +56,10 @@ public class reverse_engineering extends script.base_script
|
||||
if (isIdValid(player))
|
||||
{
|
||||
String[] possiblePowerUps = POWERUP_SLOTS;
|
||||
for (int i = 0; i < possiblePowerUps.length; i++)
|
||||
{
|
||||
obj_id thingInPlayersSlot = getObjectInSlot(player, possiblePowerUps[i]);
|
||||
if (isPoweredUpItem(thingInPlayersSlot))
|
||||
{
|
||||
obj_id thingInPlayersSlot;
|
||||
for (String possiblePowerUp : possiblePowerUps) {
|
||||
thingInPlayersSlot = getObjectInSlot(player, possiblePowerUp);
|
||||
if (isPoweredUpItem(thingInPlayersSlot)) {
|
||||
applyPowerupItemEquipped(player, thingInPlayersSlot);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +90,6 @@ public class reverse_engineering extends script.base_script
|
||||
{
|
||||
sendSystemMessage(player, new string_id("spam", "powerup_must_equip_item"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void applyPowerupItemEquipped(obj_id player, obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
@@ -115,10 +113,9 @@ public class reverse_engineering extends script.base_script
|
||||
{
|
||||
finalPower = 1;
|
||||
}
|
||||
addSkillModModifier(player, slotName + "_powerup", mod, (int)finalPower, -1, false, false);
|
||||
addSkillModModifier(player, slotName + "_powerup", mod, finalPower, -1, false, false);
|
||||
applyBuffIcon(player, itemWithPowerUp);
|
||||
recalcPoolsIfNeeded(player, mod);
|
||||
return;
|
||||
}
|
||||
public static boolean isPoweredUpItem(obj_id item) throws InterruptedException
|
||||
{
|
||||
@@ -127,9 +124,10 @@ public class reverse_engineering extends script.base_script
|
||||
public static int getPowerupType(obj_id item) throws InterruptedException
|
||||
{
|
||||
int powerupType = -1;
|
||||
String staticName;
|
||||
for (int i = 0; i < POWERUP_ITEMS.length; i++)
|
||||
{
|
||||
String staticName = getStaticItemName(item);
|
||||
staticName = getStaticItemName(item);
|
||||
if (staticName.equals(POWERUP_ITEMS[i]))
|
||||
{
|
||||
powerupType = i;
|
||||
@@ -139,11 +137,8 @@ public class reverse_engineering extends script.base_script
|
||||
}
|
||||
public static float getDieTime(float lifeSpan, obj_id tempObject) throws InterruptedException
|
||||
{
|
||||
float timeStamp = getFloatObjVar(tempObject, ENGINEERING_TIMESTAMP);
|
||||
float deathStamp = timeStamp + reverse_engineering.EXPIRATION_TIME;
|
||||
float rightNow = getGameTime();
|
||||
float dieTime = deathStamp - rightNow;
|
||||
return dieTime;
|
||||
float deathStamp = getFloatObjVar(tempObject, ENGINEERING_TIMESTAMP) + reverse_engineering.EXPIRATION_TIME;
|
||||
return deathStamp - getGameTime();
|
||||
}
|
||||
public static String getMyEquippedSlot(obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
@@ -152,12 +147,11 @@ public class reverse_engineering extends script.base_script
|
||||
if (isIdValid(containingMe))
|
||||
{
|
||||
String[] possibleSlots = POWERUP_SLOTS;
|
||||
for (int i = 0; i < possibleSlots.length; i++)
|
||||
{
|
||||
obj_id thingInPlayersSlot = getObjectInSlot(containingMe, possibleSlots[i]);
|
||||
if (thingInPlayersSlot == itemWithPowerUp)
|
||||
{
|
||||
return possibleSlots[i];
|
||||
obj_id thingInPlayersSlot;
|
||||
for (String possibleSlot : possibleSlots) {
|
||||
thingInPlayersSlot = getObjectInSlot(containingMe, possibleSlot);
|
||||
if (thingInPlayersSlot == itemWithPowerUp) {
|
||||
return possibleSlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,40 +160,34 @@ public class reverse_engineering extends script.base_script
|
||||
public static String getMyBuffIconInt(obj_id powerUp) throws InterruptedException
|
||||
{
|
||||
int powerupType = getPowerupType(powerUp);
|
||||
String buffName = "";
|
||||
String buffName;
|
||||
switch (powerupType)
|
||||
{
|
||||
case 0:
|
||||
buffName = POWERUP_CHEST;
|
||||
break;
|
||||
buffName = POWERUP_CHEST;
|
||||
break;
|
||||
case 1:
|
||||
buffName = POWERUP_SHIRT;
|
||||
break;
|
||||
buffName = POWERUP_SHIRT;
|
||||
break;
|
||||
case 2:
|
||||
buffName = POWERUP_WEAPON;
|
||||
break;
|
||||
buffName = POWERUP_WEAPON;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
return buffName;
|
||||
}
|
||||
public static String getMyBuffIconString(obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
String buffName = "";
|
||||
String slotName = getMyEquippedSlot(itemWithPowerUp);
|
||||
if (slotName.equals("chest2"))
|
||||
{
|
||||
buffName = POWERUP_CHEST;
|
||||
switch(getMyEquippedSlot(itemWithPowerUp)){
|
||||
case "chest2":
|
||||
return POWERUP_CHEST;
|
||||
case "chest1":
|
||||
return POWERUP_SHIRT;
|
||||
case "hold_r":
|
||||
default:
|
||||
return POWERUP_WEAPON;
|
||||
}
|
||||
if (slotName.equals("chest1"))
|
||||
{
|
||||
buffName = POWERUP_SHIRT;
|
||||
}
|
||||
if (slotName.equals("hold_r"))
|
||||
{
|
||||
buffName = POWERUP_WEAPON;
|
||||
}
|
||||
return buffName;
|
||||
}
|
||||
public static void applyBuffIcon(obj_id player, obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
@@ -207,8 +195,8 @@ public class reverse_engineering extends script.base_script
|
||||
}
|
||||
public static void applyBuffIcon(obj_id player, obj_id powerUp, obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
String buffName = "";
|
||||
float expiration = 0f;
|
||||
String buffName;
|
||||
float expiration;
|
||||
if (!isIdValid(powerUp))
|
||||
{
|
||||
buffName = getMyBuffIconString(itemWithPowerUp);
|
||||
@@ -226,7 +214,6 @@ public class reverse_engineering extends script.base_script
|
||||
{
|
||||
buff.applyBuff(player, buffName, expiration);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void removeBuffIcon(obj_id player, obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
@@ -235,7 +222,6 @@ public class reverse_engineering extends script.base_script
|
||||
{
|
||||
buff.removeBuff(player, buffName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void recalcPoolsIfNeeded(obj_id player, String mod) throws InterruptedException
|
||||
{
|
||||
@@ -246,7 +232,6 @@ public class reverse_engineering extends script.base_script
|
||||
combat.cacheCombatData(player);
|
||||
trial.bumpSession(player, "displayDefensiveMods");
|
||||
messageTo(player, "setDisplayOnlyDefensiveMods", trial.getSessionDict(player, "displayDefensiveMods"), 5, false);
|
||||
return;
|
||||
}
|
||||
public static void addModsAndScript(obj_id player, obj_id powerUp, obj_id itemToPowerUp) throws InterruptedException
|
||||
{
|
||||
@@ -254,17 +239,14 @@ public class reverse_engineering extends script.base_script
|
||||
}
|
||||
public static void addModsAndScript(obj_id player, obj_id powerUp, obj_id itemToPowerUp, float remainingTime) throws InterruptedException
|
||||
{
|
||||
String mod = getStringObjVar(powerUp, ENGINEERING_MODIFIER);
|
||||
int ratio = getIntObjVar(powerUp, ENGINEERING_RATIO);
|
||||
int power = getIntObjVar(powerUp, ENGINEERING_POWER);
|
||||
float timeStamp = getGameTime();
|
||||
if (remainingTime > 0f)
|
||||
{
|
||||
timeStamp = remainingTime;
|
||||
}
|
||||
setObjVar(itemToPowerUp, ENGINEERING_MODIFIER, mod);
|
||||
setObjVar(itemToPowerUp, ENGINEERING_RATIO, ratio);
|
||||
setObjVar(itemToPowerUp, ENGINEERING_POWER, power);
|
||||
setObjVar(itemToPowerUp, ENGINEERING_MODIFIER, getStringObjVar(powerUp, ENGINEERING_MODIFIER));
|
||||
setObjVar(itemToPowerUp, ENGINEERING_RATIO, getIntObjVar(powerUp, ENGINEERING_RATIO));
|
||||
setObjVar(itemToPowerUp, ENGINEERING_POWER, getIntObjVar(powerUp, ENGINEERING_POWER));
|
||||
setObjVar(itemToPowerUp, ENGINEERING_TIMESTAMP, timeStamp);
|
||||
if (!isPoweredUpItem(itemToPowerUp))
|
||||
{
|
||||
@@ -287,15 +269,11 @@ public class reverse_engineering extends script.base_script
|
||||
}
|
||||
trial.bumpSession(itemWithPowerUp, "displayDefensiveMods");
|
||||
messageTo(itemWithPowerUp, "setDisplayOnlyDefensiveMods", trial.getSessionDict(itemWithPowerUp, "displayDefensiveMods"), 5, false);
|
||||
return;
|
||||
}
|
||||
public static void removePlayerPowerUpMods(obj_id player, obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
String slotName = getMyEquippedSlot(itemWithPowerUp);
|
||||
String mod = getStringObjVar(itemWithPowerUp, ENGINEERING_MODIFIER);
|
||||
removeAttribOrSkillModModifier(player, slotName + "_powerup");
|
||||
recalcPoolsIfNeeded(player, mod);
|
||||
return;
|
||||
removeAttribOrSkillModModifier(player, getMyEquippedSlot(itemWithPowerUp) + "_powerup");
|
||||
recalcPoolsIfNeeded(player, getStringObjVar(itemWithPowerUp, ENGINEERING_MODIFIER));
|
||||
}
|
||||
public static void powerUpAttached(obj_id player, obj_id itemWithPowerUp) throws InterruptedException
|
||||
{
|
||||
@@ -311,25 +289,18 @@ public class reverse_engineering extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
int power = getIntObjVar(itemWithPowerUp, ENGINEERING_POWER);
|
||||
String mod = getStringObjVar(itemWithPowerUp, ENGINEERING_MODIFIER);
|
||||
int ratio = getIntObjVar(itemWithPowerUp, ENGINEERING_RATIO);
|
||||
int finalPower = power / ratio;
|
||||
int finalPower = getIntObjVar(itemWithPowerUp, ENGINEERING_POWER) / getIntObjVar(itemWithPowerUp, ENGINEERING_RATIO);
|
||||
if (finalPower < 1)
|
||||
{
|
||||
finalPower = 1;
|
||||
}
|
||||
addSkillModModifier(player, slotName + "_powerup", mod, (int)finalPower, -1, false, false);
|
||||
addSkillModModifier(player, slotName + "_powerup", mod, finalPower, -1, false, false);
|
||||
recalcPoolsIfNeeded(player, mod);
|
||||
return;
|
||||
}
|
||||
public static boolean canMakePowerUp(String mod) throws InterruptedException
|
||||
{
|
||||
if (dataTableGetInt(SPECIAL_MOD_TABLE, mod, "no_pup") > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return dataTableGetInt(SPECIAL_MOD_TABLE, mod, "no_pup") <= 0;
|
||||
}
|
||||
public static boolean canStaticItemBeReversedEngineered(obj_id item) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+61
-128
@@ -1,21 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.poi;
|
||||
import script.library.utils;
|
||||
import script.library.chat;
|
||||
import script.library.group;
|
||||
import script.library.combat;
|
||||
import script.library.ai_lib;
|
||||
import script.ai.ai_combat;
|
||||
import java.util.Vector;
|
||||
|
||||
public class scenario extends script.base_script
|
||||
{
|
||||
@@ -107,16 +94,13 @@ public class scenario extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int idx = params.getInt(DICT_IDX);
|
||||
String scenario_name = params.getString(COL_NAME);
|
||||
String convo = params.getString(COL_CONVO);
|
||||
if (hasObjVar(master, VAR_SCENARIO_BASE))
|
||||
{
|
||||
removeObjVar(master, VAR_SCENARIO_BASE);
|
||||
}
|
||||
setObjVar(master, VAR_SCENARIO_IDX, idx);
|
||||
setObjVar(master, VAR_SCENARIO_NAME, scenario_name);
|
||||
setObjVar(master, VAR_SCENARIO_CONVO, convo);
|
||||
setObjVar(master, VAR_SCENARIO_IDX, params.getInt(DICT_IDX));
|
||||
setObjVar(master, VAR_SCENARIO_NAME, params.getString(COL_NAME));
|
||||
setObjVar(master, VAR_SCENARIO_CONVO, params.getString(COL_CONVO));
|
||||
return messageTo(master, HANDLER_INIT_SCENARIO, params, 2, true);
|
||||
}
|
||||
public static boolean createTeam(obj_id master, String team_name, String team_faction) throws InterruptedException
|
||||
@@ -158,11 +142,10 @@ public class scenario extends script.base_script
|
||||
Vector team_members = getResizeableObjIdArrayObjVar(master, member_path);
|
||||
if (team_members != null && team_members.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < team_members.size(); i++)
|
||||
{
|
||||
obj_id target = ((obj_id)team_members.get(i));
|
||||
if (isIdValid(target))
|
||||
{
|
||||
obj_id target;
|
||||
for (Object team_member : team_members) {
|
||||
target = ((obj_id) team_member);
|
||||
if (isIdValid(target)) {
|
||||
factions.setFaction(target, team_faction);
|
||||
}
|
||||
}
|
||||
@@ -179,8 +162,6 @@ public class scenario extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String team_path = VAR_TEAM + "." + team_name;
|
||||
String fac_path = team_path + ".faction";
|
||||
return getStringObjVar(master, VAR_TEAM + "." + team_name + ".faction");
|
||||
}
|
||||
public static obj_id createTeamNpc(obj_id master, String team_name, String type, String ident, location here) throws InterruptedException
|
||||
@@ -247,8 +228,7 @@ public class scenario extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
obj_id master = poi.getBaseObject(self);
|
||||
obj_id master = poi.getBaseObject(getSelf());
|
||||
if ((master == null) || (master == obj_id.NULL_ID))
|
||||
{
|
||||
return null;
|
||||
@@ -257,10 +237,13 @@ public class scenario extends script.base_script
|
||||
if (teamsList != null)
|
||||
{
|
||||
int teamCount = teamsList.getNumItems();
|
||||
obj_var ov;
|
||||
obj_var_list team;
|
||||
|
||||
for (int i = 0; i < teamCount; i++)
|
||||
{
|
||||
obj_var ov = teamsList.getObjVar(i);
|
||||
obj_var_list team = (obj_var_list)(ov);
|
||||
ov = teamsList.getObjVar(i);
|
||||
team = (obj_var_list) (ov);
|
||||
if (team != null)
|
||||
{
|
||||
if (team.hasObjVar("members." + actor))
|
||||
@@ -290,7 +273,7 @@ public class scenario extends script.base_script
|
||||
if (idx != -1)
|
||||
{
|
||||
Vector member_alive = getResizeableIntArrayObjVar(master, VAR_TEAM + "." + team_name + ".member_alive");
|
||||
return (((Integer)member_alive.get(idx)).intValue() == 1);
|
||||
return ((Integer) member_alive.get(idx) == 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -482,7 +465,7 @@ public class scenario extends script.base_script
|
||||
{
|
||||
for (int i = 0; i < team.size(); i++)
|
||||
{
|
||||
if (((obj_id)team.get(i)) == member)
|
||||
if (team.get(i) == member)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@@ -504,13 +487,12 @@ public class scenario extends script.base_script
|
||||
return false;
|
||||
}
|
||||
String creditPath = VAR_TEAM + "." + team_name + ".kill_credits";
|
||||
for (int i = 0; i < killers.length; i++)
|
||||
{
|
||||
LOG("SCENARIO", "granting kill credit to " + getName(killers[i]) + " " + team_name);
|
||||
String path = creditPath + "." + killers[i];
|
||||
String path;
|
||||
for (obj_id killer : killers) {
|
||||
LOG("SCENARIO", "granting kill credit to " + getName(killer) + " " + team_name);
|
||||
path = creditPath + "." + killer;
|
||||
int cnt = 0;
|
||||
if (hasObjVar(master, path))
|
||||
{
|
||||
if (hasObjVar(master, path)) {
|
||||
cnt = getIntObjVar(master, path);
|
||||
}
|
||||
cnt++;
|
||||
@@ -599,33 +581,16 @@ public class scenario extends script.base_script
|
||||
poi.complete(poiMaster);
|
||||
return true;
|
||||
}
|
||||
public static boolean complete() throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
obj_id master = poi.getBaseObject(self);
|
||||
if ((master == null) || (master == obj_id.NULL_ID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return complete(master);
|
||||
public static boolean complete() throws InterruptedException {
|
||||
obj_id master = poi.getBaseObject(getSelf());
|
||||
return !((master == null) || (master == obj_id.NULL_ID)) && complete(master);
|
||||
}
|
||||
public static boolean isComplete(obj_id poiMaster) throws InterruptedException
|
||||
{
|
||||
if (poiMaster == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return getBooleanObjVar(poiMaster, VAR_SCENARIO_COMPLETE);
|
||||
public static boolean isComplete(obj_id poiMaster) throws InterruptedException {
|
||||
return poiMaster != null && getBooleanObjVar(poiMaster, VAR_SCENARIO_COMPLETE);
|
||||
}
|
||||
public static boolean isComplete() throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
obj_id master = poi.getBaseObject(self);
|
||||
if ((master == null) || (master == obj_id.NULL_ID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isComplete(master);
|
||||
public static boolean isComplete() throws InterruptedException {
|
||||
obj_id master = poi.getBaseObject(getSelf());
|
||||
return !((master == null) || (master == obj_id.NULL_ID)) && isComplete(master);
|
||||
}
|
||||
public static boolean setPlayerProgress(obj_id player, int progress) throws InterruptedException
|
||||
{
|
||||
@@ -633,8 +598,7 @@ public class scenario extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
obj_id self = getSelf();
|
||||
obj_id master = poi.getBaseObject(self);
|
||||
obj_id master = poi.getBaseObject(getSelf());
|
||||
if ((master == null) || (master == obj_id.NULL_ID))
|
||||
{
|
||||
return false;
|
||||
@@ -648,8 +612,7 @@ public class scenario extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
obj_id self = getSelf();
|
||||
obj_id master = poi.getBaseObject(self);
|
||||
obj_id master = poi.getBaseObject(getSelf());
|
||||
if ((master == null) || (master == obj_id.NULL_ID))
|
||||
{
|
||||
return false;
|
||||
@@ -664,8 +627,7 @@ public class scenario extends script.base_script
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
obj_id self = getSelf();
|
||||
obj_id master = poi.getBaseObject(self);
|
||||
obj_id master = poi.getBaseObject(getSelf());
|
||||
if ((master == null) || (master == obj_id.NULL_ID))
|
||||
{
|
||||
return -1;
|
||||
@@ -689,18 +651,17 @@ public class scenario extends script.base_script
|
||||
int numItems = ovl.getNumItems();
|
||||
if (numItems > 0)
|
||||
{
|
||||
obj_var ov;
|
||||
String ovName;
|
||||
obj_id tmp;
|
||||
for (int i = 0; i < numItems; i++)
|
||||
{
|
||||
obj_var ov = ovl.getObjVar(i);
|
||||
String ovName = ov.getName();
|
||||
ov = ovl.getObjVar(i);
|
||||
ovName = ov.getName();
|
||||
if (ovName.startsWith(prefix))
|
||||
{
|
||||
obj_id tmp = getObjIdObjVar(poiMaster, "poi.stringList." + ovName);
|
||||
if ((tmp == null) || (tmp == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = getObjIdObjVar(poiMaster, "poi.stringList." + ovName);
|
||||
if ((tmp != null) && (tmp != obj_id.NULL_ID)) {
|
||||
actors = utils.addElement(actors, tmp);
|
||||
}
|
||||
}
|
||||
@@ -715,11 +676,8 @@ public class scenario extends script.base_script
|
||||
else
|
||||
{
|
||||
obj_id[] _actors = new obj_id[0];
|
||||
if (actors != null)
|
||||
{
|
||||
_actors = new obj_id[actors.size()];
|
||||
actors.toArray(_actors);
|
||||
}
|
||||
_actors = new obj_id[actors.size()];
|
||||
actors.toArray(_actors);
|
||||
return _actors;
|
||||
}
|
||||
}
|
||||
@@ -787,29 +745,24 @@ public class scenario extends script.base_script
|
||||
return false;
|
||||
}
|
||||
obj_id[] primaryKillers = getObjIdArrayObjVar(self, VAR_PRIMARY_KILLERS);
|
||||
if ((primaryKillers == null) || (primaryKillers.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((primaryKillers != null) && (primaryKillers.length != 0)) {
|
||||
obj_id pk;
|
||||
obj_id groupId;
|
||||
obj_id[] members;
|
||||
for (int i = 0; i < primaryKillers.length; i++)
|
||||
{
|
||||
obj_id pk = primaryKillers[i];
|
||||
if ((pk == null) || (pk == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pk = primaryKillers[i];
|
||||
if ((pk != null) && (pk != obj_id.NULL_ID)) {
|
||||
if (isPlayer(pk))
|
||||
{
|
||||
obj_id groupId = getGroupObject(pk);
|
||||
groupId = getGroupObject(pk);
|
||||
if (isIdValid(groupId))
|
||||
{
|
||||
poi.grantCredit(self, pk);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
obj_id[] members = getGroupMemberIds(groupId);
|
||||
members = getGroupMemberIds(groupId);
|
||||
if (members != null && members.length > 0)
|
||||
{
|
||||
for (int n = 0; i < members.length; i++)
|
||||
@@ -819,25 +772,18 @@ public class scenario extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (group.isGroupObject(pk))
|
||||
{
|
||||
obj_id[] members = getGroupMemberIds(pk);
|
||||
if ((members == null) || (members.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
members = getGroupMemberIds(pk);
|
||||
if ((members != null) && (members.length != 0)) {
|
||||
for (int n = 0; i < members.length; i++)
|
||||
{
|
||||
poi.grantCredit(self, members[n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -863,14 +809,9 @@ public class scenario extends script.base_script
|
||||
if (isIdValid(poiMaster))
|
||||
{
|
||||
obj_id[] members = getActorsWithNamePrefix(poiMaster, prefix);
|
||||
if ((members == null) || (members.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < members.length; i++)
|
||||
{
|
||||
faceTo(members[i], target);
|
||||
if ((members != null) && (members.length != 0)) {
|
||||
for (obj_id member : members) {
|
||||
faceTo(member, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -883,21 +824,13 @@ public class scenario extends script.base_script
|
||||
{
|
||||
int formation = rand(0, 1);
|
||||
obj_id[] members = getActorsWithNamePrefix(poiMaster, prefix);
|
||||
if ((members == null) || (members.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((members != null) && (members.length != 0)) {
|
||||
int pos = 1;
|
||||
for (int i = 0; i < members.length; i++)
|
||||
{
|
||||
if ((members[i] == leader) && (leader != formTarget))
|
||||
{
|
||||
for (obj_id member : members) {
|
||||
if ((member == leader) && (leader != formTarget)) {
|
||||
ai_lib.aiFollow(leader, formTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
ai_lib.followInFormation(members[i], leader, formation, pos);
|
||||
} else {
|
||||
ai_lib.followInFormation(member, leader, formation, pos);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+51
-75
@@ -1,15 +1,9 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
import script.library.static_item;
|
||||
import script.library.utils;
|
||||
import java.util.Vector;
|
||||
|
||||
public class scheduled_drop extends script.base_script
|
||||
{
|
||||
@@ -99,9 +93,8 @@ public class scheduled_drop extends script.base_script
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (int i = 0, j = promotionList.length; i < j; i++)
|
||||
{
|
||||
weight += promotionList[i].getInt("promotionWeight");
|
||||
for (dictionary aPromotionList : promotionList) {
|
||||
weight += aPromotionList.getInt("promotionWeight");
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
@@ -141,15 +134,15 @@ public class scheduled_drop extends script.base_script
|
||||
}
|
||||
Vector allStaticItems = new Vector();
|
||||
allStaticItems.setSize(0);
|
||||
for (int i = 0, j = promotionNames.length; i < j; i++)
|
||||
{
|
||||
for (int k = 0, l = allItems.length; k < l; k++)
|
||||
{
|
||||
String promotionList = dataTableGetString(DATATABLE_SCHEDULE, promotionNames[i], DATATABLE_SCHEDULE_PROMO_LIST);
|
||||
if (allPromotionLists[k].equals(promotionList))
|
||||
{
|
||||
dictionary cardEntry = new dictionary();
|
||||
cardEntry.put("promotionName", promotionNames[i]);
|
||||
String promotionList;
|
||||
dictionary cardEntry;
|
||||
|
||||
for (String promotionName : promotionNames) {
|
||||
for (int k = 0, l = allItems.length; k < l; k++) {
|
||||
promotionList = dataTableGetString(DATATABLE_SCHEDULE, promotionName, DATATABLE_SCHEDULE_PROMO_LIST);
|
||||
if (allPromotionLists[k].equals(promotionList)) {
|
||||
cardEntry = new dictionary();
|
||||
cardEntry.put("promotionName", promotionName);
|
||||
cardEntry.put("promotionList", allPromotionLists[k]);
|
||||
cardEntry.put("promotionItem", allItems[k]);
|
||||
cardEntry.put("promotionWeight", allWeights[k]);
|
||||
@@ -185,11 +178,10 @@ public class scheduled_drop extends script.base_script
|
||||
scheduledPromotions.setSize(0);
|
||||
int currentDate = getCalendarTime();
|
||||
testingSpam(self, "currentDate: " + currentDate + " realTime: " + getCalendarTimeStringLocal(currentDate));
|
||||
for (int i = 0, promotionsLength = promotions.length; i < promotionsLength; i++)
|
||||
{
|
||||
dictionary currentPromotion = dataTableGetRow(DATATABLE_SCHEDULE, promotions[i]);
|
||||
if (!(currentPromotion.getString(DATATABLE_SCHEDULE_PROMO_TYPE)).equals(promotionType))
|
||||
{
|
||||
dictionary currentPromotion;
|
||||
for (String promotion : promotions) {
|
||||
currentPromotion = dataTableGetRow(DATATABLE_SCHEDULE, promotion);
|
||||
if (!(currentPromotion.getString(DATATABLE_SCHEDULE_PROMO_TYPE)).equals(promotionType)) {
|
||||
continue;
|
||||
}
|
||||
int startHour = currentPromotion.getInt(DATATABLE_SCHEDULE_PROMO_START_HOUR);
|
||||
@@ -207,8 +199,7 @@ public class scheduled_drop extends script.base_script
|
||||
int endYear = currentPromotion.getInt(DATATABLE_SCHEDULE_PROMO_END_YEAR);
|
||||
int endDate = getCalendarTime(endYear, endMonth, endDay, endHour, endMinute, endSecond);
|
||||
testingSpam(self, "Scheduled Promotion: " + currentPromotion.getString(DATATABLE_SCHEDULE_PROMO_NAME) + " Start: " + startDate + " End: " + endDate);
|
||||
if (startDate <= currentDate && endDate >= currentDate)
|
||||
{
|
||||
if (startDate <= currentDate && endDate >= currentDate) {
|
||||
scheduledPromotions = utils.addElement(scheduledPromotions, currentPromotion.getString(DATATABLE_SCHEDULE_PROMO_NAME));
|
||||
}
|
||||
}
|
||||
@@ -227,13 +218,12 @@ public class scheduled_drop extends script.base_script
|
||||
public static dictionary[] getPromotionMaxDrops(String[] promotions) throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
Vector maxDrops = new Vector();
|
||||
maxDrops.setSize(0);
|
||||
String[] allPromotions = getSchedulerPromotions();
|
||||
int[] allDrops = getSchedulerMaxDrops();
|
||||
Vector promotionsWithDrops = new Vector();
|
||||
promotionsWithDrops.setSize(0);
|
||||
testingSpam(self, "getPromotionMaxDrops allPromotions.length: " + allPromotions.length + " promotions.length: " + promotions.length);
|
||||
dictionary tempPromotion;
|
||||
for (int i = 0, j = promotions.length; i < j; i++)
|
||||
{
|
||||
for (int k = 0, l = allPromotions.length; k < l; k++)
|
||||
@@ -241,7 +231,7 @@ public class scheduled_drop extends script.base_script
|
||||
testingSpam(self, "allPromotions[" + k + "]: " + allPromotions[k] + " promotions[" + i + "]: " + promotions[i] + " allDrops[" + k + "]: " + allDrops[k]);
|
||||
if (promotions[i].equals(allPromotions[k]))
|
||||
{
|
||||
dictionary tempPromotion = new dictionary();
|
||||
tempPromotion = new dictionary();
|
||||
tempPromotion.put("promotion", promotions[i]);
|
||||
tempPromotion.put("promotionMaxDrops", modifyPromotionCountByServer(allDrops[k]));
|
||||
promotionsWithDrops = utils.addElement(promotionsWithDrops, tempPromotion);
|
||||
@@ -259,7 +249,7 @@ public class scheduled_drop extends script.base_script
|
||||
public static int modifyPromotionCountByServer(int promotionCount) throws InterruptedException
|
||||
{
|
||||
String serverName = toLower(getConfigSetting("CentralServer", "clusterName"));
|
||||
float percentOfCount = 0.0f;
|
||||
float percentOfCount;
|
||||
if (serverName == null || serverName.length() <= 0)
|
||||
{
|
||||
percentOfCount = 0.01f;
|
||||
@@ -276,13 +266,11 @@ public class scheduled_drop extends script.base_script
|
||||
}
|
||||
public static int getLastClusterUpdateTime() throws InterruptedException
|
||||
{
|
||||
obj_id planet = getPlanetByName("tatooine");
|
||||
return getIntObjVar(planet, CLUSTER_OBJVAR_LAST_UPDATE);
|
||||
return getIntObjVar(getPlanetByName("tatooine"), CLUSTER_OBJVAR_LAST_UPDATE);
|
||||
}
|
||||
public static void setLastClusterUpdateTime(int date) throws InterruptedException
|
||||
{
|
||||
obj_id planet = getPlanetByName("tatooine");
|
||||
setObjVar(planet, CLUSTER_OBJVAR_LAST_UPDATE, date);
|
||||
setObjVar(getPlanetByName("tatooine"), CLUSTER_OBJVAR_LAST_UPDATE, date);
|
||||
}
|
||||
public static void removeLastClusterUpdateTime() throws InterruptedException
|
||||
{
|
||||
@@ -297,9 +285,8 @@ public class scheduled_drop extends script.base_script
|
||||
{
|
||||
obj_id planet = getPlanetByName("tatooine");
|
||||
String[] promotions = getSchedulerPromotions();
|
||||
for (int i = 0, j = promotions.length; i < j; i++)
|
||||
{
|
||||
removeObjVar(planet, "tcg." + promotions[i] + ".count");
|
||||
for (String promotion : promotions) {
|
||||
removeObjVar(planet, "tcg." + promotion + ".count");
|
||||
}
|
||||
}
|
||||
public static void setClusterPromotions(dictionary[] promotionsWithMaxDrops) throws InterruptedException
|
||||
@@ -314,9 +301,8 @@ public class scheduled_drop extends script.base_script
|
||||
messageTo(planet, "clearPromotions", null, 1.0f, false);
|
||||
return;
|
||||
}
|
||||
for (int i = 0, j = promotionsWithMaxDrops.length; i < j; i++)
|
||||
{
|
||||
messageTo(planet, "setPromotion", promotionsWithMaxDrops[i], 1.0f, false);
|
||||
for (dictionary promotionsWithMaxDrop : promotionsWithMaxDrops) {
|
||||
messageTo(planet, "setPromotion", promotionsWithMaxDrop, 1.0f, false);
|
||||
}
|
||||
}
|
||||
public static void instantiatePromotionsOnCluster() throws InterruptedException
|
||||
@@ -330,17 +316,10 @@ public class scheduled_drop extends script.base_script
|
||||
String[] currentPromotions = getScheduledPromotions("card");
|
||||
obj_id self = getSelf();
|
||||
testingSpam(self, "Card promotions length: " + currentPromotions.length);
|
||||
if (currentPromotions == null)
|
||||
{
|
||||
setClusterPromotions(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
setClusterPromotions(getPromotionMaxDrops(currentPromotions));
|
||||
}
|
||||
setClusterPromotions(getPromotionMaxDrops(currentPromotions));
|
||||
currentPromotions = getScheduledPromotions("item");
|
||||
testingSpam(self, "Item promotions length: " + currentPromotions.length);
|
||||
if (currentPromotions != null && currentPromotions.length > 0)
|
||||
if (currentPromotions.length > 0)
|
||||
{
|
||||
setClusterPromotions(getPromotionMaxDrops(currentPromotions));
|
||||
}
|
||||
@@ -354,12 +333,10 @@ public class scheduled_drop extends script.base_script
|
||||
}
|
||||
Vector validatedPromotions = new Vector();
|
||||
validatedPromotions.setSize(0);
|
||||
for (int i = 0, j = promotionNames.length; i < j; i++)
|
||||
{
|
||||
int countLeft = getIntObjVar(planet, "tcg." + promotionNames[i] + ".count");
|
||||
if (countLeft > 0 || countLeft == -1)
|
||||
{
|
||||
validatedPromotions = utils.addElement(validatedPromotions, promotionNames[i]);
|
||||
for (String promotionName : promotionNames) {
|
||||
int countLeft = getIntObjVar(planet, "tcg." + promotionName + ".count");
|
||||
if (countLeft > 0 || countLeft == -1) {
|
||||
validatedPromotions = utils.addElement(validatedPromotions, promotionName);
|
||||
}
|
||||
}
|
||||
String[] _validatedPromotions = new String[0];
|
||||
@@ -375,21 +352,21 @@ public class scheduled_drop extends script.base_script
|
||||
switch (systemToDrop)
|
||||
{
|
||||
case SYSTEM_COMBAT_NORMAL:
|
||||
return CARD_DELAY_COMBAT_NORMAL;
|
||||
return CARD_DELAY_COMBAT_NORMAL;
|
||||
case SYSTEM_COMBAT_ELITE:
|
||||
return CARD_DELAY_COMBAT_ELITE;
|
||||
return CARD_DELAY_COMBAT_ELITE;
|
||||
case SYSTEM_COMBAT_BOSS:
|
||||
return CARD_DELAY_COMBAT_BOSS;
|
||||
return CARD_DELAY_COMBAT_BOSS;
|
||||
case SYSTEM_COMBAT_SPACE:
|
||||
return CARD_DELAY_COMBAT_SPACE;
|
||||
return CARD_DELAY_COMBAT_SPACE;
|
||||
case SYSTEM_ENTERTAINER:
|
||||
return CARD_DELAY_ENTERTAINER;
|
||||
return CARD_DELAY_ENTERTAINER;
|
||||
case SYSTEM_CRAFTER:
|
||||
return CARD_DELAY_CRAFTER;
|
||||
return CARD_DELAY_CRAFTER;
|
||||
case SYSTEM_UNKNOWN:
|
||||
return CARD_DELAY_DEFAULT;
|
||||
return CARD_DELAY_DEFAULT;
|
||||
default:
|
||||
return CARD_DELAY_DEFAULT;
|
||||
return CARD_DELAY_DEFAULT;
|
||||
}
|
||||
}
|
||||
public static boolean hasCardDelay(obj_id player, int systemToDrop) throws InterruptedException
|
||||
@@ -418,17 +395,17 @@ public class scheduled_drop extends script.base_script
|
||||
switch (systemToDrop)
|
||||
{
|
||||
case SYSTEM_COMBAT_NORMAL:
|
||||
return (rand(1, DROP_CHANCE_COMBAT_NORMAL) == 1 ? true : false);
|
||||
return (rand(1, DROP_CHANCE_COMBAT_NORMAL) == 1);
|
||||
case SYSTEM_COMBAT_ELITE:
|
||||
return (rand(1, DROP_CHANCE_COMBAT_ELITE) == 1 ? true : false);
|
||||
return (rand(1, DROP_CHANCE_COMBAT_ELITE) == 1);
|
||||
case SYSTEM_COMBAT_BOSS:
|
||||
return (rand(1, DROP_CHANCE_COMBAT_BOSS) == 1 ? true : false);
|
||||
return (rand(1, DROP_CHANCE_COMBAT_BOSS) == 1);
|
||||
case SYSTEM_COMBAT_SPACE:
|
||||
return (rand(1, DROP_CHANCE_COMBAT_SPACE) == 1 ? true : false);
|
||||
return (rand(1, DROP_CHANCE_COMBAT_SPACE) == 1);
|
||||
case SYSTEM_ENTERTAINER:
|
||||
return (rand(1, DROP_CHANCE_ENTERTAINER) == 1 ? true : false);
|
||||
return (rand(1, DROP_CHANCE_ENTERTAINER) == 1);
|
||||
case SYSTEM_CRAFTER:
|
||||
return (rand(1, DROP_CHANCE_CRAFTER) == 1 ? true : false);
|
||||
return (rand(1, DROP_CHANCE_CRAFTER) == 1);
|
||||
case SYSTEM_UNKNOWN:
|
||||
return false;
|
||||
default:
|
||||
@@ -438,10 +415,7 @@ public class scheduled_drop extends script.base_script
|
||||
public static obj_id dropCard(int systemToDrop, obj_id container) throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
obj_id card = null;
|
||||
String typeName = "card";
|
||||
String staticItemName = "";
|
||||
String promotionName = "";
|
||||
instantiatePromotionsOnCluster();
|
||||
if (!isIdValid(container) || !exists(container))
|
||||
{
|
||||
@@ -469,6 +443,8 @@ public class scheduled_drop extends script.base_script
|
||||
}
|
||||
dictionary[] promotionalItems = getStaticItemsForAllPromotions(promotions);
|
||||
int index = getRandomStaticItem(promotionalItems);
|
||||
String staticItemName = "";
|
||||
String promotionName;
|
||||
if (promotionalItems.length > index && index >= 0)
|
||||
{
|
||||
staticItemName = promotionalItems[index].getString("promotionItem");
|
||||
@@ -479,7 +455,7 @@ public class scheduled_drop extends script.base_script
|
||||
CustomerServiceLog("tcg", "ERROR dropCard() tcg.getRandomStaticItem(promotionalItems) out of bounds index for type: " + staticItemName + ".");
|
||||
return null;
|
||||
}
|
||||
card = static_item.createNewItemFunction(staticItemName, container);
|
||||
obj_id card = static_item.createNewItemFunction(staticItemName, container);
|
||||
if (!isIdValid(card) || !exists(card))
|
||||
{
|
||||
if (isIdValid(self) && isGod(self) && hasObjVar(self, "qa_tcg"))
|
||||
|
||||
Regular → Executable
+6
-24
@@ -1,19 +1,6 @@
|
||||
package script.library;
|
||||
|
||||
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.ai_lib;
|
||||
import script.library.pet_lib;
|
||||
import script.library.combat;
|
||||
import script.ai.ai_combat;
|
||||
import script.library.skill;
|
||||
|
||||
public class scout extends script.base_script
|
||||
{
|
||||
@@ -95,7 +82,7 @@ public class scout extends script.base_script
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int maskMod = 0;
|
||||
int maskMod;
|
||||
if (concealed)
|
||||
{
|
||||
maskMod = concealBonus;
|
||||
@@ -195,8 +182,6 @@ public class scout extends script.base_script
|
||||
else
|
||||
{
|
||||
breakScentMask(player, false);
|
||||
float dist = utils.getDistance2D(getLocation(player), getLocation(npc));
|
||||
dieRoll = rand(1, 100);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -311,14 +296,11 @@ public class scout extends script.base_script
|
||||
}
|
||||
obj_id[] contents = getContents(pInv);
|
||||
obj_id kit = null;
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
if (hasObjVar(contents[i], "camokit"))
|
||||
{
|
||||
String kitPlanet = getStringObjVar(contents[i], "camokit");
|
||||
if (kitPlanet.equals(planetName))
|
||||
{
|
||||
kit = contents[i];
|
||||
|
||||
for (obj_id content : contents) {
|
||||
if (hasObjVar(content, "camokit")) {
|
||||
if (getStringObjVar(content, "camokit").equals(planetName)) {
|
||||
kit = content;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+12
-38
@@ -1,15 +1,7 @@
|
||||
package script.library;
|
||||
|
||||
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.ai.ai_combat;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class sequencer extends script.base_script
|
||||
{
|
||||
@@ -66,8 +58,7 @@ public class sequencer extends script.base_script
|
||||
}
|
||||
public static boolean cleanUpSequenceObject(obj_id objObject, String strIdentifier) throws InterruptedException
|
||||
{
|
||||
obj_id objMaster = getMasterSequenceObject(objObject);
|
||||
return utils.removeScriptVar(objMaster, strIdentifier);
|
||||
return utils.removeScriptVar(getMasterSequenceObject(objObject), strIdentifier);
|
||||
}
|
||||
public static obj_id getMasterSequenceObject(obj_id objObject) throws InterruptedException
|
||||
{
|
||||
@@ -83,35 +74,26 @@ public class sequencer extends script.base_script
|
||||
}
|
||||
return objMaster;
|
||||
}
|
||||
public static boolean isValidSequenceIdentifier(String strIdentifier) throws InterruptedException
|
||||
{
|
||||
public static boolean isValidSequenceIdentifier(String strIdentifier) throws InterruptedException {
|
||||
obj_id objMaster = getMasterSequenceObject(getSelf());
|
||||
if (isIdValid(objMaster))
|
||||
{
|
||||
return utils.hasScriptVar(objMaster, strIdentifier);
|
||||
}
|
||||
return false;
|
||||
return isIdValid(objMaster) && utils.hasScriptVar(objMaster, strIdentifier);
|
||||
}
|
||||
public static void walkToSequenceObject(obj_id objNPC, obj_id objSeq) throws InterruptedException
|
||||
{
|
||||
location locWalkTo = getLocation(objSeq);
|
||||
pathTo(objNPC, locWalkTo);
|
||||
pathTo(objNPC, getLocation(objSeq));
|
||||
}
|
||||
public static void walkToSequenceObject(obj_id objNPC, String strObject) throws InterruptedException
|
||||
{
|
||||
obj_id objSeq = getSequenceObject(strObject);
|
||||
walkToSequenceObject(objNPC, objSeq);
|
||||
walkToSequenceObject(objNPC, getSequenceObject(strObject));
|
||||
}
|
||||
public static void runToSequenceObject(obj_id objNPC, obj_id objSeq) throws InterruptedException
|
||||
{
|
||||
location locWalkTo = getLocation(objSeq);
|
||||
setMovementRun(objNPC);
|
||||
pathTo(objNPC, locWalkTo);
|
||||
pathTo(objNPC, getLocation(objSeq));
|
||||
}
|
||||
public static void runToSequenceObject(obj_id objNPC, String strObject) throws InterruptedException
|
||||
{
|
||||
obj_id objSeq = getSequenceObject(strObject);
|
||||
runToSequenceObject(objNPC, objSeq);
|
||||
runToSequenceObject(objNPC, getSequenceObject(strObject));
|
||||
}
|
||||
public static void doCombatAnimation(obj_id objNPC, obj_id objSeq, String strAnimation) throws InterruptedException
|
||||
{
|
||||
@@ -133,18 +115,14 @@ public class sequencer extends script.base_script
|
||||
}
|
||||
doCombatResults(strAnimation, cbtAttackerResults, cbtDefenderResults);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void doCombatAnimation(obj_id objNPC, String strObject, String strAnimation) throws InterruptedException
|
||||
{
|
||||
obj_id objSeq = getSequenceObject(strObject);
|
||||
doCombatAnimation(objSeq, objNPC, strAnimation);
|
||||
doCombatAnimation(getSequenceObject(strObject), objNPC, strAnimation);
|
||||
}
|
||||
public static void faceToSequenceObject(obj_id objNPC, String strObject) throws InterruptedException
|
||||
{
|
||||
obj_id objSeq = getSequenceObject(strObject);
|
||||
faceTo(objNPC, objSeq);
|
||||
return;
|
||||
faceTo(objNPC, getSequenceObject(strObject));
|
||||
}
|
||||
public static attacker_results makeDummyAttackerResults(obj_id objAttacker) throws InterruptedException
|
||||
{
|
||||
@@ -179,16 +157,12 @@ public class sequencer extends script.base_script
|
||||
}
|
||||
public static void continueEventSequence(String strContinueTag) throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
obj_id objMaster = getMasterSequenceObject(self);
|
||||
dictionary dctParams = new dictionary();
|
||||
dctParams.put("strContinueTag", strContinueTag);
|
||||
messageTo(objMaster, "doEvents", dctParams, 0, false);
|
||||
return;
|
||||
messageTo(getMasterSequenceObject(getSelf()), "doEvents", dctParams, 0, false);
|
||||
}
|
||||
public static void stopSequence(obj_id objTarget) throws InterruptedException
|
||||
{
|
||||
messageTo(objTarget, "interruptSequence", null, 0, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
-6
@@ -1,12 +1,6 @@
|
||||
package script.library;
|
||||
|
||||
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 session extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+82
-169
@@ -1,19 +1,13 @@
|
||||
package script.library;
|
||||
|
||||
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 java.util.Random;
|
||||
import java.util.Vector;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
import script.transform;
|
||||
import script.vector;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
public class ship_ai extends script.base_script
|
||||
{
|
||||
public ship_ai()
|
||||
@@ -97,12 +91,16 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
final int points = 20;
|
||||
transform path[] = new transform[points];
|
||||
float radian;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
for (int i = 0; i < points; ++i)
|
||||
{
|
||||
final float radian = (float)Math.PI * 2.0f * ((float)i / (float)points);
|
||||
final float x = position_w.x + (float)Math.sin(radian) * radius;
|
||||
final float y = position_w.y;
|
||||
final float z = position_w.z + (float)Math.cos(radian) * radius;
|
||||
radian = (float)Math.PI * 2.0f * ((float)i / (float)points);
|
||||
x = position_w.x + (float)Math.sin(radian) * radius;
|
||||
y = position_w.y;
|
||||
z = position_w.z + (float)Math.cos(radian) * radius;
|
||||
path[i] = transform.identity.setPosition_p(x, y, z);
|
||||
}
|
||||
return path;
|
||||
@@ -111,10 +109,12 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
final int points = 20;
|
||||
transform path[] = new transform[points];
|
||||
vector direction;
|
||||
vector position;
|
||||
for (int i = 0; i < points; ++i)
|
||||
{
|
||||
final vector direction = vector.randomUnit();
|
||||
vector position = (transform_w.getPosition_p()).add(direction.multiply(minDist + (float)Math.random() * (maxDist - minDist)));
|
||||
direction = vector.randomUnit();
|
||||
position = (transform_w.getPosition_p()).add(direction.multiply(minDist + (float)Math.random() * (maxDist - minDist)));
|
||||
path[i] = transform.identity.setPosition_p(position);
|
||||
}
|
||||
return path;
|
||||
@@ -134,9 +134,8 @@ public class ship_ai extends script.base_script
|
||||
public static void squadClearPatrolPath(int squadId) throws InterruptedException
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
_spaceUnitClearPatrolPath(unitList[i]);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
_spaceUnitClearPatrolPath(anUnitList);
|
||||
}
|
||||
}
|
||||
public static void unitFollow(obj_id unit, obj_id followedUnit, vector direction_o, float distance) throws InterruptedException
|
||||
@@ -158,9 +157,8 @@ public class ship_ai extends script.base_script
|
||||
public static void squadSetAttackOrders(int squadId, int attackOrders) throws InterruptedException
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
unitSetAttackOrders(unitList[i], attackOrders);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
unitSetAttackOrders(anUnitList, attackOrders);
|
||||
}
|
||||
}
|
||||
public static void unitSetLeashDistance(obj_id unit, float distance) throws InterruptedException
|
||||
@@ -170,9 +168,8 @@ public class ship_ai extends script.base_script
|
||||
public static void squadSetLeashDistance(int squadId, float distance) throws InterruptedException
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
unitSetLeashDistance(unitList[i], distance);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
unitSetLeashDistance(anUnitList, distance);
|
||||
}
|
||||
}
|
||||
public static void unitSetPilotType(obj_id unit, String pilotType) throws InterruptedException
|
||||
@@ -240,22 +237,15 @@ public class ship_ai extends script.base_script
|
||||
public static void unitRemoveFromAllAttackTargetLists(obj_id unit) throws InterruptedException
|
||||
{
|
||||
obj_id[] whoIsTargetingMeList = unitGetWhoIsTargetingMe(unit);
|
||||
for (int index = 0; index < whoIsTargetingMeList.length; ++index)
|
||||
{
|
||||
if (exists(whoIsTargetingMeList[index]) && (whoIsTargetingMeList[index].isLoaded()))
|
||||
{
|
||||
if (!space_utils.isPlayerControlledShip(whoIsTargetingMeList[index]))
|
||||
{
|
||||
unitRemoveAttackTarget(whoIsTargetingMeList[index], unit);
|
||||
for (obj_id aWhoIsTargetingMeList : whoIsTargetingMeList) {
|
||||
if (exists(aWhoIsTargetingMeList) && (aWhoIsTargetingMeList.isLoaded())) {
|
||||
if (!space_utils.isPlayerControlledShip(aWhoIsTargetingMeList)) {
|
||||
unitRemoveAttackTarget(aWhoIsTargetingMeList, unit);
|
||||
} else {
|
||||
LOG("space", aWhoIsTargetingMeList + " was passed into getWhoistargetingme but it's a PLAYER");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("space", whoIsTargetingMeList[index] + " was passed into getWhoistargetingme but it's a PLAYER");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("space", whoIsTargetingMeList[index] + " was passed into unitGetWhoIsTargetingMe but doesn't exist on the server");
|
||||
} else {
|
||||
LOG("space", aWhoIsTargetingMeList + " was passed into unitGetWhoIsTargetingMe but doesn't exist on the server");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,28 +260,24 @@ public class ship_ai extends script.base_script
|
||||
public static void squadSetPrimaryTarget(int squadId, obj_id targetUnit) throws InterruptedException
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
unitAddDamageTaken(unitList[i], targetUnit, 100000.0f);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
unitAddDamageTaken(anUnitList, targetUnit, 100000.0f);
|
||||
}
|
||||
}
|
||||
public static void squadAddTarget(int squadId, obj_id targetUnit) throws InterruptedException
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
unitAddDamageTaken(unitList[i], targetUnit, 100.0f);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
unitAddDamageTaken(anUnitList, targetUnit, 100.0f);
|
||||
}
|
||||
}
|
||||
public static void squadSetPrimaryTarget(int squadId, int targetSquadId) throws InterruptedException
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
obj_id[] targetUnitList = squadGetUnitList(targetSquadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
for (int j = 0; j < targetUnitList.length; ++j)
|
||||
{
|
||||
unitAddDamageTaken(unitList[i], targetUnitList[j], (float)Math.random() * 100000.0f + 100000.0f);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
for (obj_id aTargetUnitList : targetUnitList) {
|
||||
unitAddDamageTaken(anUnitList, aTargetUnitList, (float) Math.random() * 100000.0f + 100000.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,11 +285,9 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
obj_id[] unitList = squadGetUnitList(squadId);
|
||||
obj_id[] targetUnitList = squadGetUnitList(targetSquadId);
|
||||
for (int i = 0; i < unitList.length; ++i)
|
||||
{
|
||||
for (int j = 0; j < targetUnitList.length; ++j)
|
||||
{
|
||||
unitAddDamageTaken(unitList[i], targetUnitList[j], (float)Math.random() * 100.0f + 100.0f);
|
||||
for (obj_id anUnitList : unitList) {
|
||||
for (obj_id aTargetUnitList : targetUnitList) {
|
||||
unitAddDamageTaken(anUnitList, aTargetUnitList, (float) Math.random() * 100.0f + 100.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,45 +330,30 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
Random random = new Random();
|
||||
final int value = Math.abs(random.nextInt()) % 6;
|
||||
int formation = FORMATION_INVALID;
|
||||
int formation;
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
|
||||
{
|
||||
formation = FORMATION_CLAW;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
{
|
||||
formation = FORMATION_WALL;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
|
||||
{
|
||||
formation = FORMATION_SPHERE;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 3:
|
||||
|
||||
{
|
||||
formation = FORMATION_DELTA;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 4:
|
||||
|
||||
{
|
||||
formation = FORMATION_BROAD;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 5:
|
||||
|
||||
{
|
||||
formation = FORMATION_X;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
formation = FORMATION_INVALID;
|
||||
break;
|
||||
}
|
||||
_spaceSquadSetFormation(squadId, formation);
|
||||
}
|
||||
@@ -472,29 +441,12 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
return _spaceSquadIsSquadIdValid(squadId);
|
||||
}
|
||||
public static boolean isShipDead(obj_id ship) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(ship))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!ship.isLoaded())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (hasObjVar(ship, "ship.isDead"));
|
||||
public static boolean isShipDead(obj_id ship) throws InterruptedException {
|
||||
return !isIdValid(ship) || !ship.isLoaded() || (hasObjVar(ship, "ship.isDead"));
|
||||
}
|
||||
public static boolean isPlayerShip(obj_id ship) throws InterruptedException
|
||||
{
|
||||
public static boolean isPlayerShip(obj_id ship) throws InterruptedException {
|
||||
obj_id pilot = getPilotId(ship);
|
||||
if (isIdValid(pilot))
|
||||
{
|
||||
return (isPlayer(pilot));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isIdValid(pilot) && (isPlayer(pilot));
|
||||
}
|
||||
public static boolean isShipAggro(obj_id ship) throws InterruptedException
|
||||
{
|
||||
@@ -525,17 +477,14 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String shipName = getStringObjVar(ship, "ship.shipName");
|
||||
String enemyFactionList = dataTableGetString("datatables/space_mobile/space_mobile.iff", shipName, "enemyFactions");
|
||||
String enemyFactionList = dataTableGetString("datatables/space_mobile/space_mobile.iff", getStringObjVar(ship, "ship.shipName"), "enemyFactions");
|
||||
if (enemyFactionList == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String[] enemiesList = split(enemyFactionList, ',');
|
||||
for (int i = 0; i < enemiesList.length; i++)
|
||||
{
|
||||
if (enemiesList[i].equals(targetFaction))
|
||||
{
|
||||
for (String anEnemiesList : enemiesList) {
|
||||
if (anEnemiesList.equals(targetFaction)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -561,17 +510,14 @@ public class ship_ai extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String shipName = getStringObjVar(ship, "ship.shipName");
|
||||
String allyFactionList = dataTableGetString("datatables/space_mobile/space_mobile.iff", shipName, "alliedFactions");
|
||||
String allyFactionList = dataTableGetString("datatables/space_mobile/space_mobile.iff", getStringObjVar(ship, "ship.shipName"), "alliedFactions");
|
||||
if (allyFactionList == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String[] allyList = split(allyFactionList, ',');
|
||||
for (int i = 0; i < allyList.length; i++)
|
||||
{
|
||||
if (allyList[i].equals(targetFaction))
|
||||
{
|
||||
for (String anAllyList : allyList) {
|
||||
if (anAllyList.equals(targetFaction)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -611,13 +557,11 @@ public class ship_ai extends script.base_script
|
||||
obj_id[] groupMembers = getGroupMemberIds(group);
|
||||
Vector groupShips = new Vector();
|
||||
groupShips.add(primaryTarget);
|
||||
for (int i = 0; i < groupMembers.length; i++)
|
||||
{
|
||||
if (groupMembers[i].isLoaded())
|
||||
{
|
||||
obj_id ship = getPilotedShip(groupMembers[i]);
|
||||
if (isIdValid(ship) && ship != primaryTarget && getDistance(ship, primaryTarget) < 120.0f)
|
||||
{
|
||||
obj_id ship;
|
||||
for (obj_id groupMember : groupMembers) {
|
||||
if (groupMember.isLoaded()) {
|
||||
ship = getPilotedShip(groupMember);
|
||||
if (isIdValid(ship) && ship != primaryTarget && getDistance(ship, primaryTarget) < 120.0f) {
|
||||
groupShips.add(ship);
|
||||
}
|
||||
}
|
||||
@@ -631,42 +575,24 @@ public class ship_ai extends script.base_script
|
||||
String result;
|
||||
switch (behavior)
|
||||
{
|
||||
default:
|
||||
|
||||
{
|
||||
result = "invalid";
|
||||
}
|
||||
break;
|
||||
case BEHAVIOR_IDLE:
|
||||
|
||||
{
|
||||
result = "BEHAVIOR_IDLE";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case BEHAVIOR_MOVETO:
|
||||
|
||||
{
|
||||
result = "BEHAVIOR_MOVETO";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case BEHAVIOR_PATROL:
|
||||
|
||||
{
|
||||
result = "BEHAVIOR_PATROL";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case BEHAVIOR_FOLLOW:
|
||||
|
||||
{
|
||||
result = "BEHAVIOR_FOLLOW";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case BEHAVIOR_TRACK:
|
||||
|
||||
{
|
||||
result = "BEHAVIOR_TRACK";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
result = "invalid";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -675,30 +601,18 @@ public class ship_ai extends script.base_script
|
||||
String result;
|
||||
switch (attackOrders)
|
||||
{
|
||||
default:
|
||||
|
||||
{
|
||||
result = "invalid";
|
||||
}
|
||||
break;
|
||||
case ATTACK_ORDERS_HOLD_FIRE:
|
||||
|
||||
{
|
||||
result = "ATTACK_ORDERS_HOLD_FIRE";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ATTACK_ORDERS_RETURN_FIRE:
|
||||
|
||||
{
|
||||
result = "ATTACK_ORDERS_DEFEND";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ATTACK_ORDERS_ATTACK_FREELY:
|
||||
|
||||
{
|
||||
result = "ATTACK_ORDERS_ATTACK_FREELY";
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
result = "invalid";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -708,9 +622,8 @@ public class ship_ai extends script.base_script
|
||||
}
|
||||
public static void spaceAttack(obj_id ship, obj_id[] targets) throws InterruptedException
|
||||
{
|
||||
for (int i = 0; i < targets.length; i++)
|
||||
{
|
||||
unitAddDamageTaken(ship, targets[i], 100000.0f);
|
||||
for (obj_id target : targets) {
|
||||
unitAddDamageTaken(ship, target, 100000.0f);
|
||||
}
|
||||
}
|
||||
public static obj_id spaceGetPrimaryTarget(obj_id ship) throws InterruptedException
|
||||
|
||||
Regular → Executable
+138
-248
@@ -1,21 +1,10 @@
|
||||
package script.library;
|
||||
|
||||
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.prose;
|
||||
import script.library.utils;
|
||||
import script.library.list;
|
||||
import script.library.jedi;
|
||||
import script.library.combat;
|
||||
import script.library.pclib;
|
||||
import script.library.space_flags;
|
||||
import script.library.buff;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
public class skill extends script.base_script
|
||||
{
|
||||
@@ -88,8 +77,7 @@ public class skill extends script.base_script
|
||||
messageTo(target, HANDLER_SKILL_GRANTED, d, 0, true);
|
||||
return true;
|
||||
}
|
||||
boolean litmus = grantSkill(target, skillName);
|
||||
return litmus;
|
||||
return grantSkill(target, skillName);
|
||||
}
|
||||
public static boolean grantSkillToPlayer(obj_id player, String skillName) throws InterruptedException
|
||||
{
|
||||
@@ -147,11 +135,11 @@ public class skill extends script.base_script
|
||||
{
|
||||
if (space_flags.isSpaceTrack(player, space_flags.PRIVATEER_TATOOINE))
|
||||
{
|
||||
soundFile = soundFile = "sound/music_themequest_acc_criminal.snd";
|
||||
soundFile = "sound/music_themequest_acc_criminal.snd";
|
||||
}
|
||||
else
|
||||
{
|
||||
soundFile = soundFile = "sound/music_themequest_acc_general.snd";
|
||||
soundFile = "sound/music_themequest_acc_general.snd";
|
||||
}
|
||||
}
|
||||
else if (skillName.startsWith("pilot_rebel"))
|
||||
@@ -214,23 +202,13 @@ public class skill extends script.base_script
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean hasRequiredSkillsForSkillPurchase(obj_id player, String skillName) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(player) || (!isPlayer(player)) || skillName == null || skillName.equals(""))
|
||||
{
|
||||
public static boolean hasRequiredSkillsForSkillPurchase(obj_id player, String skillName) throws InterruptedException {
|
||||
if (!isIdValid(player) || (!isPlayer(player)) || skillName == null || skillName.equals("")) {
|
||||
return false;
|
||||
}
|
||||
String[] pSkills = getSkillListingForPlayer(player);
|
||||
String[] skillReqs = getSkillPrerequisiteSkills(skillName);
|
||||
if (skillReqs == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (pSkills == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return utils.isSubset(pSkills, skillReqs);
|
||||
return skillReqs == null || pSkills != null && utils.isSubset(pSkills, skillReqs);
|
||||
}
|
||||
public static boolean hasRequiredXpForSkillPurchase(obj_id player, String skillName) throws InterruptedException
|
||||
{
|
||||
@@ -245,9 +223,10 @@ public class skill extends script.base_script
|
||||
}
|
||||
boolean qualifies = true;
|
||||
java.util.Enumeration e = xpReqs.keys();
|
||||
String xpType;
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String xpType = (String)(e.nextElement());
|
||||
xpType = (String) (e.nextElement());
|
||||
int xpCost = xpReqs.getInt(xpType);
|
||||
if (getExperiencePoints(player, xpType) < xpCost)
|
||||
{
|
||||
@@ -269,9 +248,10 @@ public class skill extends script.base_script
|
||||
}
|
||||
boolean qualifies = true;
|
||||
java.util.Enumeration e = xpReqs.keys();
|
||||
String xpType;
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String xpType = (String)(e.nextElement());
|
||||
xpType = (String) (e.nextElement());
|
||||
int xpCost = xpReqs.getInt(xpType);
|
||||
if (xpCost != 0)
|
||||
{
|
||||
@@ -299,20 +279,14 @@ public class skill extends script.base_script
|
||||
return null;
|
||||
}
|
||||
Vector ret = new Vector(Arrays.asList(reqs));
|
||||
for (int i = 0; i < reqs.length; i++)
|
||||
{
|
||||
String[] tmp = getAllRequiredSkills(reqs[i]);
|
||||
if ((tmp == null) || (tmp.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int n = 0; n < tmp.length; n++)
|
||||
{
|
||||
int pos = utils.getElementPositionInArray(ret, tmp[n]);
|
||||
if (pos == -1)
|
||||
{
|
||||
ret = utils.addElement(ret, tmp[n]);
|
||||
String[] tmp;
|
||||
for (String req : reqs) {
|
||||
tmp = getAllRequiredSkills(req);
|
||||
if ((tmp != null) && (tmp.length != 0)) {
|
||||
for (String aTmp : tmp) {
|
||||
int pos = utils.getElementPositionInArray(ret, aTmp);
|
||||
if (pos == -1) {
|
||||
ret = utils.addElement(ret, aTmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -338,11 +312,12 @@ public class skill extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String skill_list;
|
||||
for (int i = 0; i < templates.length; i++)
|
||||
{
|
||||
if ((toLower(templates[i])).equals(toLower(template)))
|
||||
{
|
||||
String skill_list = dataTableGetString(DATATABLE_SKILL_TEMPLATE, i, DATATABLE_BASE_SKILLS);
|
||||
skill_list = dataTableGetString(DATATABLE_SKILL_TEMPLATE, i, DATATABLE_BASE_SKILLS);
|
||||
if (skill_list.startsWith("\""))
|
||||
{
|
||||
skill_list = skill_list.substring(1);
|
||||
@@ -353,35 +328,21 @@ public class skill extends script.base_script
|
||||
}
|
||||
if (!skill_list.equals(""))
|
||||
{
|
||||
int recurseIntVal = dataTableGetInt(DATATABLE_SKILL_TEMPLATE, i, DATATABLE_RECURSE);
|
||||
boolean recurse = false;
|
||||
switch (recurseIntVal)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
recurse = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
boolean recurse = dataTableGetInt(DATATABLE_SKILL_TEMPLATE, i, DATATABLE_RECURSE) == 1;
|
||||
boolean litmus = true;
|
||||
java.util.StringTokenizer skills = new java.util.StringTokenizer(toLower(skill_list), ",");
|
||||
String skillName;
|
||||
String[] reqs;
|
||||
while (skills.hasMoreTokens())
|
||||
{
|
||||
String skillName = skills.nextToken();
|
||||
skillName = skills.nextToken();
|
||||
litmus &= grantSkill(target, skillName);
|
||||
if (recurse)
|
||||
{
|
||||
String[] reqs = getAllRequiredSkills(skillName);
|
||||
if ((reqs == null) || (reqs.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int n = 0; n < reqs.length; n++)
|
||||
{
|
||||
litmus &= grantSkill(target, reqs[n]);
|
||||
reqs = getAllRequiredSkills(skillName);
|
||||
if ((reqs != null) && (reqs.length != 0)) {
|
||||
for (String req : reqs) {
|
||||
litmus &= grantSkill(target, req);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,9 +351,10 @@ public class skill extends script.base_script
|
||||
if ((inherits_list != null) && (!inherits_list.equals("")))
|
||||
{
|
||||
java.util.StringTokenizer inheritTokens = new java.util.StringTokenizer(toLower(inherits_list), ",");
|
||||
String inheritTemplate;
|
||||
while (inheritTokens.hasMoreTokens())
|
||||
{
|
||||
String inheritTemplate = inheritTokens.nextToken();
|
||||
inheritTemplate = inheritTokens.nextToken();
|
||||
if (!inheritTemplate.equals(""))
|
||||
{
|
||||
litmus &= assignSkillTemplate(target, inheritTemplate);
|
||||
@@ -417,9 +379,8 @@ public class skill extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < skills.length; i++)
|
||||
{
|
||||
revokeSkill(target, skills[i]);
|
||||
for (String skill : skills) {
|
||||
revokeSkill(target, skill);
|
||||
CustomerServiceLog("Skill", "skill.revokeAllSkills(): (" + target + ") " + getName(target) + " is having all skills revoked!");
|
||||
}
|
||||
return true;
|
||||
@@ -428,15 +389,12 @@ public class skill extends script.base_script
|
||||
{
|
||||
String[] skillList = getSkillListingForPlayer(player);
|
||||
int attempts = skillList.length;
|
||||
if ((skillList != null) && (skillList.length != 0))
|
||||
if ((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("social_politician_") && !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") && !skillName.equals("expertise"))
|
||||
{
|
||||
for (String skillName : skillList) {
|
||||
if (!skillName.startsWith("species_") && !skillName.startsWith("social_language_") && !skillName.startsWith("social_politician_") && !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") && !skillName.equals("expertise")) {
|
||||
revokeSkillSilent(player, skillName);
|
||||
}
|
||||
}
|
||||
@@ -462,96 +420,75 @@ public class skill extends script.base_script
|
||||
}
|
||||
Vector qualifiedSkills = new Vector();
|
||||
qualifiedSkills.setSize(0);
|
||||
for (int i = 0; i < teachableSkills.length; i++)
|
||||
{
|
||||
dictionary d;
|
||||
Object o;
|
||||
String xpType;
|
||||
Enumeration species_keys;
|
||||
String key;
|
||||
String trainer_type;
|
||||
String branch;
|
||||
String skillName;
|
||||
|
||||
for (String teachableSkill : teachableSkills) {
|
||||
boolean qualifies = true;
|
||||
dictionary d = getSkillPrerequisiteExperience(teachableSkills[i]);
|
||||
if (d == null || d.isEmpty())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
java.util.Enumeration keys = d.keys();
|
||||
int n = 0;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
Object o = keys.nextElement();
|
||||
if (o instanceof String)
|
||||
{
|
||||
String xpType = (String)o;
|
||||
d = getSkillPrerequisiteExperience(teachableSkill);
|
||||
if (d != null && !d.isEmpty()) {
|
||||
Enumeration keys = d.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
o = keys.nextElement();
|
||||
if (o instanceof String) {
|
||||
xpType = (String) o;
|
||||
int xpCost = d.getInt(xpType);
|
||||
int playerXP = getExperiencePoints(target, xpType);
|
||||
if (playerXP >= xpCost)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playerXP < xpCost) {
|
||||
qualifies = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
dictionary species = getSkillPrerequisiteSpecies(teachableSkills[i]);
|
||||
if (species != null && !d.isEmpty())
|
||||
{
|
||||
java.util.Enumeration species_keys = species.keys();
|
||||
while (species_keys.hasMoreElements())
|
||||
{
|
||||
Object o = species_keys.nextElement();
|
||||
if (o instanceof String)
|
||||
{
|
||||
String key = (String)o;
|
||||
if (species.getBoolean(key))
|
||||
{
|
||||
dictionary species = getSkillPrerequisiteSpecies(teachableSkill);
|
||||
assert d != null;
|
||||
if (species != null && !d.isEmpty()) {
|
||||
species_keys = species.keys();
|
||||
while (species_keys.hasMoreElements()) {
|
||||
o = species_keys.nextElement();
|
||||
if (o instanceof String) {
|
||||
key = (String) o;
|
||||
if (species.getBoolean(key)) {
|
||||
qualifies = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String trainer_type = getStringObjVar(teacher, "trainer");
|
||||
if (trainer_type != null && trainer_type.equals("trainer_fs"))
|
||||
{
|
||||
if (qualifies)
|
||||
{
|
||||
if (fs_quests.isVillageEligible(target))
|
||||
{
|
||||
String branch = fs_quests.getBranchFromSkill(teachableSkills[i]);
|
||||
if (!fs_quests.hasUnlockedBranch(target, branch))
|
||||
{
|
||||
trainer_type = getStringObjVar(teacher, "trainer");
|
||||
if (trainer_type != null && trainer_type.equals("trainer_fs")) {
|
||||
if (qualifies) {
|
||||
if (fs_quests.isVillageEligible(target)) {
|
||||
branch = fs_quests.getBranchFromSkill(teachableSkill);
|
||||
if (!fs_quests.hasUnlockedBranch(target, branch)) {
|
||||
qualifies = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
qualifies = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasObjVar(target, "newbie.hasSkill") && !hasObjVar(target, "newbie.trained"))
|
||||
{
|
||||
String skillName = getStringObjVar(target, "newbie.hasSkill");
|
||||
if (skillName.equals(teachableSkills[i]))
|
||||
{
|
||||
if (hasObjVar(target, "newbie.hasSkill") && !hasObjVar(target, "newbie.trained")) {
|
||||
skillName = getStringObjVar(target, "newbie.hasSkill");
|
||||
if (skillName.equals(teachableSkill)) {
|
||||
qualifies = true;
|
||||
}
|
||||
}
|
||||
if (qualifies)
|
||||
{
|
||||
qualifiedSkills = utils.addElement(qualifiedSkills, teachableSkills[i]);
|
||||
if (qualifies) {
|
||||
qualifiedSkills = utils.addElement(qualifiedSkills, teachableSkill);
|
||||
}
|
||||
}
|
||||
if ((qualifiedSkills != null) && (qualifiedSkills.size() > 0))
|
||||
{
|
||||
String[] _qualifiedSkills = new String[0];
|
||||
if (qualifiedSkills != null)
|
||||
{
|
||||
_qualifiedSkills = new String[qualifiedSkills.size()];
|
||||
qualifiedSkills.toArray(_qualifiedSkills);
|
||||
}
|
||||
String[] _qualifiedSkills = new String[qualifiedSkills.size()];
|
||||
qualifiedSkills.toArray(_qualifiedSkills);
|
||||
return _qualifiedSkills;
|
||||
}
|
||||
return null;
|
||||
@@ -560,7 +497,6 @@ public class skill extends script.base_script
|
||||
{
|
||||
if (!isIdValid(target) || !isIdValid(teacher))
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
return null;
|
||||
}
|
||||
if (isPlayer(teacher))
|
||||
@@ -575,21 +511,15 @@ public class skill extends script.base_script
|
||||
}
|
||||
Vector delta = new Vector();
|
||||
delta.setSize(0);
|
||||
for (int i = 0; i < teacherSkills.length; i++)
|
||||
{
|
||||
if (utils.getElementPositionInArray(targetSkills, teacherSkills[i]) == -1)
|
||||
{
|
||||
delta = utils.addElement(delta, teacherSkills[i]);
|
||||
for (String teacherSkill : teacherSkills) {
|
||||
if (utils.getElementPositionInArray(targetSkills, teacherSkill) == -1) {
|
||||
delta = utils.addElement(delta, teacherSkill);
|
||||
}
|
||||
}
|
||||
if ((delta != null) && (delta.size() != 0))
|
||||
{
|
||||
String[] _delta = new String[0];
|
||||
if (delta != null)
|
||||
{
|
||||
_delta = new String[delta.size()];
|
||||
delta.toArray(_delta);
|
||||
}
|
||||
String[] _delta = new String[delta.size()];
|
||||
delta.toArray(_delta);
|
||||
return _delta;
|
||||
}
|
||||
return null;
|
||||
@@ -627,21 +557,15 @@ public class skill extends script.base_script
|
||||
}
|
||||
Vector delta = new Vector();
|
||||
delta.setSize(0);
|
||||
for (int i = 0; i < teacherSkills.length; i++)
|
||||
{
|
||||
if (utils.getElementPositionInArray(targetSkills, teacherSkills[i]) == -1)
|
||||
{
|
||||
delta = utils.addElement(delta, teacherSkills[i]);
|
||||
for (String teacherSkill : teacherSkills) {
|
||||
if (utils.getElementPositionInArray(targetSkills, teacherSkill) == -1) {
|
||||
delta = utils.addElement(delta, teacherSkill);
|
||||
}
|
||||
}
|
||||
if ((delta != null) && (delta.size() != 0))
|
||||
{
|
||||
String[] _delta = new String[0];
|
||||
if (delta != null)
|
||||
{
|
||||
_delta = new String[delta.size()];
|
||||
delta.toArray(_delta);
|
||||
}
|
||||
String[] _delta = new String[delta.size()];
|
||||
delta.toArray(_delta);
|
||||
return _delta;
|
||||
}
|
||||
return null;
|
||||
@@ -658,11 +582,8 @@ public class skill extends script.base_script
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int deltaPercent = params.getInt(DICT_DELTA_PERCENT);
|
||||
if ((retCode == CODE_PASS) && (deltaPercent >= 0))
|
||||
{
|
||||
}
|
||||
return deltaPercent;
|
||||
|
||||
return params.getInt(DICT_DELTA_PERCENT);
|
||||
}
|
||||
public static dictionary skillModCheck(obj_id target, String skillmod, String scale) throws InterruptedException
|
||||
{
|
||||
@@ -675,30 +596,29 @@ public class skill extends script.base_script
|
||||
int modmin = 1;
|
||||
int modmax = 100;
|
||||
int scaleIdx = scale.indexOf(DELIM_RANGE);
|
||||
if (scale.equals(""))
|
||||
{
|
||||
}
|
||||
else if (scaleIdx > 0)
|
||||
{
|
||||
java.util.StringTokenizer rng = new java.util.StringTokenizer(scale, DELIM_RANGE);
|
||||
String smin = "";
|
||||
String smax = "";
|
||||
if (rng.countTokens() == 2)
|
||||
{
|
||||
smin = rng.nextToken();
|
||||
smax = rng.nextToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.put(DICT_CODE, CODE_ERROR);
|
||||
return ret;
|
||||
}
|
||||
modmin = utils.stringToInt(smin);
|
||||
modmax = utils.stringToInt(smax);
|
||||
}
|
||||
else
|
||||
{
|
||||
modmax = utils.stringToInt(scale);
|
||||
if (!scale.equals("")) {
|
||||
if (scaleIdx > 0)
|
||||
{
|
||||
java.util.StringTokenizer rng = new java.util.StringTokenizer(scale, DELIM_RANGE);
|
||||
String smin;
|
||||
String smax;
|
||||
if (rng.countTokens() == 2)
|
||||
{
|
||||
smin = rng.nextToken();
|
||||
smax = rng.nextToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.put(DICT_CODE, CODE_ERROR);
|
||||
return ret;
|
||||
}
|
||||
modmin = utils.stringToInt(smin);
|
||||
modmax = utils.stringToInt(smax);
|
||||
}
|
||||
else
|
||||
{
|
||||
modmax = utils.stringToInt(scale);
|
||||
}
|
||||
}
|
||||
if ((modmin < 0) || (modmax <= 0) || (modmin >= modmax))
|
||||
{
|
||||
@@ -826,10 +746,7 @@ public class skill extends script.base_script
|
||||
{
|
||||
int randomNumber = rand(0, numAvailable - 1);
|
||||
strSkillsNeeded[i] = strSkills[randomNumber];
|
||||
for (int j = randomNumber; j < numAvailable - 1; ++j)
|
||||
{
|
||||
strSkills[j] = strSkills[j + 1];
|
||||
}
|
||||
System.arraycopy(strSkills, randomNumber + 1, strSkills, randomNumber, numAvailable - 1 - randomNumber);
|
||||
strSkills[--numAvailable] = null;
|
||||
}
|
||||
if (strSkillsNeeded.length > 0)
|
||||
@@ -854,14 +771,12 @@ public class skill extends script.base_script
|
||||
{
|
||||
if (grantSkillToPlayer(player, skillName))
|
||||
{
|
||||
prose_package pp = prose.getPackage(PROSE_SKILL_LEARNED, new string_id(SKILL_N, skillName));
|
||||
sendSystemMessageProse(player, pp);
|
||||
sendSystemMessageProse(player, prose.getPackage(PROSE_SKILL_LEARNED, new string_id(SKILL_N, skillName)));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
prose_package pp = prose.getPackage(PROSE_TRAIN_FAILED, new string_id(SKILL_N, skillName));
|
||||
sendSystemMessageProse(player, pp);
|
||||
sendSystemMessageProse(player, prose.getPackage(PROSE_TRAIN_FAILED, new string_id(SKILL_N, skillName)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -875,7 +790,6 @@ public class skill extends script.base_script
|
||||
}
|
||||
newbieTutorialHighlightUIElement(objPlayer, "/GroundHUD.MFDStatus.vsp.role.targetLevel", 5.0f);
|
||||
setPlayerStatsForLevel(objPlayer, intNewLevel);
|
||||
return;
|
||||
}
|
||||
public static void setPlayerStatsForLevel(obj_id objPlayer, int intLevel) throws InterruptedException
|
||||
{
|
||||
@@ -957,7 +871,6 @@ public class skill extends script.base_script
|
||||
}
|
||||
recalcPlayerPools(objPlayer, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static int getPlayerStatForLevel(obj_id player, int intLevel, String statString) throws InterruptedException
|
||||
{
|
||||
@@ -1106,7 +1019,6 @@ public class skill extends script.base_script
|
||||
ppStatGainSpam.digitInteger = actionDelta;
|
||||
sendSystemMessageProse(player, ppStatGainSpam);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static String getProfessionName(String strTemplate) throws InterruptedException
|
||||
{
|
||||
@@ -1157,12 +1069,11 @@ public class skill extends script.base_script
|
||||
setMaxAttrib(objPlayer, ACTION, intBaseAction);
|
||||
setMaxAttrib(objPlayer, HEALTH, intBaseHealth);
|
||||
int[] myBuffs = buff.getAllBuffs(objPlayer);
|
||||
for (int i = 0; i < myBuffs.length; i++)
|
||||
{
|
||||
String thisBuffEffect = buff.getEffectParam(myBuffs[i], 1);
|
||||
float thisBuffValue = buff.getEffectValue(myBuffs[i], 1);
|
||||
if (thisBuffEffect != null && thisBuffValue < 0 && thisBuffEffect.equals("healthPercent"))
|
||||
{
|
||||
String thisBuffEffect;
|
||||
for (int myBuff : myBuffs) {
|
||||
thisBuffEffect = buff.getEffectParam(myBuff, 1);
|
||||
float thisBuffValue = buff.getEffectValue(myBuff, 1);
|
||||
if (thisBuffEffect != null && thisBuffValue < 0 && thisBuffEffect.equals("healthPercent")) {
|
||||
boolHealEverything = false;
|
||||
break;
|
||||
}
|
||||
@@ -1173,7 +1084,6 @@ public class skill extends script.base_script
|
||||
setAttrib(objPlayer, HEALTH, getMaxAttrib(objPlayer, HEALTH));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void grantAllPoliticianSkills(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1199,11 +1109,9 @@ public class skill extends script.base_script
|
||||
"social_politician_master"
|
||||
};
|
||||
setObjVar(player, "clickRespec.granting", true);
|
||||
for (int i = 0; i < skillNames.length; i++)
|
||||
{
|
||||
if (!hasSkill(player, skillNames[i]))
|
||||
{
|
||||
grantSkill(player, skillNames[i]);
|
||||
for (String skillName : skillNames) {
|
||||
if (!hasSkill(player, skillName)) {
|
||||
grantSkill(player, skillName);
|
||||
}
|
||||
}
|
||||
removeObjVar(player, "clickRespec.granting");
|
||||
@@ -1255,24 +1163,18 @@ public class skill extends script.base_script
|
||||
"class_munitions_phase2_novice",
|
||||
"class_engineering_phase2_novice"
|
||||
};
|
||||
for (int i = 0; i < phaseFourSkills.length; i++)
|
||||
{
|
||||
if (hasSkill(player, phaseFourSkills[i]))
|
||||
{
|
||||
for (String phaseFourSkill : phaseFourSkills) {
|
||||
if (hasSkill(player, phaseFourSkill)) {
|
||||
return PHASE_FOUR;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < phaseThreeSkills.length; i++)
|
||||
{
|
||||
if (hasSkill(player, phaseThreeSkills[i]))
|
||||
{
|
||||
for (String phaseThreeSkill : phaseThreeSkills) {
|
||||
if (hasSkill(player, phaseThreeSkill)) {
|
||||
return PHASE_THREE;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < phaseTwoSkills.length; i++)
|
||||
{
|
||||
if (hasSkill(player, phaseTwoSkills[i]))
|
||||
{
|
||||
for (String phaseTwoSkill : phaseTwoSkills) {
|
||||
if (hasSkill(player, phaseTwoSkill)) {
|
||||
return PHASE_TWO;
|
||||
}
|
||||
}
|
||||
@@ -1312,30 +1214,18 @@ public class skill extends script.base_script
|
||||
profession = "trader_eng";
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < expertiseSkills.length; ++i)
|
||||
{
|
||||
int row = dataTableSearchColumnForString(expertiseSkills[i], "NAME", DATATABLE_EXPERTISE);
|
||||
if (row < 0)
|
||||
{
|
||||
for (String expertiseSkill : expertiseSkills) {
|
||||
int row = dataTableSearchColumnForString(expertiseSkill, "NAME", DATATABLE_EXPERTISE);
|
||||
if (row < 0) {
|
||||
continue;
|
||||
}
|
||||
String reqProf = dataTableGetString(DATATABLE_EXPERTISE, row, "REQ_PROF");
|
||||
if (!reqProf.equals(profession))
|
||||
{
|
||||
if (reqProf.equals("trader") && isTrader)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (reqProf.equals("all"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!reqProf.equals(profession)) {
|
||||
if ((!reqProf.equals("trader") || !isTrader) && !reqProf.equals("all")) {
|
||||
sendSystemMessage(player, SID_EXPERTISE_WRONG_PROFESSION);
|
||||
utils.fullExpertiseReset(player, false);
|
||||
CustomerServiceLog("SuspectedCheaterChannel: ", "DualProfessionCheat: Player " + getFirstName(player) + "(" + player + ") has an expertise that is not for thier profession. All expertises have been revoked.");
|
||||
CustomerServiceLog("SuspectedCheaterChannel: ", "DualProfessionCheat: Player " + getFirstName(player) + "(" + player + ")'s profession is " + profession + " and the skill they have is " + expertiseSkills[i] + ".");
|
||||
CustomerServiceLog("SuspectedCheaterChannel: ", "DualProfessionCheat: Player " + getFirstName(player) + "(" + player + ")'s profession is " + profession + " and the skill they have is " + expertiseSkill + ".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+31
-53
@@ -1,14 +1,10 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
import script.library.utils;
|
||||
import java.util.Vector;
|
||||
|
||||
public class skill_template extends script.base_script
|
||||
{
|
||||
@@ -44,11 +40,7 @@ public class skill_template extends script.base_script
|
||||
}
|
||||
public static boolean isValidWorkingSkill(String skillName) throws InterruptedException
|
||||
{
|
||||
if (skillName == null || skillName.equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(skillName == null || skillName.equals(""));
|
||||
}
|
||||
public static String getNextWorkingSkill(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -154,8 +146,7 @@ public class skill_template extends script.base_script
|
||||
return null;
|
||||
}
|
||||
java.util.Enumeration e = xpReqs.keys();
|
||||
String xpType = (String)(e.nextElement());
|
||||
return xpType;
|
||||
return (String)(e.nextElement());
|
||||
}
|
||||
public static boolean isQualifiedForWorkingSkill(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -180,11 +171,7 @@ public class skill_template extends script.base_script
|
||||
java.util.Enumeration e = xpReqs.keys();
|
||||
String xpType = (String)(e.nextElement());
|
||||
int xpCost = xpReqs.getInt(xpType);
|
||||
if (getExperiencePoints(player, xpType) < xpCost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return getExperiencePoints(player, xpType) >= xpCost;
|
||||
}
|
||||
public static boolean earnWorkingSkill(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -212,11 +199,9 @@ public class skill_template extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < skillList.length; i++)
|
||||
{
|
||||
if (!hasSkill(player, skillList[i]))
|
||||
{
|
||||
setWorkingSkill(player, skillList[i]);
|
||||
for (String aSkillList : skillList) {
|
||||
if (!hasSkill(player, aSkillList)) {
|
||||
setWorkingSkill(player, aSkillList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -246,36 +231,24 @@ public class skill_template extends script.base_script
|
||||
Vector allNewObjectsResizable = new Vector();
|
||||
allNewObjectsResizable.setSize(0);
|
||||
boolean success = true;
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
obj_id newItem = null;
|
||||
if (items[i].endsWith(".iff"))
|
||||
{
|
||||
newItem = createObjectInInventoryAllowOverload(items[i], player);
|
||||
obj_id newItem;
|
||||
for (String item : items) {
|
||||
if (item.endsWith(".iff")) {
|
||||
newItem = createObjectInInventoryAllowOverload(item, player);
|
||||
} else {
|
||||
newItem = static_item.createNewItemFunction(item, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
newItem = static_item.createNewItemFunction(items[i], player);
|
||||
}
|
||||
if (!isIdValid(newItem))
|
||||
{
|
||||
LOG("roadmap", "ERROR - Could not create roadmap item (" + items[i] + ")");
|
||||
if (!isIdValid(newItem)) {
|
||||
LOG("roadmap", "ERROR - Could not create roadmap item (" + item + ")");
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
utils.addElement(allNewObjectsResizable, newItem);
|
||||
}
|
||||
}
|
||||
string_id itemDesc = utils.unpackString(getRoadmapItemDesc(skillTemplate, skillName));
|
||||
prose_package pp = prose.getPackage(new string_id("base_player", "skill_template_item_reward"), itemDesc);
|
||||
sendSystemMessageProse(player, pp);
|
||||
obj_id[] allNewObjects = new obj_id[0];
|
||||
if (allNewObjectsResizable != null)
|
||||
{
|
||||
allNewObjects = new obj_id[allNewObjectsResizable.size()];
|
||||
allNewObjectsResizable.toArray(allNewObjects);
|
||||
}
|
||||
sendSystemMessageProse(player, prose.getPackage(new string_id("base_player", "skill_template_item_reward"), itemDesc));
|
||||
obj_id[] allNewObjects = new obj_id[allNewObjectsResizable.size()];
|
||||
allNewObjectsResizable.toArray(allNewObjects);
|
||||
showLootBox(player, allNewObjects);
|
||||
return success;
|
||||
}
|
||||
@@ -288,6 +261,7 @@ public class skill_template extends script.base_script
|
||||
}
|
||||
String[] templateNames = dataTableGetStringColumn(ITEM_REWARD_TABLE, "roadmapTemplateName");
|
||||
String[] templateSkills = dataTableGetStringColumn(ITEM_REWARD_TABLE, "roadmapSkillName");
|
||||
String itemDesc;
|
||||
for (int i = row; i < templateSkills.length; i++)
|
||||
{
|
||||
if (!templateNames[i].equals(skillTemplate))
|
||||
@@ -296,7 +270,7 @@ public class skill_template extends script.base_script
|
||||
}
|
||||
if (templateSkills[i].equals(workingSkill))
|
||||
{
|
||||
String itemDesc = dataTableGetString(ITEM_REWARD_TABLE, i, "stringId");
|
||||
itemDesc = dataTableGetString(ITEM_REWARD_TABLE, i, "stringId");
|
||||
if (itemDesc != null && !itemDesc.equals(""))
|
||||
{
|
||||
return itemDesc;
|
||||
@@ -314,6 +288,10 @@ public class skill_template extends script.base_script
|
||||
}
|
||||
String[] templateNames = dataTableGetStringColumn(ITEM_REWARD_TABLE, "roadmapTemplateName");
|
||||
String[] templateSkills = dataTableGetStringColumn(ITEM_REWARD_TABLE, "roadmapSkillName");
|
||||
String defaultItem;
|
||||
String wookieeItem;
|
||||
String ithorianItem;
|
||||
|
||||
for (int i = row; i < templateSkills.length; i++)
|
||||
{
|
||||
if (!templateNames[i].equals(skillTemplate))
|
||||
@@ -322,11 +300,11 @@ public class skill_template extends script.base_script
|
||||
}
|
||||
if (templateSkills[i].equals(workingSkill))
|
||||
{
|
||||
String defaultItem = dataTableGetString(ITEM_REWARD_TABLE, i, "itemDefault");
|
||||
defaultItem = dataTableGetString(ITEM_REWARD_TABLE, i, "itemDefault");
|
||||
int species = getSpecies(player);
|
||||
if (species == SPECIES_WOOKIEE)
|
||||
{
|
||||
String wookieeItem = dataTableGetString(ITEM_REWARD_TABLE, i, "itemWookiee");
|
||||
wookieeItem = dataTableGetString(ITEM_REWARD_TABLE, i, "itemWookiee");
|
||||
if (wookieeItem != null && !wookieeItem.equals(""))
|
||||
{
|
||||
return wookieeItem;
|
||||
@@ -334,7 +312,7 @@ public class skill_template extends script.base_script
|
||||
}
|
||||
else if (species == SPECIES_ITHORIAN)
|
||||
{
|
||||
String ithorianItem = dataTableGetString(ITEM_REWARD_TABLE, i, "itemIthorian");
|
||||
ithorianItem = dataTableGetString(ITEM_REWARD_TABLE, i, "itemIthorian");
|
||||
if (ithorianItem != null && !ithorianItem.equals(""))
|
||||
{
|
||||
return ithorianItem;
|
||||
|
||||
Regular → Executable
+22
-30
@@ -1,17 +1,11 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
import script.prose_package;
|
||||
import script.string_id;
|
||||
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import script.library.jedi;
|
||||
import script.library.powerup;
|
||||
import java.util.Vector;
|
||||
|
||||
public class slicing extends script.base_script
|
||||
{
|
||||
@@ -122,9 +116,10 @@ public class slicing extends script.base_script
|
||||
int rows = dataTableGetNumRows(table);
|
||||
Vector categories = new Vector();
|
||||
categories.setSize(0);
|
||||
String is_this_cat;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
String is_this_cat = dataTableGetString(table, i, "SLICE_CAT");
|
||||
is_this_cat = dataTableGetString(table, i, "SLICE_CAT");
|
||||
if (is_this_cat == null || is_this_cat.equals(""))
|
||||
{
|
||||
continue;
|
||||
@@ -169,9 +164,14 @@ public class slicing extends script.base_script
|
||||
int cats = 0;
|
||||
int type = 0;
|
||||
utils.setScriptVar(player, "slicing.cat", idx);
|
||||
String is_this_cat;
|
||||
String slice;
|
||||
String stat;
|
||||
String color_prefix;
|
||||
String status_suffix;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
String is_this_cat = dataTableGetString(table, i, "SLICE_CAT");
|
||||
is_this_cat = dataTableGetString(table, i, "SLICE_CAT");
|
||||
if (!is_this_cat.equals(""))
|
||||
{
|
||||
cats++;
|
||||
@@ -179,15 +179,15 @@ public class slicing extends script.base_script
|
||||
}
|
||||
if (cats == idx)
|
||||
{
|
||||
String slice = dataTableGetString(table, i, "SLICE");
|
||||
String stat = dataTableGetString(table, i, "STAT");
|
||||
slice = dataTableGetString(table, i, "SLICE");
|
||||
stat = dataTableGetString(table, i, "STAT");
|
||||
int req = dataTableGetInt(table, i, "SKILL_REQ");
|
||||
int rank = dataTableGetInt(table, i, "RANK");
|
||||
int cur_rank = getIntObjVar(item, "slice.rank." + stat);
|
||||
if (skillMod >= req)
|
||||
{
|
||||
String color_prefix = "";
|
||||
String status_suffix = "";
|
||||
color_prefix = "";
|
||||
status_suffix = "";
|
||||
if (rank > cur_rank + 1)
|
||||
{
|
||||
color_prefix = "\\#888888";
|
||||
@@ -208,7 +208,6 @@ public class slicing extends script.base_script
|
||||
}
|
||||
public static void handleSlicingSelect(obj_id player, int idx) throws InterruptedException
|
||||
{
|
||||
int cat = utils.getIntScriptVar(player, "slicing.cat");
|
||||
int row = utils.getIntScriptVar(player, "slicing." + idx);
|
||||
obj_id item = utils.getObjIdScriptVar(player, "slicing.slice_item");
|
||||
String query = utils.getStringScriptVar(player, "slicing.type");
|
||||
@@ -262,7 +261,6 @@ public class slicing extends script.base_script
|
||||
apply_status = new string_id("slicing/slicing", "cant_apply_cost");
|
||||
utils.setScriptVar(player, "slicing.apply_status", 5);
|
||||
}
|
||||
String component_line = null;
|
||||
String component = effect.getString("COMPONENT");
|
||||
String component_path = "object/tangible/smuggler/" + component + ".iff";
|
||||
string_id component_sid = new string_id("smuggler/items", component);
|
||||
@@ -271,11 +269,8 @@ public class slicing extends script.base_script
|
||||
obj_id pInv = utils.getInventoryContainer(player);
|
||||
obj_id[] contents = utils.getContents(pInv, true);
|
||||
int found = 0;
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
String tn = getTemplateName(contents[i]);
|
||||
if (tn.equals(component_path))
|
||||
{
|
||||
for (obj_id content : contents) {
|
||||
if (getTemplateName(content).equals(component_path)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
@@ -357,13 +352,10 @@ public class slicing extends script.base_script
|
||||
obj_id pInv = utils.getInventoryContainer(player);
|
||||
obj_id[] contents = utils.getContents(pInv, true);
|
||||
int found = 0;
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
String tn = getTemplateName(contents[i]);
|
||||
if (tn.equals(component_path))
|
||||
{
|
||||
for (obj_id content : contents) {
|
||||
if (getTemplateName(content).equals(component_path)) {
|
||||
found = 1;
|
||||
consumeComponent(contents[i]);
|
||||
consumeComponent(content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+8
-17
@@ -1,12 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import script.obj_id;
|
||||
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class slots extends script.base_script
|
||||
{
|
||||
@@ -81,12 +77,10 @@ public class slots extends script.base_script
|
||||
}
|
||||
Vector ret = new Vector();
|
||||
ret.setSize(0);
|
||||
for (int i = 0; i < slots.length; i++)
|
||||
{
|
||||
String name = slots[i];
|
||||
obj_id item = getObjectInSlot(target, name);
|
||||
if (isIdValid(item))
|
||||
{
|
||||
obj_id item;
|
||||
for (String name : slots) {
|
||||
item = getObjectInSlot(target, name);
|
||||
if (isIdValid(item)) {
|
||||
ret = utils.addElement(ret, name);
|
||||
}
|
||||
}
|
||||
@@ -95,11 +89,8 @@ public class slots extends script.base_script
|
||||
return null;
|
||||
}
|
||||
String[] _ret = new String[0];
|
||||
if (ret != null)
|
||||
{
|
||||
_ret = new String[ret.size()];
|
||||
ret.toArray(_ret);
|
||||
}
|
||||
_ret = new String[ret.size()];
|
||||
ret.toArray(_ret);
|
||||
return _ret;
|
||||
}
|
||||
public static String[] getOccupiedEqSlots(obj_id target) throws InterruptedException
|
||||
|
||||
Regular → Executable
+40
-48
@@ -1,15 +1,10 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.space_utils;
|
||||
import java.util.Vector;
|
||||
|
||||
public class spawning extends script.base_script
|
||||
{
|
||||
@@ -24,7 +19,6 @@ public class spawning extends script.base_script
|
||||
return;
|
||||
}
|
||||
messageTo(objSpawners[rand(0, objSpawners.length - 1)], "doSpawnEvent", null, 0, false);
|
||||
return;
|
||||
}
|
||||
public static location getRandomLocationInCircle(location locTest, float fltSize) throws InterruptedException
|
||||
{
|
||||
@@ -55,11 +49,7 @@ public class spawning extends script.base_script
|
||||
{
|
||||
int intSpawnCount = getIntObjVar(self, "intSpawnCount");
|
||||
int intCurrentSpawnCount = utils.getIntScriptVar(self, "intCurrentSpawnCount");
|
||||
if (intCurrentSpawnCount >= intSpawnCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return intCurrentSpawnCount < intSpawnCount;
|
||||
}
|
||||
public static void incrementSpawnCount(obj_id self) throws InterruptedException
|
||||
{
|
||||
@@ -70,7 +60,6 @@ public class spawning extends script.base_script
|
||||
{
|
||||
utils.setScriptVar(self, "intCurrentSpawnCount", intCurrentSpawnCount);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void addToSpawnDebugList(obj_id self, obj_id spawned) throws InterruptedException
|
||||
{
|
||||
@@ -98,9 +87,8 @@ public class spawning extends script.base_script
|
||||
obj_id[] objContents = getContents(objParent);
|
||||
if ((objContents != null) && (objContents.length > 0))
|
||||
{
|
||||
for (int intI = 0; intI < objContents.length; intI++)
|
||||
{
|
||||
getObjectsWithObjVar(objContents[intI], strObjVarName, objArray);
|
||||
for (obj_id objContent : objContents) {
|
||||
getObjectsWithObjVar(objContent, strObjVarName, objArray);
|
||||
}
|
||||
}
|
||||
return objArray;
|
||||
@@ -110,14 +98,12 @@ public class spawning extends script.base_script
|
||||
Vector objContents = new Vector();
|
||||
objContents.setSize(0);
|
||||
obj_id[] objCells = getContents(objObject);
|
||||
for (int intI = 0; intI < objCells.length; intI++)
|
||||
{
|
||||
obj_id[] objTestContents = getContents(objCells[intI]);
|
||||
if ((objTestContents != null) && (objTestContents.length > 0))
|
||||
{
|
||||
for (int intJ = 0; intJ < objTestContents.length; intJ++)
|
||||
{
|
||||
objContents = utils.addElement(objContents, objTestContents[intJ]);
|
||||
obj_id[] objTestContents;
|
||||
for (obj_id objCell : objCells) {
|
||||
objTestContents = getContents(objCell);
|
||||
if ((objTestContents != null) && (objTestContents.length > 0)) {
|
||||
for (obj_id objTestContent : objTestContents) {
|
||||
objContents = utils.addElement(objContents, objTestContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,19 +133,17 @@ public class spawning extends script.base_script
|
||||
Vector spawnedList = utils.getResizeableObjIdArrayScriptVar(spawner, "myCreations");
|
||||
for (int i = 0; i < spawnedList.size(); i++)
|
||||
{
|
||||
if (((obj_id)spawnedList.get(i)) == deadGuy)
|
||||
if (spawnedList.get(i) == deadGuy)
|
||||
{
|
||||
spawnedList.remove(((obj_id)spawnedList.get(i)));
|
||||
spawnedList.remove(spawnedList.get(i));
|
||||
continue;
|
||||
}
|
||||
if (((obj_id)spawnedList.get(i)) == null)
|
||||
if (spawnedList.get(i) == null)
|
||||
{
|
||||
spawnedList.remove(((obj_id)spawnedList.get(i)));
|
||||
continue;
|
||||
spawnedList.remove(spawnedList.get(i));
|
||||
}
|
||||
}
|
||||
utils.setScriptVar(spawner, "myCreations", spawnedList);
|
||||
return;
|
||||
}
|
||||
public static obj_id createSpawnInLegacyCell(obj_id dungeon, location creatureLocation, String creatureName) throws InterruptedException
|
||||
{
|
||||
@@ -207,14 +191,24 @@ public class spawning extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
dictionary objToSpawn;
|
||||
String object;
|
||||
String spawnRoom;
|
||||
obj_id room;
|
||||
obj_id objectCreated;
|
||||
String script;
|
||||
String[] scripts;
|
||||
String objVars;
|
||||
String objName;
|
||||
|
||||
for (int i = 0; i < numberOfObjectsToSpawn; i++)
|
||||
{
|
||||
dictionary objToSpawn = dataTableGetRow(table, i);
|
||||
objToSpawn = dataTableGetRow(table, i);
|
||||
if (objToSpawn == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String object = objToSpawn.getString("object");
|
||||
object = objToSpawn.getString("object");
|
||||
if (object == null || object.length() <= 0)
|
||||
{
|
||||
continue;
|
||||
@@ -223,46 +217,44 @@ public class spawning extends script.base_script
|
||||
float yCoord = objToSpawn.getFloat("loc_y");
|
||||
float zCoord = objToSpawn.getFloat("loc_z");
|
||||
float yaw = objToSpawn.getFloat("yaw");
|
||||
String spawnRoom = objToSpawn.getString("room");
|
||||
spawnRoom = objToSpawn.getString("room");
|
||||
if (spawnRoom == null || spawnRoom.length() <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj_id room = getCellId(dungeon, spawnRoom);
|
||||
room = getCellId(dungeon, spawnRoom);
|
||||
if (!isValidId(room))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
location objectLocation = new location(xCoord, yCoord, zCoord, planet, room);
|
||||
obj_id objectCreated = createObject(object, objectLocation);
|
||||
objectCreated = createObject(object, new location(xCoord, yCoord, zCoord, planet, room));
|
||||
if (!isValidId(objectCreated))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
setYaw(objectCreated, yaw);
|
||||
String script = objToSpawn.getString("script");
|
||||
script = objToSpawn.getString("script");
|
||||
if (script != null && script.length() > 0)
|
||||
{
|
||||
String[] scripts = split(script, ',');
|
||||
for (int j = 0; j < scripts.length; j++)
|
||||
{
|
||||
if (!hasScript(objectCreated, scripts[j]))
|
||||
{
|
||||
attachScript(objectCreated, scripts[j]);
|
||||
scripts = split(script, ',');
|
||||
for (String script1 : scripts) {
|
||||
if (!hasScript(objectCreated, script1)) {
|
||||
attachScript(objectCreated, script1);
|
||||
}
|
||||
}
|
||||
}
|
||||
String objVars = objToSpawn.getString("objvar");
|
||||
objVars = objToSpawn.getString("objvar");
|
||||
if (objVars != null && objVars.length() > 0)
|
||||
{
|
||||
utils.setObjVarsListUsingSemiColon(objectCreated, objVars);
|
||||
}
|
||||
String objName = objToSpawn.getString("name");
|
||||
objName = objToSpawn.getString("name");
|
||||
if (objName != null && objName.length() > 0)
|
||||
{
|
||||
setName(objectCreated, objName);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+15
-48
@@ -1,16 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.chat;
|
||||
import script.library.skill;
|
||||
import script.library.prose;
|
||||
import java.util.Vector;
|
||||
|
||||
public class squad_leader extends script.base_script
|
||||
{
|
||||
@@ -40,22 +32,20 @@ public class squad_leader extends script.base_script
|
||||
++i;
|
||||
}
|
||||
command = command.substring(i, textlen);
|
||||
if (command == null || command.equals(""))
|
||||
if (command.equals(""))
|
||||
{
|
||||
sendSystemMessage(squadLeader, SID_MESSAGE_PARAMETERS);
|
||||
return;
|
||||
}
|
||||
if (groupMembers != null)
|
||||
{
|
||||
for (int j = 0; j < groupMembers.length; ++j)
|
||||
{
|
||||
displayCommand(squadLeader, groupMembers[j], command);
|
||||
for (obj_id groupMember : groupMembers) {
|
||||
displayCommand(squadLeader, groupMember, command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessage(squadLeader, SID_NOT_IN_A_GROUP);
|
||||
return;
|
||||
}
|
||||
}
|
||||
public static boolean sendSquadWaypoint(obj_id officer, location wayLoc) throws InterruptedException
|
||||
@@ -64,15 +54,13 @@ public class squad_leader extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
obj_id groupId = getGroupObject(officer);
|
||||
obj_id[] groupMembers = getGroupMemberIds(groupId);
|
||||
obj_id[] groupMembers = getGroupMemberIds(getGroupObject(officer));
|
||||
dictionary dict = new dictionary();
|
||||
dict.put("wayLoc", wayLoc);
|
||||
if (groupMembers != null)
|
||||
{
|
||||
for (int i = 0; i < groupMembers.length; ++i)
|
||||
{
|
||||
messageTo(groupMembers[i], "createOfficerGroupWaypoint", dict, 0, false);
|
||||
for (obj_id groupMember : groupMembers) {
|
||||
messageTo(groupMember, "createOfficerGroupWaypoint", dict, 0, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -86,13 +74,7 @@ public class squad_leader extends script.base_script
|
||||
{
|
||||
if (groupMember != null)
|
||||
{
|
||||
prose_package pp = prose.getPackage(SID_SYS_SL, getName(squadLeader), command);
|
||||
sendSystemMessageProse(groupMember, pp);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
sendSystemMessageProse(groupMember, prose.getPackage(SID_SYS_SL, getName(squadLeader), command));
|
||||
}
|
||||
}
|
||||
public static boolean hasSkillsToSendCommand(obj_id squadLeader, int groupSize) throws InterruptedException
|
||||
@@ -100,11 +82,7 @@ public class squad_leader extends script.base_script
|
||||
String skillPointScale = MIN_SKILL_VALUE + ".." + MAX_SKILL_VALUE;
|
||||
int percent = skill.check(squadLeader, SKILL_NAME, skillPointScale);
|
||||
int groupPercent = groupSize / MAX_GROUP_SIZE;
|
||||
if (percent >= groupPercent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return percent >= groupPercent;
|
||||
}
|
||||
public static obj_id[] getSquadTargets(obj_id self, String requiredSkill) throws InterruptedException
|
||||
{
|
||||
@@ -149,17 +127,10 @@ public class squad_leader extends script.base_script
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
String varName = "combat." + command + "String";
|
||||
String text = getStringObjVar(self, varName);
|
||||
return text;
|
||||
return getStringObjVar(self, varName);
|
||||
}
|
||||
public static void barkSquadCommand(String command, String defaultText) throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
String text = getSquadCommandText(command);
|
||||
if ((text == null) || text.equals(""))
|
||||
{
|
||||
text = defaultText;
|
||||
}
|
||||
}
|
||||
public static obj_id[] getValidGroupMembers(obj_id self) throws InterruptedException
|
||||
{
|
||||
@@ -171,13 +142,11 @@ public class squad_leader extends script.base_script
|
||||
obj_id[] groupMembers = getGroupMemberIds(gid);
|
||||
Vector validMembers = new Vector();
|
||||
validMembers.setSize(0);
|
||||
for (int i = 0; i < groupMembers.length; i++)
|
||||
{
|
||||
if (!(isIdValid(groupMembers[i]) && exists(groupMembers[i]) && isPlayer(groupMembers[i]) && getDistance(self, groupMembers[i]) < 64.0f))
|
||||
{
|
||||
for (obj_id groupMember : groupMembers) {
|
||||
if (!(isIdValid(groupMember) && exists(groupMember) && isPlayer(groupMember) && getDistance(self, groupMember) < 64.0f)) {
|
||||
continue;
|
||||
}
|
||||
validMembers = utils.addElement(validMembers, groupMembers[i]);
|
||||
validMembers = utils.addElement(validMembers, groupMember);
|
||||
}
|
||||
obj_id[] _validMembers = new obj_id[0];
|
||||
if (validMembers != null)
|
||||
@@ -206,8 +175,7 @@ public class squad_leader extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj_id rallyPoint = getObjIdObjVar(player, "sl.rallyPoint.id");
|
||||
destroyWaypointInDatapad(rallyPoint, player);
|
||||
destroyWaypointInDatapad(getObjIdObjVar(player, "sl.rallyPoint.id"), player);
|
||||
removeObjVar(player, "sl.rallyPoint");
|
||||
}
|
||||
public static int getCalledShotAccuracyBonus(obj_id attacker, obj_id defender) throws InterruptedException
|
||||
@@ -260,7 +228,6 @@ public class squad_leader extends script.base_script
|
||||
{
|
||||
skillMod = 200;
|
||||
}
|
||||
float modifier = (skillMod + 75f) / 200f;
|
||||
return modifier;
|
||||
return (skillMod + 75f) / 200f;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+175
-313
@@ -1,18 +1,9 @@
|
||||
package script.library;
|
||||
|
||||
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.jedi;
|
||||
import java.lang.Math;
|
||||
import script.library.loot;
|
||||
import script.library.pgc_quests;
|
||||
import script.library.storyteller;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class static_item extends script.base_script
|
||||
{
|
||||
@@ -73,8 +64,7 @@ public class static_item extends script.base_script
|
||||
return null;
|
||||
}
|
||||
}
|
||||
dictionary itemData = new dictionary();
|
||||
itemData = dataTableGetRow(MASTER_ITEM_TABLE, itemName);
|
||||
dictionary itemData = dataTableGetRow(MASTER_ITEM_TABLE, itemName);
|
||||
if (charges > 0)
|
||||
{
|
||||
itemData.put("charges", itemData.getInt("charges") + charges);
|
||||
@@ -134,21 +124,19 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static void initializeObject(obj_id object, dictionary itemData) throws InterruptedException
|
||||
{
|
||||
String scriptList = itemData.getString("scripts");
|
||||
String itemName = itemData.getString("name");
|
||||
if (itemName == null || itemName.equals(""))
|
||||
{
|
||||
LOG("create", object + " InitializeObject FAILED: No NAME field in datatable or bad dictionary passed in");
|
||||
return;
|
||||
}
|
||||
String scriptList = itemData.getString("scripts");
|
||||
if (scriptList != null && !scriptList.equals(""))
|
||||
{
|
||||
String[] scriptArray = split(scriptList, ',');
|
||||
for (int i = 0; i < scriptArray.length; i++)
|
||||
{
|
||||
if (!hasScript(object, scriptArray[i]))
|
||||
{
|
||||
attachScript(object, scriptArray[i]);
|
||||
for (String aScriptArray : scriptArray) {
|
||||
if (!hasScript(object, aScriptArray)) {
|
||||
attachScript(object, aScriptArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,17 +168,15 @@ public class static_item extends script.base_script
|
||||
case 5:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean initializeArmor(obj_id object, String itemName) throws InterruptedException
|
||||
{
|
||||
dictionary itemData = new dictionary();
|
||||
int row = dataTableSearchColumnForString(itemName, 0, ARMOR_STAT_BALANCE_TABLE);
|
||||
if (row == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
itemData = dataTableGetRow(ARMOR_STAT_BALANCE_TABLE, row);
|
||||
dictionary itemData = dataTableGetRow(ARMOR_STAT_BALANCE_TABLE, row);
|
||||
float condition = itemData.getFloat("condition_multiplier");
|
||||
float generalProtection = itemData.getFloat("protection");
|
||||
int armorLevel = itemData.getInt("armor_level");
|
||||
@@ -223,34 +209,22 @@ public class static_item extends script.base_script
|
||||
if (attributeBonus != null && !attributeBonus.equals(""))
|
||||
{
|
||||
String[] stringArray = split(attributeBonus, ',');
|
||||
for (int i = 0; i < stringArray.length; i++)
|
||||
{
|
||||
String[] attributeArray = split(stringArray[i], '=');
|
||||
for (int x = 0; x < attributeArray.length; x++)
|
||||
{
|
||||
String[] attributeArray;
|
||||
for (String aStringArray : stringArray) {
|
||||
attributeArray = split(aStringArray, '=');
|
||||
for (String anAttributeArray : attributeArray) {
|
||||
int attribute = 0;
|
||||
if (attributeArray[0].equalsIgnoreCase("health"))
|
||||
{
|
||||
if (attributeArray[0].equalsIgnoreCase("health")) {
|
||||
attribute = HEALTH;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("action"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("action")) {
|
||||
attribute = ACTION;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("mind"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("mind")) {
|
||||
attribute = MIND;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("constitution"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("constitution")) {
|
||||
attribute = CONSTITUTION;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("stamina"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("stamina")) {
|
||||
attribute = STAMINA;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("willpower"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("willpower")) {
|
||||
attribute = WILLPOWER;
|
||||
}
|
||||
setAttributeBonus(object, attribute, utils.stringToInt(attributeArray[1]));
|
||||
@@ -261,9 +235,11 @@ public class static_item extends script.base_script
|
||||
if (dict != null)
|
||||
{
|
||||
java.util.Enumeration keys = dict.keys();
|
||||
String skillModName;
|
||||
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String skillModName = (String)keys.nextElement();
|
||||
skillModName = (String)keys.nextElement();
|
||||
int skillModValue = dict.getInt(skillModName);
|
||||
setSkillModBonus(object, skillModName, skillModValue);
|
||||
}
|
||||
@@ -275,11 +251,10 @@ public class static_item extends script.base_script
|
||||
if (colorMods != null && !colorMods.equals(""))
|
||||
{
|
||||
String[] colorArray = split(colorMods, ',');
|
||||
for (int i = 0; i < colorArray.length; i++)
|
||||
{
|
||||
String[] colorIndex = split(colorArray[i], '=');
|
||||
for (int x = 0; x < colorIndex.length; x++)
|
||||
{
|
||||
String[] colorIndex;
|
||||
for (String aColorArray : colorArray) {
|
||||
colorIndex = split(aColorArray, '=');
|
||||
for (String aColorIndex : colorIndex) {
|
||||
hue.setColor(object, "/private/" + colorIndex[0], Integer.parseInt(colorIndex[1]));
|
||||
}
|
||||
}
|
||||
@@ -288,13 +263,12 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static boolean initializeWeapon(obj_id object, String itemName) throws InterruptedException
|
||||
{
|
||||
dictionary itemData = new dictionary();
|
||||
int row = dataTableSearchColumnForString(itemName, 0, WEAPON_STAT_BALANCE_TABLE);
|
||||
if (row == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
itemData = dataTableGetRow(WEAPON_STAT_BALANCE_TABLE, row);
|
||||
dictionary itemData = dataTableGetRow(WEAPON_STAT_BALANCE_TABLE, row);
|
||||
int minDamage = itemData.getInt("min_damage");
|
||||
int maxDamage = itemData.getInt("max_damage");
|
||||
int attackSpeed = itemData.getInt("attack_speed");
|
||||
@@ -342,9 +316,11 @@ public class static_item extends script.base_script
|
||||
if (dict != null)
|
||||
{
|
||||
java.util.Enumeration keys = dict.keys();
|
||||
String skillModName;
|
||||
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String skillModName = (String)keys.nextElement();
|
||||
skillModName = (String)keys.nextElement();
|
||||
int skillModValue = dict.getInt(skillModName);
|
||||
setSkillModBonus(object, skillModName, skillModValue);
|
||||
}
|
||||
@@ -368,26 +344,18 @@ public class static_item extends script.base_script
|
||||
if (attributeBonus != null && !attributeBonus.equals(""))
|
||||
{
|
||||
String[] stringArray = split(attributeBonus, ',');
|
||||
for (int i = 0; i < stringArray.length; i++)
|
||||
{
|
||||
String[] attributeArray = split(stringArray[i], '=');
|
||||
for (int x = 0; x < attributeArray.length; x++)
|
||||
{
|
||||
String[] attributeArray;
|
||||
for (String aStringArray : stringArray) {
|
||||
attributeArray = split(aStringArray, '=');
|
||||
for (String anAttributeArray : attributeArray) {
|
||||
int attribute = 0;
|
||||
if (attributeArray[0].equalsIgnoreCase("health"))
|
||||
{
|
||||
if (attributeArray[0].equalsIgnoreCase("health")) {
|
||||
attribute = HEALTH;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("action"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("action")) {
|
||||
attribute = ACTION;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("constitution"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("constitution")) {
|
||||
attribute = CONSTITUTION;
|
||||
}
|
||||
else if (attributeArray[0].equalsIgnoreCase("stamina"))
|
||||
{
|
||||
} else if (attributeArray[0].equalsIgnoreCase("stamina")) {
|
||||
attribute = STAMINA;
|
||||
}
|
||||
setAttributeBonus(object, attribute, utils.stringToInt(attributeArray[1]));
|
||||
@@ -398,9 +366,10 @@ public class static_item extends script.base_script
|
||||
if (dict != null)
|
||||
{
|
||||
java.util.Enumeration keys = dict.keys();
|
||||
String skillModName;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String skillModName = (String)keys.nextElement();
|
||||
skillModName = (String)keys.nextElement();
|
||||
int skillModValue = dict.getInt(skillModName);
|
||||
setSkillModBonus(object, skillModName, skillModValue);
|
||||
}
|
||||
@@ -412,11 +381,10 @@ public class static_item extends script.base_script
|
||||
if (colorMods != null && !colorMods.equals(""))
|
||||
{
|
||||
String[] colorArray = split(colorMods, ',');
|
||||
for (int i = 0; i < colorArray.length; i++)
|
||||
{
|
||||
String[] colorIndex = split(colorArray[i], '=');
|
||||
for (int x = 0; x < colorIndex.length; x++)
|
||||
{
|
||||
String[] colorIndex;
|
||||
for (String aColorArray : colorArray) {
|
||||
colorIndex = split(aColorArray, '=');
|
||||
for (String aColorIndex : colorIndex) {
|
||||
hue.setColor(object, "/private/" + colorIndex[0], Integer.parseInt(colorIndex[1]));
|
||||
}
|
||||
}
|
||||
@@ -425,7 +393,6 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static boolean initializeStorytellerObject(obj_id newObject, String itemName) throws InterruptedException
|
||||
{
|
||||
dictionary itemData = new dictionary();
|
||||
if (!dataTableOpen(storyteller.STORYTELLER_DATATABLE))
|
||||
{
|
||||
return false;
|
||||
@@ -435,13 +402,10 @@ public class static_item extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
itemData = dataTableGetRow(storyteller.STORYTELLER_DATATABLE, row);
|
||||
String template = itemData.getString("template_name");
|
||||
dictionary itemData = dataTableGetRow(storyteller.STORYTELLER_DATATABLE, row);
|
||||
int type = itemData.getInt("type");
|
||||
String objvarString = itemData.getString("objvar");
|
||||
String scriptString = itemData.getString("scripts");
|
||||
setObjVarString(newObject, objvarString, type);
|
||||
setScriptString(newObject, scriptString, type);
|
||||
setObjVarString(newObject, itemData.getString("objvar"), type);
|
||||
setScriptString(newObject, itemData.getString("scripts"), type);
|
||||
String name = getString(new string_id("static_item_n", itemName)) + getString(new string_id("storyteller", "token_label"));
|
||||
if (pgc_quests.isPgcRelicObject(newObject))
|
||||
{
|
||||
@@ -456,34 +420,12 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static void setObjVarString(obj_id object, String objVarString, int type) throws InterruptedException
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case storyteller.PROP:
|
||||
break;
|
||||
case storyteller.STATIC_EFFECT:
|
||||
break;
|
||||
case storyteller.IMMEDIATE_EFFECT:
|
||||
break;
|
||||
case storyteller.COMBAT_NPC:
|
||||
break;
|
||||
case storyteller.FLAVOR_NPC:
|
||||
break;
|
||||
case storyteller.OTHER:
|
||||
break;
|
||||
case storyteller.THEATER:
|
||||
break;
|
||||
}
|
||||
if (objVarString != null && objVarString.length() > 0)
|
||||
{
|
||||
if (objVarString.equals("none"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!objVarString.equals("none")) {
|
||||
utils.setObjVarsList(object, objVarString);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void setScriptString(obj_id object, String scriptString) throws InterruptedException
|
||||
{
|
||||
@@ -494,25 +436,21 @@ public class static_item extends script.base_script
|
||||
switch (type)
|
||||
{
|
||||
case storyteller.PROP:
|
||||
attachScript(object, "systems.storyteller.prop_token");
|
||||
break;
|
||||
attachScript(object, "systems.storyteller.prop_token");
|
||||
break;
|
||||
case storyteller.STATIC_EFFECT:
|
||||
attachScript(object, "systems.storyteller.effect_token");
|
||||
break;
|
||||
case storyteller.IMMEDIATE_EFFECT:
|
||||
attachScript(object, "systems.storyteller.effect_token");
|
||||
break;
|
||||
attachScript(object, "systems.storyteller.effect_token");
|
||||
break;
|
||||
case storyteller.COMBAT_NPC:
|
||||
attachScript(object, "systems.storyteller.npc_token");
|
||||
break;
|
||||
case storyteller.FLAVOR_NPC:
|
||||
attachScript(object, "systems.storyteller.npc_token");
|
||||
break;
|
||||
attachScript(object, "systems.storyteller.npc_token");
|
||||
break;
|
||||
case storyteller.OTHER:
|
||||
break;
|
||||
break;
|
||||
case storyteller.THEATER:
|
||||
attachScript(object, "systems.storyteller.theater_token");
|
||||
break;
|
||||
attachScript(object, "systems.storyteller.theater_token");
|
||||
break;
|
||||
}
|
||||
if (scriptString == null || scriptString.equals("") || scriptString.equals("none"))
|
||||
{
|
||||
@@ -523,19 +461,13 @@ public class static_item extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < parse.length; i++)
|
||||
{
|
||||
attachScript(object, parse[i]);
|
||||
for (String aParse : parse) {
|
||||
attachScript(object, aParse);
|
||||
}
|
||||
}
|
||||
public static boolean validateLevelRequired(obj_id player, int requiredLevel) throws InterruptedException
|
||||
{
|
||||
int playerLevel = getLevel(player);
|
||||
if (playerLevel < requiredLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return getLevel(player) >= requiredLevel;
|
||||
}
|
||||
public static boolean validateLevelRequired(obj_id player, obj_id item) throws InterruptedException
|
||||
{
|
||||
@@ -597,33 +529,27 @@ public class static_item extends script.base_script
|
||||
}
|
||||
int count = getCount(item);
|
||||
int newCount = count - amount;
|
||||
if (count < amount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (newCount <= 0)
|
||||
{
|
||||
destroyObject(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
setCount(item, newCount);
|
||||
if (count >= amount) {
|
||||
if (newCount <= 0)
|
||||
{
|
||||
destroyObject(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
setCount(item, newCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void decrementUnstackedStaticItemAmount(obj_id[] items, int amount) throws InterruptedException
|
||||
{
|
||||
int totalCount = amount;
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
int itemCount = getCount(items[i]);
|
||||
if (itemCount <= totalCount)
|
||||
{
|
||||
destroyObject(items[i]);
|
||||
}
|
||||
else if (itemCount > totalCount)
|
||||
{
|
||||
for (obj_id item : items) {
|
||||
int itemCount = getCount(item);
|
||||
if (itemCount <= totalCount) {
|
||||
destroyObject(item);
|
||||
} else if (itemCount > totalCount) {
|
||||
totalCount = itemCount - totalCount;
|
||||
setCount(items[i], totalCount);
|
||||
setCount(item, totalCount);
|
||||
return;
|
||||
}
|
||||
totalCount = totalCount - itemCount;
|
||||
@@ -636,8 +562,7 @@ public class static_item extends script.base_script
|
||||
LOG("create", " Bad itemName passed into the getMasterItemDictionary " + itemName);
|
||||
return null;
|
||||
}
|
||||
dictionary itemData = new dictionary();
|
||||
itemData = dataTableGetRow(MASTER_ITEM_TABLE, itemName);
|
||||
dictionary itemData = dataTableGetRow(MASTER_ITEM_TABLE, itemName);
|
||||
if (itemData == null)
|
||||
{
|
||||
LOG("create", itemName + " Initalize from getMasterItemDictionary could not happen because row in datatable is bad");
|
||||
@@ -666,14 +591,7 @@ public class static_item extends script.base_script
|
||||
public static boolean isStaticItem(obj_id item) throws InterruptedException
|
||||
{
|
||||
String itemName = getStaticItemName(item);
|
||||
if (itemName == null || itemName.equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return !(itemName == null || itemName.equals(""));
|
||||
}
|
||||
public static boolean isStaticItem(String itemName) throws InterruptedException
|
||||
{
|
||||
@@ -699,14 +617,14 @@ public class static_item extends script.base_script
|
||||
switch (getStaticObjectType(itemName))
|
||||
{
|
||||
case 1:
|
||||
itemData = getStaticItemWeaponDictionary(itemName);
|
||||
break;
|
||||
itemData = getStaticItemWeaponDictionary(itemName);
|
||||
break;
|
||||
case 2:
|
||||
itemData = getStaticArmorDictionary(itemName);
|
||||
break;
|
||||
itemData = getStaticArmorDictionary(itemName);
|
||||
break;
|
||||
case 3:
|
||||
itemData = getStaticItemDictionary(itemName);
|
||||
break;
|
||||
itemData = getStaticItemDictionary(itemName);
|
||||
break;
|
||||
}
|
||||
return itemData;
|
||||
}
|
||||
@@ -717,8 +635,7 @@ public class static_item extends script.base_script
|
||||
LOG("create", " Itemname is Bad " + itemName);
|
||||
return null;
|
||||
}
|
||||
dictionary itemData = new dictionary();
|
||||
itemData = dataTableGetRow(WEAPON_STAT_BALANCE_TABLE, itemName);
|
||||
dictionary itemData = dataTableGetRow(WEAPON_STAT_BALANCE_TABLE, itemName);
|
||||
if (itemData == null)
|
||||
{
|
||||
LOG("create", itemName + " Initalize from getStaticItemWeaponDictionary could not happen because row in datatable is bad");
|
||||
@@ -745,8 +662,7 @@ public class static_item extends script.base_script
|
||||
LOG("create", " Itemname is Bad " + itemName);
|
||||
return null;
|
||||
}
|
||||
dictionary itemData = new dictionary();
|
||||
itemData = dataTableGetRow(ITEM_STAT_BALANCE_TABLE, itemName);
|
||||
dictionary itemData = dataTableGetRow(ITEM_STAT_BALANCE_TABLE, itemName);
|
||||
if (itemData == null)
|
||||
{
|
||||
LOG("create", itemName + " Initalize from getStaticItemDictionary could not happen because row in datatable is bad");
|
||||
@@ -773,8 +689,7 @@ public class static_item extends script.base_script
|
||||
LOG("create", " Itemname is Bad " + itemName);
|
||||
return null;
|
||||
}
|
||||
dictionary itemData = new dictionary();
|
||||
itemData = dataTableGetRow(ARMOR_STAT_BALANCE_TABLE, itemName);
|
||||
dictionary itemData = dataTableGetRow(ARMOR_STAT_BALANCE_TABLE, itemName);
|
||||
if (itemData == null)
|
||||
{
|
||||
LOG("create", itemName + " Initalize from getStaticArmorDictionary could not happen because row in datatable is bad");
|
||||
@@ -796,18 +711,16 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static void versionUpdate(obj_id self, dictionary itemData) throws InterruptedException
|
||||
{
|
||||
String itemName = itemData.getString("name");
|
||||
obj_id player = utils.getContainingPlayer(self);
|
||||
obj_id bioLink = getBioLink(self);
|
||||
String currentTemplate = getTemplateName(self);
|
||||
String staticName = getStaticItemName(self);
|
||||
if (staticName.equals("") || staticName == null)
|
||||
if (staticName.equals(""))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int itemRow = dataTableSearchColumnForString(staticName, "name", MASTER_ITEM_TABLE);
|
||||
String tableTemplate = dataTableGetString(MASTER_ITEM_TABLE, itemRow, "template_name");
|
||||
if (!currentTemplate.equals(tableTemplate))
|
||||
obj_id player = utils.getContainingPlayer(self);
|
||||
obj_id bioLink = getBioLink(self);
|
||||
if (!getTemplateName(self).equals(tableTemplate))
|
||||
{
|
||||
CustomerServiceLog("versionUpdate: ", "Old Item's (" + self + ") object template has changed. A new one must be created.");
|
||||
obj_id container = getContainedBy(self);
|
||||
@@ -859,6 +772,7 @@ public class static_item extends script.base_script
|
||||
{
|
||||
setBioLink(self, bioLink);
|
||||
}
|
||||
String itemName = itemData.getString("name");
|
||||
setStaticItemName(self, itemName);
|
||||
String objVarList = itemData.getString("creation_objvars");
|
||||
if (objVarList != null && !objVarList.equals(""))
|
||||
@@ -872,28 +786,24 @@ public class static_item extends script.base_script
|
||||
setCount(self, chargeList);
|
||||
}
|
||||
initializeObject(self, itemData);
|
||||
return;
|
||||
}
|
||||
public static void validateWornEffects(obj_id player) throws InterruptedException
|
||||
{
|
||||
obj_id[] equipSlots = metrics.getWornItems(player);
|
||||
if (equipSlots != null && equipSlots.length > 0)
|
||||
{
|
||||
for (int i = 0; i < equipSlots.length; i++)
|
||||
{
|
||||
String itemName = getStaticItemName(equipSlots[i]);
|
||||
if (itemName != null && !itemName.equals(""))
|
||||
{
|
||||
dictionary itemData = getStaticObjectTypeDictionary(itemName);
|
||||
if (itemData != null)
|
||||
{
|
||||
String itemName;
|
||||
dictionary itemData;
|
||||
for (obj_id equipSlot : equipSlots) {
|
||||
itemName = getStaticItemName(equipSlot);
|
||||
if (itemName != null && !itemName.equals("")) {
|
||||
itemData = getStaticObjectTypeDictionary(itemName);
|
||||
if (itemData != null) {
|
||||
String buffName = itemData.getString("buff_name");
|
||||
if (buffName != null && !buffName.equals(""))
|
||||
{
|
||||
if (validateLevelRequiredForWornEffect(player, (equipSlots[i])))
|
||||
{
|
||||
applyWornBuffs(equipSlots[i], getContainedBy(equipSlots[i]));
|
||||
checkForAddSetBonus(equipSlots[i], getContainedBy(equipSlots[i]));
|
||||
if (buffName != null && !buffName.equals("")) {
|
||||
if (validateLevelRequiredForWornEffect(player, (equipSlot))) {
|
||||
applyWornBuffs(equipSlot, getContainedBy(equipSlot));
|
||||
checkForAddSetBonus(equipSlot, getContainedBy(equipSlot));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -930,35 +840,29 @@ public class static_item extends script.base_script
|
||||
return;
|
||||
}
|
||||
String buffName = itemData.getString("buff_name");
|
||||
String clientEffect = itemData.getString("client_effect");
|
||||
int requiredLevel = itemData.getInt("required_level_for_effect");
|
||||
int playerLevel = getLevel(player);
|
||||
if (buffName == null || buffName.equals(""))
|
||||
{
|
||||
LOG("create", "Worn Buff Name is bad");
|
||||
return;
|
||||
}
|
||||
if (static_item.validateLevelRequired(player, requiredLevel))
|
||||
if (static_item.validateLevelRequired(player, itemData.getInt("required_level_for_effect")))
|
||||
{
|
||||
if (buff.canApplyBuff(player, buffName))
|
||||
{
|
||||
buff.applyBuff(player, player, buffName);
|
||||
playClientEffectObj(player, clientEffect, player, "");
|
||||
playClientEffectObj(player, itemData.getString("client_effect"), player, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
utils.setScriptVar(self, "buffNotApplied", true);
|
||||
sendSystemMessage(player, ALREADY_HAVE_SIMILAR_BUFF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
utils.setScriptVar(self, "buffNotApplied", true);
|
||||
sendSystemMessage(player, SID_ITEM_LEVEL_TOO_LOW);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void removeWornBuffs(obj_id self, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -988,7 +892,6 @@ public class static_item extends script.base_script
|
||||
{
|
||||
utils.removeScriptVar(self, "buffNotApplied");
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void checkForAddSetBonus(obj_id item, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1010,7 +913,6 @@ public class static_item extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void checkForRemoveSetBonus(obj_id item, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1032,7 +934,7 @@ public class static_item extends script.base_script
|
||||
buff.removeBuff(player, setBonusBuffName);
|
||||
}
|
||||
String lowerSetBonusBuffName = getSetBonusBuffName(item, setBonusIndex, numberOfSetItems);
|
||||
if (!lowerSetBonusBuffName.equals(null) && !lowerSetBonusBuffName.equals("none"))
|
||||
if (lowerSetBonusBuffName != null && !lowerSetBonusBuffName.equals("none"))
|
||||
{
|
||||
if (!buff.hasBuff(player, lowerSetBonusBuffName))
|
||||
{
|
||||
@@ -1042,7 +944,7 @@ public class static_item extends script.base_script
|
||||
else
|
||||
{
|
||||
lowerSetBonusBuffName = getSetBonusBuffName(item, setBonusIndex, (numberOfSetItems - 1));
|
||||
if (!lowerSetBonusBuffName.equals(null) && !lowerSetBonusBuffName.equals("none"))
|
||||
if (lowerSetBonusBuffName !=null && !lowerSetBonusBuffName.equals("none"))
|
||||
{
|
||||
if (!buff.hasBuff(player, lowerSetBonusBuffName))
|
||||
{
|
||||
@@ -1051,7 +953,6 @@ public class static_item extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean isSetBonusItem(obj_id item) throws InterruptedException
|
||||
{
|
||||
@@ -1084,12 +985,9 @@ public class static_item extends script.base_script
|
||||
obj_id[] equippedItems = metrics.getWornItems(player);
|
||||
if (equippedItems != null && equippedItems.length > 0)
|
||||
{
|
||||
for (int i = 0; i < equippedItems.length; i++)
|
||||
{
|
||||
if (isSetBonusItem(equippedItems[i]))
|
||||
{
|
||||
if (setBonusIndex == getSetBonusIndex(equippedItems[i]))
|
||||
{
|
||||
for (obj_id equippedItem : equippedItems) {
|
||||
if (isSetBonusItem(equippedItem)) {
|
||||
if (setBonusIndex == getSetBonusIndex(equippedItem)) {
|
||||
numSetItems++;
|
||||
}
|
||||
}
|
||||
@@ -1115,8 +1013,7 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static String getItemType(String itemName) throws InterruptedException
|
||||
{
|
||||
dictionary itemData = new dictionary();
|
||||
itemData = dataTableGetRow(MASTER_ITEM_TABLE, itemName);
|
||||
dictionary itemData = dataTableGetRow(MASTER_ITEM_TABLE, itemName);
|
||||
if (itemData == null)
|
||||
{
|
||||
return "";
|
||||
@@ -1137,24 +1034,24 @@ public class static_item extends script.base_script
|
||||
dictionary masterItemData = getMasterItemDictionary(itemName);
|
||||
String itemType = static_item.getItemType(itemName);
|
||||
dictionary specificItemData = null;
|
||||
if (itemType.equals("weapon"))
|
||||
{
|
||||
specificItemData = getStaticItemWeaponDictionary(itemName);
|
||||
}
|
||||
else if (itemType.equals("armor"))
|
||||
{
|
||||
specificItemData = getStaticArmorDictionary(itemName);
|
||||
}
|
||||
else if (itemType.equals("item"))
|
||||
{
|
||||
specificItemData = getStaticItemDictionary(itemName);
|
||||
switch (itemType) {
|
||||
case "weapon":
|
||||
specificItemData = getStaticItemWeaponDictionary(itemName);
|
||||
break;
|
||||
case "armor":
|
||||
specificItemData = getStaticArmorDictionary(itemName);
|
||||
break;
|
||||
case "item":
|
||||
specificItemData = getStaticItemDictionary(itemName);
|
||||
break;
|
||||
}
|
||||
if (specificItemData != null)
|
||||
{
|
||||
java.util.Enumeration e = specificItemData.keys();
|
||||
String s;
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String s = (e.nextElement()).toString();
|
||||
s = (e.nextElement()).toString();
|
||||
masterItemData.put(s, specificItemData.get(s));
|
||||
}
|
||||
}
|
||||
@@ -1162,18 +1059,16 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static void getAttributes(obj_id player, String staticItemName, String[] names, String[] attribs) throws InterruptedException
|
||||
{
|
||||
String itemType = static_item.getItemType(staticItemName);
|
||||
if (itemType.equals("weapon"))
|
||||
{
|
||||
getStaticWeaponObjectAttributes(player, staticItemName, names, attribs);
|
||||
}
|
||||
else if (itemType.equals("armor"))
|
||||
{
|
||||
getStaticArmorObjectAttributes(player, staticItemName, names, attribs);
|
||||
}
|
||||
else if (itemType.equals("item"))
|
||||
{
|
||||
getStaticItemObjectAttributes(player, staticItemName, names, attribs);
|
||||
switch (static_item.getItemType(staticItemName)) {
|
||||
case "weapon":
|
||||
getStaticWeaponObjectAttributes(player, staticItemName, names, attribs);
|
||||
break;
|
||||
case "armor":
|
||||
getStaticArmorObjectAttributes(player, staticItemName, names, attribs);
|
||||
break;
|
||||
case "item":
|
||||
getStaticItemObjectAttributes(player, staticItemName, names, attribs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void getStaticWeaponObjectAttributes(obj_id player, String staticItemName, String[] names, String[] attribs) throws InterruptedException
|
||||
@@ -1203,7 +1098,7 @@ public class static_item extends script.base_script
|
||||
int damageType = itemData.getInt("damage_type");
|
||||
String wpn_damage_type = "cat_wpn_damage.wpn_damage_type";
|
||||
names[free] = wpn_damage_type;
|
||||
String damageTypeStr = "kinetic";
|
||||
String damageTypeStr;
|
||||
if (damageType == 1)
|
||||
{
|
||||
damageTypeStr = "kinetic";
|
||||
@@ -1244,9 +1139,10 @@ public class static_item extends script.base_script
|
||||
if (dict != null)
|
||||
{
|
||||
java.util.Enumeration keys = dict.keys();
|
||||
String skillModName;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String skillModName = (String)keys.nextElement();
|
||||
skillModName = (String)keys.nextElement();
|
||||
int skillModValue = dict.getInt(skillModName);
|
||||
names[free] = statstf + skillModName;
|
||||
attribs[free++] = Integer.toString(skillModValue);
|
||||
@@ -1282,18 +1178,17 @@ public class static_item extends script.base_script
|
||||
int damageType = itemData.getInt("damage_type");
|
||||
String wpn_damage_type = "cat_wpn_damage.wpn_damage_type";
|
||||
names[free] = wpn_damage_type;
|
||||
String damageTypeStr = "kinetic";
|
||||
if (damageType == 1)
|
||||
{
|
||||
damageTypeStr = "kinetic";
|
||||
}
|
||||
else if (damageType == 2)
|
||||
{
|
||||
damageTypeStr = "energy";
|
||||
}
|
||||
else
|
||||
{
|
||||
damageTypeStr = "unknown";
|
||||
String damageTypeStr;
|
||||
switch(damageType){
|
||||
case 1:
|
||||
damageTypeStr = "kinetic";
|
||||
break;
|
||||
case 2:
|
||||
damageTypeStr = "energy";
|
||||
break;
|
||||
default:
|
||||
damageTypeStr = "unknown";
|
||||
break;
|
||||
}
|
||||
attribs[free++] = at + "armor_eff_" + damageTypeStr;
|
||||
int tier = itemData.getInt("tier");
|
||||
@@ -1307,9 +1202,10 @@ public class static_item extends script.base_script
|
||||
if (dict != null)
|
||||
{
|
||||
java.util.Enumeration keys = dict.keys();
|
||||
String skillModName;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String skillModName = (String)keys.nextElement();
|
||||
skillModName = (String)keys.nextElement();
|
||||
int skillModValue = dict.getInt(skillModName);
|
||||
names[free] = statstf + skillModName;
|
||||
attribs[free++] = Integer.toString(skillModValue);
|
||||
@@ -1391,9 +1287,10 @@ public class static_item extends script.base_script
|
||||
if (dict != null)
|
||||
{
|
||||
java.util.Enumeration keys = dict.keys();
|
||||
String skillModName;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String skillModName = (String)keys.nextElement();
|
||||
skillModName = (String)keys.nextElement();
|
||||
int skillModValue = dict.getInt(skillModName);
|
||||
names[free] = statstf + skillModName;
|
||||
attribs[free++] = Integer.toString(skillModValue);
|
||||
@@ -1405,7 +1302,7 @@ public class static_item extends script.base_script
|
||||
names[free] = "tier";
|
||||
attribs[free++] = "" + tier;
|
||||
names[free] = "tooltip.tier";
|
||||
attribs[free++] = "" + tier;
|
||||
attribs[free] = "" + tier;
|
||||
}
|
||||
public static dictionary parseSkillModifiers(obj_id player, String skillMods) throws InterruptedException
|
||||
{
|
||||
@@ -1413,11 +1310,10 @@ public class static_item extends script.base_script
|
||||
if (skillMods != null && !skillMods.equals(""))
|
||||
{
|
||||
String[] stringArray = split(skillMods, ',');
|
||||
for (int i = 0; i < stringArray.length; i++)
|
||||
{
|
||||
String[] modsArray = split(stringArray[i], '=');
|
||||
for (int x = 0; x < modsArray.length; x += 2)
|
||||
{
|
||||
String[] modsArray;
|
||||
for (String aStringArray : stringArray) {
|
||||
modsArray = split(aStringArray, '=');
|
||||
for (int x = 0; x < modsArray.length; x += 2) {
|
||||
dict.put(modsArray[0], utils.stringToInt(modsArray[1]));
|
||||
}
|
||||
}
|
||||
@@ -1460,11 +1356,7 @@ public class static_item extends script.base_script
|
||||
return null;
|
||||
}
|
||||
String strAppearance = dctItemInfo.getString("strBaseAppearance");
|
||||
if (strAppearance.endsWith(".iff"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strAppearance.endsWith(".iff")) {
|
||||
String[] strTemplates = dataTableGetStringColumnNoDefaults("datatables/item/dynamic_item/appearances/" + strAppearance + ".iff", "strTemplate");
|
||||
if ((strTemplates == null) || (strTemplates.length < 1))
|
||||
{
|
||||
@@ -1550,7 +1442,7 @@ public class static_item extends script.base_script
|
||||
{
|
||||
String armorBalanceTable = "datatables/item/dynamic_item/root_balance_data/armor_data.iff";
|
||||
String modifiersTable = "datatables/item/dynamic_item/modifiers/armor_mods.iff";
|
||||
String armorTypeTable = "datatables/item/dynamic_item/types/armor.iff";
|
||||
//String armorTypeTable = "datatables/item/dynamic_item/types/armor.iff";
|
||||
int minLevel = dataTableGetInt(armorBalanceTable, 0, "minLevel");
|
||||
int protectIncreasePerLevel = dataTableGetInt(armorBalanceTable, 0, "protectIncreasePerLevel");
|
||||
int minRawProtection = dataTableGetInt(armorBalanceTable, 0, "minRawProtection");
|
||||
@@ -1563,10 +1455,10 @@ public class static_item extends script.base_script
|
||||
float minSpecialMod = dataTableGetFloat(armorBalanceTable, 0, "minSpecialMod");
|
||||
float maxSpecialMod = dataTableGetFloat(armorBalanceTable, 0, "maxSpecialMod");
|
||||
float baseSpecialMod = dataTableGetFloat(armorBalanceTable, 0, "baseSpecialMod");
|
||||
float baseMod = minBaseMod;
|
||||
float primaryMod = minPrimaryMod;
|
||||
float specialMod = minSpecialMod;
|
||||
int armorTypeModRow = 0;
|
||||
float baseMod;
|
||||
float primaryMod;
|
||||
float specialMod;
|
||||
int armorTypeModRow;
|
||||
if (boolSetupData)
|
||||
{
|
||||
baseMod = rand(minBaseMod, maxBaseMod);
|
||||
@@ -1696,7 +1588,6 @@ public class static_item extends script.base_script
|
||||
}
|
||||
public static obj_id setupDynamicWeapon(obj_id objWeapon, String itemName, int intLevel, dictionary dctWeaponStats, dictionary dctItemInfo, boolean boolSetupData) throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
dictionary dctItemNames = new dictionary();
|
||||
if (boolSetupData)
|
||||
{
|
||||
@@ -1706,8 +1597,8 @@ public class static_item extends script.base_script
|
||||
dctItemNames.put("strBaseName", strBaseName);
|
||||
}
|
||||
}
|
||||
float fltMinDamageVal = 0;
|
||||
float fltMaxDamageVal = 0;
|
||||
float fltMinDamageVal;
|
||||
float fltMaxDamageVal;
|
||||
if (boolSetupData)
|
||||
{
|
||||
fltMinDamageVal = rand(0f, 1f);
|
||||
@@ -1734,7 +1625,7 @@ public class static_item extends script.base_script
|
||||
int intMaxDamage = intMaxDamageMin + (int)fltMax;
|
||||
float fltAttackSpeed = dctWeaponStats.getFloat(strWeaponString + "_attack_speed");
|
||||
float fltMaxRange = dctWeaponStats.getFloat(strWeaponString + "_max_range");
|
||||
int intDamageType = DAMAGE_NONE;
|
||||
int intDamageType;
|
||||
if (boolSetupData)
|
||||
{
|
||||
intDamageType = dctItemInfo.getInt("baseDamageType");
|
||||
@@ -1855,11 +1746,9 @@ public class static_item extends script.base_script
|
||||
setObjVar(item, "skillmod.bonus." + statBonusNames[i], statBonuses[i]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static int generateStatMod(int level) throws InterruptedException
|
||||
{
|
||||
final float VARIANCE = 0.125f;
|
||||
final float BASE_MOD = 0.2f;
|
||||
final float MAX_MOD = 0.312f;
|
||||
final float FLOOR_CHANCE = 60.0f;
|
||||
@@ -1867,12 +1756,7 @@ public class static_item extends script.base_script
|
||||
float exponentIncrement = 18 / varianceIncrements;
|
||||
float baseMod = level * BASE_MOD;
|
||||
float maxMod = level * MAX_MOD;
|
||||
float currentIncrement = 0.0f;
|
||||
float finalModFloat = baseMod;
|
||||
if (varianceIncrements < 1)
|
||||
{
|
||||
varianceIncrements = 1.0f;
|
||||
}
|
||||
float currentIncrement;
|
||||
if (exponentIncrement < 1)
|
||||
{
|
||||
exponentIncrement = 1.0f;
|
||||
@@ -1891,7 +1775,6 @@ public class static_item extends script.base_script
|
||||
currentIncrement = (float)Math.pow(FLOOR_CHANCE, 1 + (f / 100));
|
||||
if (roll < currentIncrement)
|
||||
{
|
||||
finalModFloat = baseMod;
|
||||
break;
|
||||
}
|
||||
baseMod++;
|
||||
@@ -1900,8 +1783,7 @@ public class static_item extends script.base_script
|
||||
{
|
||||
baseMod = maxMod;
|
||||
}
|
||||
int statMod = (int)baseMod;
|
||||
return statMod;
|
||||
return (int)baseMod;
|
||||
}
|
||||
public static String getArmorNameSuffix(obj_id item) throws InterruptedException
|
||||
{
|
||||
@@ -1953,10 +1835,9 @@ public class static_item extends script.base_script
|
||||
{
|
||||
if (fltRange != 0)
|
||||
{
|
||||
int intPrice = getIntObjVar(objObject, "junkDealer.intPrice");
|
||||
float fltDiff = (float)(intMaxValue - intMinValue);
|
||||
fltDiff = fltDiff * fltRange;
|
||||
intPrice = intMinValue + (int)fltDiff;
|
||||
int intPrice = intMinValue + (int)fltDiff;
|
||||
setObjVar(objObject, "junkDealer.intPrice", intPrice);
|
||||
}
|
||||
else
|
||||
@@ -1965,7 +1846,6 @@ public class static_item extends script.base_script
|
||||
intPrice = intPrice + rand(intMinValue, intMaxValue);
|
||||
setObjVar(objObject, "junkDealer.intPrice", intPrice);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static dictionary applyWeaponItemModifers(obj_id objWeapon, String strModifier, int intMinDamage, int intMaxDamage, dictionary dctItemNames) throws InterruptedException
|
||||
{
|
||||
@@ -2075,20 +1955,14 @@ public class static_item extends script.base_script
|
||||
setName(objItem, strName);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean isDynamicItem(obj_id objItem) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(objItem, "dynamic_item"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasObjVar(objItem, "dynamic_item");
|
||||
}
|
||||
public static boolean isUniqueStaticItem(obj_id item) throws InterruptedException
|
||||
{
|
||||
String item_name = getStaticItemName(item);
|
||||
dictionary dict = getMasterItemDictionary(item_name);
|
||||
dictionary dict = getMasterItemDictionary(getStaticItemName(item));
|
||||
if (dict != null)
|
||||
{
|
||||
return dict.getInt("unique") == 1;
|
||||
@@ -2112,21 +1986,15 @@ public class static_item extends script.base_script
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static boolean canCreateUniqueStaticItem(obj_id container, String itemName) throws InterruptedException
|
||||
{
|
||||
if (!isPlayer(getOwner(container)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return (!utils.playerHasStaticItemInBankOrInventory(getOwner(container), itemName));
|
||||
public static boolean canCreateUniqueStaticItem(obj_id container, String itemName) throws InterruptedException {
|
||||
return !isPlayer(getOwner(container)) || (!utils.playerHasStaticItemInBankOrInventory(getOwner(container), itemName));
|
||||
}
|
||||
public static boolean canEquip(obj_id player, obj_id item) throws InterruptedException
|
||||
{
|
||||
dictionary itemData = static_item.getMasterItemDictionary(item);
|
||||
int requiredLevel = itemData.getInt("required_level");
|
||||
String requiredSkill = itemData.getString("required_skill");
|
||||
boolean canEquip = true;
|
||||
if (!static_item.validateLevelRequired(player, requiredLevel))
|
||||
if (!static_item.validateLevelRequired(player, itemData.getInt("required_level")))
|
||||
{
|
||||
canEquip = false;
|
||||
}
|
||||
@@ -2157,7 +2025,6 @@ public class static_item extends script.base_script
|
||||
{
|
||||
setObjVar(object, ORIG_OWNER, player);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean userIsOrigOwner(obj_id object, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -2171,11 +2038,7 @@ public class static_item extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (origOwner == currentOwner)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return origOwner == currentOwner;
|
||||
}
|
||||
public static string_id getStaticItemStringIdName(obj_id object) throws InterruptedException
|
||||
{
|
||||
@@ -2187,7 +2050,6 @@ public class static_item extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String staticItemName = getStaticItemName(object);
|
||||
return new string_id(STATIC_ITEM_NAME, staticItemName);
|
||||
return new string_id(STATIC_ITEM_NAME, getStaticItemName(object));
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+454
-626
File diff suppressed because it is too large
Load Diff
Regular → Executable
+99
-239
@@ -1,21 +1,9 @@
|
||||
package script.library;
|
||||
|
||||
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.city;
|
||||
import script.library.beast_lib;
|
||||
import script.library.instance;
|
||||
import script.library.pet_lib;
|
||||
import script.library.player_structure;
|
||||
import script.library.space_utils;
|
||||
import script.library.utils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
|
||||
public class storyteller extends script.base_script
|
||||
{
|
||||
@@ -143,28 +131,26 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
float yaw = getYaw(player);
|
||||
return createTheaterObject(token, inBuildout, getLocation(player), yaw);
|
||||
return createTheaterObject(token, inBuildout, getLocation(player), getYaw(player));
|
||||
}
|
||||
public static obj_id createTheaterObject(obj_id token, boolean inBuildout, location createLoc, float yaw) throws InterruptedException
|
||||
{
|
||||
String itemName = getStaticItemName(token);
|
||||
dictionary dict = new dictionary();
|
||||
int row = dataTableSearchColumnForString(itemName, "name", storyteller.STORYTELLER_DATATABLE);
|
||||
if (row == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
dict = dataTableGetRow(storyteller.STORYTELLER_DATATABLE, itemName);
|
||||
dictionary dict = dataTableGetRow(storyteller.STORYTELLER_DATATABLE, itemName);
|
||||
String template = dict.getString("template_name");
|
||||
String objVarString = dict.getString("objvar");
|
||||
String scriptString = dict.getString("scripts");
|
||||
obj_id theater = create.object(template, createLoc);
|
||||
setYaw(theater, yaw);
|
||||
if (!isIdValid(theater))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String objVarString = dict.getString("objvar");
|
||||
String scriptString = dict.getString("scripts");
|
||||
static_item.setObjVarString(theater, objVarString);
|
||||
static_item.setScriptString(theater, scriptString);
|
||||
setStaticItemName(theater, getStaticItemName(token));
|
||||
@@ -180,8 +166,7 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
float yaw = getYaw(player);
|
||||
return createPropObject(token, player, inBuildout, getLocation(player), yaw);
|
||||
return createPropObject(token, player, inBuildout, getLocation(player), getYaw(player));
|
||||
}
|
||||
public static obj_id createPropObject(obj_id token, obj_id player, boolean inBuildout, location createLoc, float yaw) throws InterruptedException
|
||||
{
|
||||
@@ -189,19 +174,15 @@ public class storyteller extends script.base_script
|
||||
if (canDeployStorytellerToken(player, createLoc, token))
|
||||
{
|
||||
String itemName = getStaticItemName(token);
|
||||
dictionary dict = new dictionary();
|
||||
dictionary dict_m = new dictionary();
|
||||
int row = dataTableSearchColumnForString(itemName, "name", STORYTELLER_DATATABLE);
|
||||
if (row == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
dict = dataTableGetRow(STORYTELLER_DATATABLE, itemName);
|
||||
dictionary dict = dataTableGetRow(STORYTELLER_DATATABLE, itemName);
|
||||
String template = dict.getString("template_name");
|
||||
String objVarString = dict.getString("objvar");
|
||||
String scriptString = dict.getString("scripts");
|
||||
dict_m = dataTableGetRow(STATIC_ITEM_DATATABLE, itemName);
|
||||
String finalName = dict_m.getString("string_name");
|
||||
prop = create.object(template, createLoc);
|
||||
if (isIdValid(prop))
|
||||
{
|
||||
@@ -222,6 +203,7 @@ public class storyteller extends script.base_script
|
||||
setObjVar(prop, "storytellerid", player);
|
||||
setObjVar(prop, "storytellerName", getName(player));
|
||||
}
|
||||
String finalName = dataTableGetRow(STATIC_ITEM_DATATABLE, itemName).getString("string_name");
|
||||
setObjVar(prop, "storytellerCreationLoc", createLoc);
|
||||
setObjVar(prop, "storytellerTokenName", itemName);
|
||||
attachScript(prop, STORYTELLER_PROP_CONTROL_SCRIPT);
|
||||
@@ -238,19 +220,15 @@ public class storyteller extends script.base_script
|
||||
obj_id prop = null;
|
||||
if (canDeployStorytellerToken(player, createLoc, tokenName))
|
||||
{
|
||||
dictionary dict = new dictionary();
|
||||
dictionary dict_m = new dictionary();
|
||||
int row = dataTableSearchColumnForString(tokenName, "name", STORYTELLER_DATATABLE);
|
||||
if (row == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
dict = dataTableGetRow(STORYTELLER_DATATABLE, tokenName);
|
||||
dictionary dict = dataTableGetRow(STORYTELLER_DATATABLE, tokenName);
|
||||
String template = dict.getString("template_name");
|
||||
String objVarString = dict.getString("objvar");
|
||||
String scriptString = dict.getString("scripts");
|
||||
dict_m = dataTableGetRow(STATIC_ITEM_DATATABLE, tokenName);
|
||||
String finalName = dict_m.getString("string_name");
|
||||
prop = create.object(template, createLoc);
|
||||
if (isIdValid(prop))
|
||||
{
|
||||
@@ -271,6 +249,7 @@ public class storyteller extends script.base_script
|
||||
setObjVar(prop, "storytellerid", player);
|
||||
setObjVar(prop, "storytellerName", getName(player));
|
||||
}
|
||||
String finalName = dataTableGetRow(STATIC_ITEM_DATATABLE, tokenName).getString("string_name");
|
||||
setObjVar(prop, "storytellerCreationLoc", createLoc);
|
||||
setObjVar(prop, "storytellerTokenName", tokenName);
|
||||
attachScript(prop, STORYTELLER_PROP_CONTROL_SCRIPT);
|
||||
@@ -284,8 +263,7 @@ public class storyteller extends script.base_script
|
||||
public static obj_id createNpcAtLocation(obj_id token) throws InterruptedException
|
||||
{
|
||||
obj_id player = utils.getContainingPlayer(token);
|
||||
float yaw = getYaw(player);
|
||||
return createNpcAtLocation(token, player, getLocation(player), yaw);
|
||||
return createNpcAtLocation(token, player, getLocation(player), getYaw(player));
|
||||
}
|
||||
public static obj_id createNpcAtLocation(obj_id token, obj_id player, location createLoc, float yaw) throws InterruptedException
|
||||
{
|
||||
@@ -407,13 +385,12 @@ public class storyteller extends script.base_script
|
||||
public static void removeStorytellerPersistedEffect(obj_id self) throws InterruptedException
|
||||
{
|
||||
obj_id[] players = getPlayerCreaturesInRange(getLocation(self), 165.0f);
|
||||
if (players != null || players.length > 0)
|
||||
if (players != null && players.length > 0)
|
||||
{
|
||||
stopClientEffectObjByLabel(players, self, "storyteller_persisted_effect", false);
|
||||
removeObjVar(self, storyteller.EFFECT_ACTIVE_OBJVAR);
|
||||
removeTriggerVolume("storytellerPersistedEffect");
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean allowTokenPlacementInInteriors(obj_id token) throws InterruptedException
|
||||
{
|
||||
@@ -469,12 +446,7 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
public static boolean isTokenFlaggedWithDailyUsage(String tokenName) throws InterruptedException
|
||||
{
|
||||
int dailyUses = getTokenDailyUsageAmount(tokenName);
|
||||
if (dailyUses > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return getTokenDailyUsageAmount(tokenName) > 0;
|
||||
}
|
||||
public static int getTokenDailyUsesAvailable(obj_id token) throws InterruptedException
|
||||
{
|
||||
@@ -500,11 +472,9 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
public static boolean hasTokenUsesAvailable(obj_id token) throws InterruptedException
|
||||
{
|
||||
int num = 0;
|
||||
if (isTokenFlaggedWithDailyUsage(getStaticItemName(token)))
|
||||
{
|
||||
num = getTokenDailyUsesAvailable(token);
|
||||
if (num > 0)
|
||||
if (getTokenDailyUsesAvailable(token) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -532,7 +502,6 @@ public class storyteller extends script.base_script
|
||||
setObjVar(token, STORYTELLER_DAILY_COUNT_OBJVAR, dailyCount);
|
||||
sendDirtyAttributesNotification(token);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void resetTokenDailyCount(obj_id token) throws InterruptedException
|
||||
{
|
||||
@@ -556,15 +525,12 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void setTokenDailyCountResetTime(obj_id token) throws InterruptedException
|
||||
{
|
||||
int currentTime = getCalendarTime();
|
||||
int timeUntilAlarm = createDailyAlarmClock(token, "storytellerEffectTokenDailyAlarm", null, 4, 0, 0);
|
||||
int alarmStamp = currentTime + timeUntilAlarm;
|
||||
int alarmStamp = getCalendarTime() + timeUntilAlarm;
|
||||
setObjVar(token, storyteller.STORYTELLER_DAILY_COUNT_RESET, alarmStamp);
|
||||
return;
|
||||
}
|
||||
public static boolean canDeployStorytellerToken(obj_id player, location here, obj_id token) throws InterruptedException
|
||||
{
|
||||
@@ -710,13 +676,9 @@ public class storyteller extends script.base_script
|
||||
region[] regionsHere = getRegionsAtPoint(here);
|
||||
if (regionsHere != null && regionsHere.length > 0)
|
||||
{
|
||||
for (int i = 0; i < regionsHere.length; i++)
|
||||
{
|
||||
region testRegion = regionsHere[i];
|
||||
String regionName = testRegion.getName();
|
||||
int nameCheck = regionName.indexOf("storytellerblocked");
|
||||
if (nameCheck > -1)
|
||||
{
|
||||
for (region testRegion : regionsHere) {
|
||||
int nameCheck = testRegion.getName().indexOf("storytellerblocked");
|
||||
if (nameCheck > -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -797,56 +759,39 @@ public class storyteller extends script.base_script
|
||||
obj_id[] storytellerObjects = getAllObjectsWithObjVar(getLocation(player), 165.0f, "storytellerid");
|
||||
if (storytellerObjects != null && storytellerObjects.length > 0)
|
||||
{
|
||||
for (int i = 0; i < storytellerObjects.length; i++)
|
||||
{
|
||||
obj_id object = storytellerObjects[i];
|
||||
obj_id myStoryteller = getObjIdObjVar(object, "storytellerid");
|
||||
if (isIdValid(myStoryteller))
|
||||
{
|
||||
obj_id myStoryteller;
|
||||
obj_id[] playerInStory;
|
||||
String effectName;
|
||||
for (obj_id object : storytellerObjects) {
|
||||
myStoryteller = getObjIdObjVar(object, "storytellerid");
|
||||
if (isIdValid(myStoryteller)) {
|
||||
if (myStoryteller == storytellerPlayer)
|
||||
{
|
||||
if (hasObjVar(object, storyteller.EFFECT_ACTIVE_OBJVAR) && hasObjVar(object, storyteller.EFFECT_TOKEN_NAME))
|
||||
{
|
||||
String storytellerTokenName = getStringObjVar(object, storyteller.EFFECT_TOKEN_NAME);
|
||||
location here = getLocation(object);
|
||||
String effectName = storyteller.getEffectName(storytellerTokenName);
|
||||
obj_id[] playerInStory =
|
||||
{
|
||||
player
|
||||
};
|
||||
if (hasObjVar(object, storyteller.EFFECT_ACTIVE_OBJVAR) && hasObjVar(object, storyteller.EFFECT_TOKEN_NAME)) {
|
||||
effectName = storyteller.getEffectName(getStringObjVar(object, storyteller.EFFECT_TOKEN_NAME));
|
||||
playerInStory = new obj_id[]{player};
|
||||
playClientEffectObj(playerInStory, effectName, object, "", null, "storyteller_persisted_effect");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void stopStorytellerEffectsInAreaToPlayer(obj_id player, obj_id storytellerPlayer) throws InterruptedException
|
||||
{
|
||||
obj_id[] storytellerObjects = getAllObjectsWithObjVar(getLocation(player), 165.0f, "storytellerid");
|
||||
if (storytellerObjects != null && storytellerObjects.length > 0)
|
||||
{
|
||||
for (int i = 0; i < storytellerObjects.length; i++)
|
||||
{
|
||||
obj_id object = storytellerObjects[i];
|
||||
obj_id myStoryteller = getObjIdObjVar(object, "storytellerid");
|
||||
if (isIdValid(myStoryteller))
|
||||
{
|
||||
if (myStoryteller == storytellerPlayer)
|
||||
{
|
||||
if (hasObjVar(object, storyteller.EFFECT_ACTIVE_OBJVAR) && hasObjVar(object, storyteller.EFFECT_TOKEN_NAME))
|
||||
{
|
||||
String storytellerTokenName = getStringObjVar(object, storyteller.EFFECT_TOKEN_NAME);
|
||||
location here = getLocation(object);
|
||||
String effectName = storyteller.getEffectName(storytellerTokenName);
|
||||
obj_id myStoryteller;
|
||||
for (obj_id object : storytellerObjects) {
|
||||
myStoryteller = getObjIdObjVar(object, "storytellerid");
|
||||
if (isIdValid(myStoryteller)) {
|
||||
if (myStoryteller == storytellerPlayer) {
|
||||
if (hasObjVar(object, storyteller.EFFECT_ACTIVE_OBJVAR) && hasObjVar(object, storyteller.EFFECT_TOKEN_NAME)) {
|
||||
stopClientEffectObjByLabel(player, object, "storyteller_persisted_effect", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static String[] recordBlueprintData(obj_id blueprint, obj_id[] storytellerObjects, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -854,43 +799,35 @@ public class storyteller extends script.base_script
|
||||
blueprintString.setSize(0);
|
||||
Vector validStorytellerObjects = new Vector();
|
||||
validStorytellerObjects.setSize(0);
|
||||
for (int i = 0; i < storytellerObjects.length; i++)
|
||||
{
|
||||
obj_id object = storytellerObjects[i];
|
||||
obj_id objectOwner = getObjIdObjVar(object, "storytellerid");
|
||||
if (!isIdValid(objectOwner) || objectOwner != player)
|
||||
{
|
||||
obj_id objectOwner;
|
||||
obj_id blueprintAuthor;
|
||||
String tokenName;
|
||||
String[] excludedTokens = {"st_fn_storyteller_vendor"};
|
||||
location tokLoc;
|
||||
|
||||
for (obj_id object : storytellerObjects) {
|
||||
objectOwner = getObjIdObjVar(object, "storytellerid");
|
||||
if (!isIdValid(objectOwner) || objectOwner != player) {
|
||||
continue;
|
||||
}
|
||||
if (hasObjVar(object, storyteller.BLUEPRINT_AUTHOR_OBJVAR))
|
||||
{
|
||||
obj_id blueprintAuthor = getObjIdObjVar(object, storyteller.BLUEPRINT_AUTHOR_OBJVAR);
|
||||
if (!isIdValid(blueprintAuthor) || blueprintAuthor != player)
|
||||
{
|
||||
if (hasObjVar(object, storyteller.BLUEPRINT_AUTHOR_OBJVAR)) {
|
||||
blueprintAuthor = getObjIdObjVar(object, storyteller.BLUEPRINT_AUTHOR_OBJVAR);
|
||||
if (!isIdValid(blueprintAuthor) || blueprintAuthor != player) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String tokenName = getStaticItemName(object);
|
||||
if (tokenName == null || tokenName.length() < 1)
|
||||
{
|
||||
tokenName = getStaticItemName(object);
|
||||
if (tokenName == null || tokenName.length() < 1) {
|
||||
continue;
|
||||
}
|
||||
String[] excludedTokens =
|
||||
{
|
||||
"st_fn_storyteller_vendor"
|
||||
};
|
||||
boolean isExcludedToken = false;
|
||||
location tokLoc = getLocation(object);
|
||||
obj_id whatAmIStandingOn = getStandingOn(object);
|
||||
for (int q = 0; q < excludedTokens.length; q++)
|
||||
{
|
||||
if (tokenName.equals(excludedTokens[q]) || storyteller.getTokenType(tokenName) == storyteller.OTHER || isIdValid(tokLoc.cell) || (isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn)))
|
||||
{
|
||||
for (String excludedToken : excludedTokens) {
|
||||
if (tokenName.equals(excludedToken) || storyteller.getTokenType(tokenName) == storyteller.OTHER || isIdValid(getLocation(object).cell) || (isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn))) {
|
||||
isExcludedToken = true;
|
||||
}
|
||||
}
|
||||
if (isExcludedToken)
|
||||
{
|
||||
if (isExcludedToken) {
|
||||
continue;
|
||||
}
|
||||
utils.addElement(validStorytellerObjects, object);
|
||||
@@ -905,82 +842,69 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
return _blueprintString;
|
||||
}
|
||||
location centerLoc = new location();
|
||||
float maxX = -99999.0f;
|
||||
float maxZ = -99999.0f;
|
||||
float minX = 99999.0f;
|
||||
float minZ = 99999.0f;
|
||||
for (int j = 0; j < validStorytellerObjects.size(); j++)
|
||||
{
|
||||
obj_id object = ((obj_id)validStorytellerObjects.get(j));
|
||||
obj_id objectOwner = getObjIdObjVar(object, "storytellerid");
|
||||
if (!isIdValid(objectOwner) || objectOwner != player)
|
||||
{
|
||||
obj_id object;
|
||||
for (Object validStorytellerObject : validStorytellerObjects) {
|
||||
object = ((obj_id) validStorytellerObject);
|
||||
objectOwner = getObjIdObjVar(object, "storytellerid");
|
||||
if (!isIdValid(objectOwner) || objectOwner != player) {
|
||||
continue;
|
||||
}
|
||||
location objLoc = getLocation(object);
|
||||
if (objLoc.x > maxX)
|
||||
{
|
||||
if (objLoc.x > maxX) {
|
||||
maxX = objLoc.x;
|
||||
}
|
||||
if (objLoc.z > maxZ)
|
||||
{
|
||||
if (objLoc.z > maxZ) {
|
||||
maxZ = objLoc.z;
|
||||
}
|
||||
if (objLoc.x < minX)
|
||||
{
|
||||
if (objLoc.x < minX) {
|
||||
minX = objLoc.x;
|
||||
}
|
||||
if (objLoc.z < minZ)
|
||||
{
|
||||
if (objLoc.z < minZ) {
|
||||
minZ = objLoc.z;
|
||||
}
|
||||
}
|
||||
centerLoc = new location(maxX - ((maxX - minX) / 2), 0.0f, maxZ - ((maxZ - minZ) / 2));
|
||||
for (int i = 0; i < validStorytellerObjects.size(); i++)
|
||||
{
|
||||
obj_id validStoryObject = ((obj_id)validStorytellerObjects.get(i));
|
||||
String tokenName = getStaticItemName(validStoryObject);
|
||||
location playerLoc = getLocation(player);
|
||||
obj_id validStoryObject;
|
||||
location playerLoc;
|
||||
for (Object validStorytellerObject : validStorytellerObjects) {
|
||||
validStoryObject = ((obj_id) validStorytellerObject);
|
||||
tokenName = getStaticItemName(validStoryObject);
|
||||
playerLoc = getLocation(player);
|
||||
float playerYaw = getYaw(player);
|
||||
location objLoc = getLocation(validStoryObject);
|
||||
float objYaw = getYaw(validStoryObject);
|
||||
if (playerYaw != 0)
|
||||
{
|
||||
if (playerYaw != 0) {
|
||||
objLoc = storyteller.rotateSavedBlueprintDataXZ(playerLoc, objLoc, playerYaw);
|
||||
}
|
||||
float yawDiff = playerYaw - objYaw;
|
||||
float terrainHeight = objLoc.y;
|
||||
location creationLoc = getLocationObjVar(validStoryObject, "storytellerCreationLoc");
|
||||
if (creationLoc != null)
|
||||
{
|
||||
if (creationLoc != null) {
|
||||
terrainHeight = creationLoc.y;
|
||||
}
|
||||
float locX = objLoc.x - playerLoc.x;
|
||||
float locY = objLoc.y - terrainHeight;
|
||||
float locZ = objLoc.z - playerLoc.z;
|
||||
if (locY < 0.001f)
|
||||
{
|
||||
if (locY < 0.001f) {
|
||||
locY = 0.0f;
|
||||
}
|
||||
int combatLevel = 0;
|
||||
int difficulty = 0;
|
||||
if (isMob(validStoryObject))
|
||||
{
|
||||
if (isMob(validStoryObject)) {
|
||||
combatLevel = getLevel(validStoryObject);
|
||||
difficulty = getIntObjVar(validStoryObject, "difficultyClass");
|
||||
}
|
||||
String effect = "none";
|
||||
if (hasObjVar(validStoryObject, storyteller.EFFECT_ACTIVE_OBJVAR) && hasObjVar(validStoryObject, storyteller.EFFECT_TOKEN_NAME))
|
||||
{
|
||||
if (hasObjVar(validStoryObject, storyteller.EFFECT_ACTIVE_OBJVAR) && hasObjVar(validStoryObject, storyteller.EFFECT_TOKEN_NAME)) {
|
||||
effect = getStringObjVar(validStoryObject, storyteller.EFFECT_TOKEN_NAME);
|
||||
String effectEntry = buildBlueprintObjectData(storyteller.BLUEPRINT_TOKEN_NEEDED, effect, 0.0f, 0.0f, 0.0f, 0.0f, 0, 0, "none");
|
||||
utils.addElement(blueprintString, effectEntry);
|
||||
}
|
||||
String newEntry = buildBlueprintObjectData(storyteller.BLUEPRINT_TOKEN_NEEDED, tokenName, locX, locY, locZ, yawDiff, combatLevel, difficulty, effect);
|
||||
String newEntry = buildBlueprintObjectData(storyteller.BLUEPRINT_TOKEN_NEEDED, tokenName, locX, locY, locZ, playerYaw - objYaw, combatLevel, difficulty, effect);
|
||||
utils.addElement(blueprintString, newEntry);
|
||||
if (blueprintString.size() >= BLUEPRINT_MAX_NUM_OBJECTS)
|
||||
{
|
||||
if (blueprintString.size() >= BLUEPRINT_MAX_NUM_OBJECTS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1015,8 +939,7 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
public static int getBlueprintObjectDataSize(String blueprintObjectData) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(blueprintObjectData, '~');
|
||||
return parse.length;
|
||||
return split(blueprintObjectData, '~').length;
|
||||
}
|
||||
public static int getRequiredBlueprintDataSize() throws InterruptedException
|
||||
{
|
||||
@@ -1025,11 +948,7 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
public static boolean validateBlueprintData(String blueprintObjectData) throws InterruptedException
|
||||
{
|
||||
if (getBlueprintObjectDataSize(blueprintObjectData) == getRequiredBlueprintDataSize())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return getBlueprintObjectDataSize(blueprintObjectData) == getRequiredBlueprintDataSize();
|
||||
}
|
||||
public static obj_id createBlueprintObject(String objectData, obj_id blueprintController, obj_id player, location targetLoc, float targetYaw) throws InterruptedException
|
||||
{
|
||||
@@ -1095,16 +1014,14 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
public static void handleBlueprintObjectElevation(obj_id blueprintObject, dictionary params) throws InterruptedException
|
||||
{
|
||||
if (params != null || !params.isEmpty())
|
||||
if (params != null && !params.isEmpty())
|
||||
{
|
||||
float yOffset = params.getFloat("yOffset");
|
||||
obj_id player = params.getObjId("player");
|
||||
location here = getLocation(blueprintObject);
|
||||
setObjVar(blueprintObject, "storytellerCreationLoc", here);
|
||||
location newElevationLoc = new location(here.x, here.y + yOffset, here.z);
|
||||
setLocation(blueprintObject, newElevationLoc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static location getBlueprintObjectLocation(String spawnString, location centerLoc) throws InterruptedException
|
||||
{
|
||||
@@ -1115,52 +1032,39 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
public static boolean isBlueprintTokenLoaded(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
if (utils.stringToInt(parse[0]) == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return utils.stringToInt(split(spawnString, '~')[0]) == 1;
|
||||
}
|
||||
public static String getBlueprintItemName(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return parse[1];
|
||||
return split(spawnString, '~')[1];
|
||||
}
|
||||
public static float getBlueprintItemLocX(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return utils.stringToFloat(parse[2]);
|
||||
return utils.stringToFloat(split(spawnString, '~')[2]);
|
||||
}
|
||||
public static float getBlueprintItemLocY(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return utils.stringToFloat(parse[3]);
|
||||
return utils.stringToFloat(split(spawnString, '~')[3]);
|
||||
}
|
||||
public static float getBlueprintItemLocZ(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return utils.stringToFloat(parse[4]);
|
||||
return utils.stringToFloat(split(spawnString, '~')[4]);
|
||||
}
|
||||
public static float getBlueprintItemYaw(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return utils.stringToFloat(parse[5]);
|
||||
return utils.stringToFloat(split(spawnString, '~')[5]);
|
||||
}
|
||||
public static int getBlueprintItemCombatLevel(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return utils.stringToInt(parse[6]);
|
||||
return utils.stringToInt(split(spawnString, '~')[6]);
|
||||
}
|
||||
public static int getBlueprintItemDifficulty(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return utils.stringToInt(parse[7]);
|
||||
return utils.stringToInt(split(spawnString, '~')[7]);
|
||||
}
|
||||
public static String getBlueprintItemEffect(String spawnString) throws InterruptedException
|
||||
{
|
||||
String[] parse = split(spawnString, '~');
|
||||
return parse[8];
|
||||
return split(spawnString, '~')[8];
|
||||
}
|
||||
public static void blueprintParseConversion(obj_id blueprint) throws InterruptedException
|
||||
{
|
||||
@@ -1194,19 +1098,9 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
utils.setBatchObjVar(blueprint, storyteller.BLUEPRINT_OBJECTS_OBJVAR, blueprintObjects);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean doIAutoDeclineStorytellerInvites(obj_id player) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(player, storyteller.VAR_AUTODECLINE_STORY_INVITES))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (utils.hasScriptVar(player, "battlefield.active"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
public static boolean doIAutoDeclineStorytellerInvites(obj_id player) throws InterruptedException {
|
||||
return hasObjVar(player, storyteller.VAR_AUTODECLINE_STORY_INVITES) || utils.hasScriptVar(player, "battlefield.active");
|
||||
}
|
||||
public static int storyAssistantSui(obj_id storytellerPlayer, String storytellerName, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1214,8 +1108,7 @@ public class storyteller extends script.base_script
|
||||
prose_package pp = prose.getPackage(new string_id("storyteller", "assistant_invite"));
|
||||
prose.setTO(pp, storytellerName);
|
||||
String msg = "\0" + packOutOfBandProsePackage(null, pp);
|
||||
int pid = sui.msgbox(storytellerPlayer, player, msg, 2, title, sui.YES_NO, "storyAssistantHandler");
|
||||
return pid;
|
||||
return sui.msgbox(storytellerPlayer, player, msg, 2, title, sui.YES_NO, "storyAssistantHandler");
|
||||
}
|
||||
public static void storyAssistantAcepted(obj_id storytellerPlayer, String storytellerName, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1228,7 +1121,6 @@ public class storyteller extends script.base_script
|
||||
messageTo(storytellerPlayer, "handleStorytellerAssistantHasBeenAdded", webster, 0, false);
|
||||
utils.setScriptVar(player, "storytellerAssistant", storytellerPlayer);
|
||||
utils.setScriptVar(player, "storytellerAssistantName", storytellerName);
|
||||
return;
|
||||
}
|
||||
public static void storyPlayerRemoveAssistant(obj_id storytellerPlayer, String storytellerName, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1241,7 +1133,6 @@ public class storyteller extends script.base_script
|
||||
dictionary webster = new dictionary();
|
||||
webster.put("removedPlayerName", getName(player));
|
||||
messageTo(storytellerPlayer, "handleStorytellerAssistantHasBeenRemoved", webster, 0, false);
|
||||
return;
|
||||
}
|
||||
public static int storyInviteSui(obj_id storytellerPlayer, String storytellerName, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1249,8 +1140,7 @@ public class storyteller extends script.base_script
|
||||
prose_package pp = prose.getPackage(new string_id("storyteller", "sui_invite_body"));
|
||||
prose.setTO(pp, storytellerName);
|
||||
String msg = "\0" + packOutOfBandProsePackage(null, pp);
|
||||
int pid = sui.msgbox(storytellerPlayer, player, msg, 2, title, sui.YES_NO, "storyInviteHandler");
|
||||
return pid;
|
||||
return sui.msgbox(storytellerPlayer, player, msg, 2, title, sui.YES_NO, "storyInviteHandler");
|
||||
}
|
||||
public static void storyInviteAcepted(obj_id storytellerPlayer, String storytellerName, obj_id player, obj_id storytellerAssistant) throws InterruptedException
|
||||
{
|
||||
@@ -1272,7 +1162,6 @@ public class storyteller extends script.base_script
|
||||
utils.setScriptVar(player, "storytellerid", storytellerPlayer);
|
||||
utils.setScriptVar(player, "storytellerName", storytellerName);
|
||||
showStorytellerEffectsInAreaToPlayer(player, storytellerPlayer);
|
||||
return;
|
||||
}
|
||||
public static void storyPlayerRemovedFromStory(obj_id storytellerPlayer, String storytellerName, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1285,7 +1174,6 @@ public class storyteller extends script.base_script
|
||||
dictionary webster = new dictionary();
|
||||
webster.put("removedPlayerName", getName(player));
|
||||
messageTo(storytellerPlayer, "handleStorytellerPlayerHasBeenRemoved", webster, 0, false);
|
||||
return;
|
||||
}
|
||||
public static boolean storytellerCombatCheck(obj_id attacker, obj_id target) throws InterruptedException
|
||||
{
|
||||
@@ -1361,14 +1249,7 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
obj_id attackerNpcStoryteller = getObjIdObjVar(attacker, "storytellerid");
|
||||
obj_id targetNpcStoryteller = getObjIdObjVar(target, "storytellerid");
|
||||
if (attackerNpcStoryteller == targetNpcStoryteller)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return attackerNpcStoryteller == targetNpcStoryteller;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1383,14 +1264,7 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
obj_id playerStorytellerId = utils.getObjIdScriptVar(storyPlayer, "storytellerid");
|
||||
obj_id npcStorytellerId = getObjIdObjVar(storyNpc, "storytellerid");
|
||||
if (isIdValid(playerStorytellerId) && isIdValid(npcStorytellerId) && playerStorytellerId == npcStorytellerId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isIdValid(playerStorytellerId) && isIdValid(npcStorytellerId) && playerStorytellerId == npcStorytellerId;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1431,9 +1305,9 @@ public class storyteller extends script.base_script
|
||||
};
|
||||
Vector storytellerTokenTypes = new Vector();
|
||||
storytellerTokenTypes.setSize(0);
|
||||
for (int i = 0; i < sid_storytellerTokenTypes.length; i++)
|
||||
{
|
||||
String tokenType = utils.packStringId(new string_id("storyteller", sid_storytellerTokenTypes[i]));
|
||||
String tokenType;
|
||||
for (String sid_storytellerTokenType : sid_storytellerTokenTypes) {
|
||||
tokenType = utils.packStringId(new string_id("storyteller", sid_storytellerTokenType));
|
||||
storytellerTokenTypes = utils.addElement(storytellerTokenTypes, tokenType);
|
||||
}
|
||||
String[] _storytellerTokenTypes = new String[0];
|
||||
@@ -1530,11 +1404,8 @@ public class storyteller extends script.base_script
|
||||
utils.copyArray(finalList, tempList);
|
||||
finalList[0] = "item_costume_kit";
|
||||
int nextFinalListSlot = 1;
|
||||
for (int k = 0; k < tempList.length; k++)
|
||||
{
|
||||
String ref = tempList[k];
|
||||
if (!ref.equals("item_costume_kit"))
|
||||
{
|
||||
for (String ref : tempList) {
|
||||
if (!ref.equals("item_costume_kit")) {
|
||||
finalList[nextFinalListSlot] = ref;
|
||||
++nextFinalListSlot;
|
||||
}
|
||||
@@ -1623,9 +1494,7 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
int oldPid = utils.getIntScriptVar(storytellerVendor, scriptvar_path + ".pid");
|
||||
String[] tokenReferences = utils.getStringBatchScriptVar(storytellerVendor, scriptvar_path + ".tokenReferences");
|
||||
String[] tokens = utils.getStringBatchScriptVar(storytellerVendor, scriptvar_path + ".tokens");
|
||||
int tokenType = utils.getIntScriptVar(storytellerVendor, scriptvar_path + ".tokenType");
|
||||
utils.removeScriptVar(storytellerVendor, scriptvar_path + ".pid");
|
||||
utils.removeBatchScriptVar(storytellerVendor, scriptvar_path + ".tokenReferences");
|
||||
@@ -1692,7 +1561,6 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
givePurchasedToken(storytellerVendor, player, token_reference, tokenName, cost, 0);
|
||||
storyteller.displayStorytellerTokenPurchaseSUI(player, tokenType, storytellerVendor);
|
||||
return;
|
||||
}
|
||||
public static boolean requestNumCharges(int tokenType, String token_reference) throws InterruptedException
|
||||
{
|
||||
@@ -1708,11 +1576,7 @@ public class storyteller extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (token_reference.equals("item_costume_kit"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return token_reference.equals("item_costume_kit");
|
||||
}
|
||||
public static void storytellerSellTokenWithCharges(dictionary params, obj_id storytellerVendor) throws InterruptedException
|
||||
{
|
||||
@@ -1753,7 +1617,6 @@ public class storyteller extends script.base_script
|
||||
givePurchasedToken(storytellerVendor, player, token_reference, tokenName, cost * numCharges, numCharges);
|
||||
storyteller.displayStorytellerTokenPurchaseSUI(player, tokenType, storytellerVendor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void givePurchasedToken(obj_id storytellerVendor, obj_id player, String tokenReference, String tokenName, int cost, int numCharges) throws InterruptedException
|
||||
{
|
||||
@@ -1765,8 +1628,7 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
if (!money.hasFunds(player, money.MT_TOTAL, cost))
|
||||
{
|
||||
prose_package pp = prose.getPackage(new string_id("storyteller", "token_purchase_not_enough_credits"), tokenName);
|
||||
sendSystemMessageProse(player, pp);
|
||||
sendSystemMessageProse(player, prose.getPackage(new string_id("storyteller", "token_purchase_not_enough_credits"), tokenName));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1793,10 +1655,8 @@ public class storyteller extends script.base_script
|
||||
}
|
||||
CustomerServiceLog("storyteller", "(" + player + ")" + getName(player) + " has purchased (" + item + ")" + getName(item));
|
||||
logBalance("storyteller;" + getGameTime() + ";item;" + tokenReference + ";" + cost);
|
||||
prose_package pp = prose.getPackage(new string_id("storyteller", "token_purchase_complete"), player, item);
|
||||
sendSystemMessageProse(player, pp);
|
||||
sendSystemMessageProse(player, prose.getPackage(new string_id("storyteller", "token_purchase_complete"), player, item));
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void confirmCleanuptime(obj_id object) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+54
-122
@@ -1,17 +1,11 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
import script.library.skill;
|
||||
import script.library.utils;
|
||||
import script.library.list;
|
||||
import script.library.datatable;
|
||||
import java.util.Vector;
|
||||
|
||||
public class structure extends script.base_script
|
||||
{
|
||||
@@ -108,11 +102,7 @@ public class structure extends script.base_script
|
||||
return false;
|
||||
}
|
||||
obj_id topMost = getTopMostContainer(target);
|
||||
if ((topMost == target) || (topMost == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !((topMost == target) || (topMost == null));
|
||||
}
|
||||
public static String getRandomCell(obj_id structure) throws InterruptedException
|
||||
{
|
||||
@@ -154,11 +144,7 @@ public class structure extends script.base_script
|
||||
if (!cellName.equals(""))
|
||||
{
|
||||
obj_id cellId = getCellId(structure, cellName);
|
||||
if ((cellId == null) || (cellId == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((cellId != null) && (cellId != obj_id.NULL_ID)) {
|
||||
return cellId;
|
||||
}
|
||||
}
|
||||
@@ -188,11 +174,12 @@ public class structure extends script.base_script
|
||||
String[] tpfs = dataTableGetStringColumn(DATATABLE_STRUCTURE_VERSION, DATATABLE_COL_STRUCTURE);
|
||||
if ((tpfs != null) && (tpfs.length > 0))
|
||||
{
|
||||
String dataScript;
|
||||
for (int i = 0; i < tpfs.length; i++)
|
||||
{
|
||||
if (tpfs[i].equals(facilityTemplate))
|
||||
{
|
||||
String dataScript = dataTableGetString(DATATABLE_STRUCTURE_VERSION, i, DATATABLE_COL_SCRIPT);
|
||||
dataScript = dataTableGetString(DATATABLE_STRUCTURE_VERSION, i, DATATABLE_COL_SCRIPT);
|
||||
if (dataScript.equals(scriptName))
|
||||
{
|
||||
return dataTableGetInt(DATATABLE_STRUCTURE_VERSION, i, columnName);
|
||||
@@ -229,11 +216,7 @@ public class structure extends script.base_script
|
||||
}
|
||||
int current = getIntObjVar(facility, VAR_STRUCTURE_VERSION_TERMINAL);
|
||||
int latest = getFacilityTerminalVersion(facility, scriptName);
|
||||
if (current >= latest)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return current >= latest;
|
||||
}
|
||||
public static boolean isCurrentSpawnVersion(obj_id facility, String scriptName) throws InterruptedException
|
||||
{
|
||||
@@ -243,11 +226,7 @@ public class structure extends script.base_script
|
||||
}
|
||||
int current = getIntObjVar(facility, VAR_STRUCTURE_VERSION_SPAWN);
|
||||
int latest = getFacilitySpawnVersion(facility, scriptName);
|
||||
if (current >= latest)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return current >= latest;
|
||||
}
|
||||
public static obj_id[] getPlayersInStructure(obj_id facility) throws InterruptedException
|
||||
{
|
||||
@@ -260,52 +239,36 @@ public class structure extends script.base_script
|
||||
switch (getContainerType(facility))
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
obj_id[] contents = getContents(facility);
|
||||
if ((contents == null) || (contents.length == 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
if ((getTemplateName(contents[i])).equals(TEMPLATE_CELL))
|
||||
obj_id[] contents = getContents(facility);
|
||||
if ((contents == null) || (contents.length == 0))
|
||||
{
|
||||
cells = utils.addElement(cells, contents[i]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
default:
|
||||
break;
|
||||
for (obj_id content : contents) {
|
||||
if ((getTemplateName(content)).equals(TEMPLATE_CELL)) {
|
||||
cells = utils.addElement(cells, content);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((cells == null) || (cells.size() == 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
obj_id[] cellsArray = new obj_id[0];
|
||||
if (cells != null)
|
||||
{
|
||||
cellsArray = new obj_id[cells.size()];
|
||||
cells.toArray(cellsArray);
|
||||
}
|
||||
cellsArray = new obj_id[cells.size()];
|
||||
cells.toArray(cellsArray);
|
||||
Vector players = new Vector();
|
||||
players.setSize(0);
|
||||
for (int i = 0; i < cellsArray.length; i++)
|
||||
{
|
||||
obj_id[] cellContents = getContents(cellsArray[i]);
|
||||
if ((cellContents == null) || (cellContents.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int n = 0; n < cellContents.length; n++)
|
||||
{
|
||||
if (isPlayer(cellContents[n]))
|
||||
{
|
||||
players = utils.addElement(players, cellContents[n]);
|
||||
obj_id[] cellContents;
|
||||
for (obj_id aCellsArray : cellsArray) {
|
||||
cellContents = getContents(aCellsArray);
|
||||
if ((cellContents != null) && (cellContents.length != 0)) {
|
||||
for (obj_id cellContent : cellContents) {
|
||||
if (isPlayer(cellContent)) {
|
||||
players = utils.addElement(players, cellContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,12 +279,8 @@ public class structure extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id[] _players = new obj_id[0];
|
||||
if (players != null)
|
||||
{
|
||||
_players = new obj_id[players.size()];
|
||||
players.toArray(_players);
|
||||
}
|
||||
obj_id[] _players = new obj_id[players.size()];
|
||||
players.toArray(_players);
|
||||
return _players;
|
||||
}
|
||||
}
|
||||
@@ -344,10 +303,6 @@ public class structure extends script.base_script
|
||||
if ((coowners != null) && (coowners.size() > 0))
|
||||
{
|
||||
setObjVar(structure, utils.VAR_COOWNERS, coowners);
|
||||
if (isHouse)
|
||||
{
|
||||
setObjVar(player, VAR_PLAYER_HOME, structure);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -355,13 +310,9 @@ public class structure extends script.base_script
|
||||
{
|
||||
obj_id[] newCoOwners = new obj_id[1];
|
||||
newCoOwners[0] = player;
|
||||
if ((newCoOwners != null) && (newCoOwners.length > 0))
|
||||
if ((newCoOwners.length > 0))
|
||||
{
|
||||
setObjVar(structure, utils.VAR_COOWNERS, newCoOwners);
|
||||
if (isHouse)
|
||||
{
|
||||
setObjVar(player, VAR_PLAYER_HOME, structure);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -395,9 +346,6 @@ public class structure extends script.base_script
|
||||
{
|
||||
setObjVar(structure, utils.VAR_COOWNERS, coowners);
|
||||
}
|
||||
if (isHouse)
|
||||
{
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -442,11 +390,7 @@ public class structure extends script.base_script
|
||||
return false;
|
||||
}
|
||||
obj_id[] terminals = createStructureTerminals(facility, datatable);
|
||||
if ((terminals == null) || (terminals.length == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !((terminals == null) || (terminals.length == 0));
|
||||
}
|
||||
public static obj_id[] createStructureTerminals(obj_id facility, String datatable) throws InterruptedException
|
||||
{
|
||||
@@ -481,11 +425,7 @@ public class structure extends script.base_script
|
||||
obj_id CELL_ID = obj_id.NULL_ID;
|
||||
LOG("structureTerminal", "retrieved terminal data...");
|
||||
LOG("structureTerminal", "loc = " + X + ", " + Y + ". " + Z + " H = " + relativeHeading + " cell = " + CELL_NAME);
|
||||
if (CELL_NAME.equals(WORLD_DELTA))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CELL_NAME.equals(WORLD_DELTA)) {
|
||||
CELL_ID = getCellId(facility, CELL_NAME);
|
||||
}
|
||||
if (CELL_ID == null)
|
||||
@@ -494,7 +434,7 @@ public class structure extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id terminal_id = obj_id.NULL_ID;
|
||||
obj_id terminal_id;
|
||||
location spot = new location(X, Y, Z, sceneName, CELL_ID);
|
||||
float HEADING = relativeHeading;
|
||||
if (CELL_ID == obj_id.NULL_ID)
|
||||
@@ -546,9 +486,8 @@ public class structure extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < terminals.length; i++)
|
||||
{
|
||||
destroyObject(terminals[i]);
|
||||
for (obj_id terminal : terminals) {
|
||||
destroyObject(terminal);
|
||||
}
|
||||
removeObjVar(facility, VAR_STRUCTURE_TERMINALS);
|
||||
return true;
|
||||
@@ -652,14 +591,7 @@ public class structure extends script.base_script
|
||||
count++;
|
||||
}
|
||||
} while (doContinue);
|
||||
if (count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
public static boolean cleanupFillerSpawns(obj_id building) throws InterruptedException
|
||||
{
|
||||
@@ -668,14 +600,9 @@ public class structure extends script.base_script
|
||||
return false;
|
||||
}
|
||||
obj_id[] eggs = getObjIdArrayObjVar(building, VAR_FILLER_SPAWN_CURRENT_EGG);
|
||||
if ((eggs == null) || (eggs.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < eggs.length; i++)
|
||||
{
|
||||
destroyObject(eggs[i]);
|
||||
if ((eggs != null) && (eggs.length != 0)) {
|
||||
for (obj_id egg : eggs) {
|
||||
destroyObject(egg);
|
||||
}
|
||||
}
|
||||
removeObjVar(building, VAR_FILLER_SPAWN_CURRENT_BASE);
|
||||
@@ -692,11 +619,16 @@ public class structure extends script.base_script
|
||||
if (dataTableOpen(table))
|
||||
{
|
||||
String[] buildingTemplates = dataTableGetStringColumn(table, DATATABLE_COL_TEMPLATE);
|
||||
dictionary d;
|
||||
location bLoc;
|
||||
location loc;
|
||||
String lookup;
|
||||
String[] eggs;
|
||||
for (int i = 0; i < buildingTemplates.length; i++)
|
||||
{
|
||||
if (buildingTemplates[i].equals(buildingTemplate))
|
||||
{
|
||||
dictionary d = new dictionary();
|
||||
d = new dictionary();
|
||||
int idx = dataTableGetInt(table, i, DATATABLE_COL_IDX);
|
||||
if ((spawnIdx == -1) || (spawnIdx == idx))
|
||||
{
|
||||
@@ -704,8 +636,8 @@ public class structure extends script.base_script
|
||||
float dx = dataTableGetFloat(table, i, DATATABLE_COL_X);
|
||||
float dy = dataTableGetFloat(table, i, DATATABLE_COL_Y);
|
||||
float dz = dataTableGetFloat(table, i, DATATABLE_COL_Z);
|
||||
location bLoc = getLocation(building);
|
||||
location loc = new location(bLoc.x + dx, bLoc.y + dy, bLoc.z + dz, bLoc.area, bLoc.cell);
|
||||
bLoc = getLocation(building);
|
||||
loc = new location(bLoc.x + dx, bLoc.y + dy, bLoc.z + dz, bLoc.area, bLoc.cell);
|
||||
float bYaw = getYaw(building);
|
||||
if (bYaw != 0.0f)
|
||||
{
|
||||
@@ -713,15 +645,15 @@ public class structure extends script.base_script
|
||||
loc = utils.rotatePointXZ(bLoc, dist, bYaw);
|
||||
}
|
||||
d.put(DICT_LOC, loc);
|
||||
String lookup = DATATABLE_FILLER_BASE + getCurrentSceneName() + DATATABLE_FILLER_EGG_ENDING;
|
||||
lookup = DATATABLE_FILLER_BASE + getCurrentSceneName() + DATATABLE_FILLER_EGG_ENDING;
|
||||
if (dataTableOpen(lookup))
|
||||
{
|
||||
String[] eggs = dataTableGetStringColumn(lookup, DATATABLE_COL_TEMPLATE);
|
||||
eggs = dataTableGetStringColumn(lookup, DATATABLE_COL_TEMPLATE);
|
||||
switch (eggIdx)
|
||||
{
|
||||
case -1:
|
||||
eggIdx = rand(0, eggs.length - 1);
|
||||
default:
|
||||
eggIdx = rand(0, eggs.length - 1);
|
||||
default:
|
||||
if (eggIdx < eggs.length)
|
||||
{
|
||||
d.put(DICT_TEMPLATE, eggs[eggIdx]);
|
||||
|
||||
Regular → Executable
+224
-258
@@ -400,11 +400,7 @@ public class sui extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!flushSUIPage(pid))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return flushSUIPage(pid);
|
||||
}
|
||||
public static boolean setPageProperties(int pid, dictionary params) throws InterruptedException
|
||||
{
|
||||
@@ -416,16 +412,20 @@ public class sui extends script.base_script
|
||||
setPageTitle(pid, params);
|
||||
setPageButtons(pid, params);
|
||||
java.util.Enumeration keys = params.keys();
|
||||
String key;
|
||||
String[] s;
|
||||
Object val;
|
||||
String sVal;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String)(keys.nextElement());
|
||||
key = (String) (keys.nextElement());
|
||||
if (key.indexOf('-') > -1)
|
||||
{
|
||||
String[] s = split(key, '-');
|
||||
s = split(key, '-');
|
||||
if ((s != null) && (s.length == 2))
|
||||
{
|
||||
Object val = params.get(key);
|
||||
String sVal = null;
|
||||
val = params.get(key);
|
||||
sVal = null;
|
||||
if (val != null)
|
||||
{
|
||||
if (val instanceof string_id)
|
||||
@@ -436,9 +436,6 @@ public class sui extends script.base_script
|
||||
{
|
||||
sVal = (String)(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
if (sVal != null)
|
||||
{
|
||||
setSUIProperty(pid, s[0], s[1], sVal);
|
||||
@@ -481,8 +478,7 @@ public class sui extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int btns = params.getInt(BUTTONS);
|
||||
setButtonStyle(pid, btns);
|
||||
setButtonStyle(pid, params.getInt(BUTTONS));
|
||||
return true;
|
||||
}
|
||||
public static void setButtonStyle(int pid, int btns) throws InterruptedException
|
||||
@@ -490,51 +486,51 @@ public class sui extends script.base_script
|
||||
switch (btns)
|
||||
{
|
||||
case OK_ONLY:
|
||||
hideBtnCancel(pid);
|
||||
hideBtnRevert(pid);
|
||||
break;
|
||||
hideBtnCancel(pid);
|
||||
hideBtnRevert(pid);
|
||||
break;
|
||||
case OK_CANCEL:
|
||||
hideBtnRevert(pid);
|
||||
break;
|
||||
hideBtnRevert(pid);
|
||||
break;
|
||||
case YES_NO:
|
||||
hideBtnRevert(pid);
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
hideBtnRevert(pid);
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case YES_NO_CANCEL:
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case YES_NO_MAYBE:
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@maybe");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@maybe");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case YES_NO_ABSTAIN:
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@abstain");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@abstain");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case RETRY_CANCEL:
|
||||
hideBtnRevert(pid);
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@retry");
|
||||
break;
|
||||
hideBtnRevert(pid);
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@retry");
|
||||
break;
|
||||
case ABORT_RETRY_CANCEL:
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@retry");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@abort");
|
||||
break;
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@retry");
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, BTN_OK, PROP_TEXT, "@abort");
|
||||
break;
|
||||
case OK_REFRESH:
|
||||
hideBtnRevert(pid);
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
hideBtnRevert(pid);
|
||||
setSUIProperty(pid, BTN_CANCEL, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
case OK_CANCEL_REFRESH:
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
setSUIProperty(pid, BTN_REVERT, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void hideBtnCancel(int pid) throws InterruptedException
|
||||
@@ -615,46 +611,46 @@ public class sui extends script.base_script
|
||||
switch (buttons)
|
||||
{
|
||||
case OK_CANCEL:
|
||||
msgboxHideBtnLeft(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
msgboxHideBtnLeft(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case YES_NO:
|
||||
msgboxHideBtnLeft(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
msgboxHideBtnLeft(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case YES_NO_CANCEL:
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case YES_NO_MAYBE:
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@maybe");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@maybe");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case YES_NO_ABSTAIN:
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@abstain");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@abstain");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case RETRY_CANCEL:
|
||||
msgboxHideBtnLeft(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@retry");
|
||||
break;
|
||||
msgboxHideBtnLeft(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@retry");
|
||||
break;
|
||||
case ABORT_RETRY_CANCEL:
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@retry");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@abort");
|
||||
break;
|
||||
setSUIProperty(pid, MSGBOX_BTN_REVERT, PROP_TEXT, "@retry");
|
||||
setSUIProperty(pid, MSGBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@abort");
|
||||
break;
|
||||
case OK_ONLY:
|
||||
default:
|
||||
msgboxHideBtnLeft(pid);
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
msgboxHideBtnLeft(pid);
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, MSGBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void msgboxHideBtnLeft(int pid) throws InterruptedException
|
||||
@@ -693,8 +689,7 @@ public class sui extends script.base_script
|
||||
}
|
||||
public static int msgbox(obj_id owner, obj_id target, prose_package prompt, int buttons, String box_title, int style, String suiHandler) throws InterruptedException
|
||||
{
|
||||
String oob = packOutOfBandProsePackage(null, prompt);
|
||||
return msgbox(owner, target, "\0" + oob, buttons, box_title, style, suiHandler);
|
||||
return msgbox(owner, target, "\0" + packOutOfBandProsePackage(null, prompt), buttons, box_title, style, suiHandler);
|
||||
}
|
||||
public static int msgbox(obj_id owner, obj_id target, prose_package prompt, String suiHandler) throws InterruptedException
|
||||
{
|
||||
@@ -766,10 +761,7 @@ public class sui extends script.base_script
|
||||
prose_package pp = prose.getPackage(PROSE_OVER_MAX_ENTRIES, "", maxArraySize);
|
||||
sendSystemMessageProse(target, pp);
|
||||
String[] newSrc = new String[maxArraySize];
|
||||
for (int i = 0; i < maxArraySize; i++)
|
||||
{
|
||||
newSrc[i] = dsrc[i];
|
||||
}
|
||||
System.arraycopy(dsrc, 0, newSrc, 0, maxArraySize);
|
||||
dsrc = newSrc;
|
||||
}
|
||||
LOG("sui", "inputbox: clearing datasource dataInput");
|
||||
@@ -825,7 +817,6 @@ public class sui extends script.base_script
|
||||
return -1;
|
||||
}
|
||||
String scriptvar_pid = VAR_FILTER_BASE + "." + target + ".pid";
|
||||
String scriptvar_handler = VAR_FILTER_BASE + "." + target + ".handler";
|
||||
if (utils.hasScriptVar(owner, scriptvar_pid))
|
||||
{
|
||||
int oldpid = utils.getIntScriptVar(owner, scriptvar_pid);
|
||||
@@ -836,12 +827,7 @@ public class sui extends script.base_script
|
||||
cleanupFilteredInputbox(owner, target);
|
||||
}
|
||||
dictionary params = null;
|
||||
if (maxLength < 1)
|
||||
{
|
||||
maxLength = MAX_INPUT_LENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxLength >= 1) {
|
||||
params = new dictionary();
|
||||
params.put(INPUTBOX_INPUT + "-MaxLength", maxLength);
|
||||
}
|
||||
@@ -903,9 +889,7 @@ public class sui extends script.base_script
|
||||
{
|
||||
attachScript(owner, SCRIPT_FILTER_OWNER);
|
||||
}
|
||||
int cnt = utils.getIntScriptVar(owner, VAR_FILTER_COUNT);
|
||||
cnt++;
|
||||
utils.setScriptVar(owner, VAR_FILTER_COUNT, cnt);
|
||||
utils.setScriptVar(owner, VAR_FILTER_COUNT, utils.getIntScriptVar(owner, VAR_FILTER_COUNT) + 1);
|
||||
}
|
||||
public static void cleanupFilteredInputbox(obj_id owner, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -956,14 +940,14 @@ public class sui extends script.base_script
|
||||
switch (buttons)
|
||||
{
|
||||
case OK_CANCEL:
|
||||
setSUIProperty(pid, INPUTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, INPUTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
setSUIProperty(pid, INPUTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, INPUTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case OK_ONLY:
|
||||
default:
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, INPUTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, INPUTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void inputboxHideBtnMiddle(int pid) throws InterruptedException
|
||||
@@ -976,18 +960,18 @@ public class sui extends script.base_script
|
||||
switch (style)
|
||||
{
|
||||
case INPUT_COMBO:
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Enabled", "false");
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Visible", "false");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Enabled", "true");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Visible", "true");
|
||||
break;
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Enabled", "false");
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Visible", "false");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Enabled", "true");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Visible", "true");
|
||||
break;
|
||||
case INPUT_NORMAL:
|
||||
default:
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Enabled", "true");
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Visible", "true");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Enabled", "false");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Visible", "false");
|
||||
break;
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Enabled", "true");
|
||||
setSUIProperty(pid, INPUTBOX_INPUT, "Visible", "true");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Enabled", "false");
|
||||
setSUIProperty(pid, INPUTBOX_COMBO, "Visible", "false");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static int inputbox(obj_id owner, obj_id target, String prompt, int buttons, String box_title, int style, String[] dsrc, String suiHandler) throws InterruptedException
|
||||
@@ -1067,10 +1051,7 @@ public class sui extends script.base_script
|
||||
prose_package pp = prose.getPackage(PROSE_OVER_MAX_ENTRIES, "", maxArraySize);
|
||||
sendSystemMessageProse(target, pp);
|
||||
prose_package[] newSrc = new prose_package[maxArraySize];
|
||||
for (int i = 0; i < maxArraySize; i++)
|
||||
{
|
||||
newSrc[i] = dsrc[i];
|
||||
}
|
||||
System.arraycopy(dsrc, 0, newSrc, 0, maxArraySize);
|
||||
dsrc = newSrc;
|
||||
}
|
||||
}
|
||||
@@ -1080,18 +1061,15 @@ public class sui extends script.base_script
|
||||
setSUIProperty(pid, LISTBOX_TITLE, PROP_TEXT, box_title);
|
||||
setSUIProperty(pid, LISTBOX_PROMPT, PROP_TEXT, prompt);
|
||||
listboxButtonSetup(pid, buttons);
|
||||
if (dsrc != null)
|
||||
{
|
||||
clearSUIDataSource(pid, LISTBOX_DATASOURCE);
|
||||
int ubound = dsrc.length;
|
||||
for (int i = 0; i < ubound; i++)
|
||||
{
|
||||
addSUIDataItem(pid, LISTBOX_DATASOURCE, "" + i);
|
||||
String oob = "";
|
||||
oob = packOutOfBandProsePackage(oob, -1, dsrc[i]);
|
||||
setSUIPropertyOOB(pid, LISTBOX_DATASOURCE + "." + i, PROP_TEXT, oob);
|
||||
}
|
||||
}
|
||||
clearSUIDataSource(pid, LISTBOX_DATASOURCE);
|
||||
int ubound = dsrc.length;
|
||||
for (int i = 0; i < ubound; i++)
|
||||
{
|
||||
addSUIDataItem(pid, LISTBOX_DATASOURCE, "" + i);
|
||||
String oob = "";
|
||||
oob = packOutOfBandProsePackage(oob, -1, dsrc[i]);
|
||||
setSUIPropertyOOB(pid, LISTBOX_DATASOURCE + "." + i, PROP_TEXT, oob);
|
||||
}
|
||||
subscribeToSUIProperty(pid, LISTBOX_LIST, PROP_SELECTEDROW);
|
||||
subscribeToSUIProperty(pid, LISTBOX_TITLE, PROP_TEXT);
|
||||
if (show)
|
||||
@@ -1150,10 +1128,7 @@ public class sui extends script.base_script
|
||||
prose_package pp = prose.getPackage(PROSE_OVER_MAX_ENTRIES, "", maxArraySize);
|
||||
sendSystemMessageProse(target, pp);
|
||||
String[] newSrc = new String[maxArraySize];
|
||||
for (int i = 0; i < maxArraySize; i++)
|
||||
{
|
||||
newSrc[i] = dsrc[i];
|
||||
}
|
||||
System.arraycopy(dsrc, 0, newSrc, 0, maxArraySize);
|
||||
dsrc = newSrc;
|
||||
}
|
||||
}
|
||||
@@ -1163,16 +1138,13 @@ public class sui extends script.base_script
|
||||
setSUIProperty(pid, LISTBOX_TITLE, PROP_TEXT, box_title);
|
||||
setSUIProperty(pid, LISTBOX_PROMPT, PROP_TEXT, prompt);
|
||||
listboxButtonSetup(pid, buttons);
|
||||
if (dsrc != null)
|
||||
{
|
||||
clearSUIDataSource(pid, LISTBOX_DATASOURCE);
|
||||
int ubound = dsrc.length;
|
||||
for (int i = 0; i < ubound; i++)
|
||||
{
|
||||
addSUIDataItem(pid, LISTBOX_DATASOURCE, "" + i);
|
||||
setSUIProperty(pid, LISTBOX_DATASOURCE + "." + i, PROP_TEXT, dsrc[i]);
|
||||
}
|
||||
}
|
||||
clearSUIDataSource(pid, LISTBOX_DATASOURCE);
|
||||
int ubound = dsrc.length;
|
||||
for (int i = 0; i < ubound; i++)
|
||||
{
|
||||
addSUIDataItem(pid, LISTBOX_DATASOURCE, "" + i);
|
||||
setSUIProperty(pid, LISTBOX_DATASOURCE + "." + i, PROP_TEXT, dsrc[i]);
|
||||
}
|
||||
subscribeToSUIProperty(pid, LISTBOX_LIST, PROP_SELECTEDROW);
|
||||
subscribeToSUIProperty(pid, LISTBOX_TITLE, PROP_TEXT);
|
||||
if (show)
|
||||
@@ -1237,63 +1209,63 @@ public class sui extends script.base_script
|
||||
switch (buttons)
|
||||
{
|
||||
case OK_CANCEL:
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case YES_NO:
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case OK_REFRESH:
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case OK_CANCEL_REFRESH:
|
||||
listboxUseOtherButton(pid, "@refresh");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
listboxUseOtherButton(pid, "@refresh");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case REFRESH_CANCEL:
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
break;
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
break;
|
||||
case REFRESH_ONLY:
|
||||
listboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
listboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
case OK_CANCEL_ALL:
|
||||
listboxUseOtherButton(pid, "@all");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
listboxUseOtherButton(pid, "@all");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case MOVEUP_MOVEDOWN_DONE:
|
||||
listboxUseOtherButton(pid, "@movedown");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@done");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@moveup");
|
||||
break;
|
||||
listboxUseOtherButton(pid, "@movedown");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@done");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@moveup");
|
||||
break;
|
||||
case BET_MAX_BET_ONE_QUIT:
|
||||
listboxUseOtherButton(pid, "@bet_one");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@quit");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@bet_max");
|
||||
break;
|
||||
listboxUseOtherButton(pid, "@bet_one");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@quit");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@bet_max");
|
||||
break;
|
||||
case BET_MAX_BET_ONE_SPIN:
|
||||
listboxUseOtherButton(pid, "@bet_one");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@spin");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@bet_max");
|
||||
break;
|
||||
listboxUseOtherButton(pid, "@bet_one");
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@spin");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@bet_max");
|
||||
break;
|
||||
case REFRESH_LEAVE_GAME:
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@leave_game");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@leave_game");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
case REMOVE_CANCEL:
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@remove");
|
||||
break;
|
||||
setSUIProperty(pid, LISTBOX_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@remove");
|
||||
break;
|
||||
case OK_ONLY:
|
||||
default:
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, LISTBOX_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void listboxHideBtnMiddle(int pid) throws InterruptedException
|
||||
@@ -1309,7 +1281,7 @@ public class sui extends script.base_script
|
||||
}
|
||||
public static boolean getListboxOtherButtonPressed(dictionary params) throws InterruptedException
|
||||
{
|
||||
return (Boolean.valueOf(params.getString("this." + LISTBOX_PROP_OTHER_PRESSED))).booleanValue();
|
||||
return Boolean.valueOf(params.getString("this." + LISTBOX_PROP_OTHER_PRESSED));
|
||||
}
|
||||
public static int listbox(obj_id owner, obj_id target, String prompt, int buttons, String box_title, String[] dsrc, String suiHandler, boolean show) throws InterruptedException
|
||||
{
|
||||
@@ -1566,23 +1538,22 @@ public class sui extends script.base_script
|
||||
public static int getIntButtonPressed(dictionary params) throws InterruptedException
|
||||
{
|
||||
String bp = params.getString(PROP_BUTTONPRESSED);
|
||||
if ((bp == null) || (bp.equals("")))
|
||||
{
|
||||
}
|
||||
else if (bp.equals(OK))
|
||||
{
|
||||
if (params.containsKey("this.otherPressed"))
|
||||
{
|
||||
if ((params.getString("this.otherPressed")).equals("true"))
|
||||
{
|
||||
return BP_REVERT;
|
||||
}
|
||||
}
|
||||
return BP_OK;
|
||||
}
|
||||
else if (bp.equals(REVERT))
|
||||
{
|
||||
return BP_REVERT;
|
||||
if ((bp != null) && (!bp.equals(""))) {
|
||||
if (bp.equals(OK))
|
||||
{
|
||||
if (params.containsKey("this.otherPressed"))
|
||||
{
|
||||
if ((params.getString("this.otherPressed")).equals("true"))
|
||||
{
|
||||
return BP_REVERT;
|
||||
}
|
||||
}
|
||||
return BP_OK;
|
||||
}
|
||||
else if (bp.equals(REVERT))
|
||||
{
|
||||
return BP_REVERT;
|
||||
}
|
||||
}
|
||||
return BP_CANCEL;
|
||||
}
|
||||
@@ -1593,13 +1564,16 @@ public class sui extends script.base_script
|
||||
public static boolean setSUIObjVars(obj_id target, int pid, dictionary params) throws InterruptedException
|
||||
{
|
||||
java.util.Enumeration keys = params.keys();
|
||||
Object key;
|
||||
Object value;
|
||||
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
Object key = keys.nextElement();
|
||||
Object value = params.get(key);
|
||||
key = keys.nextElement();
|
||||
value = params.get(key);
|
||||
if (value instanceof Integer)
|
||||
{
|
||||
int v = (((Integer)value)).intValue();
|
||||
int v = (Integer) value;
|
||||
setObjVar(target, "sui." + pid + "." + key, v);
|
||||
}
|
||||
else if (value instanceof int[])
|
||||
@@ -1612,7 +1586,7 @@ public class sui extends script.base_script
|
||||
}
|
||||
else if (value instanceof Float)
|
||||
{
|
||||
float v = (((Float)value)).floatValue();
|
||||
float v = (Float) value;
|
||||
setObjVar(target, "sui." + pid + "." + key, v);
|
||||
}
|
||||
else if (value instanceof float[])
|
||||
@@ -1724,8 +1698,7 @@ public class sui extends script.base_script
|
||||
public static void setAssociateRange(obj_id player, int pid, obj_id target, String key) throws InterruptedException
|
||||
{
|
||||
float range = 16f;
|
||||
String tbl = "datatables/sui/associate_range.iff";
|
||||
float dta = dataTableGetFloat(tbl, key, "RANGE");
|
||||
float dta = dataTableGetFloat("datatables/sui/associate_range.iff", key, "RANGE");
|
||||
if (dta > 0f)
|
||||
{
|
||||
range = dta;
|
||||
@@ -1758,17 +1731,11 @@ public class sui extends script.base_script
|
||||
{
|
||||
setSUIProperty(pid, THIS, PROP_SOUND, sound == null ? "" : sound);
|
||||
}
|
||||
public static boolean hasPid(obj_id player, String pidName) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(player) || !exists(player))
|
||||
{
|
||||
public static boolean hasPid(obj_id player, String pidName) throws InterruptedException {
|
||||
if (!isIdValid(player) || !exists(player)) {
|
||||
return false;
|
||||
}
|
||||
if (pidName == null || pidName.equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return utils.hasScriptVar(player, "pid." + pidName);
|
||||
return !(pidName == null || pidName.equals("")) && utils.hasScriptVar(player, "pid." + pidName);
|
||||
}
|
||||
public static void setPid(obj_id player, int pid, String pidName) throws InterruptedException
|
||||
{
|
||||
@@ -1963,53 +1930,53 @@ public class sui extends script.base_script
|
||||
switch (buttons)
|
||||
{
|
||||
case OK_CANCEL:
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case YES_NO:
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@no");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@yes");
|
||||
break;
|
||||
case OK_REFRESH:
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case OK_CANCEL_REFRESH:
|
||||
TableUseOtherButton(pid, "@refresh");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
TableUseOtherButton(pid, "@refresh");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case REFRESH_CANCEL:
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
break;
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@refresh");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
break;
|
||||
case REFRESH_ONLY:
|
||||
TableHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
TableHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
case OK_CANCEL_ALL:
|
||||
TableUseOtherButton(pid, "@all");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
TableUseOtherButton(pid, "@all");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
case MOVEUP_MOVEDOWN_DONE:
|
||||
TableUseOtherButton(pid, "@movedown");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@done");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@moveup");
|
||||
break;
|
||||
TableUseOtherButton(pid, "@movedown");
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@done");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@moveup");
|
||||
break;
|
||||
case REFRESH_LEAVE_GAME:
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@leave_game");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@leave_game");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@refresh");
|
||||
break;
|
||||
case REMOVE_CANCEL:
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@remove");
|
||||
break;
|
||||
setSUIProperty(pid, TABLE_BTN_CANCEL, PROP_TEXT, "@cancel");
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@remove");
|
||||
break;
|
||||
case OK_ONLY:
|
||||
default:
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
msgboxHideBtnMiddle(pid);
|
||||
setSUIProperty(pid, TABLE_BTN_OK, PROP_TEXT, "@ok");
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static void TableHideBtnMiddle(int pid) throws InterruptedException
|
||||
@@ -2044,8 +2011,7 @@ public class sui extends script.base_script
|
||||
}
|
||||
public static String getEventType(dictionary params) throws InterruptedException
|
||||
{
|
||||
String eventType = params.getString("eventType");
|
||||
return eventType;
|
||||
return params.getString("eventType");
|
||||
}
|
||||
public static void cancelCountdownTimer(obj_id self, int event) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+57
-129
@@ -1,18 +1,12 @@
|
||||
package script.library;
|
||||
|
||||
import script.combat_engine.combat_data;
|
||||
import script.combat_engine.hit_result;
|
||||
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.space_utils;
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
public class target_dummy extends script.base_script
|
||||
{
|
||||
@@ -150,7 +144,7 @@ public class target_dummy extends script.base_script
|
||||
}
|
||||
location controllerLocation = getLocation(controller);
|
||||
location awayLoc = utils.getRandomAwayLocation(controllerLocation, 1.f, 2.f);
|
||||
if ((awayLoc.cell != null) || isIdValid(awayLoc.cell))
|
||||
if ((awayLoc.cell != null) && isIdValid(awayLoc.cell))
|
||||
{
|
||||
awayLoc = (location)controllerLocation.clone();
|
||||
}
|
||||
@@ -243,7 +237,6 @@ public class target_dummy extends script.base_script
|
||||
removeObjVar(controller, target_dummy.TARGET_DUMMY_ID_OBJVAR);
|
||||
removeTargetDummyFromPermissions(targetDummy);
|
||||
destroyObject(targetDummy);
|
||||
return;
|
||||
}
|
||||
public static void removeTargetDummyFromPermissions(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
@@ -255,7 +248,6 @@ public class target_dummy extends script.base_script
|
||||
permissionsRemoveAllowed(structure, targetDummy.toString());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void removeTargetDummyFromPermissionsViaController(obj_id controller, obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
@@ -267,7 +259,6 @@ public class target_dummy extends script.base_script
|
||||
permissionsRemoveAllowed(structure, targetDummy.toString());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static obj_id setTargetDummyOwner(obj_id controller) throws InterruptedException
|
||||
{
|
||||
@@ -285,9 +276,6 @@ public class target_dummy extends script.base_script
|
||||
setOwner(controller, owner);
|
||||
CustomerServiceLog("target_dummy", "target_dummy.scriptlib:setTargetDummyOwner - Target Dummy Controller: " + controller + " Ownership given to Owner OID: " + owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
return owner;
|
||||
}
|
||||
@@ -385,7 +373,6 @@ public class target_dummy extends script.base_script
|
||||
}
|
||||
public static boolean initializeTargetDummy(obj_id targetDummy, int combatLevel, int difficulty) throws InterruptedException
|
||||
{
|
||||
boolean result = false;
|
||||
String creatureName = getCreatureName(targetDummy);
|
||||
dictionary creatureDict = utils.dataTableGetRow(create.CREATURE_TABLE, creatureName);
|
||||
if (creatureDict != null)
|
||||
@@ -393,15 +380,15 @@ public class target_dummy extends script.base_script
|
||||
creatureDict.put("difficultyClass", difficulty);
|
||||
create.initializeCreature(targetDummy, creatureName, creatureDict, combatLevel);
|
||||
setNpcDifficulty(targetDummy, difficulty);
|
||||
result = false;
|
||||
obj_id controller = target_dummy.getTargetDummyController(targetDummy);
|
||||
if (isIdValid(controller))
|
||||
{
|
||||
setObjVar(controller, "intCombatDifficulty", combatLevel);
|
||||
setObjVar(controller, "difficultyClass", difficulty);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
public static int getTargetDummyDifficulty(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
@@ -426,7 +413,6 @@ public class target_dummy extends script.base_script
|
||||
String prompt = utils.packStringId(new string_id("target_dummy", "combat_level_prompt"));
|
||||
String name = utils.packStringId(new string_id("target_dummy", "combat_level_name"));
|
||||
sui.inputbox(targetDummy, player, prompt, sui.OK_CANCEL, name, sui.INPUT_NORMAL, null, "handleTargetDummyLevelSelect", null);
|
||||
return;
|
||||
}
|
||||
public static void promptForCombatDifficulty(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -441,8 +427,7 @@ public class target_dummy extends script.base_script
|
||||
elite,
|
||||
boss
|
||||
};
|
||||
int pid = sui.listbox(targetDummy, player, prompt, sui.OK_CANCEL, title, difficulties, "handleTargetDummyDifficultySelect");
|
||||
return;
|
||||
sui.listbox(targetDummy, player, prompt, sui.OK_CANCEL, title, difficulties, "handleTargetDummyDifficultySelect");
|
||||
}
|
||||
public static void showTargetDummyDefenseListSui(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -458,7 +443,6 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
utils.setScriptVar(player, "targetDummy.pidTargetDummyDefenses", pid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static String[] getTargetDummySkillModsOptions(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
@@ -477,14 +461,12 @@ public class target_dummy extends script.base_script
|
||||
String prompt = utils.packStringId(new string_id("target_dummy", "combat_defensive_skill_mod_prompt"));
|
||||
prompt += " " + utils.packStringId(new string_id("target_dummy", target_dummy.TARGET_DUMMY_DEFENSES[skill_mod_selected])) + " :";
|
||||
sui.inputbox(targetDummy, player, prompt, "handleTargetDummyDefensiveSkillModSet");
|
||||
return;
|
||||
}
|
||||
public static void setTargetDummyDefensiveValue(obj_id targetDummy, obj_id player, int value) throws InterruptedException
|
||||
{
|
||||
int skillModIndex = utils.getIntScriptVar(player, "targetDummySkillModSelected");
|
||||
String skillModName = target_dummy.TARGET_DUMMY_DEFENSES[skillModIndex];
|
||||
setTargetDummyDefensiveValue(targetDummy, player, value, skillModName);
|
||||
return;
|
||||
}
|
||||
public static void setTargetDummyDefensiveValue(obj_id targetDummy, obj_id player, int value, String skillModName) throws InterruptedException
|
||||
{
|
||||
@@ -535,7 +517,6 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
setObjVar(controller, "target_dummy_defense." + skillModName, value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void confirmClearYourCombatData(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -543,7 +524,6 @@ public class target_dummy extends script.base_script
|
||||
String prompt = utils.packStringId(new string_id("target_dummy", "data_cleared_confirm_prompt"));
|
||||
String handler = "confirmClearYourCombatData";
|
||||
buildConfirmClearCombatDataSui(targetDummy, player, title, prompt, handler);
|
||||
return;
|
||||
}
|
||||
public static void confirmClearAllCombatData(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -551,7 +531,6 @@ public class target_dummy extends script.base_script
|
||||
String prompt = utils.packStringId(new string_id("target_dummy", "data_all_cleared_confirm_prompt"));
|
||||
String handler = "confirmClearAllCombatData";
|
||||
buildConfirmClearCombatDataSui(targetDummy, player, title, prompt, handler);
|
||||
return;
|
||||
}
|
||||
public static void buildConfirmClearCombatDataSui(obj_id targetDummy, obj_id player, String title, String prompt, String handler) throws InterruptedException
|
||||
{
|
||||
@@ -565,7 +544,6 @@ public class target_dummy extends script.base_script
|
||||
setSUIProperty(pid, sui.MSGBOX_BTN_CANCEL, sui.PROP_TEXT, cancel_button);
|
||||
utils.setScriptVar(player, "clearCombatData.openSui", pid);
|
||||
sui.showSUIPage(pid);
|
||||
return;
|
||||
}
|
||||
public static void clearYourCombatData(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -580,7 +558,6 @@ public class target_dummy extends script.base_script
|
||||
removeObjVar(controller, target_dummy.BASE_TARGET_DUMMY_VAR);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void clearAllCombatData(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -595,7 +572,6 @@ public class target_dummy extends script.base_script
|
||||
removeObjVar(controller, target_dummy.BASE_TARGET_DUMMY_VAR);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void sendTargetDummyCombatData(obj_id attacker, obj_id defender, combat_data actionData, hit_result hitData) throws InterruptedException
|
||||
{
|
||||
@@ -607,7 +583,6 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
recoredCombatResultViaController(attacker, defender, actionData, hitData);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void recoredCombatResultViaController(obj_id attacker, obj_id targetDummy, combat_data actionData, hit_result hitData) throws InterruptedException
|
||||
{
|
||||
@@ -616,7 +591,6 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
recoredCombatResult(attacker, controller, actionData, hitData);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void recoredCombatResult(obj_id attacker, obj_id controller, combat_data actionData, hit_result hitData) throws InterruptedException
|
||||
{
|
||||
@@ -626,14 +600,10 @@ public class target_dummy extends script.base_script
|
||||
boolean attackParried = hitData.parry;
|
||||
int damageDone = hitData.damage;
|
||||
boolean criticalHit = hitData.critical;
|
||||
int criticalDamage = hitData.critDamage;
|
||||
boolean strikethroughHit = hitData.strikethrough;
|
||||
float strikethroughAmmount = hitData.strikethroughAmmount;
|
||||
boolean glancingHit = hitData.glancing;
|
||||
boolean evadedDamage = hitData.evadeResult;
|
||||
float evadeAmmount = hitData.evadeAmmount;
|
||||
boolean blockedHit = hitData.blockResult;
|
||||
int blockAmount = hitData.block;
|
||||
obj_id combatDataOwner = attacker;
|
||||
if (beast_lib.isBeast(attacker))
|
||||
{
|
||||
@@ -670,8 +640,7 @@ public class target_dummy extends script.base_script
|
||||
storeCumulativeCombatData(specificAttackData, INDEX_NUM_OF_ATTACKS, 1);
|
||||
if (!hitData.success)
|
||||
{
|
||||
int indexOfAvoidanceType = -1;
|
||||
int numAvoided = 1;
|
||||
int indexOfAvoidanceType;
|
||||
if (attackMissed)
|
||||
{
|
||||
indexOfAvoidanceType = INDEX_NUM_MISSED;
|
||||
@@ -688,11 +657,8 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
indexOfAvoidanceType = INDEX_NUM_MISSED;
|
||||
}
|
||||
if (indexOfAvoidanceType > -1)
|
||||
{
|
||||
storeCumulativeCombatData(allAttacksData, indexOfAvoidanceType, 1);
|
||||
storeCumulativeCombatData(specificAttackData, indexOfAvoidanceType, 1);
|
||||
}
|
||||
storeCumulativeCombatData(allAttacksData, indexOfAvoidanceType, 1);
|
||||
storeCumulativeCombatData(specificAttackData, indexOfAvoidanceType, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -736,13 +702,10 @@ public class target_dummy extends script.base_script
|
||||
utils.setScriptVar(controller, baseAllAttacksVar, allAttacksData);
|
||||
utils.setScriptVar(controller, baseSpecificAttackVar, specificAttackData);
|
||||
utils.setScriptVar(controller, baseAttackerVar + "." + LAST_ATTACK_TIME_VAR, getGameTime());
|
||||
return;
|
||||
}
|
||||
public static void storeCumulativeCombatData(int[] dataArray, int index, int newData) throws InterruptedException
|
||||
{
|
||||
int previousData = dataArray[index];
|
||||
dataArray[index] = previousData + newData;
|
||||
return;
|
||||
dataArray[index] = dataArray[index] + newData;
|
||||
}
|
||||
public static void storeComparisonCombatData(int[] dataArray, int newData) throws InterruptedException
|
||||
{
|
||||
@@ -760,25 +723,14 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
dataArray[INDEX_SMALLEST_ATTACK] = newData;
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean recordAsNormalHit(hit_result hitData) throws InterruptedException
|
||||
{
|
||||
boolean criticalHit = hitData.critical;
|
||||
boolean strikethroughHit = hitData.strikethrough;
|
||||
boolean glancingHit = hitData.glancing;
|
||||
boolean evadedDamage = hitData.evadeResult;
|
||||
boolean blockedHit = hitData.blockResult;
|
||||
if (!criticalHit && !strikethroughHit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !hitData.critical && !hitData.strikethrough;
|
||||
}
|
||||
public static void reportCombatData(obj_id player, obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
reportCombatDataViaController(player, targetDummy, obj_id.NULL_ID);
|
||||
return;
|
||||
}
|
||||
public static void reportCombatDataViaController(obj_id player, obj_id targetDummy, obj_id controller) throws InterruptedException
|
||||
{
|
||||
@@ -816,11 +768,10 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
sendSystemMessage(player, new string_id("target_dummy", "placement_no_combat_data"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static String getCombatDataReportString(obj_id reportDataObject, obj_id player) throws InterruptedException
|
||||
{
|
||||
String report = "";
|
||||
String report;
|
||||
String baseAttackerVar = BASE_TARGET_DUMMY_VAR + "." + player;
|
||||
if (utils.hasScriptVarTree(reportDataObject, baseAttackerVar))
|
||||
{
|
||||
@@ -828,13 +779,16 @@ public class target_dummy extends script.base_script
|
||||
Vector attackTypes = new Vector();
|
||||
attackTypes.setSize(0);
|
||||
Enumeration keys = vars.keys();
|
||||
String key;
|
||||
String[] data;
|
||||
String attackType;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String)(keys.nextElement());
|
||||
key = (String) (keys.nextElement());
|
||||
if (key.startsWith(baseAttackerVar + "."))
|
||||
{
|
||||
String[] data = split(key, '.');
|
||||
String attackType = data[2];
|
||||
data = split(key, '.');
|
||||
attackType = data[2];
|
||||
if (!attackType.equals(LAST_ATTACK_TIME_VAR))
|
||||
{
|
||||
utils.addElement(attackTypes, attackType);
|
||||
@@ -846,17 +800,15 @@ public class target_dummy extends script.base_script
|
||||
int[] initialDamageDoneArray = new int[numItems - 1];
|
||||
String[] sortedAttackTypes = new String[numItems];
|
||||
int initialIdx = 0;
|
||||
for (int i = 0; i < numItems; i++)
|
||||
{
|
||||
String attackName = ((String)attackTypes.get(i));
|
||||
if (attackName.equals(ALL_ATTACKS_SUB_VAR))
|
||||
{
|
||||
String attackName;
|
||||
String baseSpecificAttackVar;
|
||||
for (Object attackType1 : attackTypes) {
|
||||
attackName = ((String) attackType1);
|
||||
if (attackName.equals(ALL_ATTACKS_SUB_VAR)) {
|
||||
sortedAttackTypes[0] = attackName;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
initialAttackTypes[initialIdx] = attackName;
|
||||
String baseSpecificAttackVar = baseAttackerVar + "." + attackName;
|
||||
baseSpecificAttackVar = baseAttackerVar + "." + attackName;
|
||||
int[] tempAttackData = utils.getIntArrayScriptVar(reportDataObject, baseSpecificAttackVar);
|
||||
initialDamageDoneArray[initialIdx] = tempAttackData[INDEX_TOTAL_DAMAGE_DONE];
|
||||
initialIdx = initialIdx + 1;
|
||||
@@ -865,20 +817,18 @@ public class target_dummy extends script.base_script
|
||||
int[] ascendingDataArray = new int[initialDamageDoneArray.length];
|
||||
utils.copyArray(initialDamageDoneArray, ascendingDataArray);
|
||||
Arrays.sort(ascendingDataArray);
|
||||
String name;
|
||||
for (int j = 0; j < ascendingDataArray.length; j++)
|
||||
{
|
||||
int data = ascendingDataArray[j];
|
||||
int index = utils.getElementPositionInArray(initialDamageDoneArray, data);
|
||||
String name = initialAttackTypes[index];
|
||||
int index = utils.getElementPositionInArray(initialDamageDoneArray, ascendingDataArray[j]);
|
||||
name = initialAttackTypes[index];
|
||||
sortedAttackTypes[(ascendingDataArray.length) - j] = name;
|
||||
initialDamageDoneArray[index] = -1;
|
||||
}
|
||||
int numAttackTypes = sortedAttackTypes.length;
|
||||
report = utils.packStringId(REPORT_TITLE_SID) + addLineBreaks(1);
|
||||
for (int idx = 0; idx < numAttackTypes; idx++)
|
||||
{
|
||||
String attackTypeName = sortedAttackTypes[idx];
|
||||
String attackTypeVarName = baseAttackerVar + "." + attackTypeName;
|
||||
String attackTypeVarName;
|
||||
for (String attackTypeName : sortedAttackTypes) {
|
||||
attackTypeVarName = baseAttackerVar + "." + attackTypeName;
|
||||
int[] attackData = utils.getIntArrayScriptVar(reportDataObject, attackTypeVarName);
|
||||
int numAttacks = attackData[INDEX_NUM_OF_ATTACKS];
|
||||
int totalDamageDone = attackData[INDEX_TOTAL_DAMAGE_DONE];
|
||||
@@ -893,7 +843,6 @@ public class target_dummy extends script.base_script
|
||||
int numEvadedDamage = attackData[INDEX_NUM_EVADED_HITS];
|
||||
int numBlockedHit = attackData[INDEX_NUM_BLOCKED_HITS];
|
||||
int numSuccessfulAttacks = attackData[INDEX_NUM_SUCCESSFUL_HITS];
|
||||
int numNormalHits = attackData[INDEX_NUM_NORMAL_HITS];
|
||||
int averageDamage = totalDamageDone / numAttacks;
|
||||
float percentageMissed = getPercentage(numMissed, numAttacks);
|
||||
float percentageDodged = getPercentage(numDodged, numAttacks);
|
||||
@@ -903,7 +852,6 @@ public class target_dummy extends script.base_script
|
||||
float percentageGlancing = getPercentage(numGlancingHit, numAttacks);
|
||||
float percentageEvaded = getPercentage(numEvadedDamage, numAttacks);
|
||||
float percentageBlocked = getPercentage(numBlockedHit, numAttacks);
|
||||
float percentageNormal = getPercentage(numNormalHits, numAttacks);
|
||||
report += YELLOW + utils.packStringId(REPORT_ATTACK_TYPE_SID);
|
||||
report += WHITE + utils.packStringId(new string_id("cmd_n", attackTypeName)) + addLineBreaks(1);
|
||||
report += GREEN + utils.packStringId(REPORT_NUM_ATTACKS_SID) + WHITE + numAttacks + addLineBreaks(1);
|
||||
@@ -939,13 +887,12 @@ public class target_dummy extends script.base_script
|
||||
showRawCombatData(player, controller);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void showRawCombatData(obj_id player, obj_id controller) throws InterruptedException
|
||||
{
|
||||
if (isGod(player))
|
||||
{
|
||||
String report = "";
|
||||
String report;
|
||||
String baseAttackerVar = BASE_TARGET_DUMMY_VAR + "." + player;
|
||||
if (utils.hasScriptVarTree(controller, baseAttackerVar))
|
||||
{
|
||||
@@ -953,13 +900,16 @@ public class target_dummy extends script.base_script
|
||||
Vector attackTypes = new Vector();
|
||||
attackTypes.setSize(0);
|
||||
Enumeration keys = vars.keys();
|
||||
String key;
|
||||
String[] data;
|
||||
String attackType;
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String)(keys.nextElement());
|
||||
key = (String) (keys.nextElement());
|
||||
if (key.startsWith(baseAttackerVar + "."))
|
||||
{
|
||||
String[] data = split(key, '.');
|
||||
String attackType = data[2];
|
||||
data = split(key, '.');
|
||||
attackType = data[2];
|
||||
if (!attackType.equals(LAST_ATTACK_TIME_VAR))
|
||||
{
|
||||
utils.addElement(attackTypes, attackType);
|
||||
@@ -967,21 +917,19 @@ public class target_dummy extends script.base_script
|
||||
}
|
||||
}
|
||||
report = utils.packStringId(REPORT_TITLE_SID) + addLineBreaks(1);
|
||||
for (int i = 0; i < attackTypes.size(); i++)
|
||||
{
|
||||
String attackTypeName = ((String)attackTypes.get(i));
|
||||
String attackTypeVarName = baseAttackerVar + "." + attackTypeName;
|
||||
String attackTypeName;
|
||||
String attackTypeVarName;
|
||||
|
||||
for (Object attackType1 : attackTypes) {
|
||||
attackTypeName = ((String) attackType1);
|
||||
attackTypeVarName = baseAttackerVar + "." + attackTypeName;
|
||||
int[] attackData = utils.getIntArrayScriptVar(controller, attackTypeVarName);
|
||||
report += attackTypeName + ": { ";
|
||||
for (int j = 0; j < attackData.length; j++)
|
||||
{
|
||||
for (int j = 0; j < attackData.length; j++) {
|
||||
report += attackData[j];
|
||||
if (j == attackData.length - 1)
|
||||
{
|
||||
if (j == attackData.length - 1) {
|
||||
report += " }" + sui.newLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
report += ", ";
|
||||
}
|
||||
}
|
||||
@@ -1005,7 +953,6 @@ public class target_dummy extends script.base_script
|
||||
utils.setScriptVar(player, "target_dummy.rawCombatReportSui", pid);
|
||||
sui.showSUIPage(pid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static float getPercentage(float num, float total) throws InterruptedException
|
||||
{
|
||||
@@ -1021,7 +968,6 @@ public class target_dummy extends script.base_script
|
||||
{
|
||||
detachScript(targetDummy, "ai.creature_combat");
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void freezeMob(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
@@ -1046,11 +992,8 @@ public class target_dummy extends script.base_script
|
||||
removeAttackerFromCombat(targetDummy, player);
|
||||
if (enemies != null && enemies.length > 0)
|
||||
{
|
||||
for (int i = 0; i < enemies.length; i++)
|
||||
{
|
||||
obj_id enemy = enemies[i];
|
||||
if (isIdValid(enemy) && enemy != player)
|
||||
{
|
||||
for (obj_id enemy : enemies) {
|
||||
if (isIdValid(enemy) && enemy != player) {
|
||||
removeAttackerFromCombat(targetDummy, enemy);
|
||||
}
|
||||
}
|
||||
@@ -1070,20 +1013,17 @@ public class target_dummy extends script.base_script
|
||||
destroyObject(targetDummy);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void removeAttackerFromCombat(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
removeHateTarget(targetDummy, player);
|
||||
removeHateTarget(player, targetDummy);
|
||||
stopCombat(player);
|
||||
return;
|
||||
}
|
||||
public static void enterIntoCombat(obj_id targetDummy, obj_id player) throws InterruptedException
|
||||
{
|
||||
startCombat(targetDummy, player);
|
||||
addHate(targetDummy, player, 1000.0f);
|
||||
return;
|
||||
}
|
||||
public static final String DATA = "datatables/tcg/target_dummy_extras.iff";
|
||||
public static final String TYPE_COLUMN = "target_dummy_type";
|
||||
@@ -1097,11 +1037,10 @@ public class target_dummy extends script.base_script
|
||||
};
|
||||
public static boolean hasTargetDummyExtras(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
for (int i = 0; i < EXTRA_TYPES.length; i++)
|
||||
{
|
||||
String testExtra = getTargetDummyAnim(targetDummy, EXTRA_TYPES[i]);
|
||||
if (testExtra != null && testExtra.length() > 0)
|
||||
{
|
||||
String testExtra;
|
||||
for (String EXTRA_TYPE : EXTRA_TYPES) {
|
||||
testExtra = getTargetDummyAnim(targetDummy, EXTRA_TYPE);
|
||||
if (testExtra != null && testExtra.length() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1110,32 +1049,22 @@ public class target_dummy extends script.base_script
|
||||
public static boolean hasTargetDummyRandomAnim(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
String testAnim = getTargetDummyAnim(targetDummy, RANDON_ANIM_COLUMN);
|
||||
if (testAnim != null && testAnim.length() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return testAnim != null && testAnim.length() > 0;
|
||||
}
|
||||
public static boolean hasTargetDummyTrickAnim(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
String testTrick = getTargetDummyAnim(targetDummy, TRICK_ANIM_COLUMN);
|
||||
if (testTrick != null && testTrick.length() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return testTrick != null && testTrick.length() > 0;
|
||||
}
|
||||
public static void doTargetDummyRandomAnim(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
String animName = getTargetDummyAnim(targetDummy, RANDON_ANIM_COLUMN);
|
||||
doTargetDummyAnimation(targetDummy, animName);
|
||||
return;
|
||||
}
|
||||
public static void doTargetDummyTrick(obj_id targetDummy) throws InterruptedException
|
||||
{
|
||||
String trickName = getTargetDummyAnim(targetDummy, TRICK_ANIM_COLUMN);
|
||||
doTargetDummyAnimation(targetDummy, trickName);
|
||||
return;
|
||||
}
|
||||
public static String getTargetDummyAnim(obj_id targetDummy, String column) throws InterruptedException
|
||||
{
|
||||
@@ -1158,7 +1087,6 @@ public class target_dummy extends script.base_script
|
||||
doAnimationAction(targetDummy, animName);
|
||||
setObjVar(targetDummy, TARGET_DUMMY_LAST_EXTRAS_ANIM, animName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static String getTargetDummyExtrasData(obj_id targetDummy, String column) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+57
-118
@@ -1,19 +1,9 @@
|
||||
package script.library;
|
||||
|
||||
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.beast_lib;
|
||||
import script.library.incubator;
|
||||
import script.library.spawning;
|
||||
import script.library.static_item;
|
||||
import script.library.target_dummy;
|
||||
import script.library.utils;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
|
||||
public class tcg extends script.base_script
|
||||
{
|
||||
@@ -95,20 +85,12 @@ public class tcg extends script.base_script
|
||||
};
|
||||
public static boolean isBarnRanchhand(obj_id target) throws InterruptedException
|
||||
{
|
||||
if (hasScript(target, BARN_RANCHHAND_SCRIPT))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasScript(target, BARN_RANCHHAND_SCRIPT);
|
||||
}
|
||||
public static boolean isBarnStructure(obj_id building) throws InterruptedException
|
||||
{
|
||||
String template = getTemplateName(building);
|
||||
if (template.equals(BARN_STRUCTURE_TEMPLATE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return template.equals(BARN_STRUCTURE_TEMPLATE);
|
||||
}
|
||||
public static void barnStoreBeastPrompt(obj_id player, obj_id ranchhand) throws InterruptedException
|
||||
{
|
||||
@@ -132,17 +114,15 @@ public class tcg extends script.base_script
|
||||
vectorBcdsList.setSize(0);
|
||||
Vector vectorBeastNames = new Vector();
|
||||
vectorBeastNames.setSize(0);
|
||||
for (int i = 0; i < initialBcdsList.length; i++)
|
||||
{
|
||||
obj_id bcd = initialBcdsList[i];
|
||||
String beastName = beast_lib.getBCDBeastName(bcd);
|
||||
if (beastName != null && beastName.length() > 0)
|
||||
{
|
||||
String beastName;
|
||||
for (obj_id bcd : initialBcdsList) {
|
||||
beastName = beast_lib.getBCDBeastName(bcd);
|
||||
if (beastName != null && beastName.length() > 0) {
|
||||
utils.addElement(vectorBeastNames, toUpper(beastName, 0));
|
||||
utils.addElement(vectorBcdsList, bcd);
|
||||
}
|
||||
}
|
||||
if (vectorBeastNames != null && vectorBcdsList != null && vectorBeastNames.size() > 0 && vectorBcdsList.size() > 0)
|
||||
if (vectorBeastNames.size() > 0 && vectorBcdsList.size() > 0)
|
||||
{
|
||||
obj_id[] finalBcdsList = utils.toStaticObjIdArray(vectorBcdsList);
|
||||
String[] finalBeastNames = utils.toStaticStringArray(vectorBeastNames);
|
||||
@@ -162,7 +142,6 @@ public class tcg extends script.base_script
|
||||
barnSelectPlayerBeastSui(player, ranchhand, finalBcdsList, finalBeastNames, promptRef, promptExtra, "handleBarnBeastStorage");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void barnSelectPlayerBeastSui(obj_id player, obj_id ranchhand, obj_id[] beastControlDevices, String[] beastNames, String promptRef, String promptExtra, String handler) throws InterruptedException
|
||||
{
|
||||
@@ -200,7 +179,6 @@ public class tcg extends script.base_script
|
||||
utils.setScriptVar(player, "barnRanchHand.pid", pid);
|
||||
utils.setScriptVar(player, "barnRanchHand." + handler, sortedBeastControlDevices);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void barnReclaimBeastPrompt(obj_id player, obj_id barn, obj_id ranchhand) throws InterruptedException
|
||||
{
|
||||
@@ -215,25 +193,20 @@ public class tcg extends script.base_script
|
||||
vectorBcdsList.setSize(0);
|
||||
Vector vectorBeastNames = new Vector();
|
||||
vectorBeastNames.setSize(0);
|
||||
for (int i = 0; i < initialStorageList.length; i++)
|
||||
{
|
||||
String bcdSlot = initialStorageList[i];
|
||||
String beastName = "";
|
||||
if (hasObjVar(barn, "barnStorage." + bcdSlot + ".beast.beastName"))
|
||||
{
|
||||
String beastName;
|
||||
for (String bcdSlot : initialStorageList) {
|
||||
beastName = "";
|
||||
if (hasObjVar(barn, "barnStorage." + bcdSlot + ".beast.beastName")) {
|
||||
beastName = getStringObjVar(barn, "barnStorage." + bcdSlot + ".beast.beastName");
|
||||
}
|
||||
else if (hasObjVar(barn, "barnStorage." + bcdSlot + ".tempName"))
|
||||
{
|
||||
} else if (hasObjVar(barn, "barnStorage." + bcdSlot + ".tempName")) {
|
||||
beastName = getStringObjVar(barn, "barnStorage." + bcdSlot + ".tempName");
|
||||
}
|
||||
if (beastName != null && beastName.length() > 0)
|
||||
{
|
||||
if (beastName != null && beastName.length() > 0) {
|
||||
utils.addElement(vectorBeastNames, toUpper(beastName, 0));
|
||||
utils.addElement(vectorBcdsList, bcdSlot);
|
||||
}
|
||||
}
|
||||
if (vectorBeastNames != null && vectorBcdsList != null && vectorBeastNames.size() > 0 && vectorBcdsList.size() > 0)
|
||||
if (vectorBeastNames.size() > 0 && vectorBcdsList.size() > 0)
|
||||
{
|
||||
String[] finalBcdsList = utils.toStaticStringArray(vectorBcdsList);
|
||||
String[] finalBeastNames = utils.toStaticStringArray(vectorBeastNames);
|
||||
@@ -249,7 +222,6 @@ public class tcg extends script.base_script
|
||||
barnSelectStoredBeastSui(player, ranchhand, finalBcdsList, finalBeastNames, "barn_beast_selection_reclaim_prompt", promptExtra, "handleBarnBeastReclaim");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void barnDisplayBeastPrompt(obj_id player, obj_id barn, obj_id ranchhand) throws InterruptedException
|
||||
{
|
||||
@@ -264,28 +236,20 @@ public class tcg extends script.base_script
|
||||
vectorBcdsList.setSize(0);
|
||||
Vector vectorBeastNames = new Vector();
|
||||
vectorBeastNames.setSize(0);
|
||||
for (int i = 0; i < initialStorageList.length; i++)
|
||||
{
|
||||
String bcdSlot = initialStorageList[i];
|
||||
String beastName = "";
|
||||
if (hasObjVar(barn, "barnStorage." + bcdSlot + ".beast.beastName"))
|
||||
{
|
||||
String beastName;
|
||||
for (String bcdSlot : initialStorageList) {
|
||||
beastName = "";
|
||||
if (hasObjVar(barn, "barnStorage." + bcdSlot + ".beast.beastName")) {
|
||||
beastName = getStringObjVar(barn, "barnStorage." + bcdSlot + ".beast.beastName");
|
||||
}
|
||||
else if (hasObjVar(barn, "barnStorage." + bcdSlot + ".tempName"))
|
||||
{
|
||||
} else if (hasObjVar(barn, "barnStorage." + bcdSlot + ".tempName")) {
|
||||
beastName = getStringObjVar(barn, "barnStorage." + bcdSlot + ".tempName");
|
||||
}
|
||||
if (hasObjVar(barn, "barnStorage." + bcdSlot + "." + BEAST_ROAMING))
|
||||
{
|
||||
if (hasObjVar(barn, "barnStorage." + bcdSlot + "." + BEAST_ROAMING)) {
|
||||
beastName = beastName + " [Displayed]";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
beastName = beastName + " [Stored]";
|
||||
}
|
||||
if (beastName != null && beastName.length() > 0)
|
||||
{
|
||||
if (beastName.length() > 0) {
|
||||
utils.addElement(vectorBeastNames, toUpper(beastName, 0));
|
||||
utils.addElement(vectorBcdsList, bcdSlot);
|
||||
}
|
||||
@@ -295,14 +259,13 @@ public class tcg extends script.base_script
|
||||
{
|
||||
prompt = "barn_lite_beast_selection_display_prompt";
|
||||
}
|
||||
if (vectorBeastNames != null && vectorBcdsList != null && vectorBeastNames.size() > 0 && vectorBcdsList.size() > 0)
|
||||
if (vectorBeastNames.size() > 0 && vectorBcdsList.size() > 0)
|
||||
{
|
||||
String[] finalBcdsList = utils.toStaticStringArray(vectorBcdsList);
|
||||
String[] finalBeastNames = utils.toStaticStringArray(vectorBeastNames);
|
||||
barnSelectStoredBeastSui(player, ranchhand, finalBcdsList, finalBeastNames, prompt, "", "handleBarnBeastDisplay");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void barnSelectStoredBeastSui(obj_id player, obj_id ranchhand, String[] beastControlSlots, String[] beastNames, String promptRef, String promptExtra, String handler) throws InterruptedException
|
||||
{
|
||||
@@ -320,12 +283,11 @@ public class tcg extends script.base_script
|
||||
String[] sortedBeastControlSlots = new String[beastControlSlots.length];
|
||||
utils.copyArray(beastNames, alphabetizedBeastNames);
|
||||
Arrays.sort(alphabetizedBeastNames);
|
||||
|
||||
for (int j = 0; j < alphabetizedBeastNames.length; j++)
|
||||
{
|
||||
String alphabetizedName = alphabetizedBeastNames[j];
|
||||
int index = utils.getElementPositionInArray(beastNames, alphabetizedName);
|
||||
String sortedBeast = beastControlSlots[index];
|
||||
sortedBeastControlSlots[j] = sortedBeast;
|
||||
int index = utils.getElementPositionInArray(beastNames, alphabetizedBeastNames[j]);
|
||||
sortedBeastControlSlots[j] = beastControlSlots[index];
|
||||
beastNames[index] = "_";
|
||||
}
|
||||
String title = utils.packStringId(new string_id("tcg", "barn_beast_selection_title"));
|
||||
@@ -340,7 +302,6 @@ public class tcg extends script.base_script
|
||||
utils.setScriptVar(player, "barnRanchHand.pid", pid);
|
||||
utils.setScriptVar(player, "barnRanchHand." + handler, sortedBeastControlSlots);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean transferBeastControlDeviceToBarn(obj_id selectedBeastControlDevice, obj_id player, obj_id barn) throws InterruptedException
|
||||
{
|
||||
@@ -355,20 +316,14 @@ public class tcg extends script.base_script
|
||||
{
|
||||
setObjVar(barn, nextAvailableStorageSlot + ".tempName", beast_lib.getBeastLocalizedName(selectedBeastControlDevice));
|
||||
}
|
||||
for (int i = 0; i < BEAST_OBJVARS.length; i++)
|
||||
{
|
||||
String beastObjvar = BEAST_OBJVARS[i];
|
||||
if (hasObjVar(selectedBeastControlDevice, beastObjvar))
|
||||
{
|
||||
obj_var_list beastData = getObjVarList(selectedBeastControlDevice, beastObjvar);
|
||||
if (beastData != null)
|
||||
{
|
||||
obj_var_list beastData;
|
||||
for (String beastObjvar : BEAST_OBJVARS) {
|
||||
if (hasObjVar(selectedBeastControlDevice, beastObjvar)) {
|
||||
beastData = getObjVarList(selectedBeastControlDevice, beastObjvar);
|
||||
if (beastData != null) {
|
||||
setBCDDataObjVars(player, barn, nextAvailableStorageSlot + "." + beastObjvar + ".", beastData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasObjVar(barn, nextAvailableStorageSlot))
|
||||
{
|
||||
} else {
|
||||
if (hasObjVar(barn, nextAvailableStorageSlot)) {
|
||||
removeObjVar(barn, nextAvailableStorageSlot);
|
||||
}
|
||||
CustomerServiceLog("playerStructure", "Player: " + player + " " + getPlayerName(player) + " could not store a beast in the barn. The BCD was not destroyed. Reason: Beast in datapad had no objvars or objvars were corrupted. Barn: " + barn);
|
||||
@@ -414,18 +369,13 @@ public class tcg extends script.base_script
|
||||
bcd = createObject(bcdTemplate, datapad, "");
|
||||
if (isIdValid(bcd))
|
||||
{
|
||||
for (int i = 0; i < BEAST_OBJVARS.length; i++)
|
||||
{
|
||||
String beastObjvar = BEAST_OBJVARS[i];
|
||||
if (hasObjVar(barn, "barnStorage." + selectedStorageSlot + "." + beastObjvar))
|
||||
{
|
||||
obj_var_list beastData = getObjVarList(barn, "barnStorage." + selectedStorageSlot + "." + beastObjvar);
|
||||
if (beastData != null)
|
||||
{
|
||||
obj_var_list beastData;
|
||||
for (String beastObjvar : BEAST_OBJVARS) {
|
||||
if (hasObjVar(barn, "barnStorage." + selectedStorageSlot + "." + beastObjvar)) {
|
||||
beastData = getObjVarList(barn, "barnStorage." + selectedStorageSlot + "." + beastObjvar);
|
||||
if (beastData != null) {
|
||||
setBCDDataObjVars(player, bcd, beastObjvar + ".", beastData);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
CustomerServiceLog("playerStructure", "Player: " + player + " " + getPlayerName(player) + " did not claim beast BCD from barn. Resason: barnStorage has null or corrupted beast data for: " + selectedStorageSlot + ". Beast Obj Var: " + beastObjvar + ".");
|
||||
destroyObject(bcd);
|
||||
return obj_id.NULL_ID;
|
||||
@@ -490,28 +440,23 @@ public class tcg extends script.base_script
|
||||
}
|
||||
else if (data.isStringObjVar(dataObjvarName))
|
||||
{
|
||||
String stringData = data.getStringObjVar(dataObjvarName);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, stringData);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, data.getStringObjVar(dataObjvarName));
|
||||
}
|
||||
else if (data.isStringArrayObjVar(dataObjvarName))
|
||||
{
|
||||
String[] stringArrayData = data.getStringArrayObjVar(dataObjvarName);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, stringArrayData);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, data.getStringArrayObjVar(dataObjvarName));
|
||||
}
|
||||
else if (data.isObjIdObjVar(dataObjvarName))
|
||||
{
|
||||
obj_id objIdData = data.getObjIdObjVar(dataObjvarName);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, objIdData);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, data.getObjIdObjVar(dataObjvarName));
|
||||
}
|
||||
else if (data.isObjIdArrayObjVar(dataObjvarName))
|
||||
{
|
||||
obj_id[] objIdArrayData = data.getObjIdArrayObjVar(dataObjvarName);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, objIdArrayData);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, data.getObjIdArrayObjVar(dataObjvarName));
|
||||
}
|
||||
else if (data.isBooleanObjVar(dataObjvarName))
|
||||
{
|
||||
boolean booleanData = data.getBooleanObjVar(dataObjvarName);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, booleanData);
|
||||
setObjVar(target, objvarNamePrefix + dataObjvarName, data.getBooleanObjVar(dataObjvarName));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -521,7 +466,6 @@ public class tcg extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static String getNextAvailableBarnStorageSlot(obj_id barn, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -581,9 +525,7 @@ public class tcg extends script.base_script
|
||||
String[] slots = new String[numItems];
|
||||
for (int i = 0; i < numItems; i++)
|
||||
{
|
||||
obj_var beastDataObjvar = beastData.getObjVar(i);
|
||||
String beastDataObjvarName = beastDataObjvar.getName();
|
||||
slots[i] = beastDataObjvarName;
|
||||
slots[i] = beastData.getObjVar(i).getName();
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
@@ -618,8 +560,7 @@ public class tcg extends script.base_script
|
||||
public static obj_id barnDisplayBeast(obj_id ranchhand, String storageSlot, obj_id barn) throws InterruptedException
|
||||
{
|
||||
location here = getLocation(ranchhand);
|
||||
location spawnCenter = new location(-7.0f, 0.0f, -2.4f, here.area, here.cell);
|
||||
location spawnLocation = spawning.getRandomLocationInCircle(spawnCenter, 5.0f);
|
||||
location spawnLocation = spawning.getRandomLocationInCircle(new location(-7.0f, 0.0f, -2.4f, here.area, here.cell), 5.0f);
|
||||
return barnDisplayBeast(ranchhand, storageSlot, barn, spawnLocation);
|
||||
}
|
||||
public static obj_id barnDisplayBeast(obj_id ranchhand, String storageSlot, obj_id barn, location where) throws InterruptedException
|
||||
@@ -840,7 +781,6 @@ public class tcg extends script.base_script
|
||||
{
|
||||
beast_lib.removeAttentionPenaltyDebuff(getMaster(beast));
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean isBarnLiteDevice(obj_id object) throws InterruptedException
|
||||
{
|
||||
@@ -879,9 +819,9 @@ public class tcg extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < staticObjects.length; i++)
|
||||
{
|
||||
obj_id unpackedObject = static_item.createNewItemFunction(staticObjects[i], player);
|
||||
obj_id unpackedObject;
|
||||
for (String staticObject : staticObjects) {
|
||||
unpackedObject = static_item.createNewItemFunction(staticObject, player);
|
||||
CustomerServiceLog("tcg", "Packed item: " + objectPacked + " " + getName(objectPacked) + " unpacked: " + unpackedObject + " " + getName(unpackedObject) + " for player: " + player + " " + getName(player) + ".");
|
||||
}
|
||||
return true;
|
||||
@@ -944,30 +884,30 @@ public class tcg extends script.base_script
|
||||
{
|
||||
if (!useBeastLibraryHue)
|
||||
{
|
||||
if (primaryPalette != null || primaryPalette.length() > 0)
|
||||
if (primaryPalette != null && primaryPalette.length() > 0)
|
||||
{
|
||||
setRoamingBeastHue(beast, primaryPalette, primaryHue);
|
||||
}
|
||||
if (secondaryPalette != null || secondaryPalette.length() > 0)
|
||||
if (secondaryPalette != null && secondaryPalette.length() > 0)
|
||||
{
|
||||
setRoamingBeastHue(beast, secondaryPalette, secondaryHue);
|
||||
}
|
||||
if (thirdPalette != null || thirdPalette.length() > 0)
|
||||
if (thirdPalette != null && thirdPalette.length() > 0)
|
||||
{
|
||||
setRoamingBeastHue(beast, thirdPalette, thirdHue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (primaryPalette != null || primaryPalette.length() > 0)
|
||||
if (primaryPalette != null && primaryPalette.length() > 0)
|
||||
{
|
||||
beast_lib.setBeastHuePrimary(beast, primaryPalette, primaryHue);
|
||||
}
|
||||
if (secondaryPalette != null || secondaryPalette.length() > 0)
|
||||
if (secondaryPalette != null && secondaryPalette.length() > 0)
|
||||
{
|
||||
beast_lib.setBeastHueSecondary(beast, secondaryPalette, secondaryHue);
|
||||
}
|
||||
if (thirdPalette != null || thirdPalette.length() > 0)
|
||||
if (thirdPalette != null && thirdPalette.length() > 0)
|
||||
{
|
||||
beast_lib.setBeastHueThird(beast, thirdPalette, thirdHue);
|
||||
}
|
||||
@@ -1025,7 +965,6 @@ public class tcg extends script.base_script
|
||||
blog("tcg.scriptlib = showRoamingBeasts --- NEED ROAMING BEAST FOUND AT bcdSlot: " + bcdSlot);
|
||||
if (isBarnLiteDevice(barn))
|
||||
{
|
||||
location here = getLocation(barn);
|
||||
location spawnLoc = spawning.getRandomLocationAtDistance(getLocation(barn), 2.0f);
|
||||
tcg.barnDisplayBeast(ranchhand, bcdSlot, barn, spawnLoc);
|
||||
}
|
||||
|
||||
Regular → Executable
+5
-13
@@ -1,14 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.prose;
|
||||
import script.obj_id;
|
||||
import script.prose_package;
|
||||
import script.string_id;
|
||||
|
||||
public class temp_schematic extends script.base_script
|
||||
{
|
||||
@@ -64,10 +58,8 @@ public class temp_schematic extends script.base_script
|
||||
int total = useCount + getIntObjVar(player, ovpath);
|
||||
setObjVar(player, ovpath, total);
|
||||
string_id product_name = getProductNameFromSchematic(schematic);
|
||||
prose_package ppTempGrant = prose.getPackage(PROSE_TEMP_GRANT, product_name, useCount);
|
||||
sendSystemMessageProse(player, ppTempGrant);
|
||||
prose_package ppUsesLeft = prose.getPackage(PROSE_USES_LEFT, product_name, total);
|
||||
sendSystemMessageProse(player, ppUsesLeft);
|
||||
sendSystemMessageProse(player, prose.getPackage(PROSE_TEMP_GRANT, product_name, useCount));
|
||||
sendSystemMessageProse(player, prose.getPackage(PROSE_USES_LEFT, product_name, total));
|
||||
if (isIdValid(bioLink))
|
||||
{
|
||||
setObjVar(player, VAR_TEMP_SCHEMATIC_BIO_LINK + "." + schematic, bioLink);
|
||||
|
||||
Regular → Executable
+154
-246
@@ -1,16 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.player_structure;
|
||||
import script.library.regions;
|
||||
import java.util.Vector;
|
||||
|
||||
public class theater extends script.base_script
|
||||
{
|
||||
@@ -54,20 +46,15 @@ public class theater extends script.base_script
|
||||
region[] regionList = getRegionsAtPoint(loc);
|
||||
if (regionList != null)
|
||||
{
|
||||
for (int i = 0; i < regionList.length; ++i)
|
||||
{
|
||||
if (regionList[i] != null)
|
||||
{
|
||||
if (regionList[i].getPvPType() == regions.PVP_REGION_TYPE_BATTLEFIELD_PVP)
|
||||
{
|
||||
for (region aRegionList : regionList) {
|
||||
if (aRegionList != null) {
|
||||
if (aRegionList.getPvPType() == regions.PVP_REGION_TYPE_BATTLEFIELD_PVP) {
|
||||
return false;
|
||||
}
|
||||
if (regionList[i].getPvPType() == regions.PVP_REGION_TYPE_BATTLEFIELD_PVE)
|
||||
{
|
||||
if (aRegionList.getPvPType() == regions.PVP_REGION_TYPE_BATTLEFIELD_PVE) {
|
||||
return false;
|
||||
}
|
||||
if (regionList[i].getGeographicalType() == regions.GEO_CITY)
|
||||
{
|
||||
if (aRegionList.getGeographicalType() == regions.GEO_CITY) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -90,25 +77,17 @@ public class theater extends script.base_script
|
||||
switch (spawnMethod)
|
||||
{
|
||||
case SPAWN_RADIAL:
|
||||
break;
|
||||
break;
|
||||
case SPAWN_DATATABLE_OFFSET:
|
||||
children = spawnDatatableOffset(target);
|
||||
break;
|
||||
children = spawnDatatableOffset(target);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
dictionary d = new dictionary();
|
||||
if ((children == null) || (children.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((children != null) && (children.length != 0)) {
|
||||
obj_id[] buildings = utils.getBuildingsInObjIdList(children);
|
||||
if ((buildings == null) || (buildings.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((buildings != null) && (buildings.length != 0)) {
|
||||
d.put(DICT_CHILDREN, buildings);
|
||||
}
|
||||
}
|
||||
@@ -175,82 +154,66 @@ public class theater extends script.base_script
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int numCols = dataTableGetNumColumns(tbl);
|
||||
obj_var ov;
|
||||
String name;
|
||||
String[] entries;
|
||||
String tpf;
|
||||
location spawnLoc;
|
||||
location goodLoc;
|
||||
obj_id child;
|
||||
|
||||
for (int i = 0; i < numListItems; i++)
|
||||
{
|
||||
obj_var ov = spawnList.getObjVar(i);
|
||||
String name = ov.getName();
|
||||
ov = spawnList.getObjVar(i);
|
||||
name = ov.getName();
|
||||
int amt = ov.getIntData();
|
||||
if (dataTableHasColumn(tbl, name))
|
||||
{
|
||||
String[] entries = dataTableGetStringColumn(tbl, name);
|
||||
if ((entries == null) || (entries.length == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
entries = dataTableGetStringColumn(tbl, name);
|
||||
if ((entries != null) && (entries.length != 0)) {
|
||||
for (int n = 0; n < amt; n++)
|
||||
{
|
||||
int roll = rand(0, entries.length - 1);
|
||||
String tpf = entries[roll];
|
||||
int cnt = 0;
|
||||
tpf = entries[roll];
|
||||
while (tpf.equals(""))
|
||||
{
|
||||
roll = rand(0, entries.length - 1);
|
||||
tpf = entries[roll];
|
||||
}
|
||||
location spawnLoc = utils.getRandomLocationInRing(myLoc, ringMin, ringMax);
|
||||
if (spawnLoc == null)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
location goodLoc = locations.getGoodLocationAroundLocation(spawnLoc, iArea, iArea, sArea, sArea);
|
||||
if (goodLoc == null)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnLoc = utils.getRandomLocationInRing(myLoc, ringMin, ringMax);
|
||||
if (spawnLoc != null) {
|
||||
goodLoc = locations.getGoodLocationAroundLocation(spawnLoc, iArea, iArea, sArea, sArea);
|
||||
if (goodLoc != null) {
|
||||
spawnLoc = (location)goodLoc.clone();
|
||||
}
|
||||
if (spawnLoc.cell == obj_id.NULL_ID)
|
||||
{
|
||||
spawnLoc.y = getHeightAtLocation(spawnLoc.x, spawnLoc.z);
|
||||
}
|
||||
if (spawnLoc != null)
|
||||
{
|
||||
float fltNewSize = getDistance(myLoc, spawnLoc);
|
||||
if (fltNewSize > fltSize)
|
||||
{
|
||||
fltSize = fltNewSize;
|
||||
}
|
||||
obj_id child = createObject(tpf, spawnLoc);
|
||||
if ((child == null) || (child == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
setYaw(child, rand(-180, 180));
|
||||
children = utils.addElement(children, child);
|
||||
if (!faction.equals(""))
|
||||
{
|
||||
factions.setFaction(child, faction);
|
||||
}
|
||||
switch (persistFlag)
|
||||
{
|
||||
case PERSIST_ALL:
|
||||
break;
|
||||
}
|
||||
setObjVar(child, VAR_PARENT, target);
|
||||
}
|
||||
}
|
||||
float fltNewSize = getDistance(myLoc, spawnLoc);
|
||||
if (fltNewSize > fltSize)
|
||||
{
|
||||
fltSize = fltNewSize;
|
||||
}
|
||||
child = createObject(tpf, spawnLoc);
|
||||
if ((child != null) && (child != obj_id.NULL_ID)) {
|
||||
setYaw(child, rand(-180, 180));
|
||||
children = utils.addElement(children, child);
|
||||
if (!faction.equals(""))
|
||||
{
|
||||
factions.setFaction(child, faction);
|
||||
}
|
||||
switch (persistFlag)
|
||||
{
|
||||
case PERSIST_ALL:
|
||||
break;
|
||||
}
|
||||
setObjVar(child, VAR_PARENT, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
setObjVar(target, "poi.fltSize", fltSize + 20);
|
||||
if ((children == null) || (children.size() == 0))
|
||||
@@ -261,18 +224,13 @@ public class theater extends script.base_script
|
||||
{
|
||||
setObjVar(target, VAR_CHILDREN, children);
|
||||
}
|
||||
obj_id[] _children = new obj_id[0];
|
||||
if (children != null)
|
||||
{
|
||||
_children = new obj_id[children.size()];
|
||||
children.toArray(_children);
|
||||
}
|
||||
obj_id[] _children = new obj_id[children.size()];
|
||||
children.toArray(_children);
|
||||
return _children;
|
||||
}
|
||||
public static obj_id[] spawnDatatableOffset(obj_id target) throws InterruptedException
|
||||
{
|
||||
float fltSize = 0;
|
||||
location[] locWaypoints = new location[0];
|
||||
if ((target == null) || (target == obj_id.NULL_ID))
|
||||
{
|
||||
return null;
|
||||
@@ -286,7 +244,7 @@ public class theater extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String faction = "";
|
||||
String faction;
|
||||
if (hasObjVar(target, factions.FACTION))
|
||||
{
|
||||
faction = getStringObjVar(target, factions.FACTION);
|
||||
@@ -321,46 +279,41 @@ public class theater extends script.base_script
|
||||
Vector objWaypoints = new Vector();
|
||||
objWaypoints.setSize(0);
|
||||
float[] fltX = dataTableGetFloatColumn(tbl, X);
|
||||
float[] fltY = dataTableGetFloatColumn(tbl, Y);
|
||||
float[] fltZ = dataTableGetFloatColumn(tbl, Z);
|
||||
float[] fltYaw = dataTableGetFloatColumn(tbl, YAW);
|
||||
String[] strTemplates = dataTableGetStringColumn(tbl, TEMPLATE);
|
||||
int numRows = strTemplates.length;
|
||||
String tpf;
|
||||
location here;
|
||||
obj_id child;
|
||||
for (int i = 0; i < numRows; i++)
|
||||
{
|
||||
String tpf = strTemplates[i];
|
||||
tpf = strTemplates[i];
|
||||
float dx = fltX[i];
|
||||
float dy = fltY[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
location here = (location)myLoc.clone();
|
||||
here = (location) myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
float fltNewSize = getDistance(myLoc, here);
|
||||
if (fltNewSize > fltSize)
|
||||
{
|
||||
fltSize = fltNewSize;
|
||||
}
|
||||
obj_id child = createObject(tpf, here);
|
||||
if (!isIdValid(child))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tpf.equals("object/tangible/poi/theater/poi_mob_spawner.iff"))
|
||||
{
|
||||
objMobSpawners = utils.addElement(objMobSpawners, child);
|
||||
}
|
||||
else if (tpf.equals("object/tangible/poi/theater/poi_objective_spawner.iff"))
|
||||
{
|
||||
objObjectiveSpawners = utils.addElement(objObjectiveSpawners, child);
|
||||
}
|
||||
else if (tpf.equals("object/path_waypoint/path_waypoint.iff"))
|
||||
{
|
||||
objWaypoints = utils.addElement(objWaypoints, child);
|
||||
}
|
||||
else if (tpf.equals("object/tangible/poi/theater/poi_mob_spawner_large.iff"))
|
||||
{
|
||||
objLargeMobSpawners = utils.addElement(objLargeMobSpawners, child);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child)) {
|
||||
switch (tpf) {
|
||||
case "object/tangible/poi/theater/poi_mob_spawner.iff":
|
||||
objMobSpawners = utils.addElement(objMobSpawners, child);
|
||||
break;
|
||||
case "object/tangible/poi/theater/poi_objective_spawner.iff":
|
||||
objObjectiveSpawners = utils.addElement(objObjectiveSpawners, child);
|
||||
break;
|
||||
case "object/path_waypoint/path_waypoint.iff":
|
||||
objWaypoints = utils.addElement(objWaypoints, child);
|
||||
break;
|
||||
case "object/tangible/poi/theater/poi_mob_spawner_large.iff":
|
||||
objLargeMobSpawners = utils.addElement(objLargeMobSpawners, child);
|
||||
break;
|
||||
}
|
||||
setYaw(child, yaw + tYaw);
|
||||
children = utils.addElement(children, child);
|
||||
@@ -389,9 +342,6 @@ public class theater extends script.base_script
|
||||
{
|
||||
setObjVar(target, "theater.objLargeMobSpawners", objLargeMobSpawners);
|
||||
}
|
||||
if (objWaypoints != null && objWaypoints.size() > 0)
|
||||
{
|
||||
}
|
||||
if ((children == null) || (children.size() == 0))
|
||||
{
|
||||
return null;
|
||||
@@ -400,17 +350,12 @@ public class theater extends script.base_script
|
||||
{
|
||||
setObjVar(target, VAR_CHILDREN, children);
|
||||
}
|
||||
obj_id[] _children = new obj_id[0];
|
||||
if (children != null)
|
||||
{
|
||||
_children = new obj_id[children.size()];
|
||||
children.toArray(_children);
|
||||
}
|
||||
obj_id[] _children = new obj_id[children.size()];
|
||||
children.toArray(_children);
|
||||
return _children;
|
||||
}
|
||||
public static void spawnDatatableOffsetQueued(obj_id target, int intIndex) throws InterruptedException
|
||||
{
|
||||
boolean boolFinished = false;
|
||||
if ((target == null) || (target == obj_id.NULL_ID))
|
||||
{
|
||||
return;
|
||||
@@ -424,7 +369,7 @@ public class theater extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
String faction = "";
|
||||
String faction;
|
||||
if (hasObjVar(target, factions.FACTION))
|
||||
{
|
||||
faction = getStringObjVar(target, factions.FACTION);
|
||||
@@ -453,94 +398,82 @@ public class theater extends script.base_script
|
||||
Vector children = new Vector();
|
||||
children.setSize(0);
|
||||
float[] fltX = dataTableGetFloatColumn(tbl, X);
|
||||
float[] fltY = dataTableGetFloatColumn(tbl, Y);
|
||||
float[] fltZ = dataTableGetFloatColumn(tbl, Z);
|
||||
float[] fltYaw = dataTableGetFloatColumn(tbl, YAW);
|
||||
String[] strTemplates = dataTableGetStringColumn(tbl, TEMPLATE);
|
||||
int numRows = strTemplates.length;
|
||||
obj_id child;
|
||||
String tpf;
|
||||
location here;
|
||||
|
||||
for (int i = 0; i < numRows; i++)
|
||||
{
|
||||
obj_id child = null;
|
||||
String tpf = strTemplates[i];
|
||||
if (tpf.equals("object/tangible/poi/theater/poi_mob_spawner.iff"))
|
||||
{
|
||||
float dx = fltX[i];
|
||||
float dy = fltY[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
location here = (location)myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child))
|
||||
{
|
||||
objMobSpawners = utils.addElement(objMobSpawners, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
}
|
||||
else if (tpf.equals("object/tangible/poi/theater/poi_objective_spawner.iff"))
|
||||
{
|
||||
float dx = fltX[i];
|
||||
float dy = fltY[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
location here = (location)myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child))
|
||||
{
|
||||
objObjectiveSpawners = utils.addElement(objObjectiveSpawners, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
}
|
||||
else if (tpf.equals("object/path_waypoint/path_waypoint.iff"))
|
||||
{
|
||||
float dx = fltX[i];
|
||||
float dy = fltY[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
location here = (location)myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child))
|
||||
{
|
||||
objWaypoints = utils.addElement(objWaypoints, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
}
|
||||
else if (tpf.equals("object/tangible/poi/theater/poi_mob_spawner_large.iff"))
|
||||
{
|
||||
float dx = fltX[i];
|
||||
float dy = fltY[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
location here = (location)myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child))
|
||||
{
|
||||
objLargeMobSpawners = utils.addElement(objLargeMobSpawners, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int intStringIndex = tpf.indexOf("corral");
|
||||
if (intStringIndex > -1)
|
||||
{
|
||||
tpf = strTemplates[i];
|
||||
switch (tpf) {
|
||||
case "object/tangible/poi/theater/poi_mob_spawner.iff": {
|
||||
float dx = fltX[i];
|
||||
float dy = fltY[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
location here = (location)myLoc.clone();
|
||||
here = (location) myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child))
|
||||
{
|
||||
setYaw(child, yaw + tYaw);
|
||||
setObjVar(child, VAR_PARENT, target);
|
||||
if (isIdValid(child)) {
|
||||
objMobSpawners = utils.addElement(objMobSpawners, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "object/tangible/poi/theater/poi_objective_spawner.iff": {
|
||||
float dx = fltX[i];
|
||||
float dz = fltZ[i];
|
||||
here = (location) myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child)) {
|
||||
objObjectiveSpawners = utils.addElement(objObjectiveSpawners, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "object/path_waypoint/path_waypoint.iff": {
|
||||
float dx = fltX[i];
|
||||
float dz = fltZ[i];
|
||||
here = (location) myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child)) {
|
||||
objWaypoints = utils.addElement(objWaypoints, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "object/tangible/poi/theater/poi_mob_spawner_large.iff": {
|
||||
float dx = fltX[i];
|
||||
float dz = fltZ[i];
|
||||
here = (location) myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child)) {
|
||||
objLargeMobSpawners = utils.addElement(objLargeMobSpawners, child);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
int intStringIndex = tpf.indexOf("corral");
|
||||
if (intStringIndex > -1) {
|
||||
float dx = fltX[i];
|
||||
float dz = fltZ[i];
|
||||
float yaw = fltYaw[i];
|
||||
here = (location) myLoc.clone();
|
||||
here = player_structure.transformDeltaWorldCoord(here, dx, dz, tYaw);
|
||||
child = createObject(tpf, here);
|
||||
if (isIdValid(child)) {
|
||||
setYaw(child, yaw + tYaw);
|
||||
setObjVar(child, VAR_PARENT, target);
|
||||
children = utils.addElement(children, child);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (objMobSpawners.size() > 0)
|
||||
@@ -612,11 +545,7 @@ public class theater extends script.base_script
|
||||
here.z += (dx * fltS) + (dz * fltC);
|
||||
obj_id child = createObject(tpf, here);
|
||||
debugSpeakMsg(target, "a child " + child);
|
||||
if ((child == null) || (child == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((child != null) && (child != obj_id.NULL_ID)) {
|
||||
setYaw(child, yaw + tYaw);
|
||||
children = utils.addElement(children, child);
|
||||
if (!faction.equals(""))
|
||||
@@ -646,29 +575,18 @@ public class theater extends script.base_script
|
||||
}
|
||||
public static boolean shouldSpawn(String tpf) throws InterruptedException
|
||||
{
|
||||
if (tpf.equals("object/tangible/poi/theater/poi_mob_spawner.iff"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (tpf.equals("object/tangible/poi/theater/poi_objective_spawner.iff"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (tpf.equals("object/path_waypoint/path_waypoint.iff"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (tpf.equals("object/tangible/poi/theater/poi_mob_spawner_large.iff"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int intStringIndex = tpf.indexOf("corral");
|
||||
if (intStringIndex > -1)
|
||||
{
|
||||
switch (tpf) {
|
||||
case "object/tangible/poi/theater/poi_mob_spawner.iff":
|
||||
case "object/tangible/poi/theater/poi_objective_spawner.iff":
|
||||
case "object/path_waypoint/path_waypoint.iff":
|
||||
case "object/tangible/poi/theater/poi_mob_spawner_large.iff":
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
int intStringIndex = tpf.indexOf("corral");
|
||||
if (intStringIndex > -1) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -676,14 +594,10 @@ public class theater extends script.base_script
|
||||
{
|
||||
location locTest = getLocation(target);
|
||||
region rgnPathRegion = getRegion(target.toString(), locTest.area);
|
||||
if (rgnPathRegion == null)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rgnPathRegion != null) {
|
||||
deleteRegion(rgnPathRegion);
|
||||
}
|
||||
if ((target == null) || (target == obj_id.NULL_ID))
|
||||
if ((target == obj_id.NULL_ID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -696,14 +610,8 @@ public class theater extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
obj_id child = children[i];
|
||||
if ((child == null) || (child == obj_id.NULL_ID))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
for (obj_id child : children) {
|
||||
if ((child != null) && (child != obj_id.NULL_ID)) {
|
||||
destroyObject(child);
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+24
-44
@@ -1,14 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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_skill;
|
||||
import java.util.Vector;
|
||||
|
||||
public class township extends script.base_script
|
||||
{
|
||||
@@ -48,11 +42,7 @@ public class township extends script.base_script
|
||||
LOG("force_sensitive", "township.isTownshipEligible -- player is invalid.");
|
||||
return false;
|
||||
}
|
||||
if (getLevel(player) >= MIN_LEVEL || space_skill.isMasterPilot(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return getLevel(player) >= MIN_LEVEL || space_skill.isMasterPilot(player);
|
||||
}
|
||||
public static boolean giveTravelListFromAurilia(obj_id player, obj_id npc) throws InterruptedException
|
||||
{
|
||||
@@ -90,20 +80,17 @@ public class township extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < subGroups.length; ++i)
|
||||
{
|
||||
boolean foundAlready = false;
|
||||
for (int j = 0; j < resizeGroups.size(); ++j)
|
||||
{
|
||||
if (subGroups[i].equals(((String)resizeGroups.get(j))))
|
||||
{
|
||||
boolean foundAlready;
|
||||
for (String subGroup : subGroups) {
|
||||
foundAlready = false;
|
||||
for (Object resizeGroup : resizeGroups) {
|
||||
if (subGroup.equals(resizeGroup)) {
|
||||
foundAlready = true;
|
||||
}
|
||||
}
|
||||
if (!foundAlready)
|
||||
{
|
||||
utils.addElement(localizedGroups, "@nexus:" + subGroups[i]);
|
||||
utils.addElement(resizeGroups, subGroups[i]);
|
||||
if (!foundAlready) {
|
||||
utils.addElement(localizedGroups, "@nexus:" + subGroup);
|
||||
utils.addElement(resizeGroups, subGroup);
|
||||
}
|
||||
}
|
||||
utils.setScriptVar(player, GROUPS_SCRIPT_VAR, resizeGroups);
|
||||
@@ -135,8 +122,6 @@ public class township extends script.base_script
|
||||
String[] locations = dataTableGetStringColumn(DATATABLE_TOWNSHIP, DATATABLE_COLUMN_LOCATIONS);
|
||||
Vector resizeLocations = new Vector();
|
||||
resizeLocations.setSize(0);
|
||||
Vector resizeGroups = new Vector();
|
||||
resizeGroups.setSize(0);
|
||||
Vector localizedLocations = new Vector();
|
||||
localizedLocations.setSize(0);
|
||||
if (subGroups == null || locations == null)
|
||||
@@ -180,23 +165,18 @@ public class township extends script.base_script
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int totalCount = 0;
|
||||
obj_id crystal = utils.getStaticItemInInventory(player, MIDLITHE_CRYSTAL);
|
||||
if (!isIdValid(crystal))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
totalCount = getCount(crystal);
|
||||
return totalCount;
|
||||
return getCount(crystal);
|
||||
}
|
||||
public static void clearAllNovaOrionQuestStatus(obj_id player) throws InterruptedException
|
||||
{
|
||||
String[] questsToReset = dataTableGetStringColumnNoDefaults(NOVA_ORION_RESET_DATATABLE, "quest_name");
|
||||
for (int i = 0; i < questsToReset.length; i++)
|
||||
{
|
||||
String groundQuestName = questsToReset[i];
|
||||
if (groundquests.isQuestActiveOrComplete(player, groundQuestName))
|
||||
{
|
||||
for (String groundQuestName : questsToReset) {
|
||||
if (groundquests.isQuestActiveOrComplete(player, groundQuestName)) {
|
||||
groundquests.clearQuest(player, groundQuestName);
|
||||
}
|
||||
}
|
||||
@@ -205,9 +185,7 @@ public class township extends script.base_script
|
||||
removeObjVar(player, OBJVAR_NOVA_ORION_FACTION);
|
||||
}
|
||||
String[] slotsToReset = dataTableGetStringColumnNoDefaults(NOVA_ORION_RESET_DATATABLE, "rank_slot_name");
|
||||
for (int p = 0; p < slotsToReset.length; p++)
|
||||
{
|
||||
String slotRankName = slotsToReset[p];
|
||||
for (String slotRankName : slotsToReset) {
|
||||
long slotValue = getCollectionSlotValue(player, slotRankName);
|
||||
modifyCollectionSlotValue(player, slotRankName, (-1 * slotValue));
|
||||
}
|
||||
@@ -219,18 +197,21 @@ public class township extends script.base_script
|
||||
if (questList != null)
|
||||
{
|
||||
int spaceQuests = questList.getNumItems();
|
||||
String questType;
|
||||
obj_var_list typeList;
|
||||
obj_var quest;
|
||||
String spaceQuestName;
|
||||
String questSeries;
|
||||
for (int sq = 0; sq < spaceQuests; ++sq)
|
||||
{
|
||||
obj_var spaceFields = questList.getObjVar(sq);
|
||||
String questType = spaceFields.getName();
|
||||
obj_var_list typeList = questList.getObjVarList(questType);
|
||||
questType = questList.getObjVar(sq).getName();
|
||||
typeList = questList.getObjVarList(questType);
|
||||
int questCount = typeList.getNumItems();
|
||||
for (int j = 0; j < questCount; j++)
|
||||
{
|
||||
obj_var quest = typeList.getObjVar(j);
|
||||
String spaceQuestName = quest.getName();
|
||||
String spaceTable = "/datatables/spacequest/" + questType + "/" + spaceQuestName + ".iff";
|
||||
String questSeries = dataTableGetString(spaceTable, 0, "questSeries");
|
||||
quest = typeList.getObjVar(j);
|
||||
spaceQuestName = quest.getName();
|
||||
questSeries = dataTableGetString("/datatables/spacequest/" + questType + "/" + spaceQuestName + ".iff", 0, "questSeries");
|
||||
if (questSeries != null && questSeries.length() > 0)
|
||||
{
|
||||
if (questSeries.equals("nova_orion"))
|
||||
@@ -241,7 +222,6 @@ public class township extends script.base_script
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static string_id getNovaOrionRumor(obj_id player) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+4
-26
@@ -1,15 +1,6 @@
|
||||
package script.library;
|
||||
|
||||
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.reflect.*;
|
||||
import java.lang.Thread.*;
|
||||
import script.obj_id;
|
||||
|
||||
public class trace extends script.base_script
|
||||
{
|
||||
@@ -31,11 +22,7 @@ public class trace extends script.base_script
|
||||
}
|
||||
public static boolean isFlagSet(int mask, int flag) throws InterruptedException
|
||||
{
|
||||
if ((mask & flag) == flag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (mask & flag) == flag;
|
||||
}
|
||||
public static void log(String channelOrLogFile, String message, obj_id logAbout, int traceLevelMask) throws InterruptedException
|
||||
{
|
||||
@@ -65,24 +52,15 @@ public class trace extends script.base_script
|
||||
LOG(channelOrLogFile, "[" + logAbout + "]:" + message);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean isDebugDefined() throws InterruptedException
|
||||
{
|
||||
String flag = getConfigSetting("GameServer", "scriptDebugTrace");
|
||||
if (flag == null || flag.length() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(flag == null || flag.length() < 1);
|
||||
}
|
||||
public static boolean pipeDebugToCsLog() throws InterruptedException
|
||||
{
|
||||
String flag = getConfigSetting("GameServer", "pipeScriptDebugToCsLog");
|
||||
if (flag == null || flag.length() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(flag == null || flag.length() < 1);
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+72
-82
@@ -1,14 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class trainerlocs extends script.base_script
|
||||
{
|
||||
@@ -36,79 +30,75 @@ public class trainerlocs extends script.base_script
|
||||
{
|
||||
location targetLoc = new location();
|
||||
targetLoc.area = track;
|
||||
String waypName = "error";
|
||||
if (track.equals("naboo"))
|
||||
{
|
||||
if (profession.equals("imperial"))
|
||||
{
|
||||
targetLoc.x = 5182f;
|
||||
targetLoc.y = -192f;
|
||||
targetLoc.z = 6750f;
|
||||
waypName = "barn_sinkko";
|
||||
}
|
||||
else if (profession.equals("rebel"))
|
||||
{
|
||||
targetLoc.x = 4767f;
|
||||
targetLoc.y = 4.22f;
|
||||
targetLoc.z = -4812f;
|
||||
waypName = "v3_fx";
|
||||
}
|
||||
else
|
||||
{
|
||||
targetLoc.x = -5495f;
|
||||
targetLoc.y = 14.00f;
|
||||
targetLoc.z = 4476f;
|
||||
waypName = "dinge";
|
||||
}
|
||||
}
|
||||
else if (track.equals("corellia"))
|
||||
{
|
||||
if (profession.equals("imperial"))
|
||||
{
|
||||
targetLoc.x = -2184f;
|
||||
targetLoc.y = 20.0f;
|
||||
targetLoc.z = 2273f;
|
||||
targetLoc.area = "talus";
|
||||
waypName = "hakassha_sireen";
|
||||
}
|
||||
else if (profession.equals("rebel"))
|
||||
{
|
||||
targetLoc.x = -5170f;
|
||||
targetLoc.y = 21.00f;
|
||||
targetLoc.z = -2295f;
|
||||
waypName = "kreezo";
|
||||
}
|
||||
else
|
||||
{
|
||||
targetLoc.x = -275f;
|
||||
targetLoc.y = 28f;
|
||||
targetLoc.z = -4695f;
|
||||
waypName = "rhea";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (profession.equals("imperial"))
|
||||
{
|
||||
targetLoc.x = -1132f;
|
||||
targetLoc.y = 13.32f;
|
||||
targetLoc.z = -3542f;
|
||||
waypName = "akal_colzet";
|
||||
}
|
||||
else if (profession.equals("rebel"))
|
||||
{
|
||||
targetLoc.x = -2991f;
|
||||
targetLoc.y = 5f;
|
||||
targetLoc.z = 2123f;
|
||||
waypName = "da_la_socuna";
|
||||
}
|
||||
else
|
||||
{
|
||||
targetLoc.x = 3381f;
|
||||
targetLoc.y = 5f;
|
||||
targetLoc.z = -4799f;
|
||||
waypName = "dravis";
|
||||
}
|
||||
String waypName;
|
||||
switch (track) {
|
||||
case "naboo":
|
||||
switch (profession) {
|
||||
case "imperial":
|
||||
targetLoc.x = 5182f;
|
||||
targetLoc.y = -192f;
|
||||
targetLoc.z = 6750f;
|
||||
waypName = "barn_sinkko";
|
||||
break;
|
||||
case "rebel":
|
||||
targetLoc.x = 4767f;
|
||||
targetLoc.y = 4.22f;
|
||||
targetLoc.z = -4812f;
|
||||
waypName = "v3_fx";
|
||||
break;
|
||||
default:
|
||||
targetLoc.x = -5495f;
|
||||
targetLoc.y = 14.00f;
|
||||
targetLoc.z = 4476f;
|
||||
waypName = "dinge";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "corellia":
|
||||
switch (profession) {
|
||||
case "imperial":
|
||||
targetLoc.x = -2184f;
|
||||
targetLoc.y = 20.0f;
|
||||
targetLoc.z = 2273f;
|
||||
targetLoc.area = "talus";
|
||||
waypName = "hakassha_sireen";
|
||||
break;
|
||||
case "rebel":
|
||||
targetLoc.x = -5170f;
|
||||
targetLoc.y = 21.00f;
|
||||
targetLoc.z = -2295f;
|
||||
waypName = "kreezo";
|
||||
break;
|
||||
default:
|
||||
targetLoc.x = -275f;
|
||||
targetLoc.y = 28f;
|
||||
targetLoc.z = -4695f;
|
||||
waypName = "rhea";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch (profession) {
|
||||
case "imperial":
|
||||
targetLoc.x = -1132f;
|
||||
targetLoc.y = 13.32f;
|
||||
targetLoc.z = -3542f;
|
||||
waypName = "akal_colzet";
|
||||
break;
|
||||
case "rebel":
|
||||
targetLoc.x = -2991f;
|
||||
targetLoc.y = 5f;
|
||||
targetLoc.z = 2123f;
|
||||
waypName = "da_la_socuna";
|
||||
break;
|
||||
default:
|
||||
targetLoc.x = 3381f;
|
||||
targetLoc.y = 5f;
|
||||
targetLoc.z = -4799f;
|
||||
waypName = "dravis";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
obj_id wayp = createWaypointInDatapad(player, targetLoc);
|
||||
String playerArea = getLocation(player).area;
|
||||
|
||||
Regular → Executable
+37
-96
@@ -1,21 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.callable;
|
||||
import script.library.space_dungeon;
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import script.library.groundquests;
|
||||
import script.library.space_quest;
|
||||
import script.library.pclib;
|
||||
import script.library.pet_lib;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
public class transition extends script.base_script
|
||||
{
|
||||
@@ -35,8 +22,7 @@ public class transition extends script.base_script
|
||||
return bad_zone_data;
|
||||
}
|
||||
String zoneLine = getStringObjVar(gate, "zoneLine");
|
||||
string_id zoneString = new string_id(STF, zoneLine);
|
||||
return zoneString;
|
||||
return new string_id(STF, zoneLine);
|
||||
}
|
||||
public static void zonePlayer(obj_id gate, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -75,8 +61,7 @@ public class transition extends script.base_script
|
||||
notifyPlayerOfInvalidPermission(player, transit);
|
||||
return;
|
||||
}
|
||||
String destination = dataTableGetString(dataTable, transit, "destination");
|
||||
String[] parse = split(destination, ':');
|
||||
String[] parse = split(dataTableGetString(dataTable, transit, "destination"), ':');
|
||||
callable.storeCallables(player);
|
||||
String script = dataTableGetString(dataTable, transit, "script");
|
||||
if (!script.equals("none"))
|
||||
@@ -152,133 +137,89 @@ public class transition extends script.base_script
|
||||
doLogging("doPublicInstanceZone", "Requested clusterwide data for " + instance + "*");
|
||||
utils.setScriptVar(getSelf(), "playerId", player);
|
||||
}
|
||||
public static boolean hasPermissionForZone(obj_id player, String zone, String flagType) throws InterruptedException
|
||||
{
|
||||
public static boolean hasPermissionForZone(obj_id player, String zone, String flagType) throws InterruptedException {
|
||||
String requiredFlag = dataTableGetString(dataTable, zone, flagType);
|
||||
if (requiredFlag == null || requiredFlag.equals(""))
|
||||
{
|
||||
if (requiredFlag == null || requiredFlag.equals("")) {
|
||||
return true;
|
||||
}
|
||||
String[] parse = split(requiredFlag, ':');
|
||||
if (parse.length == 1)
|
||||
{
|
||||
if (parse[0].equals("none"))
|
||||
{
|
||||
if (flagType.equals("initialRequiredFlag"))
|
||||
{
|
||||
return hasPermissionForZone(player, zone, "finalRequiredFlag");
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (parse.length == 1) {
|
||||
if (parse[0].equals("none")) {
|
||||
return !flagType.equals("initialRequiredFlag") || hasPermissionForZone(player, zone, "finalRequiredFlag");
|
||||
}
|
||||
if (hasObjVar(player, parse[0]))
|
||||
{
|
||||
if (hasObjVar(player, parse[0])) {
|
||||
return true;
|
||||
}
|
||||
if (utils.hasScriptVar(player, parse[0]))
|
||||
{
|
||||
if (utils.hasScriptVar(player, parse[0])) {
|
||||
utils.setScriptVar(player, "tempFlag", parse[0]);
|
||||
return true;
|
||||
}
|
||||
if (parse[0].equals("level"))
|
||||
{
|
||||
if (parse[0].equals("level")) {
|
||||
int level = getLevel(player);
|
||||
if (level >= utils.stringToInt(parse[1]))
|
||||
{
|
||||
if (level >= utils.stringToInt(parse[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parse.length == 2)
|
||||
{
|
||||
if (parse[0].equals("won"))
|
||||
{
|
||||
if (groundquests.hasCompletedQuest(player, parse[1]))
|
||||
{
|
||||
if (parse.length == 2) {
|
||||
if (parse[0].equals("won")) {
|
||||
if (groundquests.hasCompletedQuest(player, parse[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("has"))
|
||||
{
|
||||
if (groundquests.isQuestActive(player, parse[1]))
|
||||
{
|
||||
if (parse[0].equals("has")) {
|
||||
if (groundquests.isQuestActive(player, parse[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("item"))
|
||||
{
|
||||
if (utils.playerHasItemByTemplateInInventoryOrEquipped(player, parse[1]))
|
||||
{
|
||||
if (parse[0].equals("item")) {
|
||||
if (utils.playerHasItemByTemplateInInventoryOrEquipped(player, parse[1])) {
|
||||
return true;
|
||||
}
|
||||
if (utils.playerHasItemWithObjVarInInventoryOrEquipped(player, parse[1]))
|
||||
{
|
||||
if (utils.playerHasItemWithObjVarInInventoryOrEquipped(player, parse[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("level"))
|
||||
{
|
||||
if (parse[0].equals("level")) {
|
||||
int level = getLevel(player);
|
||||
if (level >= utils.stringToInt(parse[1]))
|
||||
{
|
||||
if (level >= utils.stringToInt(parse[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parse.length == 3)
|
||||
{
|
||||
if (parse[0].equals("won"))
|
||||
{
|
||||
if (space_quest.hasWonQuest(player, parse[1], parse[2]))
|
||||
{
|
||||
if (parse.length == 3) {
|
||||
if (parse[0].equals("won")) {
|
||||
if (space_quest.hasWonQuest(player, parse[1], parse[2])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("has"))
|
||||
{
|
||||
if (space_quest.hasQuest(player, parse[1], parse[2]))
|
||||
{
|
||||
if (parse[0].equals("has")) {
|
||||
if (space_quest.hasQuest(player, parse[1], parse[2])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("task"))
|
||||
{
|
||||
if (groundquests.isTaskActive(player, parse[2], parse[3]))
|
||||
{
|
||||
if (parse[0].equals("task")) {
|
||||
if (groundquests.isTaskActive(player, parse[2], parse[3])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("item"))
|
||||
{
|
||||
if (utils.playerHasItemByTemplateWithObjVarInInventoryOrEquipped(player, parse[1], parse[2]))
|
||||
{
|
||||
if (parse[0].equals("item")) {
|
||||
if (utils.playerHasItemByTemplateWithObjVarInInventoryOrEquipped(player, parse[1], parse[2])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (parse[0].equals("level"))
|
||||
{
|
||||
if (parse[0].equals("level")) {
|
||||
int level = getLevel(player);
|
||||
if (level >= utils.stringToInt(parse[1]))
|
||||
{
|
||||
if (level >= utils.stringToInt(parse[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isGod(player))
|
||||
{
|
||||
if (isGod(player)) {
|
||||
sendSystemMessageTestingOnly(player, "You are passing the permissions check because you are in god mode");
|
||||
return true;
|
||||
}
|
||||
if (flagType.equals("initialRequiredFlag"))
|
||||
{
|
||||
return hasPermissionForZone(player, zone, "finalRequiredFlag");
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return flagType.equals("initialRequiredFlag") && hasPermissionForZone(player, zone, "finalRequiredFlag");
|
||||
}
|
||||
public static void notifyPlayerOfInvalidPermission(obj_id player, String zone) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+79
-174
@@ -1,19 +1,11 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
import script.library.city;
|
||||
import script.library.instance;
|
||||
import script.library.performance;
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import java.lang.Math;
|
||||
import java.util.Vector;
|
||||
|
||||
public class travel extends script.base_script
|
||||
{
|
||||
@@ -108,7 +100,6 @@ public class travel extends script.base_script
|
||||
{
|
||||
s_yaw = s_yaw + 360.0f;
|
||||
}
|
||||
int rotation = (int)(s_yaw + 1) / 90;
|
||||
float[] transform = transformDeltaWorldYaw(structure, arrival_x, arrival_z);
|
||||
arrival_x = transform[0];
|
||||
arrival_z = transform[1];
|
||||
@@ -148,7 +139,6 @@ public class travel extends script.base_script
|
||||
{
|
||||
s_yaw = s_yaw + 360.0f;
|
||||
}
|
||||
int rotation = (int)(s_yaw + 1) / 90;
|
||||
Vector object_list = new Vector();
|
||||
object_list.setSize(0);
|
||||
for (int i = idx + 1; i < num_items; i++)
|
||||
@@ -194,36 +184,29 @@ public class travel extends script.base_script
|
||||
obj_loc = new location(x, y, z, planet, cell_id);
|
||||
object = createObjectInCell(obj_template, structure, cell, obj_loc);
|
||||
}
|
||||
if (obj_loc == null)
|
||||
if (heading != 0.0f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
LOG("LOG_CHANNEL", "Unable to create " + obj_template);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (heading != 0.0f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
setYaw(object, heading);
|
||||
object_list = utils.addElement(object_list, object);
|
||||
}
|
||||
if (is_terminal == 1)
|
||||
{
|
||||
setObjVar(object, VAR_STARPORT, structure);
|
||||
}
|
||||
if (is_transport == 1)
|
||||
{
|
||||
setObjVar(object, VAR_STARPORT, structure);
|
||||
attachScript(object, SCRIPT_SHUTTLE);
|
||||
}
|
||||
if (is_pilot == 1)
|
||||
{
|
||||
setObjVar(object, VAR_STARPORT, structure);
|
||||
attachScript(object, SCRIPT_SHUTTLE_PILOT);
|
||||
}
|
||||
}
|
||||
setYaw(object, heading);
|
||||
object_list = utils.addElement(object_list, object);
|
||||
}
|
||||
if (is_terminal == 1)
|
||||
{
|
||||
setObjVar(object, VAR_STARPORT, structure);
|
||||
}
|
||||
if (is_transport == 1)
|
||||
{
|
||||
setObjVar(object, VAR_STARPORT, structure);
|
||||
attachScript(object, SCRIPT_SHUTTLE);
|
||||
}
|
||||
if (is_pilot == 1)
|
||||
{
|
||||
setObjVar(object, VAR_STARPORT, structure);
|
||||
attachScript(object, SCRIPT_SHUTTLE_PILOT);
|
||||
}
|
||||
if (object_list.size() > 0)
|
||||
{
|
||||
setObjVar(structure, VAR_BASE_OBJECT, object_list);
|
||||
@@ -442,19 +425,10 @@ public class travel extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (hasObjVar(object, VAR_DEPARTURE_PLANET))
|
||||
{
|
||||
if (hasObjVar(object, VAR_DEPARTURE_PLANET)) {
|
||||
String ticket_planet = getTicketDeparturePlanet(object);
|
||||
String ticket_point = getTicketDeparturePoint(object);
|
||||
if (!ticket_planet.equals(depart_planet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!ticket_point.equals(depart_point))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return ticket_planet.equals(depart_planet) && ticket_point.equals(depart_point);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -467,14 +441,7 @@ public class travel extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (hasObjVar(structure, VAR_IS_SHUTTLEPORT))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return hasObjVar(structure, VAR_IS_SHUTTLEPORT);
|
||||
}
|
||||
public static boolean isTravelShuttle(obj_id object) throws InterruptedException
|
||||
{
|
||||
@@ -482,14 +449,7 @@ public class travel extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (hasScript(object, SCRIPT_SHUTTLE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return hasScript(object, SCRIPT_SHUTTLE);
|
||||
}
|
||||
public static boolean isTravelShuttlePilot(obj_id object) throws InterruptedException
|
||||
{
|
||||
@@ -497,14 +457,7 @@ public class travel extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (hasScript(object, SCRIPT_SHUTTLE_PILOT))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return hasScript(object, SCRIPT_SHUTTLE_PILOT);
|
||||
}
|
||||
public static boolean isShuttleAvailable(obj_id starport) throws InterruptedException
|
||||
{
|
||||
@@ -513,14 +466,7 @@ public class travel extends script.base_script
|
||||
return false;
|
||||
}
|
||||
int available = getIntObjVar(starport, VAR_SHUTTLE_AVAILABLE);
|
||||
if (available == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return available == 1;
|
||||
}
|
||||
public static boolean qualifiesForGcwTravelPerks(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -637,24 +583,21 @@ public class travel extends script.base_script
|
||||
if ((planetTravelPoints != null) && (planetTravelPoints.length > 0))
|
||||
{
|
||||
int numStarport = 0;
|
||||
for (int i = 0; i < planetTravelPoints.length; ++i)
|
||||
{
|
||||
if (getPlanetTravelPointInterplanetary(planet, planetTravelPoints[i]))
|
||||
{
|
||||
String gcwContestedRegion;
|
||||
|
||||
for (String planetTravelPoint : planetTravelPoints) {
|
||||
if (getPlanetTravelPointInterplanetary(planet, planetTravelPoint)) {
|
||||
++numStarport;
|
||||
int score = 50;
|
||||
String gcwContestedRegion = getPlanetTravelPointGcwContestedRegion(planet, planetTravelPoints[i]);
|
||||
if ((gcwContestedRegion != null) && (gcwContestedRegion.length() > 0))
|
||||
{
|
||||
gcwContestedRegion = getPlanetTravelPointGcwContestedRegion(planet, planetTravelPoint);
|
||||
if ((gcwContestedRegion != null) && (gcwContestedRegion.length() > 0)) {
|
||||
score = getGcwImperialScorePercentile(gcwContestedRegion);
|
||||
if ((370444368) == faction)
|
||||
{
|
||||
if ((370444368) == faction) {
|
||||
score = 100 - score;
|
||||
}
|
||||
}
|
||||
if (score > highestScore)
|
||||
{
|
||||
availableStarport = planetTravelPoints[i];
|
||||
if (score > highestScore) {
|
||||
availableStarport = planetTravelPoint;
|
||||
highestScore = score;
|
||||
}
|
||||
}
|
||||
@@ -676,11 +619,9 @@ public class travel extends script.base_script
|
||||
}
|
||||
location loc = getLocation(player);
|
||||
obj_id[] items = getObjectsInRange(loc, MAXIMUM_SHUTTLE_DISTANCE);
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
if (isTravelShuttle(items[i]))
|
||||
{
|
||||
return items[i];
|
||||
for (obj_id item : items) {
|
||||
if (isTravelShuttle(item)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -702,14 +643,7 @@ public class travel extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (distance > MAXIMUM_SHUTTLE_DISTANCE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return distance <= MAXIMUM_SHUTTLE_DISTANCE;
|
||||
}
|
||||
public static boolean isValidRoute(String planet1, String point1, String planet2, String point2) throws InterruptedException
|
||||
{
|
||||
@@ -761,11 +695,9 @@ public class travel extends script.base_script
|
||||
obj_id shuttle = obj_id.NULL_ID;
|
||||
if (starport_objects != null)
|
||||
{
|
||||
for (int i = 0; i < starport_objects.length; i++)
|
||||
{
|
||||
if (travel.isTravelShuttle(starport_objects[i]))
|
||||
{
|
||||
shuttle = starport_objects[i];
|
||||
for (obj_id starport_object : starport_objects) {
|
||||
if (travel.isTravelShuttle(starport_object)) {
|
||||
shuttle = starport_object;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -831,15 +763,8 @@ public class travel extends script.base_script
|
||||
return false;
|
||||
}
|
||||
boolean interplanetary;
|
||||
if (isShuttlePort(structure))
|
||||
{
|
||||
interplanetary = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
interplanetary = true;
|
||||
}
|
||||
boolean setup = false;
|
||||
interplanetary = !isShuttlePort(structure);
|
||||
boolean setup;
|
||||
if (civic)
|
||||
{
|
||||
setup = city.addStarport(structure, arrival_loc, travel_cost, interplanetary);
|
||||
@@ -921,11 +846,9 @@ public class travel extends script.base_script
|
||||
obj_id[] base_objects = getBaseObjects(structure);
|
||||
if (base_objects != null)
|
||||
{
|
||||
for (int i = 0; i < base_objects.length; i++)
|
||||
{
|
||||
if (isIdValid(base_objects[i]))
|
||||
{
|
||||
destroyObject(base_objects[i]);
|
||||
for (obj_id base_object : base_objects) {
|
||||
if (isIdValid(base_object)) {
|
||||
destroyObject(base_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -952,7 +875,7 @@ public class travel extends script.base_script
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (planet2.equals("kashyyyk_main"))
|
||||
else if (planet2.equals("kashyyyk_main"))
|
||||
{
|
||||
if (!features.hasEpisode3Expansion(player))
|
||||
{
|
||||
@@ -960,7 +883,7 @@ public class travel extends script.base_script
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (planet1.equals(planet2))
|
||||
else if (planet1.equals(planet2))
|
||||
{
|
||||
if (point1.equals(point2))
|
||||
{
|
||||
@@ -1018,8 +941,6 @@ public class travel extends script.base_script
|
||||
hasTravelVoucher = true;
|
||||
}
|
||||
int total_money = getTotalMoney(player);
|
||||
int cash = getCashBalance(player);
|
||||
int bank = getBankBalance(player);
|
||||
if (total_money < total_cost)
|
||||
{
|
||||
hasEnoughMoney = false;
|
||||
@@ -1207,11 +1128,6 @@ public class travel extends script.base_script
|
||||
if (roundtrip)
|
||||
{
|
||||
obj_id return_ticket = createObjectOverloaded(BASE_TRAVEL_TICKET, inv);
|
||||
if (ticket == null)
|
||||
{
|
||||
LOG("LOG_CHANNEL", "player_travel::OnPurchaseTicket -- Unable to create return ticket.");
|
||||
return null;
|
||||
}
|
||||
setObjVar(return_ticket, VAR_DEPARTURE_PLANET, planet2);
|
||||
setObjVar(return_ticket, VAR_DEPARTURE_POINT, point2);
|
||||
setObjVar(return_ticket, VAR_ARRIVAL_PLANET, planet1);
|
||||
@@ -1255,7 +1171,7 @@ public class travel extends script.base_script
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (planet.equals("kashyyyk_main"))
|
||||
else if (planet.equals("kashyyyk_main"))
|
||||
{
|
||||
if (!features.hasEpisode3Expansion(player))
|
||||
{
|
||||
@@ -1306,26 +1222,24 @@ public class travel extends script.base_script
|
||||
switch (rotation)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
X = z;
|
||||
Z = -x;
|
||||
break;
|
||||
X = z;
|
||||
Z = -x;
|
||||
break;
|
||||
case 2:
|
||||
Z = -z;
|
||||
X = -x;
|
||||
break;
|
||||
Z = -z;
|
||||
X = -x;
|
||||
break;
|
||||
case 3:
|
||||
X = -z;
|
||||
Z = x;
|
||||
break;
|
||||
X = -z;
|
||||
Z = x;
|
||||
break;
|
||||
}
|
||||
float[] delta_world =
|
||||
{
|
||||
return new float[]{
|
||||
X,
|
||||
Z
|
||||
};
|
||||
return delta_world;
|
||||
}
|
||||
public static float[] transformDeltaWorldYaw(obj_id object, float x, float z) throws InterruptedException
|
||||
{
|
||||
@@ -1337,12 +1251,10 @@ public class travel extends script.base_script
|
||||
float yaw_radians = (float)Math.toRadians(yaw);
|
||||
float X = (x * (float)Math.cos(yaw_radians)) + (z * (float)Math.sin(yaw_radians));
|
||||
float Z = (z * (float)Math.cos(yaw_radians)) - (x * (float)Math.sin(yaw_radians));
|
||||
float[] delta_world =
|
||||
{
|
||||
return new float[]{
|
||||
X,
|
||||
Z
|
||||
};
|
||||
return delta_world;
|
||||
}
|
||||
public static boolean testBoardShuttle(obj_id player, obj_id shuttle) throws InterruptedException
|
||||
{
|
||||
@@ -1357,14 +1269,13 @@ public class travel extends script.base_script
|
||||
dsrc.setSize(0);
|
||||
obj_id inventory = getObjectInSlot(player, "inventory");
|
||||
obj_id[] inv_contents = utils.getContents(inventory, false);
|
||||
for (int i = 0; i < inv_contents.length; i++)
|
||||
{
|
||||
if (isTravelTicketValid(inv_contents[i], planet, depart_point))
|
||||
{
|
||||
String ticket_planet = getTicketArrivalPlanet(inv_contents[i]);
|
||||
String ticket_point = getTicketArrivalPoint(inv_contents[i]);
|
||||
String ticket_planet;
|
||||
|
||||
for (obj_id inv_content : inv_contents) {
|
||||
if (isTravelTicketValid(inv_content, planet, depart_point)) {
|
||||
ticket_planet = getTicketArrivalPlanet(inv_content);
|
||||
ticket_planet = (ticket_planet.substring(0, 1)).toUpperCase() + (ticket_planet.substring(1)).toLowerCase();
|
||||
dsrc = utils.addElement(dsrc, ticket_planet + " -- " + ticket_point);
|
||||
dsrc = utils.addElement(dsrc, ticket_planet + " -- " + getTicketArrivalPoint(inv_content));
|
||||
}
|
||||
}
|
||||
if (dsrc.size() < 1)
|
||||
@@ -1394,11 +1305,9 @@ public class travel extends script.base_script
|
||||
}
|
||||
Vector ret = new Vector();
|
||||
ret.setSize(0);
|
||||
for (int i = 0; i < allPts.length; i++)
|
||||
{
|
||||
if (getPlanetTravelPointInterplanetary(planet, allPts[i]) == isStarport)
|
||||
{
|
||||
ret = utils.addElement(ret, allPts[i]);
|
||||
for (String allPt : allPts) {
|
||||
if (getPlanetTravelPointInterplanetary(planet, allPt) == isStarport) {
|
||||
ret = utils.addElement(ret, allPt);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -1449,11 +1358,7 @@ public class travel extends script.base_script
|
||||
sendSystemMessage(player, new string_id("beast", "beast_cant_travel"));
|
||||
return false;
|
||||
}
|
||||
if (movePlayerToDestination(player, planet2, point2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return movePlayerToDestination(player, planet2, point2);
|
||||
}
|
||||
public static boolean isTravelBlocked(obj_id player, boolean isLaunch) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+364
-697
File diff suppressed because it is too large
Load Diff
Regular → Executable
+18
-44
@@ -1,16 +1,11 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
import script.prose_package;
|
||||
import script.string_id;
|
||||
|
||||
import script.library.player_structure;
|
||||
import script.library.utils;
|
||||
import script.library.xp;
|
||||
import java.util.Vector;
|
||||
|
||||
public class turnstile extends script.base_script
|
||||
{
|
||||
@@ -54,11 +49,9 @@ public class turnstile extends script.base_script
|
||||
obj_id[] contents = player_structure.getObjectsInBuilding(building);
|
||||
if (contents != null)
|
||||
{
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
if (hasScript(contents[i], "terminal.vendor"))
|
||||
{
|
||||
setEntranceCharge(contents[i], fee);
|
||||
for (obj_id content : contents) {
|
||||
if (hasScript(content, "terminal.vendor")) {
|
||||
setEntranceCharge(content, fee);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +69,7 @@ public class turnstile extends script.base_script
|
||||
}
|
||||
else
|
||||
{
|
||||
prose_package pp = prose.getPackage(SID_WAIT_TURNSTILE, (int)(((removeTime + 900 - curTime) / 60) + 1));
|
||||
prose_package pp = prose.getPackage(SID_WAIT_TURNSTILE, ((removeTime + 900 - curTime) / 60) + 1);
|
||||
sendSystemMessageProse(player, pp);
|
||||
return false;
|
||||
}
|
||||
@@ -107,13 +100,8 @@ public class turnstile extends script.base_script
|
||||
}
|
||||
return getIntObjVar(building, VAR_TURNSTILE_TIME);
|
||||
}
|
||||
public static boolean hasTurnstile(obj_id building) throws InterruptedException
|
||||
{
|
||||
if (building == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return hasObjVar(building, VAR_TURNSTILE_BASE);
|
||||
public static boolean hasTurnstile(obj_id building) throws InterruptedException {
|
||||
return building != null && hasObjVar(building, VAR_TURNSTILE_BASE);
|
||||
}
|
||||
public static boolean removeTurnstile(obj_id building) throws InterruptedException
|
||||
{
|
||||
@@ -130,11 +118,9 @@ public class turnstile extends script.base_script
|
||||
obj_id[] contents = player_structure.getObjectsInBuilding(building);
|
||||
if (contents != null)
|
||||
{
|
||||
for (int i = 0; i < contents.length; i++)
|
||||
{
|
||||
if (hasScript(contents[i], "terminal.vendor"))
|
||||
{
|
||||
setEntranceCharge(contents[i], 0);
|
||||
for (obj_id content : contents) {
|
||||
if (hasScript(content, "terminal.vendor")) {
|
||||
setEntranceCharge(content, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,11 +215,7 @@ public class turnstile extends script.base_script
|
||||
}
|
||||
obj_id[] patrons = getObjIdArrayObjVar(building, VAR_TURNSTILE_PATRON_IDS);
|
||||
int arrayPosition = utils.getElementPositionInArray(patrons, player);
|
||||
if (arrayPosition == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return arrayPosition != -1;
|
||||
}
|
||||
public static boolean hasExpired(obj_id building, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -252,14 +234,7 @@ public class turnstile extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (timestamps[arrayPosition] < getGameTime())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return timestamps[arrayPosition] < getGameTime();
|
||||
}
|
||||
public static boolean cleanupExpiredPatrons(obj_id building) throws InterruptedException
|
||||
{
|
||||
@@ -291,9 +266,8 @@ public class turnstile extends script.base_script
|
||||
expired = utils.addElement(expired, patrons[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < expired.size(); i++)
|
||||
{
|
||||
removePatron(building, ((obj_id)expired.get(i)));
|
||||
for (Object anExpired : expired) {
|
||||
removePatron(building, ((obj_id) anExpired));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Regular → Executable
+26
-77
@@ -1,16 +1,10 @@
|
||||
package script.library;
|
||||
|
||||
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.location;
|
||||
import script.obj_id;
|
||||
import script.region;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.factions;
|
||||
import script.library.battlefield;
|
||||
import java.util.Vector;
|
||||
|
||||
public class turret extends script.base_script
|
||||
{
|
||||
@@ -53,17 +47,8 @@ public class turret extends script.base_script
|
||||
}
|
||||
removeObjVar(turret, VAR_IS_ACTIVE);
|
||||
}
|
||||
public static boolean isActive(obj_id turret) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(turret))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (hasObjVar(turret, VAR_IS_ACTIVE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
public static boolean isActive(obj_id turret) throws InterruptedException {
|
||||
return isIdValid(turret) && hasObjVar(turret, VAR_IS_ACTIVE);
|
||||
}
|
||||
public static void engageTarget(obj_id turret, obj_id target) throws InterruptedException
|
||||
{
|
||||
@@ -99,70 +84,44 @@ public class turret extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (utils.hasScriptVar(turret, SCRIPTVAR_ENGAGED))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return utils.hasScriptVar(turret, SCRIPTVAR_ENGAGED);
|
||||
}
|
||||
public static boolean createWeapon(obj_id turret) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(turret))
|
||||
{
|
||||
public static boolean createWeapon(obj_id turret) throws InterruptedException {
|
||||
if (!isIdValid(turret)) {
|
||||
return false;
|
||||
}
|
||||
if (hasObjVar(turret, "objWeapon"))
|
||||
{
|
||||
if (hasObjVar(turret, "objWeapon")) {
|
||||
return false;
|
||||
}
|
||||
String strWeaponTemplate;
|
||||
if (hasObjVar(turret, "strWeaponTemplate"))
|
||||
{
|
||||
if (hasObjVar(turret, "strWeaponTemplate")) {
|
||||
strWeaponTemplate = getStringObjVar(turret, "strWeaponTemplate");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
strWeaponTemplate = "object/weapon/ranged/turret/turret_block_large.iff";
|
||||
}
|
||||
obj_id objWeapon = createObject(strWeaponTemplate, turret, "");
|
||||
if (!isIdValid(objWeapon))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return setObjVar(turret, "objWeapon", objWeapon);
|
||||
return isIdValid(objWeapon) && setObjVar(turret, "objWeapon", objWeapon);
|
||||
}
|
||||
public static boolean isValidTargetGeneric(obj_id turret, obj_id target) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(turret) || !isIdValid(target))
|
||||
{
|
||||
public static boolean isValidTargetGeneric(obj_id turret, obj_id target) throws InterruptedException {
|
||||
if (!isIdValid(turret) || !isIdValid(target)) {
|
||||
return false;
|
||||
}
|
||||
if (target == turret)
|
||||
{
|
||||
if (target == turret) {
|
||||
return false;
|
||||
}
|
||||
location there = getLocation(target);
|
||||
location here = getLocation(turret);
|
||||
if (!isIdValid(here.cell))
|
||||
{
|
||||
if (there == null || isIdValid(there.cell))
|
||||
{
|
||||
if (!isIdValid(here.cell)) {
|
||||
if (there == null || isIdValid(there.cell)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (there.cell != here.cell)
|
||||
{
|
||||
} else {
|
||||
if (there.cell != here.cell) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
float dist = getDistance(getLocation(turret), getLocation(target));
|
||||
if (dist > TURRET_RANGE + 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return canGenericTurretAttackTarget(target);
|
||||
return dist <= TURRET_RANGE + 1 && canGenericTurretAttackTarget(target);
|
||||
}
|
||||
public static boolean isGenericTurret(obj_id turret) throws InterruptedException
|
||||
{
|
||||
@@ -184,11 +143,7 @@ public class turret extends script.base_script
|
||||
return false;
|
||||
}
|
||||
String objvar = getStringObjVar(self, OBJVAR_CAN_ATTACK);
|
||||
if (hasObjVar(target, objvar) || objvar.equals("all") || (objvar.equals("allPlayers") && isPlayer(target)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasObjVar(target, objvar) || objvar.equals("all") || (objvar.equals("allPlayers") && isPlayer(target));
|
||||
}
|
||||
public static boolean isValidTarget(obj_id turret, obj_id target) throws InterruptedException
|
||||
{
|
||||
@@ -219,11 +174,7 @@ public class turret extends script.base_script
|
||||
region btlField = battlefield.getBattlefield(turret);
|
||||
if (btlField != null)
|
||||
{
|
||||
if (pvpIsEnemy(turret, target))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return pvpIsEnemy(turret, target);
|
||||
}
|
||||
float dist = getDistance(getLocation(turret), getLocation(target));
|
||||
if (dist > TURRET_RANGE + 1)
|
||||
@@ -298,11 +249,9 @@ public class turret extends script.base_script
|
||||
return;
|
||||
}
|
||||
Vector targets = utils.getResizeableObjIdBatchScriptVar(turret, SCRIPTVAR_TARGETS);
|
||||
for (int i = 0; i < target.length; i++)
|
||||
{
|
||||
if (isValidTarget(turret, target[i]) && !utils.isElementInArray(targets, target))
|
||||
{
|
||||
targets = utils.addElement(targets, target[i]);
|
||||
for (obj_id aTarget : target) {
|
||||
if (isValidTarget(turret, aTarget) && !utils.isElementInArray(targets, target)) {
|
||||
targets = utils.addElement(targets, aTarget);
|
||||
}
|
||||
}
|
||||
if ((targets != null) && (targets.size() > 0))
|
||||
|
||||
Regular → Executable
+29
-30
@@ -1,14 +1,8 @@
|
||||
package script.library;
|
||||
|
||||
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.poi;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class uberlair extends script.base_script
|
||||
{
|
||||
@@ -23,19 +17,20 @@ public class uberlair extends script.base_script
|
||||
String[] strLargeMobs = dataTableGetStringColumnNoDefaults(lairDatatable, "strLargeMobs");
|
||||
String[] strLargeMobScript = dataTableGetStringColumnNoDefaults(lairDatatable, "strLargeMobScripts");
|
||||
LOG("uberlairs", "objLargeMobSpawners length is " + objLargeMobSpawners.length);
|
||||
for (int intI = 0; intI < objLargeMobSpawners.length; intI++)
|
||||
{
|
||||
if (strLargeMobs.length == 0)
|
||||
{
|
||||
String strMobToSpawn;
|
||||
location locSpawnLocation;
|
||||
obj_id objMob;
|
||||
|
||||
for (obj_id objLargeMobSpawner : objLargeMobSpawners) {
|
||||
if (strLargeMobs.length == 0) {
|
||||
LOG("DESIGNER_FATAL", lairType + " has large mob spawners but no large mobs!");
|
||||
break;
|
||||
}
|
||||
String strMobToSpawn = strLargeMobs[rand(0, strLargeMobs.length - 1)];
|
||||
location locSpawnLocation = getLocation(objLargeMobSpawners[intI]);
|
||||
obj_id objMob = poi.createObject(poiBaseObject, strMobToSpawn, locSpawnLocation);
|
||||
strMobToSpawn = strLargeMobs[rand(0, strLargeMobs.length - 1)];
|
||||
locSpawnLocation = getLocation(objLargeMobSpawner);
|
||||
objMob = poi.createObject(poiBaseObject, strMobToSpawn, locSpawnLocation);
|
||||
ai_lib.setDefaultCalmBehavior(objMob, ai_lib.BEHAVIOR_SENTINEL);
|
||||
if (strLargeMobScript.length > 0)
|
||||
{
|
||||
if (strLargeMobScript.length > 0) {
|
||||
attachScript(objMob, strLargeMobScript[0]);
|
||||
setObjVar(objMob, "uberlair.strScript", strLargeMobScript[0]);
|
||||
}
|
||||
@@ -43,7 +38,6 @@ public class uberlair extends script.base_script
|
||||
setObjVar(objMob, "uberlair.locSpawnLocation", locSpawnLocation);
|
||||
setObjVar(objMob, "uberlair.objParent", poiBaseObject);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static void spawnNpcLairMobiles(obj_id poiBaseObject, obj_id[] objMobSpawners) throws InterruptedException
|
||||
{
|
||||
@@ -65,6 +59,9 @@ public class uberlair extends script.base_script
|
||||
setObjVar(poiBaseObject, "intTotalMobs", intTotalMobs);
|
||||
int intIndex = getIntObjVar(poiBaseObject, "intSpawnIndex");
|
||||
int intCounter = 0;
|
||||
String strMobToSpawn;
|
||||
location locSpawnLocation;
|
||||
obj_id objMob;
|
||||
for (int intI = intIndex; intI < intMobCount; intI++)
|
||||
{
|
||||
if (intCounter > SPAWNS_PER_EVENT)
|
||||
@@ -78,11 +75,11 @@ public class uberlair extends script.base_script
|
||||
LOG("DESIGNER_FATAL", lairType + " has large mob spawners but no large mobs!");
|
||||
break;
|
||||
}
|
||||
String strMobToSpawn = strMobs[rand(0, strMobs.length - 1)];
|
||||
location locSpawnLocation = getLocation(objMobSpawners[rand(0, objMobSpawners.length - 1)]);
|
||||
strMobToSpawn = strMobs[rand(0, strMobs.length - 1)];
|
||||
locSpawnLocation = getLocation(objMobSpawners[rand(0, objMobSpawners.length - 1)]);
|
||||
locSpawnLocation.x = locSpawnLocation.x + rand(-2, 2);
|
||||
locSpawnLocation.z = locSpawnLocation.z + rand(-2, 2);
|
||||
obj_id objMob = poi.createObject(poiBaseObject, strMobToSpawn, locSpawnLocation);
|
||||
objMob = poi.createObject(poiBaseObject, strMobToSpawn, locSpawnLocation);
|
||||
ai_lib.setDefaultCalmBehavior(objMob, ai_lib.BEHAVIOR_SENTINEL);
|
||||
if (strMobScript.length > 0)
|
||||
{
|
||||
@@ -97,7 +94,6 @@ public class uberlair extends script.base_script
|
||||
setObjVar(poiBaseObject, "intSpawnCount", intMobCount);
|
||||
removeObjVar(poiBaseObject, "intSpawnIndex");
|
||||
messageTo(poiBaseObject, "spawnFormations", null, 3, false);
|
||||
return;
|
||||
}
|
||||
public static void respawnMobile(obj_id poiBaseObject, location locSpawnLocation, String strMobToSpawn, String strScript) throws InterruptedException
|
||||
{
|
||||
@@ -115,7 +111,6 @@ public class uberlair extends script.base_script
|
||||
attachScript(objMob, strScript);
|
||||
}
|
||||
setObjVar(poiBaseObject, "intSpawnCount", intCurrentSpawnCount);
|
||||
return;
|
||||
}
|
||||
public static void createFormations(obj_id objParent) throws InterruptedException
|
||||
{
|
||||
@@ -125,12 +120,17 @@ public class uberlair extends script.base_script
|
||||
LOG("uber", "lairDatatable is " + lairDatatable);
|
||||
String[] strFormations = dataTableGetStringColumnNoDefaults(lairDatatable, "strFormations");
|
||||
location[] locOffsets = getPatrolOffsets(getLocation(objParent), 50);
|
||||
String strFormationDataTable;
|
||||
String[] strMobs;
|
||||
String[] strLeader;
|
||||
obj_id objLeader;
|
||||
dictionary dctParams;
|
||||
for (int intI = 0; intI < strFormations.length; intI++)
|
||||
{
|
||||
String strFormationDataTable = "datatables/uberlair/formations/" + strFormations[intI] + ".iff";
|
||||
strFormationDataTable = "datatables/uberlair/formations/" + strFormations[intI] + ".iff";
|
||||
LOG("uber", "formation datatable is " + strFormationDataTable);
|
||||
String[] strMobs = dataTableGetStringColumnNoDefaults(strFormationDataTable, "strMobs");
|
||||
String[] strLeader = dataTableGetStringColumnNoDefaults(strFormationDataTable, "strLeader");
|
||||
strMobs = dataTableGetStringColumnNoDefaults(strFormationDataTable, "strMobs");
|
||||
strLeader = dataTableGetStringColumnNoDefaults(strFormationDataTable, "strLeader");
|
||||
if (strMobs.length == 0)
|
||||
{
|
||||
LOG("DESIGNER_FATAL", "mobs in a formation file of " + strFormationDataTable + " is blank");
|
||||
@@ -141,12 +141,12 @@ public class uberlair extends script.base_script
|
||||
LOG("DESIGNER_FATAL", "leader in a formation file of " + strFormationDataTable + " is blank");
|
||||
return;
|
||||
}
|
||||
obj_id objLeader = poi.createObject(objParent, strLeader[0], locOffsets[intI]);
|
||||
objLeader = poi.createObject(objParent, strLeader[0], locOffsets[intI]);
|
||||
LOG("uber", "created leader at " + locOffsets[intI]);
|
||||
if (objLeader != null)
|
||||
{
|
||||
attachScript(objLeader, "systems.npc_lair.uber_lair_formation_leader");
|
||||
dictionary dctParams = new dictionary();
|
||||
dctParams = new dictionary();
|
||||
dctParams.put("locWaypoints", locOffsets);
|
||||
dctParams.put("strFormationMembers", strMobs);
|
||||
dctParams.put("intOffset", intI);
|
||||
@@ -155,7 +155,6 @@ public class uberlair extends script.base_script
|
||||
messageTo(objLeader, "createFormation", dctParams, 3, false);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static location[] getPatrolOffsets(location locParentLocation, float fltDistance) throws InterruptedException
|
||||
{
|
||||
|
||||
@@ -872,7 +872,7 @@ public class utils extends script.base_script
|
||||
}
|
||||
public static Vector addElement(Vector array, boolean element) throws InterruptedException
|
||||
{
|
||||
return addElement(array, new Boolean(element));
|
||||
return addElement(array, Boolean.valueOf(element));
|
||||
}
|
||||
public static Vector addElement(Vector array, int element) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+46
-148
@@ -1,24 +1,6 @@
|
||||
package script.library;
|
||||
|
||||
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.callable;
|
||||
import script.library.colors;
|
||||
import script.library.money;
|
||||
import script.library.pet_lib;
|
||||
import script.library.hue;
|
||||
import script.library.space_transition;
|
||||
import script.library.group;
|
||||
import script.library.ai_lib;
|
||||
import script.library.space_dungeon;
|
||||
import script.library.buff;
|
||||
import script.library.instance;
|
||||
|
||||
public class vehicle extends script.base_script
|
||||
{
|
||||
@@ -127,8 +109,7 @@ public class vehicle extends script.base_script
|
||||
String vi_name = s_varInfoNames[var_index];
|
||||
float vi_conversion = s_varInfoConversions[var_index];
|
||||
int ivalue = getRangedIntCustomVarValue(vehicle, vi_name);
|
||||
float value = ((float)ivalue) / vi_conversion;
|
||||
return value;
|
||||
return ((float)ivalue) / vi_conversion;
|
||||
}
|
||||
public static void setMinimumSpeed(obj_id vehicle, float value) throws InterruptedException
|
||||
{
|
||||
@@ -249,61 +230,22 @@ public class vehicle extends script.base_script
|
||||
}
|
||||
public static boolean getStrafe(obj_id vehicle) throws InterruptedException
|
||||
{
|
||||
float value = getValue(vehicle, VAR_STRAFE);
|
||||
return value > 0.0f ? true : false;
|
||||
return getValue(vehicle, VAR_STRAFE) > 0.0f;
|
||||
}
|
||||
public static boolean isRidingVehicle(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
if (!isMob(objPlayer))
|
||||
{
|
||||
public static boolean isRidingVehicle(obj_id objPlayer) throws InterruptedException {
|
||||
if (!isMob(objPlayer)) {
|
||||
return false;
|
||||
}
|
||||
obj_id objMount = getMountId(objPlayer);
|
||||
if (isIdValid(objMount))
|
||||
{
|
||||
if (hasScript(objMount, "systems.vehicle_system.vehicle_base") || isBattlefieldVehicle(objMount))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isIdValid(objMount) && (hasScript(objMount, "systems.vehicle_system.vehicle_base") || isBattlefieldVehicle(objMount));
|
||||
}
|
||||
public static boolean isRidingBattlefieldVehicle(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
public static boolean isRidingBattlefieldVehicle(obj_id objPlayer) throws InterruptedException {
|
||||
obj_id objMount = getMountId(objPlayer);
|
||||
if (isIdValid(objMount))
|
||||
{
|
||||
if (isBattlefieldVehicle(objMount))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isIdValid(objMount) && isBattlefieldVehicle(objMount);
|
||||
}
|
||||
public static boolean isDriveableVehicle(obj_id objThing) throws InterruptedException
|
||||
{
|
||||
if (hasScript(objThing, "systems.vehicle_system.vehicle_base"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return hasScript(objThing, "systems.vehicle_system.vehicle_base");
|
||||
}
|
||||
public static boolean isVehicle(obj_id obj) throws InterruptedException
|
||||
{
|
||||
@@ -343,7 +285,6 @@ public class vehicle extends script.base_script
|
||||
params.put("type", MOD_TYPE_MAX_SPEED);
|
||||
messageTo(vehicle, "revertVehicleMod", params, duration, false);
|
||||
setMaximumSpeed(vehicle, currentMaxSpeed * factor);
|
||||
return;
|
||||
}
|
||||
public static String getVehicleReference(obj_id controlDevice) throws InterruptedException
|
||||
{
|
||||
@@ -472,7 +413,7 @@ public class vehicle extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
int decayAmt = 0;
|
||||
int decayAmt;
|
||||
if (utils.hasScriptVar(vehicle, "decay.stamp"))
|
||||
{
|
||||
int stamp = utils.getIntScriptVar(vehicle, "decay.stamp");
|
||||
@@ -568,18 +509,9 @@ public class vehicle extends script.base_script
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean canQuickUnpack(obj_id master) throws InterruptedException
|
||||
{
|
||||
public static boolean canQuickUnpack(obj_id master) throws InterruptedException {
|
||||
location yourLoc = getLocation(master);
|
||||
if (isIdValid(yourLoc.cell))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (isInRestrictedScene(master))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !isIdValid(yourLoc.cell) && !isInRestrictedScene(master);
|
||||
}
|
||||
public static boolean isInValidCallState(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -645,7 +577,7 @@ public class vehicle extends script.base_script
|
||||
obj_id objVehicle = callable.getCallable(master, callable.CALLABLE_TYPE_RIDEABLE);
|
||||
if (isIdValid(objVehicle))
|
||||
{
|
||||
if (!objVehicle.isLoaded() == false)
|
||||
if (objVehicle.isLoaded())
|
||||
{
|
||||
messageTo(objVehicle, "handlePackRequest", null, 0, false);
|
||||
}
|
||||
@@ -698,7 +630,6 @@ public class vehicle extends script.base_script
|
||||
colorIdx = getIntObjVar(vehicleControlDevice, "creature_attribs.hue");
|
||||
}
|
||||
hue.setColor(vehicle, hue.INDEX_1, colorIdx);
|
||||
return;
|
||||
}
|
||||
public static void saveVehicleInfo(obj_id vehicleControlDevice, obj_id vehicle) throws InterruptedException
|
||||
{
|
||||
@@ -720,16 +651,13 @@ public class vehicle extends script.base_script
|
||||
ranged_int_custom_var[] ri = hue.getPalcolorVars(vehicle);
|
||||
if (ri != null && ri.length > 0)
|
||||
{
|
||||
boolean wasUpdated = false;
|
||||
for (int i = 0; i < ri.length; i++)
|
||||
{
|
||||
int val = ri[i].getValue();
|
||||
if (val > -1)
|
||||
{
|
||||
String varpath = VAR_PALVAR_VARS + "." + ri[i].getVarName();
|
||||
String varpath;
|
||||
for (ranged_int_custom_var aRi : ri) {
|
||||
int val = aRi.getValue();
|
||||
if (val > -1) {
|
||||
varpath = VAR_PALVAR_VARS + "." + aRi.getVarName();
|
||||
int cur = getIntObjVar(vehicleControlDevice, varpath);
|
||||
if (cur != val)
|
||||
{
|
||||
if (cur != val) {
|
||||
setObjVar(vehicleControlDevice, varpath, val);
|
||||
}
|
||||
}
|
||||
@@ -748,12 +676,12 @@ public class vehicle extends script.base_script
|
||||
if (ovl != null)
|
||||
{
|
||||
int numItem = ovl.getNumItems();
|
||||
obj_var ov;
|
||||
|
||||
for (int i = 0; i < numItem; i++)
|
||||
{
|
||||
obj_var ov = ovl.getObjVar(i);
|
||||
String var = ov.getName();
|
||||
int idx = ov.getIntData();
|
||||
hue.setColor(vehicle, var, idx);
|
||||
ov = ovl.getObjVar(i);
|
||||
hue.setColor(vehicle, ov.getName(), ov.getIntData());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -872,7 +800,6 @@ public class vehicle extends script.base_script
|
||||
int strafe = dataTableGetInt(datatable, row, "strafe");
|
||||
setStrafe(vehicle, strafe != 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean mountPermissionCheck(obj_id vehicle, obj_id rider, boolean verbose) throws InterruptedException
|
||||
{
|
||||
@@ -953,11 +880,7 @@ public class vehicle extends script.base_script
|
||||
return false;
|
||||
}
|
||||
String name = getVehicleTemplate(vehicleControlDevice);
|
||||
if (isJetPackTemplate(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isJetPackTemplate(name);
|
||||
}
|
||||
public static boolean isJetPackVehicle(obj_id vehicle) throws InterruptedException
|
||||
{
|
||||
@@ -966,11 +889,7 @@ public class vehicle extends script.base_script
|
||||
return false;
|
||||
}
|
||||
String name = getTemplateName(vehicle);
|
||||
if (isJetPackTemplate(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isJetPackTemplate(name);
|
||||
}
|
||||
public static boolean isJetPackTemplate(String template) throws InterruptedException
|
||||
{
|
||||
@@ -978,19 +897,15 @@ public class vehicle extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (template.equals("object/mobile/vehicle/jetpack.iff"))
|
||||
else if (template.equals("object/mobile/vehicle/jetpack.iff"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (template.equals("object/mobile/vehicle/tcg_merr_sonn_jt12_jetpack.iff"))
|
||||
else if (template.equals("object/mobile/vehicle/tcg_merr_sonn_jt12_jetpack.iff"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (template.equals("object/mobile/vehicle/tcg_hk47_jetpack.iff"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return template.equals("object/mobile/vehicle/tcg_hk47_jetpack.iff");
|
||||
}
|
||||
public static void applyVehicleBuffs(obj_id player, obj_id vehicle) throws InterruptedException
|
||||
{
|
||||
@@ -1000,9 +915,8 @@ public class vehicle extends script.base_script
|
||||
LOG("mount", template + " bailed out because template is bad");
|
||||
return;
|
||||
}
|
||||
dictionary vehicleData = new dictionary();
|
||||
vehicleData = dataTableGetRow(VEHICLE_STAT_TABLE, template);
|
||||
if (vehicleData == null || vehicleData.equals(""))
|
||||
dictionary vehicleData = dataTableGetRow(VEHICLE_STAT_TABLE, template);
|
||||
if (vehicleData == null || vehicleData.size() == 0)
|
||||
{
|
||||
LOG("mount", vehicleData + " bailed out because row in datatable is bad");
|
||||
return;
|
||||
@@ -1029,7 +943,6 @@ public class vehicle extends script.base_script
|
||||
{
|
||||
buff.applyBuff(vehicle, vehicleBuffName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public static boolean canRepairDisabledVehicle(obj_id controlDevice) throws InterruptedException
|
||||
{
|
||||
@@ -1038,11 +951,7 @@ public class vehicle extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (dataTableGetInt(create.VEHICLE_TABLE, ref, "CAN_REPAIR_DISABLED") == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return dataTableGetInt(create.VEHICLE_TABLE, ref, "CAN_REPAIR_DISABLED") == 1;
|
||||
}
|
||||
public static boolean checkForMountAndDismountPlayer(obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -1124,10 +1033,8 @@ public class vehicle extends script.base_script
|
||||
if (datapadContents != null)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < datapadContents.length; ++i)
|
||||
{
|
||||
if (isIdValid(datapadContents[i]) && getGameObjectType(datapadContents[i]) == GOT_data_vehicle_control_device)
|
||||
{
|
||||
for (obj_id datapadContent : datapadContents) {
|
||||
if (isIdValid(datapadContent) && getGameObjectType(datapadContent) == GOT_data_vehicle_control_device) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -1136,10 +1043,8 @@ public class vehicle extends script.base_script
|
||||
obj_id[] hangarContents = getContents(playerHangarSlot);
|
||||
if (hangarContents != null && hangarContents.length > 0)
|
||||
{
|
||||
for (int q = 0; q < hangarContents.length; ++q)
|
||||
{
|
||||
if (isIdValid(hangarContents[q]) && getGameObjectType(hangarContents[q]) == GOT_data_vehicle_control_device)
|
||||
{
|
||||
for (obj_id hangarContent : hangarContents) {
|
||||
if (isIdValid(hangarContent) && getGameObjectType(hangarContent) == GOT_data_vehicle_control_device) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -1149,11 +1054,9 @@ public class vehicle extends script.base_script
|
||||
{
|
||||
obj_id[] vehicleControlDevices = new obj_id[count];
|
||||
count = 0;
|
||||
for (int j = 0; j < datapadContents.length; ++j)
|
||||
{
|
||||
if (isIdValid(datapadContents[j]) && getGameObjectType(datapadContents[j]) == GOT_data_vehicle_control_device)
|
||||
{
|
||||
vehicleControlDevices[count++] = datapadContents[j];
|
||||
for (obj_id datapadContent : datapadContents) {
|
||||
if (isIdValid(datapadContent) && getGameObjectType(datapadContent) == GOT_data_vehicle_control_device) {
|
||||
vehicleControlDevices[count++] = datapadContent;
|
||||
}
|
||||
}
|
||||
if (includeHangerSlot && isIdValid(playerHangarSlot))
|
||||
@@ -1161,11 +1064,9 @@ public class vehicle extends script.base_script
|
||||
obj_id[] hangarContents = getContents(playerHangarSlot);
|
||||
if (hangarContents != null && hangarContents.length > 0)
|
||||
{
|
||||
for (int k = 0; k < hangarContents.length; ++k)
|
||||
{
|
||||
if (isIdValid(hangarContents[k]) && getGameObjectType(hangarContents[k]) == GOT_data_vehicle_control_device)
|
||||
{
|
||||
vehicleControlDevices[count++] = hangarContents[k];
|
||||
for (obj_id hangarContent : hangarContents) {
|
||||
if (isIdValid(hangarContent) && getGameObjectType(hangarContent) == GOT_data_vehicle_control_device) {
|
||||
vehicleControlDevices[count++] = hangarContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1185,10 +1086,9 @@ public class vehicle extends script.base_script
|
||||
if (hangarContents != null && hangarContents.length > 0)
|
||||
{
|
||||
int count = 0;
|
||||
for (int q = 0; q < hangarContents.length; ++q)
|
||||
{
|
||||
if (isIdValid(hangarContents[q]) && getGameObjectType(hangarContents[q]) == GOT_data_vehicle_control_device)
|
||||
{
|
||||
|
||||
for (obj_id hangarContent : hangarContents) {
|
||||
if (isIdValid(hangarContent) && getGameObjectType(hangarContent) == GOT_data_vehicle_control_device) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -1196,11 +1096,9 @@ public class vehicle extends script.base_script
|
||||
{
|
||||
obj_id[] vehicleHangarSlotControlDevices = new obj_id[count];
|
||||
count = 0;
|
||||
for (int k = 0; k < hangarContents.length; ++k)
|
||||
{
|
||||
if (isIdValid(hangarContents[k]) && getGameObjectType(hangarContents[k]) == GOT_data_vehicle_control_device)
|
||||
{
|
||||
vehicleHangarSlotControlDevices[count++] = hangarContents[k];
|
||||
for (obj_id hangarContent : hangarContents) {
|
||||
if (isIdValid(hangarContent) && getGameObjectType(hangarContent) == GOT_data_vehicle_control_device) {
|
||||
vehicleHangarSlotControlDevices[count++] = hangarContent;
|
||||
}
|
||||
}
|
||||
return vehicleHangarSlotControlDevices;
|
||||
|
||||
Regular → Executable
+21
-57
@@ -1,17 +1,11 @@
|
||||
package script.library;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
import script.string_id;
|
||||
|
||||
import java.util.Vector;
|
||||
import script.library.create;
|
||||
import script.library.player_structure;
|
||||
import script.library.static_item;
|
||||
|
||||
public class vendor_lib extends script.base_script
|
||||
{
|
||||
@@ -291,8 +285,8 @@ public class vendor_lib extends script.base_script
|
||||
}
|
||||
public static void finalizePackUp(obj_id player, obj_id vendor, obj_id packer, boolean isAbandoned) throws InterruptedException
|
||||
{
|
||||
obj_id vcd = null;
|
||||
obj_id datapad = null;
|
||||
obj_id vcd;
|
||||
obj_id datapad;
|
||||
final boolean isLoadedAndAuthoritative = player.isLoaded() && player.isAuthoritative();
|
||||
CustomerServiceLog("vendorpackup", "Player " + getPlayerName(packer) + " (" + packer + ") is attempting to pack vendor (" + vendor + ",abandoned=" + isAbandoned + ") owned by player " + getPlayerName(player) + " (" + player + ")");
|
||||
if (isLoadedAndAuthoritative)
|
||||
@@ -336,7 +330,6 @@ public class vendor_lib extends script.base_script
|
||||
fixLoadWith(vendor, player, maxDepth);
|
||||
}
|
||||
CustomerServiceLog("vendorpackup", "Player " + getPlayerName(packer) + " (" + packer + ") packed vendor (" + vendor + ",abandoned=" + isAbandoned + ") owned by player " + getPlayerName(player) + " (" + player + ") into device (" + vcd + ")");
|
||||
return;
|
||||
}
|
||||
public static boolean isVendorPackUpEnabled() throws InterruptedException
|
||||
{
|
||||
@@ -383,11 +376,9 @@ public class vendor_lib extends script.base_script
|
||||
blog("vendor_lib.getAllGreeterDatatableColumnNames: prevalidation completed");
|
||||
Vector greeterColNames = new Vector();
|
||||
greeterColNames.setSize(0);
|
||||
for (int i = 0; i < preParsedColListLength; i++)
|
||||
{
|
||||
if (preParsedColList[i].startsWith("greeter"))
|
||||
{
|
||||
greeterColNames = utils.addElement(greeterColNames, preParsedColList[i]);
|
||||
for (String aPreParsedColList : preParsedColList) {
|
||||
if (aPreParsedColList.startsWith("greeter")) {
|
||||
greeterColNames = utils.addElement(greeterColNames, aPreParsedColList);
|
||||
}
|
||||
}
|
||||
if (greeterColNames.size() <= 0)
|
||||
@@ -396,11 +387,8 @@ public class vendor_lib extends script.base_script
|
||||
}
|
||||
blog("vendor_lib.getAllGreeterDatatableColumnNames: greeter col name list being returned.");
|
||||
String[] _greeterColNames = new String[0];
|
||||
if (greeterColNames != null)
|
||||
{
|
||||
_greeterColNames = new String[greeterColNames.size()];
|
||||
greeterColNames.toArray(_greeterColNames);
|
||||
}
|
||||
_greeterColNames = new String[greeterColNames.size()];
|
||||
greeterColNames.toArray(_greeterColNames);
|
||||
return _greeterColNames;
|
||||
}
|
||||
public static boolean buildNpcInPlayerStructure(obj_id controller, obj_id player, String npcType, boolean newGreeter) throws InterruptedException
|
||||
@@ -454,7 +442,7 @@ public class vendor_lib extends script.base_script
|
||||
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: validateNpcPlacementInStructure said NO.");
|
||||
return false;
|
||||
}
|
||||
location loc = null;
|
||||
location loc;
|
||||
if (where == null)
|
||||
{
|
||||
loc = getLocation(owner);
|
||||
@@ -562,11 +550,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (player_structure.isAdmin(structure, player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return player_structure.isAdmin(structure, player);
|
||||
}
|
||||
public static boolean validateNonVendorInStructure(obj_id nonVendor) throws InterruptedException
|
||||
{
|
||||
@@ -579,11 +563,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!player_structure.isPlayerStructure(structure) || player_structure.isCivic(structure))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(!player_structure.isPlayerStructure(structure) || player_structure.isCivic(structure));
|
||||
}
|
||||
public static String getGreeterNonVendorCreatureType(obj_id object, String greeterOrNonVendorType) throws InterruptedException
|
||||
{
|
||||
@@ -609,7 +589,7 @@ public class vendor_lib extends script.base_script
|
||||
blog("vendor_lib.getGreeterNonVendorCreatureType creatureTypes received");
|
||||
for (int i = 0; i < creatureTypes.length; i++)
|
||||
{
|
||||
if (greeterOrNonVendorType.indexOf(creatureTypes[i]) == -1)
|
||||
if (!greeterOrNonVendorType.contains(creatureTypes[i]))
|
||||
{
|
||||
blog("vendor_lib.getGreeterNonVendorCreatureType greeterOrNonVendorType: " + greeterOrNonVendorType + " " + creatureTypes[i]);
|
||||
continue;
|
||||
@@ -630,11 +610,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getBooleanObjVar(object, vendor_lib.SPECIAL_VENDOR_IDENTIFIER) != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return getBooleanObjVar(object, vendor_lib.SPECIAL_VENDOR_IDENTIFIER);
|
||||
}
|
||||
public static obj_id setObjectOwner(obj_id controller) throws InterruptedException
|
||||
{
|
||||
@@ -686,11 +662,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!player_structure.isPlayerStructure(structure))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return player_structure.isPlayerStructure(structure);
|
||||
}
|
||||
public static boolean isObjectInSameCellAsController(obj_id controller, obj_id object) throws InterruptedException
|
||||
{
|
||||
@@ -721,11 +693,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (controllerLoc.cell != objLocation.cell)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return controllerLoc.cell == objLocation.cell;
|
||||
}
|
||||
public static boolean recreateObject(obj_id controller, obj_id player) throws InterruptedException
|
||||
{
|
||||
@@ -753,7 +721,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
npcType = GREETER_VAR_PREFIX;
|
||||
}
|
||||
if (npcType == null || npcType.equals(""))
|
||||
if (npcType.equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -792,7 +760,7 @@ public class vendor_lib extends script.base_script
|
||||
{
|
||||
npcType = GREETER_VAR_PREFIX;
|
||||
}
|
||||
if (npcType == null || npcType.equals(""))
|
||||
if (npcType.equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -819,11 +787,7 @@ public class vendor_lib extends script.base_script
|
||||
return false;
|
||||
}
|
||||
location here = getLocation(controller);
|
||||
if (getContainedBy(controller) == here.cell)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return getContainedBy(controller) == here.cell;
|
||||
}
|
||||
public static boolean removeObjectFromController(obj_id controller, obj_id greeter) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+220
-455
File diff suppressed because it is too large
Load Diff
Regular → Executable
+244
-481
File diff suppressed because it is too large
Load Diff
Regular → Executable
+1
-7
@@ -1,12 +1,6 @@
|
||||
package script.systems.spawning.dropship;
|
||||
|
||||
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.obj_id;
|
||||
|
||||
public class base extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+7
-17
@@ -1,15 +1,8 @@
|
||||
package script.systems.spawning.dropship;
|
||||
|
||||
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.utils;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class emperorsday_lambda extends script.systems.spawning.dropship.base
|
||||
{
|
||||
@@ -39,9 +32,8 @@ public class emperorsday_lambda extends script.systems.spawning.dropship.base
|
||||
blog("emperorsday_lambda.changePosture: Init");
|
||||
setPosture(self, POSTURE_UPRIGHT);
|
||||
location ownLocation = getLocation(self);
|
||||
location behind = ownLocation;
|
||||
behind.z = ownLocation.z - 20.0f;
|
||||
faceTo(self, behind);
|
||||
ownLocation.z = ownLocation.z - 20.0f;
|
||||
faceTo(self, ownLocation);
|
||||
messageTo(self, "selfCleanUp", null, 60f, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -52,8 +44,7 @@ public class emperorsday_lambda extends script.systems.spawning.dropship.base
|
||||
if (isValidId(exitPoint))
|
||||
{
|
||||
blog("emperorsday_lambda.changePosture: Facing to exit location");
|
||||
location exitLocation = getLocation(exitPoint);
|
||||
faceTo(self, exitLocation);
|
||||
faceTo(self, getLocation(exitPoint));
|
||||
messageTo(self, "moveToExitPoint", null, 2, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -71,8 +62,7 @@ public class emperorsday_lambda extends script.systems.spawning.dropship.base
|
||||
}
|
||||
setMovementPercent(self, 16);
|
||||
blog("emperorsday_lambda.moveToExitPoint exit point valid");
|
||||
location loc = getLocation(exitPoint);
|
||||
pathTo(self, loc);
|
||||
pathTo(self, getLocation(exitPoint));
|
||||
messageTo(self, "correctTakeOffThenCleanUp", null, 10, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
Regular → Executable
+2
-10
@@ -1,15 +1,7 @@
|
||||
package script.systems.spawning.dropship;
|
||||
|
||||
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.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class emperorsday_yt1300 extends script.systems.spawning.dropship.base
|
||||
{
|
||||
|
||||
Regular → Executable
+8
-11
@@ -1,17 +1,13 @@
|
||||
package script.systems.spawning.dropship;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.create;
|
||||
import script.library.gcw;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class lambda extends script.systems.spawning.dropship.base
|
||||
{
|
||||
@@ -49,9 +45,10 @@ public class lambda extends script.systems.spawning.dropship.base
|
||||
obj_id leader = null;
|
||||
Vector spawns = new Vector();
|
||||
spawns.setSize(0);
|
||||
obj_id thisSpawn;
|
||||
for (int i = 0; i < spawnNames.length; i++)
|
||||
{
|
||||
obj_id thisSpawn = create.object(spawnNames[i], here);
|
||||
thisSpawn = create.object(spawnNames[i], here);
|
||||
if (isIdValid(thisSpawn) && !isIdValid(leader))
|
||||
{
|
||||
leader = thisSpawn;
|
||||
|
||||
Regular → Executable
+5
-13
@@ -1,15 +1,8 @@
|
||||
package script.systems.spawning.dropship;
|
||||
|
||||
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.ai_lib;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class player_shuttle extends script.systems.spawning.dropship.base
|
||||
{
|
||||
@@ -40,9 +33,8 @@ public class player_shuttle extends script.systems.spawning.dropship.base
|
||||
location locList[] = params.getLocationArray("explosionLocaitonList");
|
||||
if (locList != null && locList.length > 0)
|
||||
{
|
||||
for (int i = 0; i < locList.length; i++)
|
||||
{
|
||||
playClientEffectLoc(self, "clienteffect/combat_explosion_lair_large.cef", locList[i], 0);
|
||||
for (location aLocList : locList) {
|
||||
playClientEffectLoc(self, "clienteffect/combat_explosion_lair_large.cef", aLocList, 0);
|
||||
}
|
||||
}
|
||||
messageTo(self, "destroySelf", null, 0, false);
|
||||
|
||||
Regular → Executable
+9
-25
@@ -1,17 +1,11 @@
|
||||
package script.systems.spawning.imperial;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.attrib;
|
||||
import script.library.utils;
|
||||
import script.library.create;
|
||||
import script.library.pet_lib;
|
||||
import script.library.utils;
|
||||
import script.obj_id;
|
||||
|
||||
public class probot_egg extends script.base_script
|
||||
{
|
||||
@@ -75,22 +69,12 @@ public class probot_egg extends script.base_script
|
||||
messageTo(self, "handleSpawnProbot", params, 1f, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int x = 0;
|
||||
if (x <= 6)
|
||||
{
|
||||
obj_id probot = create.object("imperial_probot_drone", getLocation(self));
|
||||
if (isIdValid(probot))
|
||||
{
|
||||
attachScript(probot, "ai.override_behavior.scout");
|
||||
messageTo(probot, "handleTargetAssignment", params, 1f, false);
|
||||
}
|
||||
}
|
||||
else if (x <= 9)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
obj_id probot = create.object("imperial_probot_drone", getLocation(self));
|
||||
if (isIdValid(probot))
|
||||
{
|
||||
attachScript(probot, "ai.override_behavior.scout");
|
||||
messageTo(probot, "handleTargetAssignment", params, 1f, false);
|
||||
}
|
||||
destroyObject(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
Regular → Executable
+16
-33
@@ -1,20 +1,12 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
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_utils;
|
||||
import script.library.planetary_map;
|
||||
import script.dictionary;
|
||||
import script.library.create;
|
||||
import script.library.objvar_mangle;
|
||||
import script.library.utils;
|
||||
import java.lang.Math;
|
||||
import script.library.hue;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class mob_spawner extends script.base_script
|
||||
{
|
||||
@@ -28,10 +20,8 @@ public class mob_spawner extends script.base_script
|
||||
}
|
||||
public int OnPreloadComplete(obj_id self) throws InterruptedException
|
||||
{
|
||||
String strTest = "" + self;
|
||||
location locTest = getLocation(self);
|
||||
String strPlanet = locTest.area;
|
||||
dictionary dctSpawnInfo = dataTableGetRow("datatables/spawning/ground_spawning/static/" + strPlanet + ".iff", strTest);
|
||||
String strPlanet = getLocation(self).area;
|
||||
dictionary dctSpawnInfo = dataTableGetRow("datatables/spawning/ground_spawning/static/" + strPlanet + ".iff", "" + self);
|
||||
if (dctSpawnInfo == null)
|
||||
{
|
||||
obj_id objTest = createObject("object/tangible/gravestone/gravestone01.iff", getLocation(self));
|
||||
@@ -39,21 +29,17 @@ public class mob_spawner extends script.base_script
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String strType = dctSpawnInfo.getString("strType");
|
||||
String strMob = dctSpawnInfo.getString("strMob");
|
||||
String strName = dctSpawnInfo.getString("strName");
|
||||
float fltMinSpawnTime = dctSpawnInfo.getFloat("fltMinSpawnTime");
|
||||
float fltMaxSpawnTime = dctSpawnInfo.getFloat("fltMaxSpawnTime");
|
||||
Vector strScripts = new Vector();
|
||||
strScripts.setSize(0);
|
||||
String strMobToSpawn = "";
|
||||
if (!strType.equals(""))
|
||||
{
|
||||
String strFileName = "datatables/spawning/ground_spawning/types/" + strType + ".iff";
|
||||
String[] strSpawnList = dataTableGetStringColumnNoDefaults(strFileName, "strItem");
|
||||
String[] strSpawnList = dataTableGetStringColumnNoDefaults("datatables/spawning/ground_spawning/types/" + strType + ".iff", "strItem");
|
||||
if ((strSpawnList == null) || (strSpawnList.length == 0))
|
||||
{
|
||||
obj_id objTest = createObject("object/tangible/gravestone/gravestone01.iff", getLocation(self));
|
||||
setName(objTest, "for object " + self + " bad entry of " + strType + " and planet " + strPlanet);
|
||||
setName(createObject("object/tangible/gravestone/gravestone01.iff", getLocation(self)), "for object " + self + " bad entry of " + strType + " and planet " + strPlanet);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
utils.setScriptVar(self, "strSpawnList", strSpawnList);
|
||||
@@ -61,12 +47,13 @@ public class mob_spawner extends script.base_script
|
||||
else
|
||||
{
|
||||
String[] strSpawnList = new String[1];
|
||||
strSpawnList[0] = strMob;
|
||||
strSpawnList[0] = dctSpawnInfo.getString("strMob");
|
||||
utils.setScriptVar(self, "strSpawnList", strSpawnList);
|
||||
}
|
||||
String strScript;
|
||||
for (int intI = 1; intI < 5; intI++)
|
||||
{
|
||||
String strScript = dctSpawnInfo.getString("strScript" + intI);
|
||||
strScript = dctSpawnInfo.getString("strScript" + intI);
|
||||
if (!strScript.equals(""))
|
||||
{
|
||||
strScripts = utils.addElement(strScripts, strScript);
|
||||
@@ -124,13 +111,10 @@ public class mob_spawner extends script.base_script
|
||||
}
|
||||
if ((strScripts != null) && (strScripts.length > 0))
|
||||
{
|
||||
for (int intI = 0; intI < strScripts.length; intI++)
|
||||
{
|
||||
if (!strScripts[intI].equals(""))
|
||||
{
|
||||
if (!hasScript(objNPC, strScripts[intI]))
|
||||
{
|
||||
attachScript(objNPC, strScripts[intI]);
|
||||
for (String strScript : strScripts) {
|
||||
if (!strScript.equals("")) {
|
||||
if (!hasScript(objNPC, strScript)) {
|
||||
attachScript(objNPC, strScript);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +122,6 @@ public class mob_spawner extends script.base_script
|
||||
attachScript(objNPC, "systems.spawning.mob_spawn_tracker");
|
||||
utils.setScriptVar(objNPC, "objParent", self);
|
||||
utils.setScriptVar(objNPC, "fltRespawnTime", rand(fltMinSpawnTime, fltMaxSpawnTime));
|
||||
return;
|
||||
}
|
||||
public int respawnMob(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
|
||||
Regular → Executable
+2
-7
@@ -1,12 +1,7 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class patrol_point_setup extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+3
-8
@@ -1,15 +1,10 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class patrol_spawned_tracker extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+73
-155
@@ -1,24 +1,10 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
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.*;
|
||||
|
||||
import script.library.skill;
|
||||
import script.library.city;
|
||||
import script.library.regions;
|
||||
import script.library.locations;
|
||||
import script.library.battlefield;
|
||||
import script.library.utils;
|
||||
import script.library.create;
|
||||
import script.library.group;
|
||||
import script.library.gcw;
|
||||
import script.library.ai_lib;
|
||||
import script.library.vehicle;
|
||||
import java.util.Objects;
|
||||
import java.util.Vector;
|
||||
|
||||
public class spawn_base extends script.base_script
|
||||
{
|
||||
@@ -69,30 +55,26 @@ public class spawn_base extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String strFileName = "";
|
||||
if (strRegion.equals("fictional"))
|
||||
{
|
||||
if ((strRegionName == null || strRegionName.equals("")) || (strPlanet == null || strPlanet.equals("")))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
strFileName = getFictionalRegionFileName(strPlanet, strRegionName);
|
||||
}
|
||||
else if (strRegion.equals("overload"))
|
||||
{
|
||||
if (strRegionName == null || strRegionName.equals(""))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
strFileName = getOverLoadRegionFileName(strRegionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strPlanet == null || strPlanet.equals(""))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
strFileName = "datatables/spawning/spawn_lists/" + strPlanet + "/" + strPlanet + "_" + strRegion + ".iff";
|
||||
String strFileName;
|
||||
switch (strRegion) {
|
||||
case "fictional":
|
||||
if ((strRegionName == null || strRegionName.equals("")) || (strPlanet == null || strPlanet.equals(""))) {
|
||||
return null;
|
||||
}
|
||||
strFileName = getFictionalRegionFileName(strPlanet, strRegionName);
|
||||
break;
|
||||
case "overload":
|
||||
if (strRegionName == null || strRegionName.equals("")) {
|
||||
return null;
|
||||
}
|
||||
strFileName = getOverLoadRegionFileName(strRegionName);
|
||||
break;
|
||||
default:
|
||||
if (strPlanet == null || strPlanet.equals("")) {
|
||||
return null;
|
||||
}
|
||||
strFileName = "datatables/spawning/spawn_lists/" + strPlanet + "/" + strPlanet + "_" + strRegion + ".iff";
|
||||
break;
|
||||
}
|
||||
if (strFileName == null)
|
||||
{
|
||||
@@ -125,10 +107,7 @@ public class spawn_base extends script.base_script
|
||||
}
|
||||
Vector validTemplateIndices = new Vector();
|
||||
validTemplateIndices.setSize(0);
|
||||
if (validTemplateIndices == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String strSpecificRegion;
|
||||
for (int i = 0; i < strTemplates.length; ++i)
|
||||
{
|
||||
int intMinDifficulty = intMinDifficulties[i];
|
||||
@@ -138,7 +117,7 @@ public class spawn_base extends script.base_script
|
||||
int intGcwFaction = intGcwFactions[i];
|
||||
int intGcwThreshold = intGcwThresholds[i];
|
||||
int intGcwScoreType = intGcwScoreTypes[i];
|
||||
String strSpecificRegion = strGcwSpecificRegions == null || strGcwSpecificRegions.length == 0 ? "" : strGcwSpecificRegions[i];
|
||||
strSpecificRegion = strGcwSpecificRegions == null || strGcwSpecificRegions.length == 0 ? "" : strGcwSpecificRegions[i];
|
||||
if (!checkGalacticCivilWarStandings(intGcwFaction, intGcwThreshold, intGcwScoreType, strSpecificRegion, currentLoc))
|
||||
{
|
||||
continue;
|
||||
@@ -159,7 +138,7 @@ public class spawn_base extends script.base_script
|
||||
_validTemplateIndices = new int[validTemplateIndices.size()];
|
||||
for (int _i = 0; _i < validTemplateIndices.size(); ++_i)
|
||||
{
|
||||
_validTemplateIndices[_i] = ((Integer)validTemplateIndices.get(_i)).intValue();
|
||||
_validTemplateIndices[_i] = (Integer) validTemplateIndices.get(_i);
|
||||
}
|
||||
}
|
||||
return _validTemplateIndices;
|
||||
@@ -170,16 +149,13 @@ public class spawn_base extends script.base_script
|
||||
}
|
||||
public int getPlayerSpawnDiffibculty(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
obj_id objGroup = getGroupObject(objPlayer);
|
||||
if (!isIdValid(objGroup))
|
||||
if (!isIdValid(getGroupObject(objPlayer)))
|
||||
{
|
||||
int intPlayerLevel = getLevel(objPlayer);
|
||||
return intPlayerLevel;
|
||||
return getLevel(objPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
int intGroupLevel = skill.getGroupLevel(objPlayer);
|
||||
return intGroupLevel;
|
||||
return skill.getGroupLevel(objPlayer);
|
||||
}
|
||||
}
|
||||
public obj_id createTemplate(location locSpawnLocation, dictionary params, obj_id objPlayer) throws InterruptedException
|
||||
@@ -191,7 +167,6 @@ public class spawn_base extends script.base_script
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int intIndex = params.getInt("intIndex");
|
||||
int intPlayerDifficulty = params.getInt("intPlayerDifficulty");
|
||||
int intNumToSpawn = params.getInt("intNumToSpawn");
|
||||
String strTemplateToSpawn = params.getString("strTemplateToSpawn");
|
||||
@@ -239,7 +214,7 @@ public class spawn_base extends script.base_script
|
||||
if (strTemplate.indexOf("lair") > 0)
|
||||
{
|
||||
setObjVar(objCreatedTemplate, "numToSpawn", intNumToSpawn);
|
||||
if (!strTemplateToSpawn.equals("") && strTemplateToSpawn != null)
|
||||
if (!strTemplateToSpawn.equals(""))
|
||||
{
|
||||
setObjVar(objCreatedTemplate, "creatureTemplate", strTemplateToSpawn);
|
||||
}
|
||||
@@ -247,7 +222,7 @@ public class spawn_base extends script.base_script
|
||||
if (strTemplate.indexOf("herd") > 0)
|
||||
{
|
||||
setObjVar(objCreatedTemplate, "numToSpawn", intNumToSpawn);
|
||||
if ((!strTemplateToSpawn.equals("")) && (strTemplateToSpawn != null))
|
||||
if ((!strTemplateToSpawn.equals("")))
|
||||
{
|
||||
setObjVar(objCreatedTemplate, "creatureTemplate", strTemplateToSpawn);
|
||||
}
|
||||
@@ -270,22 +245,19 @@ public class spawn_base extends script.base_script
|
||||
public dictionary chooseWeightedSpawnTemplate(int[] intDataIndex, String strRegionName, String strPlanetName, region rgnRegion) throws InterruptedException
|
||||
{
|
||||
String strFileName;
|
||||
if (strRegionName.equals("fictional"))
|
||||
{
|
||||
String strRegionFullName = rgnRegion.getName();
|
||||
strFileName = getFictionalRegionFileName(strPlanetName, strRegionFullName);
|
||||
switch (strRegionName) {
|
||||
case "fictional":
|
||||
String strRegionFullName = rgnRegion.getName();
|
||||
strFileName = getFictionalRegionFileName(strPlanetName, strRegionFullName);
|
||||
break;
|
||||
case "overload":
|
||||
strFileName = getOverLoadRegionFileName(strRegionName);
|
||||
break;
|
||||
default:
|
||||
strFileName = "datatables/spawning/spawn_lists/" + strPlanetName + "/" + strPlanetName + "_" + strRegionName + ".iff";
|
||||
break;
|
||||
}
|
||||
else if (strRegionName.equals("overload"))
|
||||
{
|
||||
strFileName = getOverLoadRegionFileName(strRegionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
strFileName = "datatables/spawning/spawn_lists/" + strPlanetName + "/" + strPlanetName + "_" + strRegionName + ".iff";
|
||||
}
|
||||
dictionary dctRegion = new dictionary();
|
||||
String[] strTemplates = dataTableGetStringColumn(strFileName, "strTemplate");
|
||||
int[] intSpawnLimits = dataTableGetIntColumn(strFileName, "intSpawnLimit");
|
||||
int[] intMinDifficulties = dataTableGetIntColumn(strFileName, "intMinDifficulty");
|
||||
int[] intMaxDifficulties = dataTableGetIntColumn(strFileName, "intMaxDifficulty");
|
||||
int[] intWeightings = dataTableGetIntColumn(strFileName, "intWeighting");
|
||||
@@ -298,9 +270,8 @@ public class spawn_base extends script.base_script
|
||||
if (intDataIndex.length != 1)
|
||||
{
|
||||
int weightingGrandTotal = 0;
|
||||
for (int i = 0; i < intDataIndex.length; ++i)
|
||||
{
|
||||
weightingGrandTotal += intWeightings[intDataIndex[i]];
|
||||
for (int anIntDataIndex : intDataIndex) {
|
||||
weightingGrandTotal += intWeightings[anIntDataIndex];
|
||||
}
|
||||
int randomValue = rand(0, weightingGrandTotal - 1);
|
||||
int previousChance = 0;
|
||||
@@ -330,9 +301,6 @@ public class spawn_base extends script.base_script
|
||||
}
|
||||
public void sendSpawnSpam(obj_id objPlayer, boolean boolLogFailures, boolean boolVerboseMode, String strSpam) throws InterruptedException
|
||||
{
|
||||
if (boolLogFailures)
|
||||
{
|
||||
}
|
||||
if (boolVerboseMode && isIdValid(objPlayer))
|
||||
{
|
||||
deltadictionary dctScriptVars = objPlayer.getScriptVars();
|
||||
@@ -345,30 +313,17 @@ public class spawn_base extends script.base_script
|
||||
sendSystemMessageTestingOnly(objPlayer, strSpam);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public boolean getVerboseMode(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(objPlayer, "spawning.verboseMode"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasObjVar(objPlayer, "spawning.verboseMode");
|
||||
}
|
||||
public boolean checkTemplatesInRange(obj_id objPlayer, location locHome, boolean boolCheckForTheaters, String strObjectType) throws InterruptedException
|
||||
{
|
||||
boolean boolLogFailures = checkSpawnLogFailures();
|
||||
boolean boolVerboseMode = getVerboseMode(objPlayer);
|
||||
final int SPAWN_TEMPLATE_CHECK_DISTANCE = 128;
|
||||
final int SPAWN_CHECK_TEMPLATE_LIMIT = 140;
|
||||
final int SPAWN_THEATER_CHECK_DISTANCE = 200;
|
||||
final int SPAWN_CHECK_THEATER_LIMIT = 1;
|
||||
return true;
|
||||
}
|
||||
public boolean canSpawn(obj_id objPlayer, location locSpawnLocation, boolean boolCheckForTheaters, String strObjectType) throws InterruptedException
|
||||
{
|
||||
boolean boolLogFailures = checkSpawnLogFailures();
|
||||
boolean boolVerboseMode = getVerboseMode(objPlayer);
|
||||
if (!isSpawningAllowed(locSpawnLocation))
|
||||
{
|
||||
return false;
|
||||
@@ -394,7 +349,7 @@ public class spawn_base extends script.base_script
|
||||
}
|
||||
}
|
||||
location locCurrentLocation = getLocation(objPlayer);
|
||||
if (locCurrentLocation.area == "tutorial")
|
||||
if (Objects.equals(locCurrentLocation.area, "tutorial"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -422,9 +377,9 @@ public class spawn_base extends script.base_script
|
||||
{
|
||||
boolean boolSpawnerIsOn;
|
||||
boolSpawnerIsOn = getBooleanObjVar(objMasterSpawner, "boolSpawnerIsOn");
|
||||
if (boolSpawnerIsOn == false)
|
||||
if (!boolSpawnerIsOn)
|
||||
{
|
||||
return boolSpawnerIsOn;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (locCurrentLocation.cell != obj_id.NULL_ID)
|
||||
@@ -475,7 +430,6 @@ public class spawn_base extends script.base_script
|
||||
public region getSpawnRegion(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
location locTest = getLocation(objPlayer);
|
||||
String strPlanet = locTest.area;
|
||||
region[] rgnRegionList = getRegionsWithSpawnableAtPoint(locTest, regions.SPAWN_TRUE);
|
||||
if (rgnRegionList == null)
|
||||
{
|
||||
@@ -486,10 +440,6 @@ public class spawn_base extends script.base_script
|
||||
return null;
|
||||
}
|
||||
region rgnSpawnRegion = locations.getSmallestRegion(rgnRegionList);
|
||||
String strTestPlanet = rgnSpawnRegion.getPlanetName();
|
||||
if (!strTestPlanet.equals(strPlanet))
|
||||
{
|
||||
}
|
||||
if (rgnSpawnRegion == null)
|
||||
{
|
||||
return null;
|
||||
@@ -511,20 +461,10 @@ public class spawn_base extends script.base_script
|
||||
}
|
||||
public void preLoadSpawnDataTables(obj_id objMasterSpawner) throws InterruptedException
|
||||
{
|
||||
return;
|
||||
}
|
||||
public boolean checkSpawnLogFailures() throws InterruptedException
|
||||
{
|
||||
public boolean checkSpawnLogFailures() throws InterruptedException {
|
||||
String strConfigSetting = getConfigSetting("GameServer", "fastSpawn");
|
||||
if (strConfigSetting == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (strConfigSetting.equals("true"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return strConfigSetting != null && strConfigSetting.equals("true");
|
||||
}
|
||||
public boolean isSpawningAllowed(location locTest) throws InterruptedException
|
||||
{
|
||||
@@ -532,10 +472,8 @@ public class spawn_base extends script.base_script
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < INVALID_SPAWNING_AREAS.length; ++i)
|
||||
{
|
||||
if (locTest.area == INVALID_SPAWNING_AREAS[i])
|
||||
{
|
||||
for (String INVALID_SPAWNING_AREA : INVALID_SPAWNING_AREAS) {
|
||||
if (locTest.area.equals(INVALID_SPAWNING_AREA)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -543,10 +481,8 @@ public class spawn_base extends script.base_script
|
||||
}
|
||||
public String getFictionalRegionFileName(String strPlanet, String strFullName) throws InterruptedException
|
||||
{
|
||||
string_id strId = utils.unpackString(strFullName);
|
||||
String strRegionName = strId.getAsciiId();
|
||||
String strTableName = "datatables/spawning/spawn_lists/" + strPlanet + "/" + strRegionName + ".iff";
|
||||
return strTableName;
|
||||
String strRegionName = utils.unpackString(strFullName).getAsciiId();
|
||||
return "datatables/spawning/spawn_lists/" + strPlanet + "/" + strRegionName + ".iff";
|
||||
}
|
||||
public String getOverLoadRegionFileName(String strRegionName) throws InterruptedException
|
||||
{
|
||||
@@ -556,8 +492,7 @@ public class spawn_base extends script.base_script
|
||||
return "";
|
||||
}
|
||||
String strFileName = strRegionName.substring(0, intIndex);
|
||||
String strTableName = "datatables/spawning/spawn_lists/spawn_overloads/" + strFileName + ".iff";
|
||||
return strTableName;
|
||||
return "datatables/spawning/spawn_lists/spawn_overloads/" + strFileName + ".iff";
|
||||
}
|
||||
public void doSpawnEvent(dictionary params) throws InterruptedException
|
||||
{
|
||||
@@ -570,13 +505,12 @@ public class spawn_base extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
int intPlayerDifficulty = params.getInt("intDifficulty");
|
||||
String strRegionName = params.getString("strRegionName");
|
||||
String strPlanet = params.getString("strPlanet");
|
||||
if (strRegionName == null || strRegionName.length() < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
String strPlanet = params.getString("strPlanet");
|
||||
if (strPlanet == null || strPlanet.length() < 1)
|
||||
{
|
||||
return;
|
||||
@@ -599,51 +533,38 @@ public class spawn_base extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
dictionary dctSpawnInformation = new dictionary();
|
||||
dctSpawnInformation = chooseWeightedSpawnTemplate(validSpawnIndices, strRegionType, strPlanet, rgnSpawnRegion);
|
||||
dictionary dctSpawnInformation = chooseWeightedSpawnTemplate(validSpawnIndices, strRegionType, strPlanet, rgnSpawnRegion);
|
||||
if (dctSpawnInformation == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
dctSpawnInformation.put("intPlayerDifficulty", intPlayerDifficulty);
|
||||
dctSpawnInformation.put("intPlayerDifficulty", params.getInt("intDifficulty"));
|
||||
dctSpawnInformation.put("strRegionName", strRegionName);
|
||||
dctSpawnInformation.put("strPlanet", strPlanet);
|
||||
doSpawnTemplate(objPlayer, dctSpawnInformation);
|
||||
}
|
||||
public void doSpawnTemplate(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
String strTemplate = params.getString("strTemplate");
|
||||
int intIndex = params.getInt("intIndex");
|
||||
int intMinDifficulty = params.getInt("intMinDifficulty");
|
||||
int intMaxDifficulty = params.getInt("intMaxDifficulty");
|
||||
int intSize = params.getInt("intSize");
|
||||
int intNumToSpawn = params.getInt("intNumToSpawn");
|
||||
String strLairType = params.getString("strLairType");
|
||||
String strBuildingType = params.getString("strBuildingType");
|
||||
String strTemplateToSpawn = params.getString("strBuildingType");
|
||||
String strRegionName = params.getString("strRegionName");
|
||||
String strPlanet = params.getString("strPlanet");
|
||||
int intPlayerDifficulty = params.getInt("intPlayerDifficulty");
|
||||
dictionary dctParams = new dictionary();
|
||||
location locSpawnLocation = getLocation(self);
|
||||
if (canSpawn(self, locSpawnLocation, true, strLairType))
|
||||
{
|
||||
dctParams.put("intMinDifficulty", intMinDifficulty);
|
||||
dctParams.put("intMaxDifficulty", intMaxDifficulty);
|
||||
dctParams.put("intMinDifficulty", params.getInt("intMinDifficulty"));
|
||||
dctParams.put("intMaxDifficulty", params.getInt("intMaxDifficulty"));
|
||||
dctParams.put("strLairType", strLairType);
|
||||
dctParams.put("strBuildingType", strBuildingType);
|
||||
dctParams.put("strRegionName", strRegionName);
|
||||
dctParams.put("strPlanet", strPlanet);
|
||||
dctParams.put("intIndex", intIndex);
|
||||
dctParams.put("intPlayerDifficulty", intPlayerDifficulty);
|
||||
dctParams.put("intNumToSpawn", intNumToSpawn);
|
||||
dctParams.put("strTemplateToSpawn", strTemplateToSpawn);
|
||||
dctParams.put("strTemplate", strTemplate);
|
||||
float fltSize = getLocationSize((float)intSize);
|
||||
dctParams.put("strBuildingType", params.getString("strBuildingType"));
|
||||
dctParams.put("strRegionName", params.getString("strRegionName"));
|
||||
dctParams.put("strPlanet", params.getString("strPlanet"));
|
||||
dctParams.put("intIndex", params.getInt("intIndex"));
|
||||
dctParams.put("intPlayerDifficulty", params.getInt("intPlayerDifficulty"));
|
||||
dctParams.put("intNumToSpawn", params.getInt("intNumToSpawn"));
|
||||
dctParams.put("strTemplateToSpawn", params.getString("strBuildingType"));
|
||||
dctParams.put("strTemplate", params.getString("strTemplate"));
|
||||
float fltSize = getLocationSize((float)params.getInt("intSize"));
|
||||
utils.setScriptVar(self, "dctSpawnInfo", dctParams);
|
||||
requestLocation(self, "spawnLocation", locSpawnLocation, 100.0f, fltSize, true, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
public int OnLocationReceived(obj_id self, String strId, obj_id objObject, location locSpawnLocation, float fltRadius) throws InterruptedException
|
||||
{
|
||||
@@ -713,17 +634,14 @@ public class spawn_base extends script.base_script
|
||||
region[] allRegions = getRegionsAtPoint(loc);
|
||||
if (allRegions != null && allRegions.length > 0)
|
||||
{
|
||||
for (int iter = 0; iter < allRegions.length; ++iter)
|
||||
{
|
||||
region gcwRegion = allRegions[iter];
|
||||
if ((gcwRegion.getName()).startsWith("gcw"))
|
||||
{
|
||||
for (region gcwRegion : allRegions) {
|
||||
if ((gcwRegion.getName()).startsWith("gcw")) {
|
||||
ImperialScore = getGcwImperialScorePercentile(toLower(gcwRegion.getName()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -739,7 +657,7 @@ public class spawn_base extends script.base_script
|
||||
int ImperialScore = getGcwImperialScorePercentile(toLower(gcwSpecificRegion));
|
||||
return isGalaticCivilWarWinner(gcwFaction, gcwThreshold, ImperialScore);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Regular → Executable
+10
-29
@@ -1,17 +1,7 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
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_create;
|
||||
import script.library.ship_ai;
|
||||
import script.library.locations;
|
||||
import script.library.utils;
|
||||
import script.*;
|
||||
|
||||
public class spawn_egg_manager extends script.base_script
|
||||
{
|
||||
@@ -34,7 +24,6 @@ public class spawn_egg_manager extends script.base_script
|
||||
LOG("spawn", "Spawning stuff");
|
||||
setObjVar(self, "intNoDump", 1);
|
||||
location locTest = getLocation(self);
|
||||
String strArea = locTest.area;
|
||||
String strDataTable = "";
|
||||
String strName = locations.getCityName(locTest);
|
||||
if (strName != null)
|
||||
@@ -72,7 +61,7 @@ public class spawn_egg_manager extends script.base_script
|
||||
vector vctI = vctJ.cross(vctK);
|
||||
vctJ = vctK.cross(vctI);
|
||||
vector vctP = new vector(fltPX[intI], fltPY[intI], fltPZ[intI]);
|
||||
transform tranCreation = new transform();
|
||||
transform tranCreation;
|
||||
try
|
||||
{
|
||||
tranCreation = new transform(vctI, vctJ, vctK, vctP);
|
||||
@@ -88,11 +77,7 @@ public class spawn_egg_manager extends script.base_script
|
||||
if (!strObject[intI].equals(""))
|
||||
{
|
||||
obj_id objTest = createObject(strObject[intI], tranCreation, null);
|
||||
if ((!isIdValid(objTest)) || (!objTest.isLoaded()))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((isIdValid(objTest)) && (objTest.isLoaded())) {
|
||||
if (!strObjVars[intI].equals(""))
|
||||
{
|
||||
if ((isIdValid(objTest)) && (objTest.isLoaded()))
|
||||
@@ -103,19 +88,15 @@ public class spawn_egg_manager extends script.base_script
|
||||
if (!strScripts[intI].equals(""))
|
||||
{
|
||||
String[] strScriptArray = split(strScripts[intI], ',');
|
||||
for (int intJ = 0; intJ < strScriptArray.length; intJ++)
|
||||
{
|
||||
if ((isIdValid(objTest)) && (objTest.isLoaded()))
|
||||
{
|
||||
String script = strScriptArray[intJ];
|
||||
if (script.indexOf("script.") > -1)
|
||||
{
|
||||
String script;
|
||||
for (String aStrScriptArray : strScriptArray) {
|
||||
if ((isIdValid(objTest)) && (objTest.isLoaded())) {
|
||||
script = aStrScriptArray;
|
||||
if (script.contains("script.")) {
|
||||
script = script.substring(7);
|
||||
}
|
||||
if (!script.equals(""))
|
||||
{
|
||||
if (!hasScript(objTest, script))
|
||||
{
|
||||
if (!script.equals("")) {
|
||||
if (!hasScript(objTest, script)) {
|
||||
attachScript(objTest, script);
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+1
-14
@@ -1,17 +1,6 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
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.regions;
|
||||
import java.util.Set;
|
||||
import java.util.Iterator;
|
||||
import java.lang.Integer;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawn_master extends script.systems.spawning.spawn_base
|
||||
{
|
||||
@@ -20,7 +9,6 @@ public class spawn_master extends script.systems.spawning.spawn_base
|
||||
}
|
||||
public int OnUniverseComplete(obj_id self) throws InterruptedException
|
||||
{
|
||||
String strPlanet = getNameForPlanetObject(self);
|
||||
if (!hasObjVar(self, "boolSpawnerIsOn"))
|
||||
{
|
||||
setObjVar(self, "boolSpawnerIsOn", true);
|
||||
@@ -57,7 +45,6 @@ public class spawn_master extends script.systems.spawning.spawn_base
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
String strPlanet = getNameForPlanetObject(self);
|
||||
if (!hasObjVar(self, "boolSpawnerIsOn"))
|
||||
{
|
||||
setObjVar(self, "boolSpawnerIsOn", true);
|
||||
|
||||
Regular → Executable
+2
-7
@@ -1,12 +1,7 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawn_npc_lair_tracker extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+44
-109
@@ -1,25 +1,9 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
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.*;
|
||||
|
||||
import script.library.buff;
|
||||
import script.library.craftinglib;
|
||||
import script.library.create;
|
||||
import script.library.datatable;
|
||||
import script.library.group;
|
||||
import script.library.locations;
|
||||
import script.library.regions;
|
||||
import script.library.skill;
|
||||
import script.library.space_utils;
|
||||
import script.library.spawning;
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import java.util.Vector;
|
||||
|
||||
public class spawn_player extends script.systems.spawning.spawn_base
|
||||
{
|
||||
@@ -103,8 +87,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
sendSystemMessageTestingOnly(self, strTable + " is not a valid dataTable");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
Integer ServerSpawnLimit = new Integer(0);
|
||||
Integer intTestIndex = new Integer(0);
|
||||
Integer intTestIndex;
|
||||
try
|
||||
{
|
||||
intTestIndex = new Integer(strNumber);
|
||||
@@ -114,17 +97,16 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
sendSystemMessageTestingOnly(self, strNumber + " is not a valid index");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
intIndex = intTestIndex.intValue();
|
||||
intIndex = intTestIndex;
|
||||
dictionary dctRow = dataTableGetRow(strTable, intIndex);
|
||||
if (dctRow == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "Not a valid combination of data");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int intMinDifficulty = dctRow.getInt("intMinDifficulty");
|
||||
int intMaxDifficulty = dctRow.getInt("intMaxDifficulty");
|
||||
int intPlayerDifficulty = rand(intMinDifficulty, intMaxDifficulty);
|
||||
int intNumToSpawn = dctRow.getInt("intNumToSpawn");
|
||||
String strTemplateToSpawn = dctRow.getString("strTemplateToSpawn");
|
||||
String strTemplate = dctRow.getString("strTemplate");
|
||||
String strLairType = dctRow.getString("strLairType");
|
||||
String strBuildingType = dctRow.getString("strBuildingType");
|
||||
@@ -176,8 +158,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
sendSystemMessageTestingOnly(self, strTable + " is not a valid dataTable");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
Integer ServerSpawnLimit = new Integer(0);
|
||||
Integer intTestIndex = new Integer(0);
|
||||
Integer intTestIndex;
|
||||
try
|
||||
{
|
||||
intTestIndex = new Integer(strNumber);
|
||||
@@ -187,8 +168,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
sendSystemMessageTestingOnly(self, strNumber + " is not a valid index");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
intIndex = intTestIndex.intValue();
|
||||
Integer intTestDifficulty = new Integer(0);
|
||||
intIndex = intTestIndex;
|
||||
try
|
||||
{
|
||||
intTestIndex = new Integer(strDifficultyInt);
|
||||
@@ -198,17 +178,15 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
sendSystemMessageTestingOnly(self, strDifficultyInt + " is not a valid index");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int intLevel = intTestIndex.intValue();
|
||||
int intLevel = intTestIndex;
|
||||
dictionary dctRow = dataTableGetRow(strTable, intIndex);
|
||||
if (dctRow == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "Not a valid combination of data");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int intMinDifficulty = dctRow.getInt("intMinDifficulty");
|
||||
int intMaxDifficulty = dctRow.getInt("intMaxDifficulty");
|
||||
int intPlayerDifficulty = rand(intMinDifficulty, intMaxDifficulty);
|
||||
int intNumToSpawn = dctRow.getInt("intNumToSpawn");
|
||||
String strTemplateToSpawn = dctRow.getString("strTemplateToSpawn");
|
||||
String strTemplate = dctRow.getString("strTemplate");
|
||||
String strLairType = dctRow.getString("strLairType");
|
||||
String strBuildingType = dctRow.getString("strBuildingType");
|
||||
@@ -243,8 +221,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
public int startSpawner(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
|
||||
{
|
||||
location locCurrentLocation = getLocation(self);
|
||||
obj_id objMasterSpawner = getPlanetByName(locCurrentLocation.area);
|
||||
obj_id objMasterSpawner = getPlanetByName(getLocation(self).area);
|
||||
if (objMasterSpawner == null)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
@@ -261,9 +238,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean boolSpawnerIsOn;
|
||||
boolSpawnerIsOn = getBooleanObjVar(objMasterSpawner, "boolSpawnerIsOn");
|
||||
if (boolSpawnerIsOn == false)
|
||||
if (!getBooleanObjVar(objMasterSpawner, "boolSpawnerIsOn"))
|
||||
{
|
||||
setObjVar(objMasterSpawner, "boolSpawnerIsOn", true);
|
||||
sendSystemMessageTestingOnly(self, "The master spawner is now on!");
|
||||
@@ -294,7 +269,6 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
spawning.activateSpawnerHack(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
dictionary dctParams = new dictionary();
|
||||
location locCurrentLocation = getLocation(self);
|
||||
if (locCurrentLocation == null)
|
||||
{
|
||||
@@ -302,12 +276,6 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
if (canSpawn(self, locCurrentLocation, false, null))
|
||||
{
|
||||
dictionary dctSpawnParams = new dictionary();
|
||||
int intLevel = 0;
|
||||
intLevel = skill.getGroupLevel(self);
|
||||
intLevel = locations.normalizeDifficultyForRegion(intLevel, locCurrentLocation);
|
||||
dctSpawnParams.put("intDifficulty", intLevel);
|
||||
dctSpawnParams.put("objPlayer", self);
|
||||
region rgnSpawnRegion = getSpawnRegion(self);
|
||||
if (rgnSpawnRegion == null)
|
||||
{
|
||||
@@ -321,14 +289,15 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
LOG("DESIGNER_FATAL", "For region " + strRegionName + " planet is " + strPlanet);
|
||||
LOG("DESIGNER_FATAL", "But planet name for player is " + strTestPlanet);
|
||||
}
|
||||
int intLevel = locations.normalizeDifficultyForRegion(skill.getGroupLevel(self), locCurrentLocation);
|
||||
dictionary dctSpawnParams = new dictionary();
|
||||
dctSpawnParams.put("intDifficulty", intLevel);
|
||||
dctSpawnParams.put("objPlayer", self);
|
||||
if (strRegionName != null)
|
||||
{
|
||||
dctSpawnParams.put("strRegionName", strRegionName);
|
||||
}
|
||||
if (strPlanet != null)
|
||||
{
|
||||
dctSpawnParams.put("strPlanet", strPlanet);
|
||||
}
|
||||
dctSpawnParams.put("strPlanet", strPlanet);
|
||||
boolean boolTheatersAllowed = false;
|
||||
int intNumRules = getNumRunTimeRules();
|
||||
if (intNumRules > 0)
|
||||
@@ -366,7 +335,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
if (strCommands[0].equals("dumpBuildout"))
|
||||
{
|
||||
String strDataTable = "";
|
||||
String strDataTable;
|
||||
if (strCommands.length > 1)
|
||||
{
|
||||
strDataTable = "datatables/spawning/ground_spawning/buildouts/" + strCommands[1] + ".tab";
|
||||
@@ -378,19 +347,11 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
location locTest = getLocation(self);
|
||||
obj_id objCell = locTest.cell;
|
||||
boolean boolInBuilding = true;
|
||||
if (!isIdValid(objCell))
|
||||
{
|
||||
boolInBuilding = false;
|
||||
}
|
||||
boolean boolInBuilding = isIdValid(objCell);
|
||||
obj_id objBuilding = null;
|
||||
if (boolInBuilding)
|
||||
{
|
||||
objBuilding = getContainedBy(objCell);
|
||||
if (!isIdValid(objBuilding))
|
||||
{
|
||||
boolean boolInbuilding = false;
|
||||
}
|
||||
}
|
||||
String[] strHeaderTypes =
|
||||
{
|
||||
@@ -424,13 +385,12 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
"strScripts",
|
||||
"strCellName"
|
||||
};
|
||||
boolean boolTest = datatable.createDataTable(strDataTable, strHeaders, strHeaderTypes);
|
||||
if (!boolTest)
|
||||
if (!datatable.createDataTable(strDataTable, strHeaders, strHeaderTypes))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "No dattable made");
|
||||
sendSystemMessageTestingOnly(self, "No datatable made");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id[] objObjects = null;
|
||||
obj_id[] objObjects;
|
||||
if (boolInBuilding)
|
||||
{
|
||||
objObjects = spawning.getAllContents(objBuilding);
|
||||
@@ -440,26 +400,13 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
objObjects = getAllObjectsWithObjVar(getLocation(self), 15000, "intSpawnLocation");
|
||||
}
|
||||
sendSystemMessageTestingOnly(self, "dumping contents of " + objBuilding);
|
||||
for (int intI = 0; intI < objObjects.length; intI++)
|
||||
{
|
||||
if (hasObjVar(objObjects[intI], "intSpawnLocation"))
|
||||
{
|
||||
dictionary dctRow = new dictionary();
|
||||
locTest = getLocation(objObjects[intI]);
|
||||
String strTemplate = getTemplateName(objObjects[intI]);
|
||||
float fltX = locTest.x;
|
||||
float fltY = locTest.y;
|
||||
float fltZ = locTest.z;
|
||||
if (boolInBuilding)
|
||||
{
|
||||
String strCellName = space_utils.getCellName(objBuilding, locTest.cell);
|
||||
dctRow.put("strCellName", strCellName);
|
||||
}
|
||||
else
|
||||
{
|
||||
dctRow.put("strCellName", "");
|
||||
}
|
||||
transform vctTest = getTransform_o2p(objObjects[intI]);
|
||||
dictionary dctRow;
|
||||
for (obj_id objObject : objObjects) {
|
||||
if (hasObjVar(objObject, "intSpawnLocation")) {
|
||||
dctRow = new dictionary();
|
||||
locTest = getLocation(objObject);
|
||||
dctRow.put("strCellName",(boolInBuilding ? space_utils.getCellName(objBuilding, locTest.cell) : ""));
|
||||
transform vctTest = getTransform_o2p(objObject);
|
||||
vector vctJ = vctTest.getLocalFrameJ_p();
|
||||
vector vctK = vctTest.getLocalFrameK_p();
|
||||
vector vctP = vctTest.getPosition_p();
|
||||
@@ -472,10 +419,10 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
dctRow.put("fltPX", vctP.x);
|
||||
dctRow.put("fltPY", vctP.y);
|
||||
dctRow.put("fltPZ", vctP.z);
|
||||
dctRow.put("strTemplate", strTemplate);
|
||||
String strObjVars = getPackedObjvars(objObjects[intI]);
|
||||
dctRow.put("strTemplate", getTemplateName(objObject));
|
||||
String strObjVars = getPackedObjvars(objObject);
|
||||
dctRow.put("strObjVars", strObjVars);
|
||||
String strScripts = utils.getPackedScripts(objObjects[intI]);
|
||||
String strScripts = utils.getPackedScripts(objObject);
|
||||
dctRow.put("strScripts", strScripts);
|
||||
datatable.serverDataTableAddRow(strDataTable, dctRow);
|
||||
}
|
||||
@@ -484,9 +431,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
if (strCommands[0].equals("addSpawnLocation"))
|
||||
{
|
||||
transform trTest = getTransform_o2p(self);
|
||||
location locTest = getLocation(self);
|
||||
obj_id objSpawner = createObject("object/tangible/space/content_infrastructure/generic_egg_small.iff", trTest, locTest.cell);
|
||||
obj_id objSpawner = createObject("object/tangible/space/content_infrastructure/generic_egg_small.iff", getTransform_o2p(self), getLocation(self).cell);
|
||||
setObjVar(objSpawner, "intSpawnLocation", 1);
|
||||
setName(objSpawner, "SPAWN LOCATION!");
|
||||
sendSystemMessageTestingOnly(self, "Made spawn location");
|
||||
@@ -527,7 +472,6 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
float fltSpawnerMinTime = utils.getFloatScriptVar(self, "fltMinSpawnTime");
|
||||
float fltSpawnerMaxTime = utils.getFloatScriptVar(self, "fltMaxSpawnTime");
|
||||
int intSpawnerBehavior = utils.getIntScriptVar(self, "intDefaultBehavior");
|
||||
int intSpawnerGoodLoc = utils.getIntScriptVar(self, "intGoodLocationSpawner");
|
||||
String[] behaviors =
|
||||
{
|
||||
"wander",
|
||||
@@ -993,14 +937,12 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
Vector objPatrolPoints = utils.getResizeableObjIdArrayScriptVar(self, "objPatrolPoints");
|
||||
if (objPatrolPoints != null)
|
||||
{
|
||||
for (int intI = 0; intI < objPatrolPoints.size(); intI++)
|
||||
{
|
||||
destroyObject(((obj_id)objPatrolPoints.get(intI)));
|
||||
for (Object objPatrolPoint : objPatrolPoints) {
|
||||
destroyObject(((obj_id) objPatrolPoint));
|
||||
}
|
||||
}
|
||||
}
|
||||
utils.removeScriptVar(self, "objPatrolPoints");
|
||||
return;
|
||||
}
|
||||
public void writeSpawner(obj_id self) throws InterruptedException
|
||||
{
|
||||
@@ -1008,8 +950,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
String strSpawnerType = utils.getStringScriptVar(self, "strType");
|
||||
Vector patrolPoints = new Vector();
|
||||
patrolPoints.setSize(0);
|
||||
obj_id objSpawner = null;
|
||||
String patrolPathType = null;
|
||||
obj_id objSpawner;
|
||||
if (strSpawnerType.equals("area") || strSpawnerType.equals("location"))
|
||||
{
|
||||
transform trTest = getTransform_o2p(self);
|
||||
@@ -1076,11 +1017,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
}
|
||||
public boolean isValidSpawnerType(String strText) throws InterruptedException
|
||||
{
|
||||
if (strText.equals("area") || strText.equals("patrol"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return strText.equals("area") || strText.equals("patrol");
|
||||
}
|
||||
public void handleMineFieldCreation() throws InterruptedException
|
||||
{
|
||||
@@ -1097,7 +1034,7 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
{
|
||||
packedMineStrings[i] = validMineTypes[i] + " DR[" + detonateRange[i] + "] BR[" + blastRadius[i] + "] MinD[" + minDamage[i] + "] MaxD[" + maxDamage[i] + "] DT [" + damageType[i] + "]";
|
||||
}
|
||||
if (validMineTypes != null && validMineTypes.length > 0)
|
||||
if (validMineTypes.length > 0)
|
||||
{
|
||||
int pid = sui.listbox(user, user, "Select Mine Type", packedMineStrings, "handleSelectMineType");
|
||||
if (pid > -1)
|
||||
@@ -1209,19 +1146,17 @@ public class spawn_player extends script.systems.spawning.spawn_base
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < stations.length; ++i)
|
||||
{
|
||||
if (!isIdValid(stations[i]))
|
||||
{
|
||||
String buffName;
|
||||
for (obj_id station : stations) {
|
||||
if (!isIdValid(station)) {
|
||||
continue;
|
||||
}
|
||||
int craftingType = getIntObjVar(stations[i], craftinglib.OBJVAR_CRAFTING_TYPE);
|
||||
String buffName = craftinglib.getCraftingStationBuffName(craftingType);
|
||||
if (buffName == null || buffName.equals(""))
|
||||
{
|
||||
int craftingType = getIntObjVar(station, craftinglib.OBJVAR_CRAFTING_TYPE);
|
||||
buffName = craftinglib.getCraftingStationBuffName(craftingType);
|
||||
if (buffName == null || buffName.equals("")) {
|
||||
continue;
|
||||
}
|
||||
buff.applyBuff(self, stations[i], buffName);
|
||||
buff.applyBuff(self, station, buffName);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
Regular → Executable
+3
-7
@@ -1,12 +1,8 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawn_tangible extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+3
-10
@@ -1,12 +1,7 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawn_template extends script.systems.spawning.spawn_base
|
||||
{
|
||||
@@ -85,9 +80,7 @@ public class spawn_template extends script.systems.spawning.spawn_base
|
||||
int intNumberOfMobiles = getIntObjVar(objLair, "npc_lair.numberOfMobiles");
|
||||
for (int intI = 0; intI < intNumberOfMobiles; intI++)
|
||||
{
|
||||
obj_id objCreature = getObjIdObjVar(objLair, "npc_lair.mobile." + intNumberOfMobiles);
|
||||
int intState = getState(objCreature, STATE_COMBAT);
|
||||
if (intState > 0)
|
||||
if (getState(getObjIdObjVar(objLair, "npc_lair.mobile." + intNumberOfMobiles), STATE_COMBAT) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Regular → Executable
+3
-8
@@ -1,14 +1,9 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawned_tracker extends script.base_script
|
||||
{
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.space_utils;
|
||||
import script.library.spawning;
|
||||
import script.library.create;
|
||||
import script.library.spawning;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawner_area extends script.base_script
|
||||
{
|
||||
@@ -159,9 +153,7 @@ public class spawner_area extends script.base_script
|
||||
{
|
||||
return;
|
||||
}
|
||||
float spawnerYaw = getYaw(self);
|
||||
int intIndex = strId.indexOf(".iff");
|
||||
float fltRespawnTime = getRespawnTime(self);
|
||||
|
||||
if (isIdValid(objLocationObject))
|
||||
{
|
||||
@@ -188,19 +180,19 @@ public class spawner_area extends script.base_script
|
||||
int intBehavior = getIntObjVar(self, "intDefaultBehavior");
|
||||
ai_lib.setDefaultCalmBehavior(objTemplate, intBehavior);
|
||||
}
|
||||
float fltRespawnTime = getRespawnTime(self);
|
||||
spawning.incrementSpawnCount(self);
|
||||
spawning.addToSpawnDebugList(self, objTemplate);
|
||||
setObjVar(objTemplate, "objParent", self);
|
||||
setObjVar(objTemplate, "fltRespawnTime", fltRespawnTime);
|
||||
attachScript(objTemplate, "systems.spawning.spawned_tracker");
|
||||
setYaw(objTemplate, spawnerYaw);
|
||||
setYaw(objTemplate, getYaw(self));
|
||||
|
||||
if (!spawning.checkSpawnCount(self))
|
||||
{
|
||||
return;
|
||||
}
|
||||
messageTo(self, "doSpawnEvent", null, fltRespawnTime, false);
|
||||
return;
|
||||
}
|
||||
public int OnLocationReceived(obj_id self, String strId, obj_id objLocationObject, location locLocation, float fltRadius) throws InterruptedException
|
||||
{
|
||||
@@ -217,8 +209,8 @@ public class spawner_area extends script.base_script
|
||||
public int spawnDestroyed(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
int intCurrentSpawnCount = utils.getIntScriptVar(self, "intCurrentSpawnCount");
|
||||
intCurrentSpawnCount = intCurrentSpawnCount - 1;
|
||||
if (intCurrentSpawnCount > -1)
|
||||
intCurrentSpawnCount--;
|
||||
if (intCurrentSpawnCount >= 0)
|
||||
{
|
||||
utils.setScriptVar(self, "intCurrentSpawnCount", intCurrentSpawnCount);
|
||||
}
|
||||
@@ -251,11 +243,9 @@ public class spawner_area extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < spawns.length; ++i)
|
||||
{
|
||||
if (isIdValid(spawns[i]) && exists(spawns[i]))
|
||||
{
|
||||
messageTo(spawns[i], "selfDestruct", null, 5, false);
|
||||
for (obj_id spawn : spawns) {
|
||||
if (isIdValid(spawn) && exists(spawn)) {
|
||||
messageTo(spawn, "selfDestruct", null, 5, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+2
-20
@@ -1,25 +1,7 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
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.craftinglib;
|
||||
import script.library.create;
|
||||
import script.library.datatable;
|
||||
import script.library.group;
|
||||
import script.library.locations;
|
||||
import script.library.regions;
|
||||
import script.library.skill;
|
||||
import script.library.space_utils;
|
||||
import script.library.spawning;
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawner_find_node extends script.base_script
|
||||
{
|
||||
|
||||
Regular → Executable
+26
-55
@@ -1,18 +1,13 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.space_utils;
|
||||
import script.library.spawning;
|
||||
import script.library.create;
|
||||
import script.library.spawning;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class spawner_patrol extends script.base_script
|
||||
@@ -51,7 +46,6 @@ public class spawner_patrol extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int intGoodLocationSpawner = getIntObjVar(self, "intGoodLocationSpawner");
|
||||
String strSpawnType = getStringObjVar(self, "strSpawns");
|
||||
String[] strSpawns =
|
||||
{
|
||||
@@ -90,7 +84,6 @@ public class spawner_patrol extends script.base_script
|
||||
LOG("spawning", "ERROR: patrolArray script var not defined.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int spawnNum = params.getInt("spawnNum");
|
||||
int maxSpawns = getIntObjVar(self, "intSpawnCount");
|
||||
if (maxSpawns >= patrolPoints.length)
|
||||
{
|
||||
@@ -100,16 +93,14 @@ public class spawner_patrol extends script.base_script
|
||||
Vector goodSpawns = new Vector();
|
||||
for (int i = 0; i < fltSizes.length; ++i)
|
||||
{
|
||||
goodSpawns.addElement(new Integer(i));
|
||||
goodSpawns.addElement(i);
|
||||
}
|
||||
int spawnCount = 0;
|
||||
while (spawnCount < maxSpawns)
|
||||
{
|
||||
int roll = rand(0, goodSpawns.size() - 1);
|
||||
int rowIndex = ((Integer)goodSpawns.get(roll)).intValue();
|
||||
float size = fltSizes[rowIndex];
|
||||
int rowIndex = (Integer) goodSpawns.get(roll);
|
||||
String spawn = strSpawns[rowIndex];
|
||||
size = getClosestSize(size);
|
||||
location locTest = patrolPoints[spawnCount];
|
||||
if (createMob(spawn, null, locTest, 0.0f, self, false, spawnCount))
|
||||
{
|
||||
@@ -148,7 +139,7 @@ public class spawner_patrol extends script.base_script
|
||||
float[] fltSizes = dataTableGetFloatColumn(strFileName, "fltSize");
|
||||
if ((strSpawns == null) || (strSpawns.length == 0))
|
||||
{
|
||||
setName(self, "Mangled spawner. strFileName is " + strFileName + " I couldnt find any spawns in that file.");
|
||||
setName(self, "Mangled spawner. strFileName is " + strFileName + " I couldn't find any spawns in that file.");
|
||||
}
|
||||
int intRoll = rand(0, strSpawns.length - 1);
|
||||
if (fltSizes.length == 0)
|
||||
@@ -309,30 +300,21 @@ public class spawner_patrol extends script.base_script
|
||||
dungeonController = getObjIdObjVar(self, "dungeonController");
|
||||
}
|
||||
setName(self, getStringObjVar(self, "strName"));
|
||||
for (int i = 0; i < patrolPointString.length; i++)
|
||||
{
|
||||
for (int k = 0; k < objects.length; k++)
|
||||
{
|
||||
if (!isIdValid(objects[k]))
|
||||
{
|
||||
for (String aPatrolPointString : patrolPointString) {
|
||||
for (obj_id object : objects) {
|
||||
if (!isIdValid(object)) {
|
||||
continue;
|
||||
}
|
||||
if (hasObjVar(objects[k], "pointName"))
|
||||
{
|
||||
if ((getStringObjVar(objects[k], "pointName")).equals(patrolPointString[i]))
|
||||
{
|
||||
if (isInInstance)
|
||||
{
|
||||
if (getObjIdObjVar(objects[k], "dungeonController") == dungeonController)
|
||||
{
|
||||
setName(objects[k], getStringObjVar(objects[k], "pointName"));
|
||||
patrolPointLocation = utils.addElement(patrolPointLocation, getLocation(objects[k]));
|
||||
if (hasObjVar(object, "pointName")) {
|
||||
if ((getStringObjVar(object, "pointName")).equals(aPatrolPointString)) {
|
||||
if (isInInstance) {
|
||||
if (getObjIdObjVar(object, "dungeonController") == dungeonController) {
|
||||
setName(object, getStringObjVar(object, "pointName"));
|
||||
patrolPointLocation = utils.addElement(patrolPointLocation, getLocation(object));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setName(objects[k], getStringObjVar(objects[k], "pointName"));
|
||||
patrolPointLocation = utils.addElement(patrolPointLocation, getLocation(objects[k]));
|
||||
} else {
|
||||
setName(object, getStringObjVar(object, "pointName"));
|
||||
patrolPointLocation = utils.addElement(patrolPointLocation, getLocation(object));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,18 +359,9 @@ public class spawner_patrol extends script.base_script
|
||||
messageTo(self, "doSpawnEvent", null, 2, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public boolean canSpawnByConfigSetting() throws InterruptedException
|
||||
{
|
||||
public boolean canSpawnByConfigSetting() throws InterruptedException {
|
||||
String disableSpawners = getConfigSetting("GameServer", "disablePatrolSpawners");
|
||||
if (disableSpawners == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (disableSpawners.equals("true") || disableSpawners.equals("1"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return disableSpawners == null || !(disableSpawners.equals("true") || disableSpawners.equals("1"));
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
@@ -399,11 +372,9 @@ public class spawner_patrol extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < spawns.length; ++i)
|
||||
{
|
||||
if (isIdValid(spawns[i]) && exists(spawns[i]))
|
||||
{
|
||||
messageTo(spawns[i], "selfDestruct", null, 5, false);
|
||||
for (obj_id spawn : spawns) {
|
||||
if (isIdValid(spawn) && exists(spawn)) {
|
||||
messageTo(spawn, "selfDestruct", null, 5, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+11
-29
@@ -1,18 +1,12 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.space_utils;
|
||||
import script.library.spawning;
|
||||
import script.library.create;
|
||||
import script.library.spawning;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawner_random extends script.base_script
|
||||
{
|
||||
@@ -130,7 +124,7 @@ public class spawner_random extends script.base_script
|
||||
}
|
||||
CustomerServiceLog("holidaySpawner", "spawner_random.doSpawnEvent: strSpawns: " + strSpawnType);
|
||||
String strSpawn = strSpawnType;
|
||||
if (strSpawnType.indexOf(".iff") < 0)
|
||||
if (!strSpawnType.contains(".iff"))
|
||||
{
|
||||
String strFileName = "datatables/spawning/ground_spawning/types/" + strSpawnType + ".iff";
|
||||
if (dataTableOpen(strFileName))
|
||||
@@ -268,7 +262,6 @@ public class spawner_random extends script.base_script
|
||||
return;
|
||||
}
|
||||
messageTo(self, "doSpawnEvent", null, fltRespawnTime, false);
|
||||
return;
|
||||
}
|
||||
public int spawnDestroyed(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
@@ -290,18 +283,9 @@ public class spawner_random extends script.base_script
|
||||
messageTo(self, "doSpawnEvent", null, 2, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public boolean canSpawnByConfigSetting() throws InterruptedException
|
||||
{
|
||||
public boolean canSpawnByConfigSetting() throws InterruptedException {
|
||||
String disableSpawners = getConfigSetting("GameServer", "disableAreaSpawners");
|
||||
if (disableSpawners == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (disableSpawners.equals("true") || disableSpawners.equals("1"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return disableSpawners == null || !(disableSpawners.equals("true") || disableSpawners.equals("1"));
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
@@ -312,11 +296,9 @@ public class spawner_random extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < spawns.length; ++i)
|
||||
{
|
||||
if (isIdValid(spawns[i]) && exists(spawns[i]))
|
||||
{
|
||||
messageTo(spawns[i], "selfDestruct", null, 5, false);
|
||||
for (obj_id spawn : spawns) {
|
||||
if (isIdValid(spawn) && exists(spawn)) {
|
||||
messageTo(spawn, "selfDestruct", null, 5, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+11
-29
@@ -1,18 +1,12 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.space_utils;
|
||||
import script.library.spawning;
|
||||
import script.library.create;
|
||||
import script.library.spawning;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class spawner_random_proxy extends script.base_script
|
||||
{
|
||||
@@ -130,7 +124,7 @@ public class spawner_random_proxy extends script.base_script
|
||||
}
|
||||
CustomerServiceLog("holidaySpawner", "spawner_random.doSpawnEvent: strSpawns: " + strSpawnType);
|
||||
String strSpawn = strSpawnType;
|
||||
if (strSpawnType.indexOf(".iff") < 0)
|
||||
if (!strSpawnType.contains(".iff"))
|
||||
{
|
||||
String strFileName = "datatables/spawning/ground_spawning/types/" + strSpawnType + ".iff";
|
||||
if (dataTableOpen(strFileName))
|
||||
@@ -341,7 +335,6 @@ public class spawner_random_proxy extends script.base_script
|
||||
return;
|
||||
}
|
||||
messageTo(self, "doSpawnEvent", null, fltRespawnTime, false);
|
||||
return;
|
||||
}
|
||||
public int spawnDestroyed(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
@@ -363,18 +356,9 @@ public class spawner_random_proxy extends script.base_script
|
||||
messageTo(self, "doSpawnEvent", null, 2, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public boolean canSpawnByConfigSetting() throws InterruptedException
|
||||
{
|
||||
public boolean canSpawnByConfigSetting() throws InterruptedException {
|
||||
String disableSpawners = getConfigSetting("GameServer", "disableAreaSpawners");
|
||||
if (disableSpawners == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (disableSpawners.equals("true") || disableSpawners.equals("1"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return disableSpawners == null || !(disableSpawners.equals("true") || disableSpawners.equals("1"));
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
@@ -385,11 +369,9 @@ public class spawner_random_proxy extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < spawns.length; ++i)
|
||||
{
|
||||
if (isIdValid(spawns[i]) && exists(spawns[i]))
|
||||
{
|
||||
messageTo(spawns[i], "selfDestruct", null, 5, false);
|
||||
for (obj_id spawn : spawns) {
|
||||
if (isIdValid(spawn) && exists(spawn)) {
|
||||
messageTo(spawn, "selfDestruct", null, 5, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+6
-13
@@ -1,16 +1,11 @@
|
||||
package script.systems.spawning;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.dictionary;
|
||||
import script.library.ai_lib;
|
||||
import script.library.create;
|
||||
import script.library.utils;
|
||||
import script.location;
|
||||
import script.obj_id;
|
||||
|
||||
public class theater_spawnegg extends script.base_script
|
||||
{
|
||||
@@ -29,11 +24,9 @@ public class theater_spawnegg extends script.base_script
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < spawnList.length; i++)
|
||||
{
|
||||
if (isIdValid(spawnList[i]))
|
||||
{
|
||||
destroyObject(spawnList[i]);
|
||||
for (obj_id aSpawnList : spawnList) {
|
||||
if (isIdValid(aSpawnList)) {
|
||||
destroyObject(aSpawnList);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
Reference in New Issue
Block a user