include library.chat; include library.utils; include library.sui; include library.attrib; include library.create; include library.space_dungeon; include library.space_transition; include library.pclib; include library.datatable; include library.buff; include library.trial; include library.space_dungeon_data; include library.badge; include library.ai_lib; include library.gcw; include library.factions; include library.faction_perk; include library.respec; include library.skill; include library.static_item; include library.stealth; include library.space_crafting; include library.vehicle; include library.combat; include library.instance; string[] OPTIONS ={ "listScripts", "clearScript", "clearAllScripts", "listObjVars", "clearObjVar", "listAllObjVar", "doClientEffect EFFECT", "spawn SPAWN" }; const int listScripts = 0; const int clearScript = 1; const int clearAllScripts = 2; const int listObjVars = 3; const int clearObjVar = 4; const int clearAllObjVars = 5; const int doClientEffect = 6; const int spawnCreature = 7; trigger OnMoveMoving() { setState(self, STATE_STUNNED, false); setState(self, STATE_FROZEN, false); return SCRIPT_CONTINUE; } trigger OnLogin() { setState(self, STATE_STUNNED, false); setState(self, STATE_FROZEN, false); return SCRIPT_CONTINUE; } trigger OnSpeaking(string text) { if (text.equals("set")) overrideDefaultAttack(self, "hoth_speeder_bolt"); if (text.equals("ping")) { obj_id record = utils.getObjIdScriptVar(self, "messageTo.recordObject"); if (!isIdValid(record)) { record = instance.getAreaInstanceController(self); } dictionary dict = new dictionary(); dict.put("sender", self); messageTo(record, "ping", dict, 0.0f, false); } if (text.equals("clear")) setState(self, STATE_COVER, false); if (!isGod(self)) return SCRIPT_CONTINUE; string[] parse = split( text, ' ' ); if (parse[0].equals("showGodWindow")) showGodWindow(self); if (parse[0].equals("help")) { showHelp(); } if (parse[0].equals("listScripts")) { listScripts(self); } if (parse[0].equals("clearScript")) { clearScript(self); } if (parse[0].equals("clearAllScripts")) { clearAllScripts(self); } if (parse[0].equals("doClientEffect")) runDoClientEffect(self, parse); if (parse[0].equals("spawn")) runSpawnCreature(self, parse); if (parse[0].equals("find")) runFind(self, parse); if (parse[0].equals("warpToFind")) runWarpToFind(self, parse); if (parse[0].equals("enterFind")) runEnterFind(self, parse); if (parse[0].equals("buildingWarp")) runInteriorWarp(self, parse); if (parse[0].equals("showTime")) runShowTime(self, parse); if (parse[0].equals("isScentMasked")) runIsScentMasked(self, parse); if (parse[0].equals("validateConceal")) runValidateConceal(self, parse); if (parse[0].equals("getBuildingScripts")) runGetBuildingScripts(self, parse); if (parse[0].equals("getBuildingObjVars")) runGetBuildingObjVars(self, parse); if (parse[0].equals("getLoc")) runTargetLocation(self, parse); if (parse[0].equals("getTop")) runGetTopMostContainer(self, parse); if (parse[0].equals("buildoutLoc")) { runBuildoutLoc(self, parse); } if (parse[0].equals("messageTo")) { sendMessageTo(self, parse); } if (parse[0].equals("recreate")) { runDestroyAndRecreate(self, parse); } if (parse[0].equals("buildingMessage")) { runMessageToBuilding(self, parse); } if (parse[0].equals("deathTouch")) { runDeathTouch(self, parse); } if (parse[0].equals("buffMe")) { runBuffMe(self, parse); } if (parse[0].equals("buffYou")) runBuffYou(self, parse); if (parse[0].equals("setRecordObject")) { runSetRecordObject(self, parse); } if (parse[0].equals("recordTo")) { runRecordTo(self, parse); } if (parse[0].equals("getCellId")) runGetCellId(self, parse); if (parse[0].equals("clearLockout")) runClearAllLockoutTimers(self, parse); if (parse[0].equals("applyBuff")) runApplyBuff(self, parse); if (parse[0].equals("doAnim")) runDoAnim(self, parse); if (parse[0].equals("recordLoc")) runDoRecordBuildoutLoc(self, parse); if (parse[0].equals("playMusic")) runPlayMusic(self, parse); if (parse[0].equals("doPrt")) runDoPrt(self, parse); if (parse[0].equals("spawnAk")) runSpawnAkPrime(self, parse); if (parse[0].equals("badge")) runBadgeOperation(self, parse); if (parse[0].equals("formation")) runSetFollowInFormation(self, parse); if (parse[0].equals("deleteObject")) runDeleteObject(self, parse); if (parse[0].equals("dumpArea")) runRoriConversion(self, parse); if (parse[0].equals("getModLoc")) getModLoc(self); if (parse[0].equals("calculateWarp")) calculateWarp(self, parse); if (parse[0].equals("getRecordDistance")) calculateDistance(self, parse); if (parse[0].equals("deleteRegion")) deleteRegion(self, parse); if (parse[0].equals("broadcastMessage")) broadcastMessageTo(self, parse); if (parse[0].equals("getSpaceLoc")) get3dSpaceLoc(self, parse); if (parse[0].equals("query")) runQuery(self, parse); if (parse[0].equals("getBaseCount")) getBaseCount(self, parse); if (parse[0].equals("getGameTime")) calculateGameTime(self, parse); if (parse[0].equals("testBatch")) runTestBatch(self, parse); if (parse[0].equals("makeSpaceOvert")) runMakeSpaceOvert(self, parse); if (parse[0].equals("getPlanetObject")) runGetPlanetObject(self, parse); if (parse[0].equals("respec")) runRespec(self, parse); if (parse[0].equals("getSkillTemplate")) runGetSkillTemplate(self, parse); if (parse[0].equals("queueCommand")) runQueueCommand(self, parse); if (parse[0].equals("setCooldown")) runSetCooldown(self, parse); if (parse[0].equals("getWeapon")) runGetWeapon(self, parse); if (parse[0].equals("validateInstance")) runVerifySession(self, parse); if (parse[0].equals("getHateList")) runGetHateList(self, parse); if (parse[0].equals("getRespect")) runGetRespect(self, parse); if (parse[0].equals("makeDecoy")) runMakeDecoy(self, parse); if (parse[0].equals("comm_link")) runCommLink(self, parse); if (parse[0].equals("prepCave")) runPrepCave(self, parse); if (parse[0].equals("swarmTarget")) runSwarmTarget(self, parse); if (parse[0].equals("setMaster")) runSetMaster(self, parse); if (parse[0].equals("convert")) runConvert(self, parse); if (parse[0].equals("dumpToTable")) dumpToTable(self, parse); if (parse[0].equals("recreateTable")) recreateTable(self, parse); if (parse[0].equals("getCommandList")) runGetCommmandList(self, parse); if(parse[0].equals("cell")) { // If no destination is stated, then get the cell list. if(parse.length == 1) { string[] params = new string[2]; params[0] = "getCellList"; params[1] = "" + getTopMostContainer(self); runGetCellList(self, params); } // If a destination cell is stated, then teleport to that cell. if(parse.length == 2) { string[] params = new string[3]; params[0] = "enterNamedCell"; params[1] = "" + getTopMostContainer(self); params[2] = parse[1]; // parse[1] has the cell name runEnterCell(self, params); } } if (parse[0].equals("getCellList")) runGetCellList(self, parse); if (parse[0].equals("enterNamedCell")) runEnterCell(self, parse); if (parse[0].equals("doIt")) runIt(self, parse); if (parse[0].equals("getBell")) runGetBell(self, parse); if (parse[0].equals("setHover")) runSetHover(self, parse); if (parse[0].equals("testSlope")) runTestSlope(self, parse); if (parse[0].equals("changeY")) runAlterHeight(self, parse); if (parse[0].equals("testBool")) runTestBool(self, parse); if (parse[0].equals("addAttrib")) runAddAttrib(self, parse); if (parse[0].equals("lit3")) runLit3(self, parse); if (parse[0].equals("shield")) runShieldMe(self, parse); if (parse[0].equals("clearStun")) clearStunEffects(self, parse); if (parse[0].equals("shazam")) makeMeAGod(self, parse); if (parse[0].equals("setSlopeMod")) runSetSlope(self, parse); if (parse[0].equals("setKillMeter")) runSetKillMeter(self, parse); if (parse[0].equals("setMind")) runSetMind(self, parse); if (parse[0].equals("getMind")) runGetMind(self, parse); if (parse[0].equals("snowspeeder")) runSetupSnowspeeder(self, parse); if (parse[0].equals("recordSet")) runSetRecordObjectFromFind(self, parse); if (parse[0].equals("shoot")) runTestShoot(self, parse); if (parse[0].equals("setLoc")) runSetLoc(self, parse); if (parse[0].equals("dda_set")) runSetDda(self, parse); if (parse[0].equals("dda_get")) runGetDda(self, parse); if (toLower(parse[0]).equals("staticitem")) runStaticItemParse(self, parse); if (toLower(parse[0]).equals("staticitemfind")) runStaticItemFind(self, parse); if (toLower(parse[0]).equals("staticitemcreate")) runStaticItemCreate(self, parse); if (toLower(parse[0]).equals("staticitemlist")) runStaticItemShowList(self); if (toLower(parse[0]).equals("staticitemclear")) runStaticItemClearList(self); if (parse[0].equals("init_vehicle")) { vehicle.initializeVehicle(getMountId(self)); } if (parse[0].equals("playSound")) runPlaySound(self, parse); if (parse[0].equals("triggerId")) runFireTrigger(self, parse); if (parse[0].equals("setCellLabel")) runSetCellLabel(self, parse); if (parse[0].equals("setId")) runSetIdOnInstance(self, parse); if (parse[0].equals("clearWp")) runClearWaypoints(self, parse); if (parse[0].equals("hideFrom")) runHideFromClient(self, parse); return SCRIPT_CONTINUE; } void showHelp() { for (int i=0;i -1 && objects[i] != self) { float range = getDistance(self, objects[i]); if (range < distance) { distance = range; closest = objects[i]; } } } location foundLoc = getLocation(closest); utils.setScriptVar(self, "objectLoc", foundLoc); utils.setScriptVar(self, "objectId", closest); sendSystemMessageTestingOnly(self, "Object("+getTemplateName(closest)+"/"+closest+") found at: "+foundLoc); return; } if(parse[1].equals("indexOfAll")) { obj_id[] objects = getObjectsInRange(self, 32000); location foundLoc; for (int i=0;i -1 && objects[i] != self) { float range = getDistance(self, objects[i]); foundLoc = getLocation(objects[i]); sendSystemMessageTestingOnly(self, "Object("+getTemplateName(objects[i])+"/"+objects[i]+") found at: "+foundLoc); if (range < distance) { distance = range; closest = objects[i]; } } } foundLoc = getLocation(closest); utils.setScriptVar(self, "objectLoc", foundLoc); utils.setScriptVar(self, "objectId", closest); sendSystemMessageTestingOnly(self, "Closest Object("+getTemplateName(closest)+"/"+closest+") found at: "+foundLoc); return; } if(parse[1].equals("spawnId")) { obj_id instance_id = instance.getAreaInstanceController(self); if ( !isIdValid(instance_id) ) { sendSystemMessage(self, "Invalid instance_id.", ""); } if ( parse.length < 3 ) { sendSystemMessage(self, "No spawn id specified.", ""); return; } sendSystemMessage(self, "spawnId search = "+ parse[2], ""); location foundLoc; obj_id[] spawnIdObjects = trial.getObjectsInInstanceBySpawnId(instance_id, parse[2]); if ( spawnIdObjects != null && spawnIdObjects.length > 0 ) { for ( int i = 0; i < spawnIdObjects.length; i++ ) { float range = getDistance(self, spawnIdObjects[i]); foundLoc = getLocation(spawnIdObjects[i]); sendSystemMessage(self, "Object( "+getTemplateName(spawnIdObjects[i])+" / "+spawnIdObjects[i]+" ) found at: "+foundLoc, ""); if (range < distance) { distance = range; closest = spawnIdObjects[i]; } } foundLoc = getLocation(closest); utils.setScriptVar(self, "objectLoc", foundLoc); utils.setScriptVar(self, "objectId", closest); sendSystemMessageTestingOnly(self, "Closest Object( "+getTemplateName(closest)+" / "+closest+" ) found at: "+foundLoc); return; } } sendSystemMessageTestingOnly(self, "No objects of that type found"); return; } void runWarpToFind(obj_id self, string[] parse) { if (!utils.hasScriptVar(self, "objectLoc")) { sendSystemMessageTestingOnly(self, "No found loc on self"); return; } obj_id toEnter = trial.getTop(utils.getObjIdScriptVar(self, "objectId")); obj_id[] cells = getCellIds(toEnter); boolean isPob = false; if (cells != null && cells.length > 0) isPob = true; location objLoc = utils.getLocationScriptVar(self, "objectLoc"); if (!isPob) { location warpTo = utils.getLocationScriptVar(self, "objectLoc"); warpPlayer(self, warpTo.area, warpTo.x, warpTo.y, warpTo.z, null, warpTo.x, warpTo.y, warpTo.z); } else { obj_id cellId = objLoc.cell; string cellName = getCellName(cellId); location cellLoc = getGoodLocation(toEnter, cellName); warpPlayer(self, cellLoc.area, cellLoc.x, cellLoc.y, cellLoc.z, toEnter, cellName, cellLoc.x, cellLoc.y, cellLoc.z, "nullCallback", false); } } void runEnterFind(obj_id self, string[] parse) { if (!utils.hasScriptVar(self, "objectId")) { sendSystemMessageTestingOnly(self, "No object id on self"); return; } obj_id toEnter = utils.getObjIdScriptVar(self, "objectId"); obj_id[] cells = getCellIds(toEnter); if (cells == null || cells.length == 0) { sendSystemMessageTestingOnly(self, "There are no cells on this object"); return; } string cellName = getCellName(cells[0]); location cellLoc = getGoodLocation(toEnter, cellName); warpPlayer(self, cellLoc.area, cellLoc.x, cellLoc.y, cellLoc.z, toEnter, cellName, cellLoc.x, cellLoc.y, cellLoc.z, "nullCallback", false); } void runInteriorWarp(obj_id self, string[] parse) { if (getTopMostContainer(self) == null) return; location cellLoc = getGoodLocation(getTopMostContainer(self), parse[1]); if (cellLoc == null) { sendSystemMessageTestingOnly(self, "No floor in target cell: "+parse[1]); return; } warpPlayer(self, cellLoc.area, cellLoc.x, cellLoc.y, cellLoc.z, getTopMostContainer(self), parse[1], cellLoc.x, cellLoc.y, cellLoc.z, "nullCallback", false); } void runShowTime(obj_id self, string[] parse) { string time = utils.formatTime(getGameTime()); sendSystemMessageTestingOnly(self, time); } void runIsScentMasked(obj_id self, string[] parse) { if (getState(self, STATE_MASK_SCENT) == 1) sendSystemMessageTestingOnly(self, "You are scent masked"); else sendSystemMessageTestingOnly(self, "You are not scent masked"); } void runValidateConceal(obj_id self, string[] parse) { if (utils.hasScriptVar(self, "scentmask.count")) sendSystemMessageTestingOnly(self, "Count: "+utils.getIntScriptVar(self, "scentmask.count")); if (utils.hasScriptVar(self, "scentmask.camokit")) sendSystemMessageTestingOnly(self, "Planet: "+utils.getStringScriptVar(self, "scentmask.camokit")); if (utils.hasScriptVar(self, "scentmask.camoquality")) sendSystemMessageTestingOnly(self, "Quality: "+utils.getIntScriptVar(self, "scentmask.camoquality")); if (utils.hasScriptVar(self, "scentmask.camoapply")) sendSystemMessageTestingOnly(self, "Player: "+getName(utils.getObjIdScriptVar(self, "scentmask.camoapply"))); } void runGetBuildingScripts(obj_id self, string[] parse) { obj_id top = getTopMostContainer(self); if (isIdValid(top)) { string[] scriptList = getScriptList(top); int pid = sui.listbox(self, self, "SCRIPTS ON BUILDING", scriptList, "handleRecievedScriptList"); } } void runGetBuildingObjVars(obj_id player, string[] parse) { obj_id target = getTopMostContainer(player); string[] scriptList = getScriptList(target); int pid = sui.listbox(player, player, "SCRIPTS ON TARGET", scriptList, "handleRecievedScriptList"); } void runTargetLocation(obj_id self, string[] parse) { obj_id target = getIntendedTarget(self); if (!isIdValid(target)) { sendSystemMessageTestingOnly(self, "You must target something first"); return; } location tarLoc = getLocation(target); float yaw = getYaw(target); if (!isIdValid(tarLoc.cell)) { sendSystemMessageTestingOnly(self, "Location("+tarLoc.x+", "+tarLoc.y+", "+tarLoc.z+") yaw("+yaw+") cell("+tarLoc.cell+") on scene ("+tarLoc.area+")"); } else { string cell = utils.getCellName(getTopMostContainer(self), tarLoc.cell); sendSystemMessageTestingOnly(self, "Location("+tarLoc.x+", "+tarLoc.y+", "+tarLoc.z+") yaw("+yaw+") cell("+cell+") on scene ("+tarLoc.area+")"); } } void runBuildoutLoc(obj_id self, string[] parse) { if (!hasObjVar(self, "record_table")) { sendSystemMessageTestingOnly(self, "You do not have the record_table objvar defined"); return; } obj_id target = getTarget(self); if (!isIdValid(target)) { if (parse.length < 2) { sendSystemMessageTestingOnly(self, "You must target something first"); return; } target = utils.stringToObjId(parse[1]); if (!isIdValid(target)) { sendSystemMessageTestingOnly(self, "Invalid Target Specified"); return; } } string table = getStringObjVar(self, "record_table"); location tarLoc = getLocation(target); string name = getTemplateName(target); float yaw = getYaw(target); string cell = utils.getCellName(getTopMostContainer(self), tarLoc.cell); sendSystemMessageTestingOnly(self, "Location("+tarLoc.x+", "+tarLoc.y+", "+tarLoc.z+") yaw("+yaw+") cell("+cell+")"); dictionary dctRow = new dictionary (); dctRow.put ("spawns", name); dctRow.put ("loc_x", tarLoc.x); dctRow.put ("loc_y", tarLoc.y); dctRow.put ("loc_z", tarLoc.z); dctRow.put ("room", cell); dctRow.put ("yaw", yaw); datatable.serverDataTableAddRow(table, dctRow); } void sendMessageTo(obj_id self, string[] parse) { obj_id target = getTarget(self); if (!isIdValid(target)) target = self; string message = parse[1]; if (parse.length > 2) { dictionary dict = new dictionary(); for (int i=2;i 2) { dictionary dict = new dictionary(); for (int i=2;i 1) { if (parse[1].equals("recordObject")) target = utils.getObjIdScriptVar(self, "messageTo.recordObject"); } else target = getTopMostContainer(self); if (!isIdValid(target) || target == self) return; string template = getTemplateName(target); location tarLoc = getLocation(target); if (template.startsWith("object")) { if (target == getTopMostContainer(self)) { obj_id[] toDestroy = trial.getAllObjectsInDungeon(target); trial.cleanupNpc(toDestroy); location recordLoc = getLocation(target); location selfLoc = getLocation(self); string cell = getCellName(selfLoc.cell); trial.cleanupObject(target); obj_id newObject = createObject(template, tarLoc); warpPlayer(self, recordLoc.area, recordLoc.x, recordLoc.y, recordLoc.z, newObject, cell, selfLoc.x, selfLoc.y, selfLoc.z, ""); } } } void runMessageToBuilding(obj_id self, string[] parse) { obj_id top = getTopMostContainer(self); string message = parse[1]; if (parse.length > 2) { dictionary dict = trial.getSessionDict(top); for (int i=2;i 2) { dictionary dict = trial.getSessionDict(target); for (int i=2;i -1) trial.cleanupObject(objects[j]); } return; } } void runRoriConversion(obj_id self, string[] parse) { if (!hasObjVar(self, "record_table")) { sendSystemMessageTestingOnly(self, "You do not have the record_table objvar defined"); return; } if (!utils.hasScriptVar(self, "messageTo.recordObject")) { sendSystemMessageTestingOnly(self, "You do not have a recordTo defined"); return; } //string table = "datatables/spawning/npc_base_builder/restuss_event/rebel/barr_4.tab"; string table = getStringObjVar(self, "record_table"); string[] strHeaderTypes = { "s","s","f","f","f","f","s"}; string[] strHeaders = {"object","phase","x_offset","y_offset","z_offset","yaw","cell"}; boolean boolTest = datatable.createDataTable(table, strHeaders,strHeaderTypes); if(!boolTest) { sendSystemMessageTestingOnly(self, "No dataTable made"); return; } location recordLoc = getLocation(utils.getObjIdScriptVar(self, "messageTo.recordObject")); obj_id[] objects = getAllObjectsWithObjVar(recordLoc, 300.0f, "test"); if (objects == null || objects.length == 0) return; for (int i=0;i 0) { obj_id[] contents = trial.getAllObjectsInDungeon(objects[i]); if (contents != null && contents.length > 0) { for (int k=0;k -1) { dictionary creatureDict = dataTableGetRow(creatureTable, row); string[] data = convertCreatureQueryToStringArray(creatureDict); populateListbox(self, data, "none"); } else { string[] nameList = dataTableGetStringColumn(creatureTable, "creatureName"); resizeable string[] indexList = new string[0]; for (int i=0;i -1) { utils.addElement(indexList, nameList[i]); } } if (indexList == null || indexList.length == 0) { sendSystemMessageTestingOnly(self, "No matches could be found"); return; } nameList = indexList; populateListbox(self, nameList, "creatureLookup"); } } } } void populateListbox(obj_id self, string[] data, string handler) { int pid = createSUIPage(sui.SUI_LISTBOX, self, self, handler); if ( pid > -1 ) { setSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT, "Query Result"); setSUIProperty(pid, sui.LISTBOX_PROMPT, sui.PROP_TEXT, "Query Results"); sui.listboxButtonSetup(pid, 0); if ( data != null && data.length > 0 ) { clearSUIDataSource(pid, sui.LISTBOX_DATASOURCE); for ( int i = 0; i < data.length; i++ ) { sui.addSUIDataItem(pid, sui.LISTBOX_DATASOURCE, "" + i); sui.setSUIProperty(pid, sui.LISTBOX_DATASOURCE + "." + i, sui.PROP_TEXT, data[i]); } } utils.setScriptVar(self, "query.data", data); sui.subscribeToSUIProperty(pid, sui.LISTBOX_LIST, sui.PROP_SELECTEDROW); sui.subscribeToSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT); sui.showSUIPage(pid); } } string[] convertCreatureQueryToStringArray(dictionary creatureDict) { string[] data = new string[18]; data[0] = "Name: "+creatureDict.getString("creatureName"); data[1] = "Level: "+creatureDict.getInt("BaseLevel"); data[2] = "Difficulty Class: "+creatureDict.getInt("difficultyClass"); data[3] = "Location: "+creatureDict.getString("where"); data[4] = "Social Group: "+creatureDict.getString("socialGroup"); data[5] = "PvP Faction: "+creatureDict.getString("pvpFaction"); data[6] = "Template: "+creatureDict.getString("template"); data[7] = "Loot Table: "+creatureDict.getString("lootTable"); data[8] = "Loot List: "+creatureDict.getString("lootList"); data[9] = "Niche: "+creatureDict.getInt("niche"); data[10] = "Scripts: "+creatureDict.getString("scripts"); data[11] = "Primary Weapon: "+creatureDict.getString("primary_weapon"); data[12] = "Primary Specials: "+creatureDict.getString("primary_weapon_specials"); data[13] = "Secondary Weapon: "+creatureDict.getString("secondary_weapon"); data[14] = "Secondary Specials: "+creatureDict.getString("secondary_weapon_specials"); data[15] = "Aggressive: "+creatureDict.getFloat("aggressive"); data[16] = "Assist: "+creatureDict.getFloat("assist"); data[17] = "Death Blow: "+creatureDict.getInt("death_blow"); return data; } messageHandler creatureLookup() { int btn = sui.getIntButtonPressed(params); int idx = sui.getListboxSelectedRow(params); if ( btn == sui.BP_CANCEL ) { return SCRIPT_CONTINUE; } if ( idx == -1 ) { return SCRIPT_CONTINUE; } string[] passedData = utils.getStringArrayScriptVar(self, "query.data"); string creatureTable = "datatables/mob/creatures.iff"; int row = dataTableSearchColumnForString(passedData[idx], "creatureName", creatureTable); if ( row > -1) { dictionary creatureDict = dataTableGetRow(creatureTable, row); string[] data = convertCreatureQueryToStringArray(creatureDict); populateListbox(self, data, "none"); } return SCRIPT_CONTINUE; } void getBaseCount(obj_id self, string[] parse) { obj_id planetId = getPlanetByName(getLocation(self).area); obj_id planetRegister = utils.getObjIdScriptVar(planetId, gcw.GCW_BASE_MANAGER); int rebel = gcw.getRebelBaseCount(planetId); int imperial = gcw.getImperialBaseCount(planetId); sendSystemMessageTestingOnly(self, "There are "+rebel+" Rebel Bases and "+imperial+" Imperial Bases in scene "+getLocation(self).area+" via manager "+planetRegister); } void calculateGameTime(obj_id self, string[] parse) { if (parse.length == 1) sendSystemMessageTestingOnly(self, ""+getGameTime()); else { int passedTime = utils.stringToInt(parse[1]); string verboseTime = utils.formatTimeVerbose(getGameTime() - passedTime); sendSystemMessageTestingOnly(self, verboseTime); } } void runTestBatch(obj_id self, string[] parse) { if (parse.length < 2) return; int[] toTheMax = new int[45]; for (int i=0;i<45;i++) { toTheMax[i] = i; } if (utils.hasIntBatchObjVar(self, parse[1])) utils.removeBatchObjVar(self, parse[1]); else utils.setBatchObjVar(self, parse[1], toTheMax); } void runMakeSpaceOvert(obj_id self, string[] parse) { string faction = factions.getFaction(self); if (faction == null) return; if (faction.equals("Rebel")) space_transition.setPlayerOvert( self, ##"rebel" ); else space_transition.setPlayerOvert( self, ##"imperial" ); } void runGetPlanetObject(obj_id self, string[] parse) { sendSystemMessageTestingOnly(self, ""+getPlanetByName(getLocation(self).area)); } void runRespec(obj_id self, string[] parse) { if (parse.length < 3) { sendSystemMessageTestingOnly(self, "Not enough parameters"); return; } string newTemplate = parse[1]; float pctDone = utils.stringToFloat(parse[2]); skill.revokeAllProfessionSkills(self); setSkillTemplate(self, newTemplate); respec.setPercentageCompletion(self, newTemplate, pctDone, false); skill.recalcPlayerPools(self, true); } void runGetSkillTemplate (obj_id self, string[] parse) { sendSystemMessageTestingOnly(self, getSkillTemplate(self)); } void runQueueCommand(obj_id self, string[] parse) { obj_id target = getIntendedTarget(self); //target = isIdValid(target) ? target : self; queueCommand(self, getStringCrc(parse[1].toLowerCase()), target, "", COMMAND_PRIORITY_DEFAULT); } void runSetCooldown(obj_id self, string[] parse) { sendSystemMessageTestingOnly(self, "Gathering Data for : "+parse[1]); combat_data cd = combat_engine.getCombatData(parse[1]); string cooldownGroup = cd.cooldownGroup; sendSystemMessageTestingOnly(self, "Cooldown Group and Base: "+cd.cooldownGroup+", "+cd.cooldownTime); int groupCrc = getStringCrc(cooldownGroup); float baseCooldownTime = 1.0f; if (parse.length > 2) { sendSystemMessageTestingOnly(self, "Overriding base time with "+utils.stringToFloat(parse[2])); baseCooldownTime = utils.stringToFloat(parse[2]); } else baseCooldownTime = cd.cooldownTime; sendSystemMessageTestingOnly(self, "Attempting to Set cooldown time on "+getName(self)+" to group "+cd.cooldownGroup+" at time "+baseCooldownTime); sendCooldownGroupTimingOnly(self, groupCrc, baseCooldownTime); } void runGetWeapon(obj_id self, string[] parse) { obj_id weapon = getCurrentWeapon(self); sendSystemMessageTestingOnly(self, "Current weapon is: "+weapon); } void runVerifySession(obj_id self, string[] parse) { space_dungeon.verifyPlayerSession(self); } void runGetHateList(obj_id self, string[] parse) { obj_id subject = getTarget(self); obj_id primary_target = getHateTarget(subject); float hate_value = getHate(subject, primary_target); obj_id[] hated = getHateList(subject); sendSystemMessageTestingOnly(self, "Primary Target: "+getName(primary_target)+" - "+hate_value); if (hated.length < 2) return; sendSystemMessageTestingOnly(self, "Full List"); string[] detailed_list = new string[hated.length]; for (int i=0;i -1) { obj_id top = trial.getTop(objects[i]); if (top == objects[i]) { location objLoc = getLocation(objects[i]); float x = objLoc.x - recordLoc.x; float y = objLoc.y - recordLoc.y; float z = objLoc.z - recordLoc.z; string name = getTemplateName(objects[i]); float yaw = getYaw(objects[i]); sendSystemMessageTestingOnly(self, "Object("+name+") Location("+x+", "+y+", "+z+") yaw("+yaw+")"); dictionary dctRow = new dictionary (); dctRow.put ("object", name); dctRow.put ("x_offset", x); dctRow.put ("y_offset", y); dctRow.put ("z_offset", z); dctRow.put ("yaw", yaw); datatable.serverDataTableAddRow(table, dctRow); /** obj_id[] cells = getCellIds(objects[i]); if (cells != null && cells.length > 0) { obj_id[] contents = trial.getAllObjectsInDungeon(objects[i]); if (contents != null && contents.length > 0) { for (int k=0;k high) high = bigList[i]; float num = bigList[i]; if (num >= 4.0f && num < 5.0f) in4++; if (num >= 5.0f && num < 6.0f) in5++; if (num >= 6.0f && num < 7.0f) in6++; if (num >= 7.0f && num < 8.0f) in7++; if (num >= 8.0f && num < 9.0f) in8++; if (num >= 9.0f && num < 10.0f) in9++; if (num >= 10.0f) in10++; } average = average / listSize; setSUIProperty(pid, sui.LISTBOX_PROMPT, sui.PROP_TEXT, "Average = "+average+", High = "+high+", Low = "+low+" \n 4 = "+in4+" \n 5 = "+in5+" \n 6 = "+in6+" \n 7 = "+in7+" \n 8 = "+in8+" \n 9 = "+in9+" \n 10 = "+in10); subscribeToSUIEvent(pid, sui_event_type.SET_onGenericSelection, sui.LISTBOX_LIST, "noHandler"); subscribeToSUIPropertyForEvent(pid, sui_event_type.SET_onGenericSelection, sui.LISTBOX_LIST, sui.LISTBOX_LIST, sui.PROP_SELECTEDROW); subscribeToSUIProperty(pid, sui.LISTBOX_LIST, sui.PROP_SELECTEDROW); subscribeToSUIProperty(pid, sui.LISTBOX_TITLE, sui.PROP_TEXT); showSUIPage(pid); flushSUIPage(pid); utils.setScriptVar(self, "bellpid", pid); } float distributedRand(float min, float max, int level) { const int levelMin = 0; const int levelMax = 10; boolean inverted = false; float _min = min; float _max = max; if (min > max) { inverted = true; min = _max; max = _min; } //if (level < levelMin) level = levelMin; //if (level > levelMax) level = levelMax; float rank = (float)(level - levelMin) / (float)(levelMax - levelMin); float mid = min + ((max - min) * rank); if (mid < min) { max += (mid-min); mid = min; } if (mid > max) { min += (mid-max); mid = max; } float minRand = rand(min, mid); float maxRand = rand(mid, max); float randNum = rand(minRand, maxRand); if (inverted) randNum = _min + (_max - randNum); return randNum; } void runSetHover(obj_id self, string[] parse) { float height = utils.stringToFloat(parse[1]); vehicle.setHoverHeight(getIntendedTarget(self), height); } void runTestSlope(obj_id self, string[] parse) { obj_id target = getIntendedTarget(self); addSlowDownEffect(self, target, 10.0f, 180.0f, 85.0f, 10.0f); } void runAlterHeight(obj_id self, string[] parse) { obj_id target = getIntendedTarget(self); float change = utils.stringToFloat(parse[1]); location loc = getLocation(target); loc.y += change; setLocation(target, loc); } void runTestBool(obj_id self, string[] parse) { boolean overall = false; for (int i=0;i<6;i++) { boolean current = false; if (i == 4) { current = true; } overall |= current; debugSpeakMsg(self, "overall = "+overall+", current = "+current); } debugSpeakMsg(self, "overall = "+overall); } void runAddAttrib(obj_id self, string[] parse) { string attrib = parse[1]; int value = utils.stringToInt(parse[2]); int time = utils.stringToInt(parse[3]); addSkillModModifier(self, attrib+"_0", attrib, value, time, false, false); } void runLit3(obj_id self, string[] parse) { obj_id recordObject = utils.getObjIdScriptVar(self, "messageTo.recordObject"); obj_id target = getIntendedTarget(self); chat.chat(self, "Can See: "+canSee(recordObject, target)); } void runShieldMe(obj_id self, string[] parse) { for (int i=0;i<9;i++) { debugSpeakMsg(self, "attrib"+i+" = "+getAttrib(self, i)); } } void clearStunEffects(obj_id self, string[] parse) { setState(self, STATE_STUNNED, false); setState(self, STATE_FROZEN, false); } void makeMeAGod(obj_id self, string[] parse) { buff.applyBuff(self, "kun_eight_sacrifice", 2400); buff.applyBuff(self, "crystal_buff", 2400); buff.applyBuff(self, "kun_minder_heal_buff", 2400); } void runSetSlope(obj_id self, string[] parse) { obj_id target = getIntendedTarget(self); addSlowDownEffect(self, target, 50.0f, 0.01f, 75.0f, 10.0f); } void runSetKillMeter(obj_id self, string[] parse) { int value = utils.stringToInt(parse[1]); combat.setKillMeter(self, value); } void runSetMind(obj_id self, string[] parse) { setMind(self, utils.stringToInt(parse[1])); } void runGetMind(obj_id self, string[] parse) { int current = getMind(self); int max = getMaxMind(self); debugSpeakMsg(self, "Mind = "+current+" of "+max); } void runSetupSnowspeeder(obj_id self, string[] parse) { obj_id target = getMountId(self); setBeastmasterPet(self, target); string[] abilities = { "hoth_speeder_shoot", "", "", "", "", "", "", "", "" }; setBeastmasterPetCommands(self, abilities); } void runTestShoot(obj_id self, string[] parse) { obj_id target = getIntendedTarget(self); float travelDistance = getDistance(target, self); float speed = travelDistance / 2.0f; location selfLoc = getLocation(self); selfLoc.y += 10.0f;//vehicle.getHoverHeight(getMountId(self)); location tarLoc = getLocation(target); createClientProjectile(self, "object/weapon/ranged/pistol/shared_pistol_green_bolt.iff", selfLoc, getLocation(target), speed, 2.0f, false, 32, 178, 170, 255); } void runSetLoc(obj_id self, string[] parse) { float locx = utils.stringToFloat(parse[1]); float locy = utils.stringToFloat(parse[2]); float locz = utils.stringToFloat(parse[3]); location tarLoc = getLocation(getIntendedTarget(self)); location newLoc = new location(locx, locy, locz, tarLoc.area, tarLoc.cell); setLocation(getIntendedTarget(self), newLoc); } const dictionary dict = new dictionary(); void runSetDda(obj_id self, string[] parse) { int fromRow = utils.stringToInt(parse[1]); string[] testString = {"one", "two", "three", "four", "five", "six", "seven", "eight"};//, "nine", "ten"}; int[] testInt = {1,2,3,4,5,6,7,8};//,9,10}; string[] passString = new string[3]; int[] passInt = new int[3]; int q = 0; for (int i = fromRow;i= 2 ) { if ( toLower(parse[1]).equals("find") ) { if ( parseLength < 3 ) { sendSystemMessage(self, "Syntax: staticItem find [keyword] [optional sub-keyword]", ""); return; } string[] data = new string[parse.length-1]; int dataIndex = 0; for ( int i = 0; i < parse.length; i++ ) { if ( i != 1 ) { data[dataIndex] = parse[i]; ++dataIndex; } } runStaticItemFind(self, data); } else if ( toLower(parse[1]).equals("create") ) { if ( parseLength < 3 ) { sendSystemMessage(self, "Syntax: staticItem create [list index or static item name]", ""); return; } string[] data = new string[parse.length-1]; int dataIndex = 0; for ( int i = 0; i < parse.length; i++ ) { if ( i != 1 ) { data[dataIndex] = parse[i]; ++dataIndex; } } runStaticItemCreate(self, data); } else if ( toLower(parse[1]).equals("list") ) { runStaticItemShowList(self); } else if ( toLower(parse[1]).equals("clear") ) { runStaticItemClearList(self); } } else { string helpMessage = "staticItem Help: \n"+ "--------------- \n"+ "staticItem find [keyword] [optional sub-keyword] \n"+ "staticItem create [list index or static item name] \n"+ "staticItem list \n"+ "staticItem clear"; sendSystemMessage(self, helpMessage, ""); } return; } void runStaticItemFind(obj_id self, string[] parse) { string staticItemWanted = ""; string subString = ""; int parseLength = parse.length; if ( parseLength < 2 ) { sendSystemMessage(self, "Syntax: staticItem find [keyword] [optional sub-keyword]", ""); return; } staticItemWanted = parse[1]; if ( parseLength >= 3 ) { subString = parse[2]; } resizeable string[] matchingStaticItems = new string[0]; string output = ""; int index = 0; string[] allStaticItems = dataTableGetStringColumn(static_item.MASTER_ITEM_TABLE, "name"); for ( int i = 0; i < allStaticItems.length; i++ ) { boolean matchFound = false; string staticItemName = allStaticItems[i]; int stringCheck = staticItemName.indexOf(staticItemWanted); if ( stringCheck > -1 ) { if ( subString != null && subString.length() > 0 ) { int subStringCheck = staticItemName.indexOf(subString); if ( subStringCheck > -1 ) { matchFound = true; } } else { matchFound = true; } if ( matchFound ) { utils.addElement(matchingStaticItems, staticItemName); output += index +" - "+staticItemName+" \n"; ++index; } } } if ( matchingStaticItems.length < 1 ) { output = "No matching static items found."; } else { utils.setScriptVar(self, "idiot_matchingStaticItems", matchingStaticItems); } sendSystemMessage(self, output, "\n"); return; } void runStaticItemCreate(obj_id self, string[] parse) { if ( parse.length < 2 ) { sendSystemMessage(self, "Syntax: staticItem create [list index or static item name]", ""); return; } string staticItemString = parse[1]; int staticItemIndex = utils.stringToInt(staticItemString); if (staticItemIndex > -1 && utils.hasScriptVar(self, "idiot_matchingStaticItems") ) { resizeable string[] matchingStaticItems = utils.getResizeableStringArrayScriptVar(self, "idiot_matchingStaticItems"); if ( matchingStaticItems != null && matchingStaticItems.length > 0 ) { if( staticItemIndex >= 0 && staticItemIndex < matchingStaticItems.length ) { string staticItem = matchingStaticItems[staticItemIndex]; obj_id inv = getObjectInSlot(self, "inventory"); obj_id item = static_item.createNewItemFunction(staticItem, inv); if ( isIdValid(item) ) { sendSystemMessage(self, "Static Item " + staticItem + " created in your inventory.", ""); } else { sendSystemMessage(self, "Error creating static item with supplied NAME (" + staticItem + ").", ""); } } else { sendSystemMessage(self, "Invalid static item index.", ""); } } else { sendSystemMessage(self, "Empty or Null array returned from Scriptvar.", ""); } } else { // if the input data was -1 or if there is no static items list, // then the string wasn't an index number and should be the name of a static item. Try creating it. if ( static_item.createNewItemFunction(staticItemString, self) == null ) { sendSystemMessage(self, "Error creating static item with supplied NAME (" + staticItemString + ").", ""); return; } else { sendSystemMessage(self, "Static Item " + staticItemString + " created in your inventory.", ""); return; } } return; } void runStaticItemShowList(obj_id self) { if ( utils.hasScriptVar(self, "idiot_matchingStaticItems") ) { resizeable string[] matchingStaticItems = utils.getResizeableStringArrayScriptVar(self, "idiot_matchingStaticItems"); string output = "\n"; if ( matchingStaticItems != null && matchingStaticItems.length > 0 ) { for ( int i = 0; i < matchingStaticItems.length; i++ ) { output = output + i +" - "+matchingStaticItems[i]+" \n"; } sendSystemMessage(self, output, ""); } else { sendSystemMessage(self, "Empty or Null array returned from Static Items List Scriptvar.", ""); } } else { sendSystemMessage(self, "Static Items List not found.", ""); } return; } void runStaticItemClearList(obj_id self) { if ( utils.hasScriptVar(self, "idiot_matchingStaticItems") ) { utils.removeScriptVar(self, "idiot_matchingStaticItems"); sendSystemMessage(self, "Static Items List removed.", ""); } else { sendSystemMessage(self, "Static Items List not found.", ""); } return; } void runPlaySound(obj_id self, string[] parse) { debugSpeakMsg(self, "attempting to play: "+parse[1]); play2dNonLoopingSound(self, "sound/"+parse[1]+".snd"); } messageHandler instance_ping_response() { string message = params.getString("message"); sendConsoleMessage(self, message); return SCRIPT_CONTINUE; } void runFireTrigger(obj_id self, string[] parse) { trial.sendSequenceTrigger(parse[1]); } void runSetCellLabel(obj_id self, string[] parse) { obj_id top = trial.getTop(self); obj_id cellId = getCellId(top, parse[1]); setCellLabel(cellId, parse[2]); } void runClearWaypoints(obj_id self, string[] parse) { obj_id[] waypoints = getWaypointsInDatapad(self); if (waypoints != null && waypoints.length > 0) { for (int i=0;i