mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
Added zone and object information utiltiies
This commit is contained in:
@@ -0,0 +1,237 @@
|
||||
package script.developer;
|
||||
|
||||
import script.*;
|
||||
import script.library.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class obj_information_utility extends script.base_script {
|
||||
|
||||
|
||||
//Dictionary Constants
|
||||
public static final String DICT_OBJ_ID = "ObjectId";
|
||||
public static final String DICT_OBJ_TYPE = "ObjectType";
|
||||
public static final String DICT_OBJ_NAME = "DisplayName";
|
||||
public static final String DICT_OBJ_SERVER_TEMPLATE_NAME = "ServerTemplateName";
|
||||
public static final String DICT_OBJ_SHARED_TEMPLATE_NAME = "SharedTemplateName";
|
||||
public static final String DICT_OBJ_CRC = "CRC";
|
||||
|
||||
//Object Type Constants
|
||||
public static final int OBJ_TYPE_UNKNOWN = -1;
|
||||
public static final int OBJ_TYPE_OBJECT = 0;
|
||||
public static final int OBJ_TYPE_PLAYER = 2;
|
||||
|
||||
public obj_information_utility()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//Returns the target if it is valid, self if target is invalid and
|
||||
//self is valid, otherwise a obj_id.NULL_ID
|
||||
//self: obj_id of self
|
||||
//target: obj_id of self's target
|
||||
public static obj_id getTargetOrSelf(obj_id self, obj_id target) throws InterruptedException
|
||||
{
|
||||
|
||||
if (isValidId(target))
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
if (isValidId(self))
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
return obj_id.NULL_ID;
|
||||
}
|
||||
|
||||
//Gets information on the object and stores it in the returned dictionary
|
||||
//obj: The obj_id to get information for
|
||||
public static dictionary getObjectInformation(obj_id obj) throws InterruptedException
|
||||
{
|
||||
dictionary dict = new dictionary();
|
||||
getObjectInformation(obj, dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
//Gets information on the object and stores it in the provided dictionary
|
||||
//obj: The obj_id to get information for
|
||||
//dict: The dictionary to the data in
|
||||
public static void getObjectInformation(obj_id obj, dictionary dict) throws InterruptedException
|
||||
{
|
||||
boolean isPlayer = false;
|
||||
|
||||
dict.put(DICT_OBJ_ID, obj);
|
||||
dict.put(DICT_OBJ_NAME, getName(obj));
|
||||
|
||||
if (isPlayer(obj))
|
||||
{
|
||||
dict.put(DICT_OBJ_TYPE, OBJ_TYPE_PLAYER);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
String sharedTemplateName = getSharedObjectTemplateName(obj);
|
||||
|
||||
dict.put(DICT_OBJ_TYPE, OBJ_TYPE_OBJECT);
|
||||
dict.put(DICT_OBJ_SERVER_TEMPLATE_NAME, getTemplateName(obj));
|
||||
dict.put(DICT_OBJ_SHARED_TEMPLATE_NAME, sharedTemplateName);
|
||||
dict.put(DICT_OBJ_CRC, getStringCrc(sharedTemplateName));
|
||||
}
|
||||
}
|
||||
|
||||
public int cmdObjectInfo(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
|
||||
{
|
||||
if (!isGod(self))
|
||||
{
|
||||
sendSystemMessage(self, "\\#ff0000You do not authorized to use this script.\\#ffffff", null);
|
||||
}
|
||||
|
||||
obj_id infoTarget = null;
|
||||
|
||||
StringTokenizer st = new java.util.StringTokenizer(params);
|
||||
int tokens = st.countTokens();
|
||||
String objIdString = "";
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
objIdString = st.nextToken();
|
||||
}
|
||||
|
||||
if (objIdString != null && objIdString.length() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
infoTarget = obj_id.getObjId(Long.parseLong(objIdString));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
infoTarget = self;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isValidId(infoTarget))
|
||||
{
|
||||
infoTarget = self;
|
||||
}
|
||||
|
||||
//now pull the data
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
GetPlayerInformation(infoTarget, sb);
|
||||
GetObjectInformation(infoTarget, sb);
|
||||
GetObjVars(infoTarget, sb);
|
||||
GetScriptVars(infoTarget, sb);
|
||||
GetScripts(infoTarget, sb);
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Object Information", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
private static void GetObjVars(obj_id target, StringBuilder sb) throws InterruptedException
|
||||
{
|
||||
|
||||
String packedObjVars = getPackedObjvars(target);
|
||||
sb.append("\\#FFFFFF======Obj Vars======\\#FFFFFF\n");
|
||||
|
||||
String[] strSplit = split(packedObjVars, '|');
|
||||
if (strSplit.length > 2)
|
||||
{
|
||||
for (int intI = 0; intI < strSplit.length - 2; intI++)
|
||||
{
|
||||
sb.append("\\#00FF00");
|
||||
sb.append(strSplit[intI]);
|
||||
sb.append("=");
|
||||
sb.append("\\#FFFFFF");
|
||||
sb.append(strSplit[intI + 2]);
|
||||
sb.append("\n\r");
|
||||
intI = intI + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetScriptVars(obj_id target, StringBuilder sb) throws InterruptedException
|
||||
{
|
||||
deltadictionary scriptVars = target.getScriptVars();
|
||||
Enumeration keys = scriptVars.keys();
|
||||
sb.append("\\#FFFFFF=====Script Vars=====\\#FFFFFF\n");
|
||||
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String)keys.nextElement();
|
||||
sb.append("\\#00FF00");
|
||||
sb.append(key);
|
||||
sb.append("=");
|
||||
sb.append("\\#FFFFFF");
|
||||
sb.append(scriptVars.getObject(key).toString());
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetScripts(obj_id target, StringBuilder sb) throws InterruptedException
|
||||
{
|
||||
sb.append("\\#FFFFFF=======Scripts=======\\#FFFFFF\n");
|
||||
String[] scriptList = getScriptList(target);
|
||||
|
||||
for (String script : scriptList)
|
||||
{
|
||||
sb.append("\\#00FF00");
|
||||
sb.append(script);
|
||||
sb.append("\\#FFFFFF");
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetPlayerInformation(obj_id target, StringBuilder sb)
|
||||
{
|
||||
if (isPlayer(target))
|
||||
{
|
||||
sb.append("\\#00FFFFPlayer: \\#FFFFFF");
|
||||
sb.append(getName(target) );
|
||||
sb.append("\\#00FF00 (");
|
||||
sb.append(target.toString());
|
||||
sb.append("\\)\\#FFFFFF");
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetObjectInformation(obj_id target, StringBuilder sb)
|
||||
{
|
||||
if (!isPlayer(target))
|
||||
{
|
||||
sb.append("\\#00FFFFDetails for object id: \\#FFFFFF");
|
||||
sb.append(target.toString());
|
||||
sb.append("\n");
|
||||
String serverTemplateName = getTemplateName(target);
|
||||
String sharedTemplateName = getSharedObjectTemplateName(target);
|
||||
int crc = getStringCrc(sharedTemplateName);
|
||||
String displayName = getName(target);
|
||||
|
||||
sb.append("\\#00FFFFServer Template: \\#FFFFFF");
|
||||
sb.append(serverTemplateName);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFShared Template: \\#FFFFFF");
|
||||
sb.append(sharedTemplateName);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFDisplay Name: \\#FFFFFF");
|
||||
sb.append(displayName);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFGame Object Type: \\#FFFFFF");
|
||||
sb.append(getGameObjectTypeName(getGameObjectType(target)));
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFCRC: \\#FFFFFF");
|
||||
sb.append(Integer.toString(crc));
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
package script.developer;
|
||||
|
||||
import script.*;
|
||||
import script.library.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class zone_utility extends script.base_script {
|
||||
|
||||
public static final int LOCATION_UNKNOWN = -1;
|
||||
public static final int LOCATION_CELL = 0;
|
||||
public static final int LOCATION_SPACE = 1;
|
||||
public static final int LOCATION_GROUND = 2;
|
||||
|
||||
public zone_utility()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public int OnAttach(obj_id self) throws InterruptedException {
|
||||
|
||||
if (!isGod(self))
|
||||
{
|
||||
detachScript(self, "developer.zone_utility");
|
||||
sendSystemMessage(self, "\\#ff0000You do not authorized to use this script.\\#ffffff", null);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
public int cmdZoneUtility(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
|
||||
{
|
||||
if (!isGod(self))
|
||||
{
|
||||
sendSystemMessage(self, "\\#ff0000You do not authorized to use this script.\\#ffffff", null);
|
||||
}
|
||||
|
||||
|
||||
StringTokenizer st = new java.util.StringTokenizer(params);
|
||||
int tokens = st.countTokens();
|
||||
String command = "";
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
command = st.nextToken();
|
||||
}
|
||||
|
||||
if (command != null && command.length() > 0)
|
||||
{
|
||||
command = command.toLowerCase();
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
|
||||
case "scene":
|
||||
case "getscene":
|
||||
showSceneInformation(self);
|
||||
break;
|
||||
|
||||
case "cellinfo":
|
||||
showCellInformation(self);
|
||||
break;
|
||||
|
||||
|
||||
case "gettransform":
|
||||
showTransformInformation(self, target);
|
||||
break;
|
||||
|
||||
case "showobjvars":
|
||||
showObjVars(self, target);
|
||||
break;
|
||||
|
||||
case "showscriptvars":
|
||||
showScriptVars(self, target);
|
||||
break;
|
||||
|
||||
case "showscripts":
|
||||
showScripts(self, target);
|
||||
break;
|
||||
|
||||
case "showcrc":
|
||||
|
||||
String stringToConvert = "";
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
stringToConvert = st.nextToken();
|
||||
}
|
||||
|
||||
if (stringToConvert != null && stringToConvert.length() > 0)
|
||||
{
|
||||
stringToConvert = stringToConvert.toLowerCase();
|
||||
showStringCrc(self, stringToConvert);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendConsoleMessage(self, "\\#ff0000A string to convert to a CRC is required\\#ffffff");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "pcityinfo":
|
||||
|
||||
|
||||
String cityIdString = "";
|
||||
int cityId = 0;
|
||||
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
cityIdString = st.nextToken();
|
||||
|
||||
|
||||
if (cityIdString != null && cityIdString.length() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
cityId = Integer.parseInt(cityIdString);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
cityId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cityId = getCityAtLocation(getLocation(self), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (cityExists(cityId))
|
||||
{
|
||||
|
||||
|
||||
//fetch city info
|
||||
|
||||
sendSystemMessage(self, "Player City name is " + cityGetName(cityId) + " (" + cityId + ")", "");
|
||||
obj_id cityHall = cityGetCityHall(cityId);
|
||||
|
||||
if (hasObjVar(cityHall, city.OBJVAR_DERANK_EXEMPT))
|
||||
{
|
||||
sendSystemMessage(self, "The city IS derank exempt", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessage(self, "The city is NOT derank exempt", "");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessage(self, "There is no player city at your present location. Are you outside?", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "help":
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("\\#ffff00Command zoneutil help\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'scene' \\#ffff00 Gets name of the current scene\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'getscene' \\#ffff00 Gets name of the current scene\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'cellinfo' \\#ffff00 Gets information about your current cell and the containing structure\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'gettransform' \\#ffff00 Experimental replacement for gettransform\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'showobjvars' \\#ffff00 Show the object variables for self or the target\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'showscriptvars' \\#ffff00 Show the script variables for self or the target\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'showscripts' \\#ffff00 Show the scripts for self or the target\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'showcrc' \\#ffff00 Convert a string to a crc\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'pcityinfo' \\#ffff00 Shows info for the player city at the current location, if there is one\\#ffffff\n");
|
||||
sb.append("\\#ffffffsub command\\#00ffff 'pcityinfo <oid>' \\#ffff00 Shows info for the player city with the matching id, if there is one\\#ffffff\n");
|
||||
sendConsoleMessage(self, sb.toString());
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
//"\\#ffff00 ============ buildout_utility spatial chat/speak commands ============ \\#."
|
||||
sendConsoleMessage(self, "\\#ff0000Invalid command.\\#ffffff Use \\#00ffff'zoneutil help' \\#ffffff for help");
|
||||
break;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
private static void showSceneInformation(obj_id self) throws InterruptedException
|
||||
{
|
||||
String sceneName = getCurrentSceneName();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("\\#ffffffCurrent Scene: \\#00ff00");
|
||||
sb.append(sceneName);
|
||||
sb.append("\\#ffffff");
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Scene Information", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
private static void showStringCrc(obj_id self, String string) throws InterruptedException
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int crc = getStringCrc(string);
|
||||
|
||||
sb.append("\\#ffffffCRC for \\#00ff00'");
|
||||
sb.append(string);
|
||||
sb.append("'\\#ffffff is \\#00ff00'");
|
||||
sb.append(Integer.toString(crc));
|
||||
sb.append("'\\#ffffff");
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "String CRC", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
|
||||
private static void showCellInformation(obj_id self) throws InterruptedException
|
||||
{
|
||||
location here = getLocation(self);
|
||||
obj_id cell = here.cell;
|
||||
obj_id building = null;
|
||||
boolean inBuilding = false;
|
||||
|
||||
if (!isIdValid(cell))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "You are not in a building!");
|
||||
return;
|
||||
}
|
||||
|
||||
building = getContainedBy(cell);
|
||||
location containerLocation = getLocation(building);
|
||||
String buildoutAreaName = getBuildoutAreaName(containerLocation.x, containerLocation.z, containerLocation.area);
|
||||
String[] cellNames = getCellNames(building);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("\\#00FF00Building Name: \\#FFFFFF");
|
||||
sb.append(getName(building));
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FF00Cell Count: \\#FFFFFF");
|
||||
sb.append(cellNames.length);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFCell Names: \\#FFFFFF\n");
|
||||
|
||||
for(String cellName : cellNames)
|
||||
{
|
||||
sb.append("\\#00FF00\tCell Name: ");
|
||||
sb.append(cellName);
|
||||
sb.append("\\#FFFFFF\n");
|
||||
}
|
||||
|
||||
sb.append("\\#00FFFFYou are in cell: \\#FFFFFF");
|
||||
sb.append(utils.getCellName(building, cell));
|
||||
sb.append(", \\#00FFFFIndex: \\#FFFFFF");
|
||||
sb.append(getCellIndex(getCurrentSceneName( ), buildoutAreaName, cell));
|
||||
sb.append("\n");
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Cell Information", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
private static int getCellIndex(String region, String area, obj_id cell)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("datatables/buildout/");
|
||||
sb.append(region);
|
||||
sb.append("/");
|
||||
sb.append(area);
|
||||
sb.append(".iff");
|
||||
|
||||
String dataTable = sb.toString();
|
||||
|
||||
int row = dataTableSearchColumnForInt((int) cell.getValue(), "objid", dataTable);
|
||||
|
||||
|
||||
if (row == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int index = dataTableGetInt(dataTable, row, "cell_index");
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
private static void showObjVars(obj_id self, obj_id target) throws InterruptedException
|
||||
{
|
||||
obj_id infoTarget;
|
||||
|
||||
if (isValidId(target))
|
||||
{
|
||||
infoTarget = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTarget = self;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String packedObjVars = getPackedObjvars(infoTarget);
|
||||
AppendPlayerInformation(sb, infoTarget);
|
||||
AppendObjectInformation(sb, infoTarget);
|
||||
sb.append("\\#FFFFFF=====================\\#FFFFFF\n");
|
||||
|
||||
String[] strSplit = split(packedObjVars, '|');
|
||||
if (strSplit.length > 2)
|
||||
{
|
||||
for (int intI = 0; intI < strSplit.length - 2; intI++)
|
||||
{
|
||||
sb.append("\\#00FF00");
|
||||
sb.append(strSplit[intI]);
|
||||
sb.append("=");
|
||||
sb.append("\\#FFFFFF");
|
||||
sb.append(strSplit[intI + 2]);
|
||||
sb.append("\n\r");
|
||||
intI = intI + 2;
|
||||
}
|
||||
}
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Object Variables", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
private static void showScriptVars(obj_id self, obj_id target) throws InterruptedException
|
||||
{
|
||||
obj_id infoTarget;
|
||||
|
||||
if (isValidId(target))
|
||||
{
|
||||
infoTarget = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTarget = self;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
deltadictionary scriptVars = infoTarget.getScriptVars();
|
||||
Enumeration keys = scriptVars.keys();
|
||||
AppendPlayerInformation(sb, infoTarget);
|
||||
AppendObjectInformation(sb, infoTarget);
|
||||
sb.append("\\#FFFFFF=====================\\#FFFFFF\n");
|
||||
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String)keys.nextElement();
|
||||
sb.append("\\#00FF00");
|
||||
sb.append(key);
|
||||
sb.append("=");
|
||||
sb.append("\\#FFFFFF");
|
||||
sb.append(scriptVars.getObject(key).toString());
|
||||
sb.append("\n");
|
||||
}
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Script Variables", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
|
||||
private static void showScripts(obj_id self, obj_id target) throws InterruptedException
|
||||
{
|
||||
obj_id infoTarget;
|
||||
|
||||
if (isValidId(target))
|
||||
{
|
||||
infoTarget = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTarget = self;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
AppendPlayerInformation(sb, infoTarget);
|
||||
AppendObjectInformation(sb, infoTarget);
|
||||
sb.append("\\#FFFFFF=====================\\#FFFFFF\n");
|
||||
|
||||
String[] scriptList = getScriptList(infoTarget);
|
||||
|
||||
for (String script : scriptList)
|
||||
{
|
||||
sb.append("\\#00FF00");
|
||||
sb.append(script);
|
||||
sb.append("\\#FFFFFF");
|
||||
sb.append("\n");
|
||||
}
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Scripts", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
|
||||
private static void showTransformInformation(obj_id self, obj_id target) throws InterruptedException
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
obj_id infoTarget;
|
||||
|
||||
if (isValidId(target))
|
||||
{
|
||||
infoTarget = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTarget = self;
|
||||
}
|
||||
|
||||
sb.append("\\#00FF00Transform Information\\#FFFFFF\n");
|
||||
sb.append("\\#00FF00=====================\\#FFFFFF\n");
|
||||
AppendPlayerInformation(sb, infoTarget);
|
||||
AppendObjectInformation(sb, infoTarget);
|
||||
AppendQuaternion(sb, infoTarget);
|
||||
AppendLocationInformation(sb, infoTarget);
|
||||
|
||||
int pid = sui.msgbox(self, self, sb.toString(), sui.OK_ONLY, "Transform Information", sui.MSG_INFORMATION, "noHandler");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "true");
|
||||
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
|
||||
flushSUIPage(pid);
|
||||
}
|
||||
|
||||
private static void AppendPlayerInformation(StringBuilder sb, obj_id target)
|
||||
{
|
||||
if (isPlayer(target))
|
||||
{
|
||||
sb.append("\\#00FFFFPlayer: \\#FFFFFF");
|
||||
sb.append(getName(target) );
|
||||
sb.append("\\#00FF00 (");
|
||||
sb.append(target.toString());
|
||||
sb.append("\\)\\#FFFFFF");
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void AppendObjectInformation(StringBuilder sb, obj_id target)
|
||||
{
|
||||
if (!isPlayer(target))
|
||||
{
|
||||
sb.append("\\#00FFFFDetails for object id: \\#FFFFFF");
|
||||
sb.append(target.toString());
|
||||
sb.append("\n");
|
||||
String serverTemplateName = getTemplateName(target);
|
||||
String sharedTemplateName = getSharedObjectTemplateName(target);
|
||||
int crc = getStringCrc(sharedTemplateName);
|
||||
String displayName = getName(target);
|
||||
|
||||
sb.append("\\#00FFFFServer Template: \\#FFFFFF");
|
||||
sb.append(serverTemplateName);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFShared Template: \\#FFFFFF");
|
||||
sb.append(sharedTemplateName);
|
||||
sb.append("\\#00FFFFDisplay Name: \\#FFFFFF");
|
||||
sb.append(displayName);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFGame Object Type: \\#FFFFFF");
|
||||
sb.append(getGameObjectTypeName(getGameObjectType(target)));
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFCRC: \\#FFFFFF");
|
||||
sb.append(Integer.toString(crc));
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void AppendQuaternion(StringBuilder sb, obj_id target) throws InterruptedException
|
||||
{
|
||||
float[] quat = getQuaternion(target);
|
||||
|
||||
sb.append("\\#00FFFFQuaternion: \\#FFFFFF");
|
||||
sb.append("\\#00FF00 qX: \\#FFFFFF");
|
||||
sb.append(quat[0]);
|
||||
sb.append("\\#00FF00 qY: \\#FFFFFF");
|
||||
sb.append(quat[1]);
|
||||
sb.append("\\#00FF00 qZ: \\#FFFFFF");
|
||||
sb.append(quat[2]);
|
||||
sb.append("\\#00FF00 qW: \\#FFFFFF");
|
||||
sb.append(quat[3]);
|
||||
sb.append("\n");
|
||||
}
|
||||
|
||||
private static void AppendVectorInformation(StringBuilder sb, transform pos) throws InterruptedException
|
||||
{
|
||||
vector vctJ = pos.getLocalFrameJ_p();
|
||||
vector vctK = pos.getLocalFrameK_p();
|
||||
vector vctP = pos.getPosition_p();
|
||||
|
||||
sb.append("\\#00FFFFJ vector is: \\#FFFFFF");
|
||||
sb.append(vctJ);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFK vector is: \\#FFFFFF");
|
||||
sb.append(vctK);
|
||||
sb.append("\n");
|
||||
sb.append("\\#00FFFFP vector is: \\#FFFFFF");
|
||||
sb.append(vctP);
|
||||
sb.append("\n");
|
||||
}
|
||||
|
||||
private static void AppendLocationInformation(StringBuilder sb, obj_id target) throws InterruptedException
|
||||
{
|
||||
location localLocation = getLocation(target);
|
||||
int locationType = getLocationType(target);
|
||||
String sceneName = getCurrentSceneName();
|
||||
|
||||
|
||||
sb.append("\\#00FFFFScene Name: \\#FFFFFF");
|
||||
sb.append(sceneName);
|
||||
sb.append("\n");
|
||||
|
||||
switch(locationType)
|
||||
{
|
||||
|
||||
case LOCATION_GROUND:
|
||||
case LOCATION_SPACE:
|
||||
|
||||
String buildoutAreaName = getBuildoutAreaName(localLocation.x, localLocation.z, localLocation.area);
|
||||
final transform pos = getTransform_o2w(target);
|
||||
|
||||
//add the buildout coordinates
|
||||
float[] rawBuildoutCoord = getBuildoutAreaSizeAndCenter(localLocation.x, localLocation.z, localLocation.area, false, false);
|
||||
|
||||
float[] extBuildoutCoord = new float[3];
|
||||
extBuildoutCoord[0] = localLocation.x - (rawBuildoutCoord[2] - (rawBuildoutCoord[0] / 2));
|
||||
extBuildoutCoord[1] = localLocation.y;
|
||||
extBuildoutCoord[2] = (localLocation.z - (rawBuildoutCoord[3] - (rawBuildoutCoord[1] / 2)));
|
||||
|
||||
sb.append("\\#00FFFFBuildout Area Name: \\#FFFFFF");
|
||||
sb.append(buildoutAreaName);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFBuildout Coordinates: \\#FFFFFF");
|
||||
sb.append("\\#00FF00 X: \\#FFFFFF");
|
||||
|
||||
sb.append(extBuildoutCoord[0]);
|
||||
sb.append("\\#00FF00 Y: \\#FFFFFF");
|
||||
sb.append(extBuildoutCoord[1]);
|
||||
sb.append("\\#00FF00 Z: \\#FFFFFF");
|
||||
sb.append(extBuildoutCoord[2]);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFObject To World Transform: \\#FFFFFF");
|
||||
sb.append("\n");
|
||||
sb.append(pos);
|
||||
sb.append("\n");
|
||||
|
||||
AppendVectorInformation(sb, pos);
|
||||
|
||||
break;
|
||||
|
||||
case LOCATION_CELL:
|
||||
obj_id cell = localLocation.cell;
|
||||
obj_id containerId = getContainedBy(cell);
|
||||
location containerLocation = getLocation(containerId);
|
||||
String cellbuildoutAreaName = getBuildoutAreaName(containerLocation.x, containerLocation.z, containerLocation.area);
|
||||
String cellName = utils.getCellName(containerId, cell);
|
||||
int cellIndex = getCellIndex(sceneName, cellbuildoutAreaName, cell);
|
||||
String containerName = getName(containerId);
|
||||
final transform cellPos = getTransform_o2p(target);
|
||||
|
||||
sb.append("\\#00FFFFBuildout Area Name: \\#FFFFFF");
|
||||
sb.append(cellbuildoutAreaName);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFContainer Name: \\#FFFFFF");
|
||||
sb.append(containerName);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFCell Name: \\#FFFFFF");
|
||||
sb.append(cellName);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFCell Index: \\#FFFFFF");
|
||||
sb.append(cellIndex);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFCell Coordinates: \\#FFFFFF");
|
||||
sb.append("\\#00FF00 X: \\#FFFFFF");
|
||||
sb.append(containerLocation.x);
|
||||
sb.append("\\#00FF00 Y: \\#FFFFFF");
|
||||
sb.append(containerLocation.y);
|
||||
sb.append("\\#00FF00 Z: \\#FFFFFF");
|
||||
sb.append(containerLocation.z);
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("\\#00FFFFObject To Parent Transform: \\#FFFFFF");
|
||||
sb.append("\n");
|
||||
sb.append(cellPos);
|
||||
sb.append("\n");
|
||||
|
||||
AppendVectorInformation(sb, cellPos);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static int getLocationType(obj_id self) throws InterruptedException
|
||||
{
|
||||
int locationType = LOCATION_UNKNOWN;
|
||||
location localLocation = null;
|
||||
|
||||
localLocation = getLocation(self);
|
||||
|
||||
if (isValidId(localLocation.cell))
|
||||
{
|
||||
return LOCATION_CELL;
|
||||
}
|
||||
|
||||
if (isValidId(space_transition.getContainingShip(self)))
|
||||
{
|
||||
return LOCATION_SPACE;
|
||||
}
|
||||
|
||||
return LOCATION_GROUND;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1207,6 +1207,8 @@ fs_dm_cc_6_root commandClicky normal fs_dm_cc_6 failSpecialAttack 1 fs_dm_cc_6
|
||||
milkCreature commandClicky normal milkCreature failSpecialAttack 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
|
||||
searchLair commandClicky normal searchLair failSpecialAttack 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
|
||||
adminLair commandClicky normal adminLair failAdmin 1 admin 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
|
||||
zoneUtil commandClicky normal cmdZoneUtility failAdmin 1 admin 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
|
||||
objInfo commandClicky normal cmdObjectInfo failAdmin 1 admin 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 other none 1 3 0 other 0 ALL gathering 0 0.25 1 0
|
||||
of_buff_def_4 commandClicky normal of_buff_def_4 failSpecialAttack 1 of_buff_def_4 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 other none 2 combat_ranged combat 1 ALL of_buff_def 0.25 7 1
|
||||
of_buff_def_5 commandClicky normal of_buff_def_5 failSpecialAttack 1 of_buff_def_5 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 other none 2 combat_ranged combat 1 ALL of_buff_def 0.25 7 1
|
||||
of_buff_def_6 commandClicky normal of_buff_def_6 failSpecialAttack 1 of_buff_def_6 1 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 other none 2 combat_ranged combat 1 ALL of_buff_def 0.25 7 1
|
||||
|
||||
Reference in New Issue
Block a user