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

827 lines
24 KiB
Plaintext

//James Michener'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.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;
trigger OnSpeaking(string text)
{
obj_id player = self;
//obj_id pInv = utils.getInventoryContainer(player);
//obj_id target = getIntendedTarget(self);
if(isGod(player))
{
StringTokenizer st = new java.util.StringTokenizer(text);
int tokens = st.countTokens();
string command = null;
if (st.hasMoreTokens())
command = st.nextToken();
//Lists player's buffs in system messages.
if(command.equals("list_player_buffs"))
{
//list the buffs the player currently has on him.
int[] playerBuffs = buff.getAllBuffs(player);
string[] strPlayerBuffs = new string[playerBuffs.length];
for(int i = 0; i < playerBuffs.length; i++)
{
strPlayerBuffs[i] = buff.getBuffNameFromCrc(playerBuffs[i]);
sendSystemMessageTestingOnly(player, strPlayerBuffs[i]);
}
return SCRIPT_CONTINUE;
}
//Removes all buffs from the player
if(command.equals("remove_player_buffs"))
{
buff.removeAllBuffs(player);
sendSystemMessageTestingOnly(player, "All buffs have been removed from player");
return SCRIPT_CONTINUE;
}
//Removes only the Entertainer Timer Buff (Collections)
if(command.equals("remove_entertainer_invis_buff"))
{
buff.removeBuff(player, "col_ent_invis_buff_tracker");
sendSystemMessageTestingOnly(player, "Entertainer Timer Buff Removed(Build-A-Buff collection)");
return SCRIPT_CONTINUE;
}
//Returns whether or not the player has the Entertainer timer buff on him or not.
if(command.equals("check_has_entertainer_invis_buff"))
{
if(buff.hasBuff(player, "col_ent_invis_buff_tracker"))
{
sendSystemMessageTestingOnly(player, "player has buff: 'col_ent_invis_buff_tracker'.");
}
else
{
sendSystemMessageTestingOnly(player, "player does NOT have buff: 'col_ent_invis_buff_tracker'.");
}
return SCRIPT_CONTINUE;
}
//Removes Heroic SD Taxi Timer Buff
if(command.equals("remove_heroic_sd_invis_buff"))
{
buff.removeBuff(player, "col_sd_invis_buff_tracker");
sendSystemMessageTestingOnly(player, "Heroic SD Taxi Buff Removed");
return SCRIPT_CONTINUE;
}
//Returns whether or not the player has the Heroic SD Taxi Timer Buff on him or not.
if(command.equals("check_has_heroic_sd_invis_buff"))
{
if(buff.hasBuff(player, "col_sd_invis_buff_tracker"))
{
sendSystemMessageTestingOnly(player, "player has buff: 'col_sd_invis_buff_tracker'.");
}
else
{
sendSystemMessageTestingOnly(player, "player does NOT have buff: 'col_sd_invis_buff_tracker'.");
}
return SCRIPT_CONTINUE;
}
//Used to bypass the roll for the Exceptional Harvest Collections (Meat, Hide and Bone)
if(command.equals("bypass_harvest_roll"))
{
utils.setScriptVar(player, "qa.resource_roll_bypass", "testing");
sendSystemMessageTestingOnly(player, "resource roll has been bypassed - drop rate for exceptionals is 100%");
}
//Return the Exceptional Harvest Collection Roll to normal
if(command.equals("remove_bypass_harvest_roll"))
{
utils.removeScriptVar(player, "qa.resource_roll_bypass");
sendSystemMessageTestingOnly(player, "resource roll has been negated - drop rate for exceptionals is no longer bypassed");
}
if(command.equals("durni"))
{
location myLoc = getLocation(self);
create.object("durni", myLoc, true);
sendSystemMessageTestingOnly(player, "you created a durni");
}
if(command.equals("stop_regen"))
{
float QARegenRate = getActionRegenRate(player);
//Store the objvar on the character to restore later
setObjVar(player, "QARegenRate", QARegenRate);
//this is a SET
getActionRegenRate(player, 0);
sendSystemMessageTestingOnly(player, "Your Regen Rate has been set to Zero!");
}
if(command.equals("restore_regen"))
{
float myStoredRegen = getFloatObjVar(player, "QARegenRate");
getActionRegenRate(player, myStoredRegen);
removeObjVar(self, "QARegenRate");
if(!hasObjVar(player, "QARegenRate"))
{
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been restored");
}
else
{
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not restored!");
}
}
}
return SCRIPT_CONTINUE;
}
/*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("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("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("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(self);
switch(myPosture)
{
case POSTURE_NONE:
debugSpeakMsg(self, "my Posuture is POSTURE_NONE");
break;
case POSTURE_UPRIGHT:
debugSpeakMsg(self, "my Posuture is POSTURE_UPRIGHT");
break;
case POSTURE_CROUCHED:
debugSpeakMsg(self, "my Posuture is POSTURE_CROUCHED");
break;
case POSTURE_PRONE:
debugSpeakMsg(self, "my Posuture is POSTURE_PRONE");
break;
case POSTURE_SNEAKING:
debugSpeakMsg(self, "my Posuture is POSTURE_SNEAKING");
break;
case POSTURE_BLOCKING:
debugSpeakMsg(self, "my Posuture is POSTURE_BLOCKING");
break;
case POSTURE_CLIMBING:
debugSpeakMsg(self, "my Posuture is POSTURE_CLIMBING");
break;
case POSTURE_FLYING:
debugSpeakMsg(self, "my Posuture is POSTURE_FLYING");
break;
case POSTURE_LYING_DOWN:
debugSpeakMsg(self, "my Posuture is POSTURE_LYING_DOWN");
break;
case POSTURE_SITTING:
debugSpeakMsg(self, "my Posuture is POSTURE_SITTING");
break;
case POSTURE_SKILL_ANIMATING:
debugSpeakMsg(self, "my Posuture is POSTURE_SKILL_ANIMATING");
break;
case POSTURE_DRIVING_VEHICLE:
debugSpeakMsg(self, "my Posuture is POSTURE_DRIVING_VEHICLE");
break;
case POSTURE_RIDING_CREATURE:
debugSpeakMsg(self, "my Posuture is POSTURE_RIDING_CREATURE");
break;
case POSTURE_KNOCKED_DOWN:
debugSpeakMsg(self, "my Posuture is POSTURE_KNOCKED_DOWN");
break;
case POSTURE_INCAPACITATED:
debugSpeakMsg(self, "my Posuture is POSTURE_INCAPACITATED");
break;
case POSTURE_DEAD:
debugSpeakMsg(self, "my Posuture is POSTURE_DEAD");
break;
case POSTURE_COUNT:
debugSpeakMsg(self, "my Posuture is POSTURE_COUNT");
break;
default:
debugSpeakMsg(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;
}*/