//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 "); return SCRIPT_CONTINUE; } else debugSpeakMsg(self, "parameters are updateScriptvar "); 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