//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 "); 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