mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-29 23:15:55 -04:00
193 lines
5.8 KiB
Plaintext
193 lines
5.8 KiB
Plaintext
|
|
include library.combat;
|
|
include library.sui;
|
|
include library.quests;
|
|
include library.ai_lib;
|
|
include library.money;
|
|
include library.chat;
|
|
include library.pclib;
|
|
include library.vehicle;
|
|
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
|
|
trigger OnSpeaking(String text)
|
|
{
|
|
debugConsoleMsg( self, "jwatson_test OnSpeaking: " + text );
|
|
|
|
java.util.StringTokenizer tok = new java.util.StringTokenizer (text);
|
|
|
|
if (tok.hasMoreTokens ())
|
|
{
|
|
String command = tok.nextToken ();
|
|
|
|
debugConsoleMsg( self, "command is: " + command);
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
if (command.equals ("jw_suiTargetInfo") )
|
|
{
|
|
spawnSuiTargetInfo(self);
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
if (command.equals ("jw_suiTargetViewer") )
|
|
{
|
|
spawnSuiTargetViewer(self);
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
//-- SUI TARGET INFO
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
|
|
string OBJVAR_SUI_TARGET_INFO_PID = "suiTargetInfoPid";
|
|
string OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID = "suiTargetInfoTargetObjId";
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void spawnSuiTargetInfo(obj_id player)
|
|
{
|
|
int pId = createSUIPage ("Script.ColorPicker", player, player, "suiTargetInfoCallbackClosedCancel");
|
|
|
|
if (pId < 0)
|
|
return;
|
|
|
|
obj_id target = getLookAtTarget(player);
|
|
if (target == null)
|
|
target = player;
|
|
|
|
setSUIProperty (pId, "ColorPicker", "TargetNetworkId", target.toString ());
|
|
setSUIProperty (pId, "ColorPicker", "TargetVariable", "/shared_owner/index_color_skin");
|
|
setSUIProperty (pId, "ColorPicker", "TargetRangeMin", "0");
|
|
setSUIProperty (pId, "ColorPicker", "TargetRangeMax", "500");
|
|
setSUIProperty (pId, "bg.caption.lblTitle", "text", "(test) SuiTargetInfo");
|
|
|
|
subscribeToSUIProperty (pId, "ColorPicker", "SelectedIndex");
|
|
setSUIAssociatedObject (pId, target);
|
|
showSUIPage (pId);
|
|
|
|
setObjVar(player, OBJVAR_SUI_TARGET_INFO_PID, pId);
|
|
setObjVar(player, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID, target);
|
|
|
|
messageTo(player, "updateSuiTargetInfo", null, 1.0f, true);
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
messageHandler updateSuiTargetInfo()
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target == null)
|
|
target = self;
|
|
|
|
obj_id oldTarget = getObjIdObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID);
|
|
|
|
if (!oldTarget.equals(target))
|
|
{
|
|
setObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID, target);
|
|
|
|
int pId = getIntObjVar(self, OBJVAR_SUI_TARGET_INFO_PID);
|
|
|
|
setSUIProperty (pId, "ColorPicker", "TargetNetworkId", target.toString ());
|
|
setSUIProperty (pId, "ColorPicker", "TargetRangeMin", "0");
|
|
setSUIProperty (pId, "ColorPicker", "TargetRangeMax", "500");
|
|
|
|
flushSUIPage(pId);
|
|
}
|
|
|
|
messageTo(self, "updateSuiTargetInfo", null, 1.0f, true);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
messageHandler suiTargetInfoCallbackClosedCancel()
|
|
{
|
|
removeObjVar(self, OBJVAR_SUI_TARGET_INFO_PID);
|
|
removeObjVar(self, OBJVAR_SUI_TARGET_INFO_TARGET_OBJ_ID);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
//-- SUI TARGET VIEWER
|
|
//----------------------------------------------------------------------
|
|
//----------------------------------------------------------------------
|
|
|
|
string OBJVAR_SUI_TARGET_VIEWER_PID = "suiTargetViewerPid";
|
|
string OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID = "suiTargetViewerTargetObjId";
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void spawnSuiTargetViewer(obj_id player)
|
|
{
|
|
int pId = createSUIPage ("Script.ObjectViewer", player, player, "suiTargetViewerCallbackClosedCancel");
|
|
|
|
if (pId < 0)
|
|
return;
|
|
|
|
obj_id target = getLookAtTarget(player);
|
|
if (target == null)
|
|
target = player;
|
|
|
|
setSUIProperty (pId, "v", "SetObject", target.toString ());
|
|
setSUIProperty (pId, "bg.caption.lblTitle", "text", "(test) SuiTargetViewer");
|
|
|
|
showSUIPage (pId);
|
|
|
|
setObjVar(player, OBJVAR_SUI_TARGET_VIEWER_PID, pId);
|
|
setObjVar(player, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID, target);
|
|
|
|
messageTo(player, "updateSuiTargetViewer", null, 1.0f, true);
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
messageHandler updateSuiTargetViewer()
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target == null)
|
|
target = self;
|
|
|
|
obj_id oldTarget = getObjIdObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID);
|
|
|
|
if (!oldTarget.equals(target))
|
|
{
|
|
setObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID, target);
|
|
|
|
int pId = getIntObjVar(self, OBJVAR_SUI_TARGET_VIEWER_PID);
|
|
|
|
setSUIProperty (pId, "v", "SetObject", target.toString ());
|
|
|
|
flushSUIPage(pId);
|
|
}
|
|
|
|
messageTo(self, "updateSuiTargetViewer", null, 1.0f, true);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
messageHandler suiTargetViewerCallbackClosedCancel()
|
|
{
|
|
removeObjVar(self, OBJVAR_SUI_TARGET_VIEWER_TARGET_OBJ_ID);
|
|
removeObjVar(self, OBJVAR_SUI_TARGET_VIEWER_PID);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|