Files
dsrc/sku.0/sys.server/compiled/game/script/working/jbenjtest.script
T
2013-09-10 23:17:15 -07:00

905 lines
26 KiB
Plaintext

//Jesse Benjamin's utility test script
//Includes
include java.util.StringTokenizer;
include java.lang.Math;
include library.ai_lib;
include library.buff;
include library.beast_lib;
include library.create;
include library.expertise;
include library.groundquests;
include library.guild;
include library.incubator;
include library.instance;
include library.npe;
include library.player_structure;
include library.pet_lib;
include library.respec;
include library.skill;
include library.skill_template;
include library.space_combat;
include library.space_flags;
include library.space_quest;
include library.static_item;
include library.sui;
include library.transition;
include library.trial;
include library.utils;
const string PID_NAME = "hateList";
//getting a players skill tempalte
trigger OnSpeaking(string text)
{
obj_id player = self;
obj_id pInv = utils.getInventoryContainer(player);
obj_id target = getIntendedTarget(self);
obj_id tInv = utils.getInventoryContainer(target);
//if(isGod(player))
//{
StringTokenizer st = new java.util.StringTokenizer(text);
int tokens = st.countTokens();
string command = null;
if (st.hasMoreTokens())
command = st.nextToken();
if(command.equals("setSpaceFlag"))
{
if (st.hasMoreTokens())
{
command = st.nextToken();
space_flags.setSpaceFlag(self, command, 1 );
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
if(command.equals("tweakRespecValues"))
{
int combatLevel = -1;
int entLevel = -1;
int traderLevel = -1;
if (st.hasMoreTokens())
{
command = st.nextToken();
combatLevel = utils.stringToInt(command);
if (st.hasMoreTokens())
{
command = st.nextToken();
entLevel = utils.stringToInt(command);
if (st.hasMoreTokens())
{
command = st.nextToken();
traderLevel = utils.stringToInt(command);
}
}
}
int[] recpecLevelsNewValue = {combatLevel, entLevel, traderLevel};
setObjVar(player, respec.PROF_LEVEL_ARRAY, recpecLevelsNewValue);
return SCRIPT_CONTINUE;
}
if(command.equals("respecFix"))
{
//lets make sure that our current template is the right level
if (hasObjVar(player, respec.PROF_LEVEL_ARRAY))
{
//get the current tempalte of the player
string skillTemplate = getSkillTemplate(player);
//get the respec history values
int[] recpecLevelsValue = getIntArrayObjVar(player, respec.PROF_LEVEL_ARRAY);
//get the current level
int currentLevel = getLevel(player);
//if you are not an entertainer or trader, you are a combat toon
if (!skillTemplate.startsWith("entertainer") && !skillTemplate.startsWith("trader"))
{
//get respec history combat level
int combatLevel = recpecLevelsValue[respec.PROF_LEVEL_COMBAT];
//if current level is lower than respec history combat level
//we need to level the player up to the historical level
if(currentLevel < combatLevel)
respec.autoLevelPlayer(player, combatLevel, true);
}
//are you an entertainer?
else if (skillTemplate.startsWith("entertainer"))
{
debugSpeakMsg(self, "you should be a entertainer dude");
//get respec history entertainer level
int entLevel = recpecLevelsValue[respec.PROF_LEVEL_ENT];
debugSpeakMsg(self, "entLevel " + entLevel);
//if current level is lower than respec history entertainer level
//we need to level the player up to the historical level
if(currentLevel < entLevel)
respec.autoLevelPlayer(player, entLevel, true);
}
//are you an trader?
else if (skillTemplate.startsWith("trader"))
{
debugSpeakMsg(self, "you should be a trader dude");
//get respec history trader level
int traderLevel = recpecLevelsValue[respec.PROF_LEVEL_TRADER];
debugSpeakMsg(self, "traderLevel " + traderLevel);
//if current level is lower than respec history trader level
//we need to level the player up to the historical level
if(currentLevel < traderLevel)
respec.autoLevelPlayer(player, traderLevel, true);
}
}
}
if(command.equals("sendTestMail"))
{
utils.sendMail(new string_id("spam", "test_mail_title"), new string_id("spam", "test_mail_title"), self, "Galactic Vacant Building Demolishing Movement");
return SCRIPT_CONTINUE;
}
if(command.equals("hasScriptVar"))
{
if (st.hasMoreTokens())
{
command = st.nextToken();
debugSpeakMsg(self, ""+utils.hasObjIdBatchScriptVar(target, command));
return SCRIPT_CONTINUE;
}
}
if(command.equals("getAttackerList"))
{
obj_id[] attackerList = utils.getObjIdBatchScriptVar(target, "creditForKills.attackerList.attackers");
string list = utils.getStringScriptVar(target, "creditForKills.attackerList");
if(attackerList == null)
{
debugSpeakMsg(self, "attackerList was null");
debugSpeakMsg(self, "list was " + list);
return SCRIPT_CONTINUE;
}
for(int i = 0; i < attackerList.length; ++i)
debugSpeakMsg(self, "attackerList["+i+"] " + attackerList[i]);
return SCRIPT_CONTINUE;
}
if(command.equals("testMonthly"))
{
sendSystemMessageTestingOnly(self, ""+getCalendarTimeStringGMT(getIntObjVar(self, respec.OBJVAR_RESPEC_DECAY_TIME)));
return SCRIPT_CONTINUE;
}
if(command.equals("clearInstanceQueue"))
{
instance.setRequestResolved(self);
return SCRIPT_CONTINUE;
}
if(command.equals("setRespecDecay"))
{
sendSystemMessageTestingOnly(self, "setting respec decay to end in 10 seconds. You need to log out fully to test this, or use the speach command 'testRespecDecay'.");
int now = getCalendarTime();
int then = now + 10;
setObjVar(player, respec.OBJVAR_RESPEC_DECAY_TIME, then);
return SCRIPT_CONTINUE;
}
if(command.equals("testRespecDecay"))
{
respec.checkRespecDecay(self);
return SCRIPT_CONTINUE;
}
if (command.equals("get_tat"))
{
obj_id planetId = getPlanetByName("tatooine");
sendSystemMessageTestingOnly(self, ""+planetId);
}
if(command.equals("sendTestHeroicComplete"))
{
dictionary dict = new dictionary();
dict.put("tokenIndex",5);
dict.put("tokenCount",9);
messageTo(self, "handleAwardtoken", dict, 1, false);
return SCRIPT_CONTINUE;
}
if(command.equals("getHealthRate"))
{
float fltHealthRegen = getHealthRegenRate(target);
debugSpeakMsg(self, "" + fltHealthRegen);
}
if(command.equals("testSuiCountDown"))
{
int flags = 0;
//Break on Incap or damage. You would think you would need to be damaged to be incaped, oh how wrong you are.
flags |= sui.CD_EVENT_INCAPACITATE;
flags |= sui.CD_EVENT_DAMAGED;
int startTime = 0;
int endTime = 6;
string displayGroup = "bm_creature_knowledge";
string_id prompt = new string_id ("beast", "ability_activate_creature_knowledge");
string handler = "testSuiCountDown";
//Min 24 to activate from comand_table, this allows a bit of wiggle with loitering creatures
float maxRange = 32;
int pid = sui.smartCountdownTimerSUI(self, self, displayGroup, prompt, startTime, endTime, handler, maxRange, flags);
return SCRIPT_CONTINUE;
}
if(command.equals("getFirstName"))
{
debugSpeakMsg(self, "" + getFirstName(self));
return SCRIPT_CONTINUE;
}
if(command.equals("setStatic"))
{
setCreatureStatic(target, true);
return SCRIPT_CONTINUE;
}
if(command.equals("clearInspiration"))
{
utils.removeScriptVarTree(self, "performance");
return SCRIPT_CONTINUE;
}
if(command.equals("removeScriptVar"))
{
if (st.hasMoreTokens())
{
command = st.nextToken();
utils.removeScriptVarTree(self, command);
return SCRIPT_CONTINUE;
}
}
if(command.equals("displayScriptVarDictionary"))
{
dictionary dict = new dictionary();
dict.put("myInt", 1);
dict.put("myString", "Mikkel");
debugSpeakMsg(self, "dictionary is " + dict.toString());
return SCRIPT_CONTINUE;
}
if(command.equals("createCameraPcd"))
{
obj_id datapad = utils.getPlayerDatapad(self);
obj_id petControlDevice = createObject( pet_lib.PET_CTRL_DEVICE_TEMPLATE, datapad, "");
attachScript(petControlDevice,"ai.pcd_ping_response");
attachScript(petControlDevice,"ai.pet_control_device");
setObjVar(petControlDevice,"ai.pet.command.0", "f");
setObjVar(petControlDevice,"ai.pet.command.1" , "st");
setObjVar(petControlDevice,"ai.pet.command.10" , "tran");
setObjVar(petControlDevice,"ai.pet.command.11" , "s");
setObjVar(petControlDevice,"ai.pet.command.12" , "t1");
setObjVar(petControlDevice,"ai.pet.command.13" , "t2");
setObjVar(petControlDevice,"ai.pet.command.1563288080" , "fa");
setObjVar(petControlDevice,"ai.pet.command.16" , "g");
setObjVar(petControlDevice,"ai.pet.command.17" , "ft");
setObjVar(petControlDevice,"ai.pet.command.2" , "gu");
setObjVar(petControlDevice,"ai.pet.command.20" , "r");
setObjVar(petControlDevice,"ai.pet.command.3" , "bef");
setObjVar(petControlDevice,"ai.pet.command.4" , "a");
setObjVar(petControlDevice,"ai.pet.command.5" , "p");
setObjVar(petControlDevice,"ai.pet.command.6" , "gp");
setObjVar(petControlDevice,"ai.pet.command.7" , "cp");
setObjVar(petControlDevice,"ai.pet.command.8" , "w");
setObjVar(petControlDevice,"ai.pet.command.9" , "c");
setObjVar(petControlDevice,"ai.pet.currentStats" , "0:0:0:0:0:0:");
setObjVar(petControlDevice,"ai.pet.palvar.vars./private/index_color_1" , 19);
setObjVar(petControlDevice,"ai.pet.type" , 1);
setObjVar(petControlDevice,"ai.petAbility.abilityList" , "1319491216:1563288080:");
setObjVar(petControlDevice,"ai.petAbility.available" , 2);
setObjVar(petControlDevice,"ai.petAbility.toBeEarned" , 1);
setObjVar(petControlDevice,"ai.petAbility.trainingPts" , 24);
setObjVar(petControlDevice,"ai.petAdvance.cannotBeMount" , 1);
setObjVar(petControlDevice,"ai.petAdvance.growthStage" , 5);
setObjVar(petControlDevice,"ai.petAdvance.xpEarned" , 6223);
setObjVar(petControlDevice,"pet.creatureName" , "noxious_vrelt_scavenger");
setObjVar(petControlDevice,"pet.timeStored" , 65802667);
return SCRIPT_CONTINUE;
}
if(command.equals("getExpertiseAllocation"))
{
string[] skills = expertise.getExpertiseAllocation(self);
if(skills == null || skills.length <=0)
{
debugSpeakMsg(self, "No Expertise Skills");
return SCRIPT_CONTINUE;
}
for(int i = 0; i < skills.length; ++i)
{
debugSpeakMsg(self, "" + skills[i]);
}
return SCRIPT_CONTINUE;
}
if(command.equals("getStandingON"))
{
debugSpeakMsg(self, "Standing On " + getStandingOn(self));
return SCRIPT_CONTINUE;
}
if(command.equals("getTargetYaw"))
{
debugSpeakMsg(self, "yaw is " + getYaw(target));
return SCRIPT_CONTINUE;
}
if(command.equals("clearHouseId"))
{
setHouseId( self, obj_id.NULL_ID);
return SCRIPT_CONTINUE;
}
if(command.equals("destroyTarget"))
{
destroyObject(target);
return SCRIPT_CONTINUE;
}
if(command.equals("getTargetHateList"))
{
if(!isIdValid(target) || !exists(target))
return SCRIPT_CONTINUE;
string enemyNames = generateStringHateList(target);
if(enemyNames != null && !enemyNames.equals(""))
{
//int pid = sui.listbox(self, self, "Hate list", sui.OK_CANCEL, "Hate list", enemyNames, "onHateListSuiUpdate", true, false);
int pid = sui.msgbox( self, self, enemyNames, sui.OK_ONLY, "Hate List", "onHateListSuiUpdate" );
messageTo(self, "refreshSuiHateList", null, 1, false);
sui.setPid(self, pid, PID_NAME);
}
return SCRIPT_CONTINUE;
}
if(command.equals("freezeAi"))
{
stop(target);
return SCRIPT_CONTINUE;
}
if(command.equals("testAddHate"))
{
debugSpeakMsg(self, "beginingHate is " + getHate(target, self));
addHateDot(target, self, 50, 25);
debugSpeakMsg(self, "hateDot is " + getHate(target, self));
float currentHate = getHate(target, self);
addHate(target, self, currentHate + 500);
debugSpeakMsg(self, "SecondHate is " + getHate(target, self));
return SCRIPT_CONTINUE;
}
if(command.equals("incrementSlot"))
{
if (st.hasMoreTokens())
{
command = st.nextToken();
if (st.hasMoreTokens())
{
int number = utils.stringToInt( st.nextToken());
modifyCollectionSlotValue(player, command, number);
}
}
return SCRIPT_CONTINUE;
}
if(command.equals("showDroids"))
{
obj_id[] droidIds = pet_lib.getPcdsForType(player, pet_lib.PET_TYPE_DROID);
resizeable obj_id[] resizAbleDroidIds = droidIds;
resizeable string[] droidNames = new string[0];
for(int i = 0; i < droidIds.length; ++i)
{
if(hasObjVar(droidIds[i], "module_data.dancing_droid"))
{
utils.removeElement(resizAbleDroidIds, droidIds[i]);
continue;
}
string droidName = getName(droidIds[i]);
string[] splitName = split(droidName, '/');
if(splitName.length > 1)
utils.addElement(droidNames, "@" + droidName);
else
utils.addElement(droidNames, droidName);
}
utils.setScriptVar(player, "dancing_droid.ids", droidIds);
int pid = sui.listbox(self, self, "prompt", sui.OK_CANCEL, "title", droidNames, "onDanceDroidLoaded", true, true);
return SCRIPT_CONTINUE;
}
if(command.equals("getMemberIds"))
{
int guildId = getGuildId(self);
obj_id[] members = guildGetMemberIds(guildId);
debugSpeakMsg(self, "members.length = " + members.length);
debugSpeakMsg(self, "guildId = " + guildId);
for(int i = 0; i < members.length; ++i)
{
if(!isIdValid(members[i]))
debugSpeakMsg(self, "members[" + i + "] was Invalid");
}
return SCRIPT_CONTINUE;
}
if (command.equals("gc"))
{
debugSpeakMsg(self, "telling Java to do garbage collection");
System.gc();
}
if(command.equals("getGameTime"))
{
debugSpeakMsg(self, "" + getGameTime());
return SCRIPT_CONTINUE;
}
if(command.equals("clearGuildPid"))
{
guild.removeWindowPid(self);
return SCRIPT_CONTINUE;
}
if(command.equals("giveNewbShip"))
{
space_quest.grantNewbieShip( self, "neutral");
return SCRIPT_CONTINUE;
}
if(command.equals("getGuildId"))
{
int guildId = getGuildId( target );
debugSpeakMsg(self, "guildId " +guildId);
return SCRIPT_CONTINUE;
}
if(command.equals("maxDailyPackup"))
{
setObjVar(self, "dailyHousePackup", player_structure.MAX_PACKUP_PER_DAY);
return SCRIPT_CONTINUE;
}
if(command.equals("getMasterGuildObj"))
{
obj_id masterGuildObj = getMasterGuildObject();
debugSpeakMsg(self, "masterGuildObj " + masterGuildObj);
}
if(command.equals("getGameTime"))
{
debugSpeakMsg(self, "Game Time is " + getGameTime());
return SCRIPT_CONTINUE;
}
if(command.equals("mountable"))
{
debugSpeakMsg(self, "couldPetBeMadeMountable " +couldPetBeMadeMountable(target));
}
if(command.equals("getMyCityId"))
{
debugSpeakMsg(self, "My city is " + getCitizenOfCityId(self));
return SCRIPT_CONTINUE;
}
if(command.equals("updateScriptvar"))
{
if (st.hasMoreTokens())
{
string scriptVarName = st.nextToken();
if(st.hasMoreTokens())
{
string scriptVarValue = st.nextToken();
utils.setScriptVar(target, scriptVarName, utils.stringToInt(scriptVarValue));
return SCRIPT_CONTINUE;
}
else
debugSpeakMsg(self, "parameters are updateScriptvar <scriptVarName> <scriptVarValue>");
return SCRIPT_CONTINUE;
}
else
debugSpeakMsg(self, "parameters are updateScriptvar <scriptVarName> <scriptVarValue>");
return SCRIPT_CONTINUE;
}
if(command.equals("getAppearance"))
{
string targetAppearance = getAppearance(target);
String[] splitAppearance = split(targetAppearance, '/');
String[] finalAppearance = split(splitAppearance[1], '.');
int row = dataTableSearchColumnForString(finalAppearance[0], "start_template", "datatables/beast/incubator_templates.iff");
debugSpeakMsg(self, "finalAppearance = "+finalAppearance[0]);
debugSpeakMsg(self, "row = "+row);
return SCRIPT_CONTINUE;
}
if(command.equals("getRawAppearance"))
{
string targetAppearance = getAppearance(target);
debugSpeakMsg(self, "targetAppearance = "+targetAppearance);
return SCRIPT_CONTINUE;
}
if(command.equals("getDna"))
{
obj_id dnaContainer = incubator.extractDna(self, target);
debugSpeakMsg(self, "dnaContainer = "+dnaContainer);
return SCRIPT_CONTINUE;
}
if(command.equals("validateExpertise"))
{
skill.validateExpertise(self);
return SCRIPT_CONTINUE;
}
if(command.equals("newbArmor"))
{
npe.grantNewbArmor(self);
return SCRIPT_CONTINUE;
}
if(command.equals("getTemplate"))
{
string skillTemplate = getSkillTemplate(self);
debugSpeakMsg(self, "Skill Template is " + skillTemplate);
return SCRIPT_CONTINUE;
}
if(command.equals("setBlankTemplate"))
{
setSkillTemplate(self, "a");
string skillTemplate = getSkillTemplate(self);
debugSpeakMsg(self, "Skill Template is " + skillTemplate);
return SCRIPT_CONTINUE;
}
if(command.equals("startMarket"))
{
debugSpeakMsg(self, "target is " + target);
messageTo(target, "spawnMarketplaceNpcs", null, 1, false);
return SCRIPT_CONTINUE;
}
if(command.equals("nukeWorld"))
{
obj_id[] objObjects = getObjectsInRange(self, 32000);
sendSystemMessageTestingOnly(self, "Destroying world");
for(int intI = 0; intI<objObjects.length; intI++)
{
if(!isPlayer(objObjects[intI]))
{
setObjVar(objObjects[intI], "intCleaningUp", 1);
destroyObject(objObjects[intI]);
}
}
return SCRIPT_CONTINUE;
}
if (command.equals("topMostContainer"))
{
debugSpeakMsg(self, "topmost is" + getTopMostContainer(self));
return SCRIPT_CONTINUE;
}
if (command.equals("getScene"))
{
string planet = getCurrentSceneName();
debugSpeakMsg(self, "planet is " + planet);
return SCRIPT_CONTINUE;
}
if(command.equals("faceMe"))
{
faceTo(target, self);
}
if(command.equals("addNightSisterVendor"))
{
applySkillStatisticModifier(self, "vendor_nightsister", 1);
}
if(command.equals("addSkillMod"))
{
if (st.hasMoreTokens())
{
string modName = st.nextToken();
if(st.hasMoreTokens())
{
int amount = utils.stringToInt(st.nextToken());
applySkillStatisticModifier(self, modName, amount);
messageTo(self, "setDisplayOnlyDefensiveMods", trial.getSessionDict(self, "displayDefensiveMods") , 0, false);
}
}
}
if(command.equals("callTravelUI"))
{
string planet = getCurrentSceneName();
boolean uiCalled = enterClientTicketPurchaseMode(self, planet, "Dathomir Outpost", true);
debugSpeakMsg(self, "enterClientTicketPurchaseMode " + uiCalled);
}
if(command.equals("zoneAurillia"))
{
transition.zonePlayerNoGate("aurillia_township", self, true);
//debugSpeakMsg(self, "enterClientTicketPurchaseMode " + uiCalled);
}
if(command.equals("removeNightSisterVendor"))
{
applySkillStatisticModifier(self, "vendor_nightsister", -1);
}
if(command.equals("getResistance"))
{
int resistance_mod = getEnhancedSkillStatisticModifier(self, "resistance_poison");
float resist_scale = (0.4f / ((100f + resistance_mod) / 200f)); // Scale of the resistance curve based on resist value
float to_hit_chance = 100 * resist_scale; // hit chance based on potency vs resist_mod
debugSpeakMsg(self, "My resistance mod is " + resistance_mod);
debugSpeakMsg(self, "My resist_scale is " + resist_scale);
debugSpeakMsg(self, "To hit Chance for spy fang is " + to_hit_chance);
to_hit_chance = 360 * resist_scale;
debugSpeakMsg(self, "To hit Chance for artery strike is " + to_hit_chance);
to_hit_chance = 120 * resist_scale;
debugSpeakMsg(self, "To hit Chance for malady is " + to_hit_chance);
}
if(command.equals("spawnCommoner"))
{
location myLoc = getLocation(self);
create.object("commoner", myLoc, false);
}
if(command.equals("incrementHappiness"))
{
obj_id beast = beast_lib.getBeastOnPlayer(self);
obj_id bcd = beast_lib.getBeastBCD(beast);
int currentHappiness = utils.getIntScriptVar(bcd, beast_lib.PET_HAPPINESS_SCRIPTVAR);
int updatedHappiness = currentHappiness + 5;
utils.setScriptVar(bcd, beast_lib.PET_HAPPINESS_SCRIPTVAR, updatedHappiness);
beast_lib.updateBeastStats(bcd, beast);
}
if(command.equals("decrementHappiness"))
{
obj_id beast = beast_lib.getBeastOnPlayer(self);
obj_id bcd = beast_lib.getBeastBCD(beast);
int currentHappiness = utils.getIntScriptVar(bcd, beast_lib.PET_HAPPINESS_SCRIPTVAR);
int updatedHappiness = currentHappiness - 5;
utils.setScriptVar(bcd, beast_lib.PET_HAPPINESS_SCRIPTVAR, updatedHappiness);
beast_lib.updateBeastStats(bcd, beast);
}
if(command.equals("testCrystal"))
{
obj_id createdObject = createObjectInInventoryAllowOverload("object/tangible/item/quest/force_sensitive/fs_buff_item.iff", self);
if(!isIdNull(createdObject))
{
setObjVar (createdObject, "createdFor", self);
setObjVar (createdObject,"item.time.reuse_time",345600);
setObjVar (createdObject,"item.buff.type",6);
setObjVar (createdObject,"item.buff.value",900);
setObjVar (createdObject,"item.buff.duration",5400);
}
return SCRIPT_CONTINUE;
}
if(command.equals("giveTargetBuff"))
{
if (st.hasMoreTokens())
{
string buffName = st.nextToken();
buff.applyBuff(target, buffName);
}
}
if(command.equals("giveMidlithe"))
{
if (st.hasMoreTokens())
{
string count = st.nextToken();
obj_id lootItem = static_item.createNewItemFunction(space_combat.NOVA_ORION_RESOURCE, utils.getInventoryContainer(self)); // create item and place in mob's inventory
setCount(lootItem, utils.stringToInt(count));
}
}
if(command.equals("nukeTarget"))
{
destroyObject(target);
return SCRIPT_OVERRIDE;
}
if(command.equals("getPosture"))
{
int myPosture = getPosture(target);
switch(myPosture)
{
case POSTURE_NONE:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_NONE");
break;
case POSTURE_UPRIGHT:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_UPRIGHT");
break;
case POSTURE_CROUCHED:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_CROUCHED");
break;
case POSTURE_PRONE:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_PRONE");
break;
case POSTURE_SNEAKING:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_SNEAKING");
break;
case POSTURE_BLOCKING:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_BLOCKING");
break;
case POSTURE_CLIMBING:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_CLIMBING");
break;
case POSTURE_FLYING:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_FLYING");
break;
case POSTURE_LYING_DOWN:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_LYING_DOWN");
break;
case POSTURE_SITTING:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_SITTING");
break;
case POSTURE_SKILL_ANIMATING:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_SKILL_ANIMATING");
break;
case POSTURE_DRIVING_VEHICLE:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_DRIVING_VEHICLE");
break;
case POSTURE_RIDING_CREATURE:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_RIDING_CREATURE");
break;
case POSTURE_KNOCKED_DOWN:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_KNOCKED_DOWN");
break;
case POSTURE_INCAPACITATED:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_INCAPACITATED");
break;
case POSTURE_DEAD:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_DEAD");
break;
case POSTURE_COUNT:
sendSystemMessageTestingOnly(self, "my Posuture is POSTURE_COUNT");
break;
default:
sendSystemMessageTestingOnly(self, "my Posuture is default");
break;
}
}
//}
return SCRIPT_CONTINUE;
}
messageHandler testSuiCountDown()
{
debugSpeakMsg(self, "params is " + params);
return SCRIPT_CONTINUE;
}
messageHandler onHateListSuiUpdate()
{
if(params == null || params.isEmpty())
return SCRIPT_CONTINUE;
//get button pressed
int bp = sui.getIntButtonPressed(params);
//if they pressed cancel then we bail out and do nothing
if ( bp == sui.BP_CANCEL || bp == sui.BP_OK)
{
sui.removePid(self, PID_NAME);
return SCRIPT_CONTINUE;
}
//double check that this is the only SUI window open
if(!sui.hasPid(self, PID_NAME))
return SCRIPT_CONTINUE;
return SCRIPT_CONTINUE;
}
messageHandler refreshSuiHateList()
{
if(sui.hasPid(self, PID_NAME))
{
int pid = sui.getPid(self, PID_NAME);
//sui.removePid(self, PID_NAME);
//forceCloseSUIPage(pid);
obj_id target = getIntendedTarget(self);
if(!isIdValid(target) || !exists(target))
return SCRIPT_CONTINUE;
string enemyNames = generateStringHateList(target);
if(enemyNames != null && !enemyNames.equals(""))
{
//pid = sui.listbox(self, self, "Hate list", sui.OK_CANCEL, "Hate list", enemyNames, "onHateListSuiUpdate", true, false);
//int pid = sui.msgbox( self, self, inputText, sui.OK_ONLY, enemyNames, "onHateListSuiUpdate" );
setSUIProperty(pid, sui.MSGBOX_PROMPT, sui.PROP_TEXT, enemyNames);
flushSUIPage(pid);
//sui.setPid(self, pid, PID_NAME);
messageTo(self, "refreshSuiHateList", null, 1, false);
}
}
return SCRIPT_CONTINUE;
}
int getStructureGuildId(obj_id self)
{
// if the terminal is in a player structure, grab the guildId off the structure
int guildId = 0;
obj_id structure = player_structure.getStructure(self);
if (isIdValid(structure) && hasObjVar(structure, "player_structure.owner") && hasObjVar(structure, "guildId"))
{
guildId = getIntObjVar(structure, "guildId");
if (guildId != 0 && !guildExists(guildId))
{
removeObjVar(structure, "guildId");
guildId = 0;
}
}
// if not set, grab it off the terminal, since GMs may use them this way
if (guildId == 0 && hasObjVar(self, "guildId"))
{
guildId = getIntObjVar(self, "guildId");
if (guildId != 0 && !guildExists(guildId))
{
removeObjVar(self, "guildId");
guildId = 0;
}
}
return guildId;
}
string generateStringHateList(obj_id target)
{
obj_id[] enemies = getHateList(target);
// Target hates nobody
if(enemies == null || enemies.length == 0)
{
return null;
}
string enemyNames = "\n";
for(int i = 0; i < enemies.length; ++i)
{
string enemyStringName = "";
if(!isPlayer(enemies[i]))
enemyStringName = "NotAPlayer ObjID(" + enemies[i] + ")";
else
enemyStringName = getPlayerName(enemies[i]);
enemyNames += enemyStringName + "\t\t" + (int)getHate(target, enemies[i]) + "\n";
}
return enemyNames;
}