mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-21 07:13:00 -04:00
who isn't sick of converting the freaking scripts? this negates the need
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class character_age extends script.base_script
|
||||
{
|
||||
public character_age()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if (target == null)
|
||||
{
|
||||
target = self;
|
||||
}
|
||||
if (text.equals("age"))
|
||||
{
|
||||
int age = getCurrentBirthDate() - getPlayerBirthDate(target);
|
||||
sendSystemMessageTestingOnly(self, "Age ->" + age);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if (target == null)
|
||||
target = self;
|
||||
|
||||
if (text == "age")
|
||||
{
|
||||
int age = getCurrentBirthDate() - getPlayerBirthDate(target);
|
||||
//debugSpeakMsg(self, "Age ->" + age);
|
||||
sendSystemMessageTestingOnly(self, "Age ->" + age);
|
||||
}
|
||||
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.cloninglib;
|
||||
|
||||
public class clone_debug extends script.base_script
|
||||
{
|
||||
public clone_debug()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
if (text.equals("info"))
|
||||
{
|
||||
String planetName = getCurrentSceneName();
|
||||
obj_id planet = getPlanetByName(planetName);
|
||||
deltadictionary planetVars = planet.getScriptVars();
|
||||
location[] loc = planetVars.getLocationArray(cloninglib.VAR_PLANET_CLONE_LOC);
|
||||
location[] spawn = planetVars.getLocationArray(cloninglib.VAR_PLANET_CLONE_RESPAWN);
|
||||
obj_id[] id = planetVars.getObjIdArray(cloninglib.VAR_PLANET_CLONE_ID);
|
||||
for (int i = 0; i < loc.length; ++i)
|
||||
{
|
||||
debugConsoleMsg(self, "loc: " + loc[i] + spawn[i] + id[i]);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
include library.cloninglib;
|
||||
|
||||
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
if (text == "info")
|
||||
{
|
||||
string planetName = getCurrentSceneName();
|
||||
obj_id planet = getPlanetByName(planetName);
|
||||
deltadictionary planetVars = planet.getScriptVars();
|
||||
|
||||
location[] loc = planetVars.getLocationArray(cloninglib.VAR_PLANET_CLONE_LOC);
|
||||
location[] spawn = planetVars.getLocationArray(cloninglib.VAR_PLANET_CLONE_RESPAWN);
|
||||
obj_id[] id = planetVars.getObjIdArray(cloninglib.VAR_PLANET_CLONE_ID);
|
||||
|
||||
for (int i = 0; i < loc.length; ++i)
|
||||
debugConsoleMsg(self, "loc: " + loc[i] + spawn[i] + id[i]);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.hue;
|
||||
import script.library.colors;
|
||||
import script.library.utils;
|
||||
|
||||
public class coloring extends script.base_script
|
||||
{
|
||||
public coloring()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
int stringCheck = text.indexOf("color");
|
||||
int twoCheck = text.indexOf("shade");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
obj_id thing = getLookAtTarget(self);
|
||||
String hue = text.substring(text.indexOf(" ") + 1, text.length());
|
||||
int col = utils.stringToInt(hue);
|
||||
hueClothes(thing, col);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (twoCheck > -1)
|
||||
{
|
||||
obj_id thing = getLookAtTarget(self);
|
||||
String hue = text.substring(text.indexOf(" ") + 2, text.length());
|
||||
int col = utils.stringToInt(hue);
|
||||
hueClothes(thing, col);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void hueClothes(obj_id newClothes, int col) throws InterruptedException
|
||||
{
|
||||
custom_var[] allVars = getAllCustomVars(newClothes);
|
||||
for (int i = 0; i < allVars.length; i++)
|
||||
{
|
||||
custom_var cv = allVars[i];
|
||||
ranged_int_custom_var ri = (ranged_int_custom_var)cv;
|
||||
if (cv.isPalColor())
|
||||
{
|
||||
ri.setValue(col);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
include library.hue;
|
||||
include library.colors;
|
||||
include library.utils;
|
||||
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
int stringCheck = text.indexOf("color");
|
||||
int twoCheck = text.indexOf("shade");
|
||||
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
obj_id thing = getLookAtTarget (self);
|
||||
string hue = text.substring( text.indexOf(" ")+1, text.length() );
|
||||
int col = utils.stringToInt (hue);
|
||||
hueClothes (thing, col);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
if (twoCheck > -1)
|
||||
{
|
||||
obj_id thing = getLookAtTarget (self);
|
||||
string hue = text.substring( text.indexOf(" ")+2, text.length() );
|
||||
int col = utils.stringToInt (hue);
|
||||
hueClothes (thing, col);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
void hueClothes( obj_id newClothes, int col )
|
||||
{
|
||||
|
||||
custom_var[] allVars = getAllCustomVars(newClothes);
|
||||
|
||||
for ( int i = 0; i < allVars.length; i++ )
|
||||
{
|
||||
|
||||
custom_var cv = allVars[i];
|
||||
ranged_int_custom_var ri = (ranged_int_custom_var)cv;
|
||||
if ( cv.isPalColor() )
|
||||
{
|
||||
ri.setValue (col);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
|
||||
public class donham_terminal extends script.base_script
|
||||
{
|
||||
public donham_terminal()
|
||||
{
|
||||
}
|
||||
public static final String DATATABLE_ITEMS_TO_TEST = "datatables/beta/items_to_test.iff";
|
||||
public static final string_id SID_ORDER_ITEM = new string_id("sui", "order_item");
|
||||
public static final String CATEGORY_PROMPT = "Select an item category.";
|
||||
public static final String ITEM_REQUEST_PROMPT = "Select a template to test.";
|
||||
public static final String HANDLER_CATEGORY_RESPONSE = "handleCategoryResponse";
|
||||
public static final String HANDLER_ITEM_REQUEST = "handleItemRequest";
|
||||
public static final String VAR_ITEM_REQUEST_BASE = "item_request";
|
||||
public static final String VAR_ITEM_REQUEST_CATEGORY = VAR_ITEM_REQUEST_BASE + ".category";
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
int mnu = mi.addRootMenu(menu_info_types.SERVER_ITEM_OPTIONS, SID_ORDER_ITEM);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (item == menu_info_types.SERVER_ITEM_OPTIONS)
|
||||
{
|
||||
if (dataTableOpen(DATATABLE_ITEMS_TO_TEST))
|
||||
{
|
||||
String[] colName = dataTableGetStringColumn(DATATABLE_ITEMS_TO_TEST, "column_names");
|
||||
if ((colName == null) || (colName.length == 0))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Unable to load test item information. Exiting.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
String[] entries = new String[colName.length];
|
||||
for (int i = 0; i < colName.length; i++)
|
||||
{
|
||||
entries[i] = "@beta:" + colName[i];
|
||||
}
|
||||
sui.listbox(self, player, CATEGORY_PROMPT, entries, HANDLER_CATEGORY_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleCategoryResponse(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id playerId = sui.getPlayerId(params);
|
||||
if ((playerId == null) || (playerId == obj_id.NULL_ID))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int selRow = sui.getListboxSelectedRow(params);
|
||||
if (selRow == -1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dataTableOpen(DATATABLE_ITEMS_TO_TEST))
|
||||
{
|
||||
String title = "unknown";
|
||||
String[] colName = dataTableGetStringColumn(DATATABLE_ITEMS_TO_TEST, "column_names");
|
||||
if ((colName == null) || (colName.length == 0))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = colName[selRow];
|
||||
}
|
||||
String[] templates = dataTableGetStringColumn(DATATABLE_ITEMS_TO_TEST, selRow + 1);
|
||||
if ((templates == null) || (templates.length == 0))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!title.equals("unknown"))
|
||||
{
|
||||
setObjVar(playerId, VAR_ITEM_REQUEST_CATEGORY, title);
|
||||
sui.listbox(self, playerId, ITEM_REQUEST_PROMPT, sui.OK_ONLY, title, templates, HANDLER_ITEM_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleItemRequest(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id playerId = sui.getPlayerId(params);
|
||||
if ((playerId == null) || (playerId == obj_id.NULL_ID))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
String category = getStringObjVar(playerId, VAR_ITEM_REQUEST_CATEGORY);
|
||||
removeObjVar(playerId, VAR_ITEM_REQUEST_BASE);
|
||||
int selRow = sui.getListboxSelectedRow(params);
|
||||
if (selRow == -1)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dataTableOpen(DATATABLE_ITEMS_TO_TEST))
|
||||
{
|
||||
String template = dataTableGetString(DATATABLE_ITEMS_TO_TEST, selRow, category);
|
||||
if ((template == null) || (template.equals("")))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id pInv = utils.getInventoryContainer(playerId);
|
||||
if ((pInv == null) || (pInv == obj_id.NULL_ID))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id itemId = createObject(template, pInv, "");
|
||||
if ((itemId == null) || (itemId == obj_id.NULL_ID))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
/**
|
||||
* Title: terminal_food.script
|
||||
* Description: BETA SCRIPT: food dispenser
|
||||
*/
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.sui;
|
||||
include library.utils;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const string DATATABLE_ITEMS_TO_TEST = "datatables/beta/items_to_test.iff";
|
||||
|
||||
const string_id SID_ORDER_ITEM = new string_id ("sui", "order_item");
|
||||
|
||||
const string CATEGORY_PROMPT = "Select an item category.";
|
||||
const string ITEM_REQUEST_PROMPT = "Select a template to test.";
|
||||
|
||||
const string HANDLER_CATEGORY_RESPONSE = "handleCategoryResponse";
|
||||
const string HANDLER_ITEM_REQUEST = "handleItemRequest";
|
||||
|
||||
const string VAR_ITEM_REQUEST_BASE = "item_request";
|
||||
const string VAR_ITEM_REQUEST_CATEGORY = VAR_ITEM_REQUEST_BASE + ".category";
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
int mnu = mi.addRootMenu ( menu_info_types.SERVER_ITEM_OPTIONS, SID_ORDER_ITEM);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
if ( item == menu_info_types.SERVER_ITEM_OPTIONS)
|
||||
{
|
||||
if ( dataTableOpen(DATATABLE_ITEMS_TO_TEST) )
|
||||
{
|
||||
string[] colName = dataTableGetStringColumn(DATATABLE_ITEMS_TO_TEST, "column_names");
|
||||
if ( (colName == null) || (colName.length == 0) )
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Unable to load test item information. Exiting.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] entries = new string[colName.length];
|
||||
for ( int i = 0; i < colName.length; i++ )
|
||||
{
|
||||
entries[i] = "@beta:" + colName[i];
|
||||
}
|
||||
|
||||
sui.listbox(self, player, CATEGORY_PROMPT, entries, HANDLER_CATEGORY_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
messageHandler handleCategoryResponse()
|
||||
{
|
||||
if ( params == null )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id playerId = sui.getPlayerId(params);
|
||||
if ( (playerId == null) || (playerId == obj_id.NULL_ID) )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//debugSpeakMsg(self, "player = " + playerId);
|
||||
int selRow = sui.getListboxSelectedRow(params);
|
||||
if ( selRow == -1 )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( dataTableOpen(DATATABLE_ITEMS_TO_TEST) )
|
||||
{
|
||||
string title = "unknown";
|
||||
string[] colName = dataTableGetStringColumn(DATATABLE_ITEMS_TO_TEST, "column_names");
|
||||
if ( (colName == null) || (colName.length == 0) )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = colName[selRow];
|
||||
}
|
||||
|
||||
string[] templates = dataTableGetStringColumn(DATATABLE_ITEMS_TO_TEST, selRow + 1);
|
||||
if ( (templates == null) || (templates.length == 0) )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !title.equals("unknown") )
|
||||
{
|
||||
setObjVar(playerId, VAR_ITEM_REQUEST_CATEGORY, title);
|
||||
sui.listbox(self, playerId, ITEM_REQUEST_PROMPT, sui.OK_ONLY, title, templates, HANDLER_ITEM_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handleItemRequest()
|
||||
{
|
||||
if ( params == null )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id playerId = sui.getPlayerId(params);
|
||||
if ( (playerId == null) || (playerId == obj_id.NULL_ID) )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//debugSpeakMsg(self, "entering handleItemRequest...");
|
||||
//string category = sui.getListboxTitle(params);
|
||||
string category = getStringObjVar(playerId, VAR_ITEM_REQUEST_CATEGORY);
|
||||
removeObjVar(playerId, VAR_ITEM_REQUEST_BASE);
|
||||
|
||||
int selRow = sui.getListboxSelectedRow(params);
|
||||
if ( selRow == -1 )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( dataTableOpen(DATATABLE_ITEMS_TO_TEST) )
|
||||
{
|
||||
string template = dataTableGetString(DATATABLE_ITEMS_TO_TEST, selRow, category);
|
||||
if ( (template == null) || (template.equals("")) )
|
||||
{
|
||||
//debugSpeakMsg(self, "Unable to retrieve template: category = " + category + " selRow = " + selRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id pInv = utils.getInventoryContainer(playerId);
|
||||
if ( (pInv == null) || (pInv == obj_id.NULL_ID) )
|
||||
{
|
||||
//debugSpeakMsg(self, "Unable to determine player's inventory");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id itemId = createObject(template, pInv, "");
|
||||
if ( (itemId == null) || (itemId == obj_id.NULL_ID) )
|
||||
{
|
||||
//debugSpeakMsg(self, "Unable to create requested item!");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//debugSpeakMsg(self, "Object successfully created for " + getName(playerId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.ai_lib;
|
||||
import script.library.chat;
|
||||
import script.library.pet_lib;
|
||||
import script.library.create;
|
||||
|
||||
public class droid_vendor extends script.base_script
|
||||
{
|
||||
public droid_vendor()
|
||||
{
|
||||
}
|
||||
public static final String DROID_VENDOR_CONVO = "beta/droid_vendor";
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setInvulnerable(self, true);
|
||||
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
setObjVar(self, "ai.diction", "townperson");
|
||||
setName(self, "Travelling Droid Merchant (beta)");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
int mnu = mi.addRootMenu(menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data mdata = mi.getMenuItemById(mnu);
|
||||
mdata.setServerNotify(false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnStartNpcConversation(obj_id self, obj_id speaker) throws InterruptedException
|
||||
{
|
||||
chat.setGoodMood(self);
|
||||
faceToBehavior(self, speaker);
|
||||
string_id greeting = new string_id(DROID_VENDOR_CONVO, "start");
|
||||
string_id response[] = new string_id[2];
|
||||
response[0] = new string_id(DROID_VENDOR_CONVO, "yes");
|
||||
response[1] = new string_id(DROID_VENDOR_CONVO, "no");
|
||||
npcStartConversation(speaker, self, DROID_VENDOR_CONVO, greeting, response);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnNpcConversationResponse(obj_id self, String convo, obj_id player, string_id response) throws InterruptedException
|
||||
{
|
||||
if (!convo.equals(DROID_VENDOR_CONVO))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
npcRemoveConversationResponse(player, response);
|
||||
if ((response.getAsciiId()).equals("yes"))
|
||||
{
|
||||
if (pet_lib.hasMaxPets(player, pet_lib.PET_TYPE_DROID))
|
||||
{
|
||||
string_id message = new string_id(DROID_VENDOR_CONVO, "toomany");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
npcRemoveConversationResponse(player, new string_id(DROID_VENDOR_CONVO, "no"));
|
||||
string_id message = new string_id(DROID_VENDOR_CONVO, "choose");
|
||||
npcSpeak(player, message);
|
||||
string_id[] responses = new string_id[8];
|
||||
responses[0] = new string_id(DROID_VENDOR_CONVO, "droideka");
|
||||
responses[1] = new string_id(DROID_VENDOR_CONVO, "eg6_power_droid");
|
||||
responses[2] = new string_id(DROID_VENDOR_CONVO, "mouse_droid");
|
||||
responses[3] = new string_id(DROID_VENDOR_CONVO, "probot");
|
||||
responses[4] = new string_id(DROID_VENDOR_CONVO, "protocol_droid_3po");
|
||||
responses[5] = new string_id(DROID_VENDOR_CONVO, "r2");
|
||||
responses[6] = new string_id(DROID_VENDOR_CONVO, "surgical_droid_21b");
|
||||
responses[7] = new string_id(DROID_VENDOR_CONVO, "le_repair_droid");
|
||||
npcSetConversationResponses(player, responses);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if ((response.getAsciiId()).equals("no"))
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(DROID_VENDOR_CONVO, "yes"));
|
||||
string_id message = new string_id(DROID_VENDOR_CONVO, "goodbye");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String droidType = response.getAsciiId();
|
||||
String diction = "";
|
||||
if (droidType.equals("r2"))
|
||||
{
|
||||
droidType = "r" + rand(2, 5);
|
||||
}
|
||||
else if (droidType.equals("protocol_droid_3po"))
|
||||
{
|
||||
switch (rand(1, 3))
|
||||
{
|
||||
case 1:
|
||||
droidType = "protocol_droid_3po";
|
||||
break;
|
||||
case 2:
|
||||
droidType = "protocol_droid_3po_red";
|
||||
break;
|
||||
case 3:
|
||||
droidType = "protocol_droid_3po_silver";
|
||||
break;
|
||||
}
|
||||
switch (rand(1, 6))
|
||||
{
|
||||
case 1:
|
||||
diction = "droid_geek";
|
||||
break;
|
||||
case 2:
|
||||
diction = "droid_prissy";
|
||||
break;
|
||||
case 3:
|
||||
diction = "droid_sarcastic";
|
||||
break;
|
||||
case 4:
|
||||
diction = "droid_slang";
|
||||
break;
|
||||
case 5:
|
||||
diction = "droid_stupid";
|
||||
break;
|
||||
case 6:
|
||||
diction = "droid_worshipful";
|
||||
break;
|
||||
}
|
||||
}
|
||||
location spawnLoc = getLocation(self);
|
||||
spawnLoc.x += 2;
|
||||
spawnLoc.z += 2;
|
||||
playClientEffectLoc(player, "clienteffect/combat_explosion_lair_large.cef", spawnLoc, 0);
|
||||
obj_id droid = create.object(droidType, spawnLoc);
|
||||
pet_lib.makePet(droid, player);
|
||||
if (!diction.equals(""))
|
||||
{
|
||||
setObjVar(droid, "ai.diction", diction);
|
||||
}
|
||||
string_id message = new string_id(DROID_VENDOR_CONVO, "ok");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
include library.ai_lib;
|
||||
include library.chat;
|
||||
include library.pet_lib;
|
||||
include library.create;
|
||||
|
||||
const string DROID_VENDOR_CONVO = "beta/droid_vendor";
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
setInvulnerable( self, true );
|
||||
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
|
||||
setObjVar( self, "ai.diction", "townperson" );
|
||||
setName( self, "Travelling Droid Merchant (beta)" );
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
int mnu = mi.addRootMenu (menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data mdata = mi.getMenuItemById(mnu);
|
||||
mdata.setServerNotify(false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
trigger OnStartNpcConversation (obj_id speaker)
|
||||
{
|
||||
chat.setGoodMood( self );
|
||||
|
||||
faceToBehavior( self, speaker );
|
||||
string_id greeting = new string_id (DROID_VENDOR_CONVO, "start");//Wanna buy a droid?
|
||||
string_id response[] = new string_id [2];
|
||||
response[0] = new string_id (DROID_VENDOR_CONVO, "yes");//yes
|
||||
response[1] = new string_id (DROID_VENDOR_CONVO, "no");//no
|
||||
|
||||
npcStartConversation (speaker, self, DROID_VENDOR_CONVO, greeting, response);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnNpcConversationResponse(string convo, obj_id player, string_id response)
|
||||
{
|
||||
if (!convo.equals( DROID_VENDOR_CONVO ))
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
npcRemoveConversationResponse(player, response );
|
||||
|
||||
if ( response.getAsciiId().equals("yes"))//yes
|
||||
{
|
||||
if ( pet_lib.hasMaxPets( player, pet_lib.PET_TYPE_DROID ))
|
||||
{
|
||||
string_id message = new string_id (DROID_VENDOR_CONVO, "toomany");//you have too many
|
||||
npcSpeak( player, message );
|
||||
npcEndConversation( player );
|
||||
}
|
||||
|
||||
|
||||
npcRemoveConversationResponse(player, new string_id( DROID_VENDOR_CONVO, "no" ));
|
||||
|
||||
string_id message = new string_id (DROID_VENDOR_CONVO, "choose");//pick a droid
|
||||
npcSpeak( player, message );
|
||||
string_id[] responses = new string_id[8];
|
||||
responses[0] = new string_id( DROID_VENDOR_CONVO, "droideka" );
|
||||
responses[1] = new string_id( DROID_VENDOR_CONVO, "eg6_power_droid" );
|
||||
responses[2] = new string_id( DROID_VENDOR_CONVO, "mouse_droid" );
|
||||
responses[3] = new string_id( DROID_VENDOR_CONVO, "probot" );
|
||||
responses[4] = new string_id( DROID_VENDOR_CONVO, "protocol_droid_3po" );
|
||||
responses[5] = new string_id( DROID_VENDOR_CONVO, "r2" );
|
||||
responses[6] = new string_id( DROID_VENDOR_CONVO, "surgical_droid_21b" );
|
||||
responses[7] = new string_id( DROID_VENDOR_CONVO, "le_repair_droid" );
|
||||
npcSetConversationResponses(player, responses);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if ( response.getAsciiId().equals("no"))//no
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id( DROID_VENDOR_CONVO, "yes" ));
|
||||
|
||||
string_id message = new string_id (DROID_VENDOR_CONVO, "goodbye");//goodbye
|
||||
npcSpeak( player, message );
|
||||
npcEndConversation( player );
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string droidType = response.getAsciiId();
|
||||
|
||||
string diction = "";
|
||||
|
||||
if ( droidType.equals("r2") )
|
||||
droidType = "r" + rand(2,5);
|
||||
else if ( droidType.equals("protocol_droid_3po"))
|
||||
{
|
||||
switch ( rand(1,3) )
|
||||
{
|
||||
case 1 :
|
||||
droidType = "protocol_droid_3po";
|
||||
break;
|
||||
case 2 :
|
||||
droidType = "protocol_droid_3po_red";
|
||||
break;
|
||||
case 3 :
|
||||
droidType = "protocol_droid_3po_silver";
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( rand(1,6 ))
|
||||
{
|
||||
case 1 :
|
||||
diction = "droid_geek";
|
||||
break;
|
||||
case 2 :
|
||||
diction = "droid_prissy";
|
||||
break;
|
||||
case 3 :
|
||||
diction = "droid_sarcastic";
|
||||
break;
|
||||
case 4 :
|
||||
diction = "droid_slang";
|
||||
break;
|
||||
case 5 :
|
||||
diction = "droid_stupid";
|
||||
break;
|
||||
case 6 :
|
||||
diction = "droid_worshipful";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
location spawnLoc = getLocation( self );
|
||||
spawnLoc.x += 2;
|
||||
spawnLoc.z += 2;
|
||||
playClientEffectLoc(player, "clienteffect/combat_explosion_lair_large.cef", spawnLoc, 0);
|
||||
obj_id droid = create.object( droidType, spawnLoc );
|
||||
pet_lib.makePet( droid, player );
|
||||
if ( !diction.equals("") )
|
||||
{
|
||||
setObjVar( droid, "ai.diction", diction );
|
||||
}
|
||||
string_id message = new string_id (DROID_VENDOR_CONVO, "ok");//here you go
|
||||
npcSpeak( player, message );
|
||||
npcEndConversation( player );
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.player_structure;
|
||||
|
||||
public class e3_housing extends script.base_script
|
||||
{
|
||||
public e3_housing()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
obj_id deed = obj_id.NULL_ID;
|
||||
obj_id inv = getObjectInSlot(self, "inventory");
|
||||
if (inv == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "Player inventory is null.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text.equals("tatooine small"))
|
||||
{
|
||||
deed = createObjectOverloaded("object/tangible/deed/player_house_deed/tatooine_house_small_deed.iff", inv);
|
||||
}
|
||||
else if (text.equals("naboo medium"))
|
||||
{
|
||||
deed = createObjectOverloaded("object/tangible/deed/player_house_deed/naboo_house_medium_deed.iff", inv);
|
||||
}
|
||||
else if (text.equals("corellia large"))
|
||||
{
|
||||
deed = createObjectOverloaded("object/tangible/deed/player_house_deed/corellia_house_large_deed.iff", inv);
|
||||
}
|
||||
else if (text.equals("tatooine guild"))
|
||||
{
|
||||
deed = createObjectOverloaded("object/tangible/deed/guild_deed/tatooine_guild_style_02_deed.iff", inv);
|
||||
}
|
||||
if (isIdValid(deed))
|
||||
{
|
||||
setObjVar(deed, player_structure.VAR_DEED_BUILDTIME, 15);
|
||||
removeObjVar(deed, player_structure.VAR_DEED_SCENE);
|
||||
sendSystemMessageTestingOnly(self, deed + " created.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text.startsWith("destroy"))
|
||||
{
|
||||
location loc = getLocation(self);
|
||||
obj_id[] objects = getObjectsInRange(loc, 30.0f);
|
||||
for (int i = 0; i < objects.length; i++)
|
||||
{
|
||||
if (player_structure.isBuilding(objects[i]) || player_structure.isInstallation(objects[i]))
|
||||
{
|
||||
if (player_structure.getStructureOwnerObjId(objects[i]) == self)
|
||||
{
|
||||
player_structure.destroyStructure(objects[i]);
|
||||
sendSystemMessageTestingOnly(self, objects[i] + " destroyed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (text.startsWith("damagestructure"))
|
||||
{
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if (target != null)
|
||||
{
|
||||
player_structure.damageStructure(target, 100);
|
||||
debugSpeakMsg(self, "Structure damaged.");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/**********************************************************************
|
||||
* Title: e3_housing
|
||||
* Description: Player script that enables the creation of deeds and placement of houses.
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.player_structure;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
// Deed creation
|
||||
obj_id deed = obj_id.NULL_ID;
|
||||
obj_id inv = getObjectInSlot(self, "inventory");
|
||||
if (inv == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "Player inventory is null.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
if (text == "tatooine small")
|
||||
deed = createObjectOverloaded("object/tangible/deed/player_house_deed/tatooine_house_small_deed.iff", inv);
|
||||
|
||||
else if (text == "naboo medium")
|
||||
deed = createObjectOverloaded("object/tangible/deed/player_house_deed/naboo_house_medium_deed.iff", inv);
|
||||
|
||||
else if (text == "corellia large")
|
||||
deed = createObjectOverloaded("object/tangible/deed/player_house_deed/corellia_house_large_deed.iff", inv);
|
||||
|
||||
else if (text == "tatooine guild")
|
||||
deed = createObjectOverloaded("object/tangible/deed/guild_deed/tatooine_guild_style_02_deed.iff", inv);
|
||||
|
||||
if (isIdValid(deed))
|
||||
{
|
||||
setObjVar(deed, player_structure.VAR_DEED_BUILDTIME, 15);
|
||||
removeObjVar(deed, player_structure.VAR_DEED_SCENE);
|
||||
sendSystemMessageTestingOnly(self, deed + " created.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
// Structure destruction
|
||||
if (text.startsWith("destroy"))
|
||||
{
|
||||
location loc = getLocation(self);
|
||||
obj_id[] objects = getObjectsInRange(loc, 30.0f);
|
||||
for (int i = 0; i < objects.length; i++)
|
||||
{
|
||||
if (player_structure.isBuilding(objects[i]) || player_structure.isInstallation(objects[i]))
|
||||
{
|
||||
if (player_structure.getStructureOwnerObjId(objects[i]) == self)
|
||||
{
|
||||
player_structure.destroyStructure(objects[i]);
|
||||
sendSystemMessageTestingOnly(self, objects[i] + " destroyed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (text.startsWith("damagestructure"))
|
||||
{
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if (target != null)
|
||||
{
|
||||
player_structure.damageStructure(target, 100);
|
||||
debugSpeakMsg(self, "Structure damaged.");
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.features;
|
||||
|
||||
public class featuretest extends script.base_script
|
||||
{
|
||||
public featuretest()
|
||||
{
|
||||
}
|
||||
public static final int SWG_BASE_GAME = 0x00000001;
|
||||
public static final int SWG_COLLECTORS_GAME = 0x00000002;
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
debugSpeakMsg(self, "feature test script attached");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
if (text.equals("featuretest"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "getGameFeatures(): " + getGameFeatureBits(self));
|
||||
sendSystemMessageTestingOnly(self, "getSubFeatures(): " + getSubscriptionFeatureBits(self));
|
||||
sendSystemMessageTestingOnly(self, "utils.checkBit( SWG_BASE_GAME ): " + utils.checkBit(getGameFeatureBits(self), SWG_COLLECTORS_GAME));
|
||||
sendSystemMessageTestingOnly(self, "utils.checkBit( SWG_COLLECTORS_GAME ): " + utils.checkBit(getGameFeatureBits(self), SWG_COLLECTORS_GAME));
|
||||
sendSystemMessageTestingOnly(self, "isCollectorEdition" + features.isCollectorEdition(self));
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
include library.utils;
|
||||
include library.features;
|
||||
|
||||
const int SWG_BASE_GAME = 0x00000001;
|
||||
const int SWG_COLLECTORS_GAME = 0x00000002;
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
debugSpeakMsg( self, "feature test script attached" );
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnSpeaking( string text )
|
||||
{
|
||||
if ( text.equals( "featuretest" ) )
|
||||
{
|
||||
sendSystemMessageTestingOnly (self, "getGameFeatures(): " + getGameFeatureBits( self ) );
|
||||
sendSystemMessageTestingOnly (self, "getSubFeatures(): " + getSubscriptionFeatureBits( self ) );
|
||||
sendSystemMessageTestingOnly (self, "utils.checkBit( SWG_BASE_GAME ): " + utils.checkBit( getGameFeatureBits( self ), SWG_COLLECTORS_GAME ));
|
||||
sendSystemMessageTestingOnly (self, "utils.checkBit( SWG_COLLECTORS_GAME ): " + utils.checkBit( getGameFeatureBits( self ), SWG_COLLECTORS_GAME ));
|
||||
sendSystemMessageTestingOnly (self, "isCollectorEdition" + features.isCollectorEdition( self ));
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.consumable;
|
||||
import script.library.player_stomach;
|
||||
|
||||
public class food extends script.base_script
|
||||
{
|
||||
public food()
|
||||
{
|
||||
}
|
||||
public static final String SCRIPT_BETA_FOOD = "beta.food";
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
include library.utils;
|
||||
include library.consumable;
|
||||
include library.player_stomach;
|
||||
|
||||
const string SCRIPT_BETA_FOOD = "beta.food";
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
// This script is deprecated.
|
||||
|
||||
/*
|
||||
int numItems = rand(1,3);
|
||||
attrib_mod[] am = new attrib_mod[numItems];
|
||||
for (int i = 0; i < numItems; i++ )
|
||||
{
|
||||
am[i] = new attrib_mod(rand(HEALTH, WILLPOWER), rand(0, 50), (float)(rand(180,600)), 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
|
||||
int[] stomach = new int[player_stomach.STOMACH_MAX];
|
||||
stomach[player_stomach.STOMACH_FOOD] = 20;
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
|
||||
int charges = rand(1,5);
|
||||
//setObjVar(self, consumable.VAR_CONSUMABLE_CHARGES, charges);
|
||||
setCount(self, charges);
|
||||
*/
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.callable;
|
||||
import script.library.utils;
|
||||
|
||||
public class free_mount extends script.base_script
|
||||
{
|
||||
public free_mount()
|
||||
{
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
||||
if (getGameTime() > expirationTime)
|
||||
{
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int expireAndCleanup(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id currentPet = callable.getCDCallable(self);
|
||||
if (isIdValid(currentPet) && exists(currentPet))
|
||||
{
|
||||
obj_id riderId = getRiderId(currentPet);
|
||||
if (isIdValid(riderId))
|
||||
{
|
||||
dismountCreature(riderId);
|
||||
}
|
||||
}
|
||||
setObjVar(self, "pet.isDead", true);
|
||||
destroyObject(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
|
||||
include library.callable;
|
||||
include library.utils;
|
||||
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
||||
|
||||
if (getGameTime() > expirationTime)
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler expireAndCleanup()
|
||||
{
|
||||
obj_id currentPet = callable.getCDCallable(self);
|
||||
|
||||
if(isIdValid(currentPet) && exists(currentPet))
|
||||
{
|
||||
// pet is out, is it mounted?
|
||||
obj_id riderId = getRiderId(currentPet);
|
||||
|
||||
if (isIdValid(riderId))
|
||||
{
|
||||
// dismount
|
||||
dismountCreature(riderId);
|
||||
}
|
||||
}
|
||||
|
||||
setObjVar( self, "pet.isDead", true );
|
||||
destroyObject(self);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.callable;
|
||||
import script.library.utils;
|
||||
|
||||
public class free_vehicle extends script.base_script
|
||||
{
|
||||
public free_vehicle()
|
||||
{
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
||||
if (getGameTime() > expirationTime)
|
||||
{
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
obj_id currentPet = callable.getCDCallable(self);
|
||||
messageTo(currentPet, "handlePackRequest", null, 1, false);
|
||||
if (hasObjVar(self, "hasOwner"))
|
||||
{
|
||||
obj_id player = getObjIdObjVar(self, "hasOwner");
|
||||
if (hasObjVar(player, "hasTestVehicle"))
|
||||
{
|
||||
removeObjVar(player, "hasTestVehicle");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int expireAndCleanup(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id currentPet = callable.getCDCallable(self);
|
||||
if (isIdValid(currentPet))
|
||||
{
|
||||
obj_id riderId = getRiderId(currentPet);
|
||||
if (isIdValid(riderId))
|
||||
{
|
||||
dismountCreature(riderId);
|
||||
}
|
||||
}
|
||||
setObjVar(self, "pet.isDead", true);
|
||||
destroyObject(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
|
||||
include library.callable;
|
||||
include library.utils;
|
||||
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
||||
|
||||
if(getGameTime() > expirationTime)
|
||||
{
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDestroy()
|
||||
{
|
||||
|
||||
obj_id currentPet = callable.getCDCallable(self);
|
||||
|
||||
messageTo(currentPet, "handlePackRequest", null, 1, false);
|
||||
|
||||
if(hasObjVar(self, "hasOwner"))
|
||||
{
|
||||
obj_id player = getObjIdObjVar(self, "hasOwner");
|
||||
|
||||
if(hasObjVar(player, "hasTestVehicle"))
|
||||
{
|
||||
removeObjVar(player, "hasTestVehicle");
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler expireAndCleanup()
|
||||
{
|
||||
obj_id currentPet = callable.getCDCallable(self);
|
||||
|
||||
if(isIdValid(currentPet))
|
||||
{
|
||||
// pet is out, is it mounted?
|
||||
obj_id riderId = getRiderId(currentPet);
|
||||
|
||||
if(isIdValid(riderId))
|
||||
{
|
||||
// dismount
|
||||
dismountCreature(riderId);
|
||||
}
|
||||
}
|
||||
|
||||
setObjVar(self, "pet.isDead", true);
|
||||
|
||||
destroyObject(self);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class jedi_test extends script.base_script
|
||||
{
|
||||
public jedi_test()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (getJediState(self) < JEDI_STATE_JEDI)
|
||||
{
|
||||
setJediState(self, JEDI_STATE_JEDI);
|
||||
}
|
||||
setMaxForcePower(self, 10000);
|
||||
setForcePowerRegenRate(self, 1000);
|
||||
detachScript(self, "beta.jedi_test");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
if (getJediState(self) < JEDI_STATE_JEDI)
|
||||
setJediState(self, JEDI_STATE_JEDI);
|
||||
|
||||
setMaxForcePower(self, 10000);
|
||||
setForcePowerRegenRate(self, 1000);
|
||||
|
||||
detachScript(self, "beta.jedi_test");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.healing;
|
||||
import script.library.consumable;
|
||||
import script.library.player_stomach;
|
||||
|
||||
public class medicine extends script.base_script
|
||||
{
|
||||
public medicine()
|
||||
{
|
||||
}
|
||||
public static final String SCRIPT_BETA_MEDICINE = "beta.medicine";
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
int type = rand(1, 3);
|
||||
int numItems = rand(1, 4);
|
||||
attrib_mod[] am = new attrib_mod[numItems];
|
||||
for (int i = 0; i < numItems; i++)
|
||||
{
|
||||
attrib_mod tmp = new attrib_mod(0, 0, 0.0f, 0.0f, 0.0f);
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
tmp = utils.createHealDamageAttribMod(rand(0, 2) * 3, rand(50, 200));
|
||||
break;
|
||||
case 2:
|
||||
tmp = utils.createAntidoteAttribMod(rand(HEALTH, WILLPOWER));
|
||||
break;
|
||||
case 3:
|
||||
tmp = utils.createHealWoundAttribMod(rand(HEALTH, WILLPOWER), rand(10, 35));
|
||||
break;
|
||||
case 4:
|
||||
tmp = utils.createHealShockAttribMod(rand(10, 35));
|
||||
break;
|
||||
}
|
||||
am[i] = tmp;
|
||||
}
|
||||
if ((am == null) || (am.length == 0))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
int[] stomach = new int[player_stomach.STOMACH_MAX];
|
||||
for (int i = 0; i < player_stomach.STOMACH_MAX; i++)
|
||||
{
|
||||
stomach[i] = rand(1, 50);
|
||||
}
|
||||
if (stomach != null && stomach.length > 0)
|
||||
{
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
include library.utils;
|
||||
include library.healing;
|
||||
include library.consumable;
|
||||
include library.player_stomach;
|
||||
|
||||
const string SCRIPT_BETA_MEDICINE = "beta.medicine";
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
int type = rand(1,3);
|
||||
int numItems = rand(1,4);
|
||||
attrib_mod[] am = new attrib_mod[numItems];
|
||||
for (int i = 0; i < numItems; i++ )
|
||||
{
|
||||
attrib_mod tmp = new attrib_mod(0, 0, 0.0f, 0.0f, 0.0f);
|
||||
switch (type)
|
||||
{
|
||||
case 1: //heal damage
|
||||
tmp = utils.createHealDamageAttribMod(rand(0,2) * 3, rand(50,200));
|
||||
break;
|
||||
|
||||
case 2: //clear attrib mods on the specified attrib
|
||||
tmp = utils.createAntidoteAttribMod(rand(HEALTH, WILLPOWER));
|
||||
break;
|
||||
|
||||
case 3: //heal wound
|
||||
tmp = utils.createHealWoundAttribMod(rand(HEALTH, WILLPOWER),rand(10,35));
|
||||
break;
|
||||
|
||||
case 4: //heal shock
|
||||
tmp = utils.createHealShockAttribMod(rand(10,35));
|
||||
break;
|
||||
}
|
||||
am[i] = tmp;
|
||||
}
|
||||
|
||||
if ( (am == null) || (am.length ==0) )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
|
||||
int[] stomach = new int[player_stomach.STOMACH_MAX];
|
||||
for (int i = 0; i < player_stomach.STOMACH_MAX; i++ )
|
||||
{
|
||||
stomach[i] = rand(1,50);
|
||||
}
|
||||
|
||||
if(stomach != null && stomach.length > 0) { // Check for zero length array
|
||||
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
}
|
||||
|
||||
/*
|
||||
string[] skillReq = new string[1];
|
||||
skillReq[0] = "LightRifleAccuracy";
|
||||
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skillReq);
|
||||
|
||||
int[] skillMin = new int[1];
|
||||
skillMin[0] = 20;
|
||||
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skillMin);
|
||||
*/
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.healing;
|
||||
import script.library.consumable;
|
||||
import script.library.player_stomach;
|
||||
|
||||
public class medicine_buff extends script.base_script
|
||||
{
|
||||
public medicine_buff()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (hasObjVar(self, consumable.VAR_CONSUMABLE_MODS))
|
||||
{
|
||||
removeObjVar(self, consumable.VAR_CONSUMABLE_MODS);
|
||||
}
|
||||
String template_name = getTemplateName(self);
|
||||
int buff_type = -1;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_health.iff"))
|
||||
{
|
||||
buff_type = 0;
|
||||
}
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_constitution.iff"))
|
||||
{
|
||||
buff_type = 2;
|
||||
}
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_action.iff"))
|
||||
{
|
||||
buff_type = 3;
|
||||
}
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_stamina.iff"))
|
||||
{
|
||||
buff_type = 5;
|
||||
}
|
||||
int power = rand(25, 150);
|
||||
int charges = rand(1, 3);
|
||||
int duration = rand(300, 1800);
|
||||
if (buff_type == -1)
|
||||
{
|
||||
buff_type = rand(0, NUM_ATTRIBUTES - NUM_ATTRIBUTES_PER_GROUP - 1);
|
||||
}
|
||||
attrib_mod[] am = new attrib_mod[1];
|
||||
attrib_mod tmp = new attrib_mod(buff_type, power, duration, healing.VAR_BUFF_MOD_ATTACK, healing.VAR_BUFF_MOD_DECAY);
|
||||
am[0] = tmp;
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
setCount(self, charges);
|
||||
int[] stomach =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
String[] skill_mod =
|
||||
{
|
||||
"healing_ability"
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
int skill_req = rand(1, 25);
|
||||
int[] skill_value =
|
||||
{
|
||||
skill_req
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/**********************************************************************
|
||||
* Title: buff_medicine
|
||||
* Description: creates a buff medicine. For testing only.
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.utils;
|
||||
include library.healing;
|
||||
include library.consumable;
|
||||
include library.player_stomach;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnAttach()
|
||||
{
|
||||
if (hasObjVar(self, consumable.VAR_CONSUMABLE_MODS))
|
||||
removeObjVar(self, consumable.VAR_CONSUMABLE_MODS);
|
||||
|
||||
string template_name = getTemplateName(self);
|
||||
|
||||
int buff_type = -1;
|
||||
|
||||
// Each template corresponds to a wound_type
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_health.iff")) buff_type = 0;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_constitution.iff")) buff_type = 2;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_action.iff")) buff_type = 3;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_enhance_stamina.iff")) buff_type = 5;
|
||||
|
||||
int power = rand(25,150);
|
||||
int charges = rand(1,3);
|
||||
int duration = rand(300, 1800);
|
||||
|
||||
if (buff_type == -1)
|
||||
buff_type = rand(0,NUM_ATTRIBUTES-NUM_ATTRIBUTES_PER_GROUP-1);
|
||||
|
||||
attrib_mod[] am = new attrib_mod[1];
|
||||
attrib_mod tmp = new attrib_mod(buff_type, power, duration, healing.VAR_BUFF_MOD_ATTACK, healing.VAR_BUFF_MOD_DECAY);
|
||||
am[0] = tmp;
|
||||
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
setCount(self, charges);
|
||||
//setObjVar(self, consumable.VAR_CONSUMABLE_CHARGES, charges);
|
||||
|
||||
// Set all stomachs to zero since we aren't currently using the stomach for medicine
|
||||
int[] stomach = {0, 0, 0};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
|
||||
// Add in skill mod required data
|
||||
string[] skill_mod = {"healing_ability"};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
|
||||
// Add in min mod value data
|
||||
int skill_req = rand(1, 25);
|
||||
int[] skill_value = {skill_req};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.healing;
|
||||
import script.library.consumable;
|
||||
import script.library.player_stomach;
|
||||
|
||||
public class medicine_damage extends script.base_script
|
||||
{
|
||||
public medicine_damage()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
int power = rand(50, 300);
|
||||
int charges = rand(1, 10);
|
||||
if (healing.isRangedMedicine(self))
|
||||
{
|
||||
charges = 1;
|
||||
}
|
||||
attrib_mod[] am = createHealDamageMedicineMod(power);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
setCount(self, charges);
|
||||
int[] stomach =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
String[] skill_mod =
|
||||
{
|
||||
"healing_ability"
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
int skill_req = rand(10, 50);
|
||||
int[] skill_value =
|
||||
{
|
||||
skill_req
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
LOG("LOG_CHANNEL", "Medicine created!");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public attrib_mod[] createHealDamageMedicineMod(int power) throws InterruptedException
|
||||
{
|
||||
attrib_mod[] am = new attrib_mod[3];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
am[i] = utils.createHealDamageAttribMod(i * 3, power);
|
||||
}
|
||||
return am;
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Title: medicine_damage.script
|
||||
* Description: Testing script that makes a random damage medicine
|
||||
*/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.utils;
|
||||
include library.healing;
|
||||
include library.consumable;
|
||||
include library.player_stomach;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
|
||||
int power = rand(50,300);
|
||||
int charges = rand(1,10);
|
||||
|
||||
// Ranged medicines only have 1 charge.
|
||||
if (healing.isRangedMedicine(self))
|
||||
charges = 1;
|
||||
|
||||
attrib_mod[] am = createHealDamageMedicineMod(power);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
setCount(self, charges);
|
||||
//setObjVar(self, consumable.VAR_CONSUMABLE_CHARGES, charges);
|
||||
|
||||
// Set all stomachs to zero since we aren't currently using the stomach for medicine
|
||||
int[] stomach = {0, 0, 0};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
|
||||
// Add in skill mod required data
|
||||
string[] skill_mod = {"healing_ability"};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
|
||||
// Add in min mod value data
|
||||
int skill_req = rand(10, 50);
|
||||
int[] skill_value = {skill_req};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
|
||||
LOG("LOG_CHANNEL", "Medicine created!");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/***** FUNCTIONS *************************************************/
|
||||
|
||||
attrib_mod[] createHealDamageMedicineMod(int power)
|
||||
{
|
||||
attrib_mod[] am = new attrib_mod[3];
|
||||
|
||||
//create attribute mods for HEALTH 0, ACTION 3, and MIND 6
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
am[i] = utils.createHealDamageAttribMod(i * 3, power);
|
||||
}
|
||||
|
||||
return am;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.consumable;
|
||||
|
||||
public class medicine_revive extends script.base_script
|
||||
{
|
||||
public medicine_revive()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
attrib_mod[] am = new attrib_mod[6];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int attrib = i * 3;
|
||||
am[i * 2] = utils.createHealWoundAttribMod(attrib, rand(10, 50));
|
||||
am[i * 2 + 1] = utils.createHealDamageAttribMod(attrib, rand(50, 150));
|
||||
}
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
int charges = rand(1, 3);
|
||||
setCount(self, charges);
|
||||
int[] stomach =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
String[] skill_mod =
|
||||
{
|
||||
"healing_efficiency"
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
int[] skill_value =
|
||||
{
|
||||
30
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* Title: medicine_maker.script
|
||||
* Description: Testing script that adds wound medicine attributes to an object
|
||||
*/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.utils;
|
||||
include library.consumable;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
attrib_mod[] am = new attrib_mod[6];
|
||||
for ( int i = 0; i < 3; i++ )
|
||||
{
|
||||
int attrib = i * 3;
|
||||
am[i*2] = utils.createHealWoundAttribMod(attrib, rand(10,50));
|
||||
am[i*2+1] = utils.createHealDamageAttribMod(attrib, rand(50, 150));
|
||||
}
|
||||
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
|
||||
int charges = rand(1,3);
|
||||
setCount(self, charges);
|
||||
|
||||
// Set all stomachs to zero since we aren't currently using the stomach for medicine
|
||||
int[] stomach = {0, 0, 0};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
|
||||
// Add in skill mod required data
|
||||
string[] skill_mod = {"healing_efficiency"};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
|
||||
// Add in min mod value data
|
||||
//int skill_req = rand(33,66);
|
||||
//int[] skill_value = {skill_req};
|
||||
int[] skill_value = {30};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.healing;
|
||||
import script.library.consumable;
|
||||
import script.library.player_stomach;
|
||||
|
||||
public class medicine_wound extends script.base_script
|
||||
{
|
||||
public medicine_wound()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
String template_name = getTemplateName(self);
|
||||
int wound_type = -1;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_health.iff"))
|
||||
{
|
||||
wound_type = 0;
|
||||
}
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_constitution.iff"))
|
||||
{
|
||||
wound_type = 2;
|
||||
}
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_action.iff"))
|
||||
{
|
||||
wound_type = 3;
|
||||
}
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_stamina.iff"))
|
||||
{
|
||||
wound_type = 5;
|
||||
}
|
||||
int power = rand(25, 150);
|
||||
int charges = rand(1, 3);
|
||||
if (wound_type == -1)
|
||||
{
|
||||
wound_type = rand(0, NUM_ATTRIBUTES - NUM_ATTRIBUTES_PER_GROUP - 1);
|
||||
}
|
||||
attrib_mod[] am = new attrib_mod[1];
|
||||
am[0] = utils.createHealWoundAttribMod(wound_type, power);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
setCount(self, charges);
|
||||
int[] stomach =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
String[] skill_mod =
|
||||
{
|
||||
"healing_ability"
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
int skill_req = rand(25, 100);
|
||||
int[] skill_value =
|
||||
{
|
||||
skill_req
|
||||
};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
LOG("LOG_CHANNEL", "Medicine created!");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/**
|
||||
* Title: medicine_maker.script
|
||||
* Description: Testing script that adds wound medicine attributes to an object
|
||||
*/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.utils;
|
||||
include library.healing;
|
||||
include library.consumable;
|
||||
include library.player_stomach;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
|
||||
string template_name = getTemplateName(self);
|
||||
|
||||
int wound_type = -1;
|
||||
|
||||
// Each template corresponds to a wound_type
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_health.iff")) wound_type = 0;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_constitution.iff")) wound_type = 2;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_action.iff")) wound_type = 3;
|
||||
if (template_name.equals("object/tangible/medicine/medpack_wound_stamina.iff")) wound_type = 5;
|
||||
|
||||
int power = rand(25,150);
|
||||
int charges = rand(1,3);
|
||||
|
||||
//LOG("LOG_CHANNEL", "template_name ->" + template_name + " wound_type ->" + wound_type + " power ->" + power + " charges ->" + charges);
|
||||
|
||||
if (wound_type == -1)
|
||||
{
|
||||
wound_type = rand(0,NUM_ATTRIBUTES-NUM_ATTRIBUTES_PER_GROUP-1);
|
||||
}
|
||||
|
||||
attrib_mod[] am = new attrib_mod[1];
|
||||
am[0] = utils.createHealWoundAttribMod(wound_type, power);
|
||||
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MODS, am);
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_MEDICINE, true);
|
||||
setCount(self, charges);
|
||||
//setObjVar(self, consumable.VAR_CONSUMABLE_CHARGES, charges);
|
||||
|
||||
// Set all stomachs to zero since we aren't currently using the stomach for medicine
|
||||
int[] stomach = {0, 0, 0};
|
||||
setObjVar(self, consumable.VAR_CONSUMABLE_STOMACH_VALUES, stomach);
|
||||
|
||||
// Add in skill mod required data
|
||||
string[] skill_mod = {"healing_ability"};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_REQUIRED, skill_mod);
|
||||
|
||||
// Add in min mod value data
|
||||
int skill_req = rand(25, 100);
|
||||
int[] skill_value = {skill_req};
|
||||
setObjVar(self, consumable.VAR_SKILL_MOD_MIN, skill_value);
|
||||
|
||||
|
||||
LOG("LOG_CHANNEL", "Medicine created!");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class messaging extends script.base_script
|
||||
{
|
||||
public messaging()
|
||||
{
|
||||
}
|
||||
public int setLoginTitle(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
|
||||
{
|
||||
location locTest = getLocation(self);
|
||||
obj_id objPlanetObject = getPlanetByName(locTest.area);
|
||||
setObjVar(objPlanetObject, "strLoginMessageTitle", params);
|
||||
sendSystemMessageTestingOnly(self, "Login Title set");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int setLoginMessage(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
|
||||
{
|
||||
location locTest = getLocation(self);
|
||||
obj_id objPlanetObject = getPlanetByName(locTest.area);
|
||||
setObjVar(objPlanetObject, "strLoginMessage", params);
|
||||
sendSystemMessageTestingOnly(self, "Login message set");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int resendLoginMessageToAll(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
|
||||
{
|
||||
location locTest = getLocation(self);
|
||||
obj_id objPlanetObject = getPlanetByName(locTest.area);
|
||||
String strLoginMessageTitle = "";
|
||||
String strLoginMessage = "";
|
||||
if (hasObjVar(objPlanetObject, "strLoginMessageTitle"))
|
||||
{
|
||||
strLoginMessageTitle = getStringObjVar(objPlanetObject, "strLoginMessageTitle");
|
||||
}
|
||||
if (hasObjVar(objPlanetObject, "strLoginMessage"))
|
||||
{
|
||||
strLoginMessage = getStringObjVar(objPlanetObject, "strLoginMessage");
|
||||
}
|
||||
deltadictionary dctPlayerInformation = objPlanetObject.getScriptVars();
|
||||
obj_id[] objPlayers = dctPlayerInformation.getObjIdArray("objPlayers");
|
||||
int intI = 0;
|
||||
if (objPlayers == null)
|
||||
{
|
||||
debugServerConsoleMsg(self, "Null array for objPlayers");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if ((!strLoginMessage.equals("")) && (!strLoginMessageTitle.equals("")))
|
||||
{
|
||||
while (intI < objPlayers.length)
|
||||
{
|
||||
debugServerConsoleMsg(self, "objPlayers[" + intI + "] is " + objPlayers[intI]);
|
||||
intI = intI + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "No title or message currently set, please set before sending ");
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
|
||||
|
||||
commandHandler setLoginTitle()
|
||||
{
|
||||
|
||||
location locTest = getLocation(self);
|
||||
obj_id objPlanetObject = getPlanetByName(locTest.area);
|
||||
setObjVar(objPlanetObject, "strLoginMessageTitle", params);
|
||||
|
||||
sendSystemMessageTestingOnly(self, "Login Title set");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
commandHandler setLoginMessage()
|
||||
{
|
||||
location locTest = getLocation(self);
|
||||
obj_id objPlanetObject = getPlanetByName(locTest.area);
|
||||
setObjVar(objPlanetObject, "strLoginMessage", params);
|
||||
sendSystemMessageTestingOnly(self, "Login message set");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
commandHandler resendLoginMessageToAll()
|
||||
{
|
||||
location locTest = getLocation(self);
|
||||
obj_id objPlanetObject = getPlanetByName(locTest.area);
|
||||
|
||||
string strLoginMessageTitle = "";
|
||||
string strLoginMessage = "";
|
||||
|
||||
if(hasObjVar(objPlanetObject, "strLoginMessageTitle"))
|
||||
{
|
||||
|
||||
strLoginMessageTitle = getStringObjVar(objPlanetObject, "strLoginMessageTitle");
|
||||
|
||||
}
|
||||
if(hasObjVar(objPlanetObject, "strLoginMessage"))
|
||||
{
|
||||
|
||||
strLoginMessage = getStringObjVar(objPlanetObject, "strLoginMessage");
|
||||
|
||||
}
|
||||
|
||||
deltadictionary dctPlayerInformation = objPlanetObject.getScriptVars();
|
||||
|
||||
obj_id[] objPlayers = dctPlayerInformation.getObjIdArray("objPlayers");
|
||||
int intI = 0;
|
||||
if(objPlayers==null)
|
||||
{
|
||||
debugServerConsoleMsg(self, "Null array for objPlayers");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
}
|
||||
if((strLoginMessage!="")&&(strLoginMessageTitle!=""))
|
||||
{
|
||||
// send persistent chat message
|
||||
while(intI<objPlayers.length)
|
||||
{
|
||||
debugServerConsoleMsg(self, "objPlayers["+intI+"] is "+objPlayers[intI]);
|
||||
//chatSendPersistentMessage("Star Wars Galaxies",getName(objPlayers[intI]), strLoginMessageTitle,strLoginMessage, "");
|
||||
//chatSendPersistentMessage(objPlayers[intI], strLoginMessageTitle,strLoginMessage, "");
|
||||
intI = intI+1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
sendSystemMessageTestingOnly(self, "No title or message currently set, please set before sending ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.ai_lib;
|
||||
import script.library.callable;
|
||||
import script.library.pet_lib;
|
||||
import script.library.utils;
|
||||
import script.library.chat;
|
||||
import script.library.create;
|
||||
|
||||
public class mount_vendor extends script.base_script
|
||||
{
|
||||
public mount_vendor()
|
||||
{
|
||||
}
|
||||
public static final String MOUNT_VENDOR_CONVO = "beta/mount_vendor";
|
||||
public static final int EXPIRATION_TIME = 60 * 60 * 24 * 4;
|
||||
public static final int MOUNT_EXPIRATION_TIME = 60 * 60 * 24 * 7;
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setInvulnerable(self, true);
|
||||
persistObject(self);
|
||||
setCondition(self, CONDITION_CONVERSABLE);
|
||||
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
setObjVar(self, "ai.diction", "townperson");
|
||||
setObjVar(self, "mount_vendor.create", (getGameTime() + EXPIRATION_TIME));
|
||||
setName(self, "Travelling Mount Merchant");
|
||||
messageTo(self, "expireAndCleanup", null, EXPIRATION_TIME, true);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
||||
if (getGameTime() > expirationTime)
|
||||
{
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int expireAndCleanup(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
destroyObject(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
int mnu = mi.addRootMenu(menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data mdata = mi.getMenuItemById(mnu);
|
||||
mdata.setServerNotify(false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnStartNpcConversation(obj_id self, obj_id speaker) throws InterruptedException
|
||||
{
|
||||
chat.setGoodMood(self);
|
||||
faceToBehavior(self, speaker);
|
||||
string_id greeting = new string_id(MOUNT_VENDOR_CONVO, "start");
|
||||
string_id response[] = new string_id[2];
|
||||
response[0] = new string_id(MOUNT_VENDOR_CONVO, "yes");
|
||||
response[1] = new string_id(MOUNT_VENDOR_CONVO, "no");
|
||||
npcStartConversation(speaker, self, MOUNT_VENDOR_CONVO, greeting, response);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnNpcConversationResponse(obj_id self, String convo, obj_id player, string_id response) throws InterruptedException
|
||||
{
|
||||
if (!convo.equals(MOUNT_VENDOR_CONVO))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
npcRemoveConversationResponse(player, response);
|
||||
if ((response.getAsciiId()).equals("yes"))
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(MOUNT_VENDOR_CONVO, "no"));
|
||||
string_id message = new string_id(MOUNT_VENDOR_CONVO, "choose");
|
||||
npcSpeak(player, message);
|
||||
string_id[] responses = new string_id[8];
|
||||
responses[0] = new string_id(MOUNT_VENDOR_CONVO, "carrion_spat");
|
||||
responses[1] = new string_id(MOUNT_VENDOR_CONVO, "kaadu");
|
||||
responses[2] = new string_id(MOUNT_VENDOR_CONVO, "dewback");
|
||||
responses[3] = new string_id(MOUNT_VENDOR_CONVO, "bol");
|
||||
responses[4] = new string_id(MOUNT_VENDOR_CONVO, "falumpaset");
|
||||
responses[5] = new string_id(MOUNT_VENDOR_CONVO, "brackaset");
|
||||
npcSetConversationResponses(player, responses);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if ((response.getAsciiId()).equals("no"))
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(MOUNT_VENDOR_CONVO, "yes"));
|
||||
string_id message = new string_id(MOUNT_VENDOR_CONVO, "goodbye");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String mountType = response.getAsciiId();
|
||||
String diction = "";
|
||||
if (mountType.equals("carrion_spat"))
|
||||
{
|
||||
mountType = "carrion_spat";
|
||||
}
|
||||
else if (mountType.equals("kaadu"))
|
||||
{
|
||||
mountType = "kaadu_motley";
|
||||
}
|
||||
else if (mountType.equals("dewback"))
|
||||
{
|
||||
mountType = "lesser_dewback";
|
||||
}
|
||||
else if (mountType.equals("bol"))
|
||||
{
|
||||
mountType = "bol_lesser_plains";
|
||||
}
|
||||
else if (mountType.equals("falumpaset"))
|
||||
{
|
||||
mountType = "falumpaset_plodding";
|
||||
}
|
||||
else if (mountType.equals("brackaset"))
|
||||
{
|
||||
mountType = "brackaset_lowlands";
|
||||
}
|
||||
else
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
location spawnLoc = getLocation(self);
|
||||
spawnLoc.x += 2;
|
||||
spawnLoc.z += 2;
|
||||
obj_id mount = create.object(mountType, spawnLoc);
|
||||
if (isValidId(mount))
|
||||
{
|
||||
if (!hasScript(player, "ai.pet_master"))
|
||||
{
|
||||
attachScript(player, "ai.pet_master");
|
||||
}
|
||||
if (!createNewMount(player, mount))
|
||||
{
|
||||
destroyObject(mount);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getMountsEnabled())
|
||||
{
|
||||
if (couldPetBeMadeMountable(mount) == 0)
|
||||
{
|
||||
if (makePetMountable(mount))
|
||||
{
|
||||
obj_id petControlDevice = callable.getCallableCD(mount);
|
||||
setObjVar(petControlDevice, "ai.pet.trainedMount", 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "For some reason, the creature spawned can NOT be turned into a mount. Might be out of SCALE, could be several other things.");
|
||||
sendSystemMessageTestingOnly(player, "Anyhow, try making a mount using the REAL way instead of using a fake-out shortcut method. If you've got GOD access, it shouldn't take *much* longer.");
|
||||
sendSystemMessageTestingOnly(player, "And no writing up bugs on a broken TEST script.");
|
||||
}
|
||||
}
|
||||
string_id message = new string_id(MOUNT_VENDOR_CONVO, "ok");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public boolean createNewMount(obj_id master, obj_id pet) throws InterruptedException
|
||||
{
|
||||
String creatureName = ai_lib.getCreatureName(pet);
|
||||
if (creatureName == null || creatureName.equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int petSpecies = ai_lib.aiGetSpecies(pet);
|
||||
if (petSpecies == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (callable.hasCallable(master, callable.CALLABLE_TYPE_RIDEABLE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int petType = pet_lib.getPetType(pet);
|
||||
if (!pet_lib.hasMaxStoredPetsOfType(master, petType))
|
||||
{
|
||||
if (!callable.hasCallableCD(pet))
|
||||
{
|
||||
obj_id datapad = utils.getPlayerDatapad(master);
|
||||
if (!isIdValid(datapad))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String controlTemplate = "object/intangible/pet/" + utils.dataTableGetString(create.CREATURE_TABLE, creatureName, "template");
|
||||
if (!controlTemplate.endsWith(".iff"))
|
||||
{
|
||||
controlTemplate = pet_lib.PET_CTRL_DEVICE_TEMPLATE;
|
||||
}
|
||||
obj_id petControlDevice = createObject(controlTemplate, datapad, "");
|
||||
if (!isIdValid(petControlDevice))
|
||||
{
|
||||
petControlDevice = createObject(pet_lib.PET_CTRL_DEVICE_TEMPLATE, datapad, "");
|
||||
if (!isIdValid(petControlDevice))
|
||||
{
|
||||
sendSystemMessage(master, pet_lib.SID_SYS_TOO_MANY_STORED_PETS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
pet_lib.setUpPetControlDevice(petControlDevice, pet);
|
||||
callable.setCallableLinks(master, petControlDevice, pet);
|
||||
setObjVar(petControlDevice, "mount_vendor.create", (getGameTime() + MOUNT_EXPIRATION_TIME));
|
||||
messageTo(petControlDevice, "expireAndCleanup", null, MOUNT_EXPIRATION_TIME, true);
|
||||
attachScript(petControlDevice, "beta.free_mount");
|
||||
}
|
||||
else
|
||||
{
|
||||
callable.setCallableLinks(master, callable.getCallableCD(pet), pet);
|
||||
}
|
||||
dictionary params = new dictionary();
|
||||
params.put("pet", pet);
|
||||
params.put("master", master);
|
||||
messageTo(pet, "handleAddMaster", params, 1, false);
|
||||
return true;
|
||||
}
|
||||
sendSystemMessage(master, pet_lib.SID_SYS_TOO_MANY_STORED_PETS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,249 +0,0 @@
|
||||
include library.ai_lib;
|
||||
include library.callable;
|
||||
include library.pet_lib;
|
||||
include library.utils;
|
||||
include library.chat;
|
||||
include library.create;
|
||||
|
||||
const string MOUNT_VENDOR_CONVO = "beta/mount_vendor";
|
||||
|
||||
const int EXPIRATION_TIME = 60 * 60 * 24 * 4; // 4 days
|
||||
const int MOUNT_EXPIRATION_TIME = 60 * 60 * 24 * 7; // 7 days
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
setInvulnerable(self, true);
|
||||
persistObject(self);
|
||||
setCondition(self, CONDITION_CONVERSABLE);
|
||||
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
setObjVar(self, "ai.diction", "townperson");
|
||||
setObjVar(self, "mount_vendor.create", (getGameTime() + EXPIRATION_TIME));
|
||||
setName(self, "Travelling Mount Merchant");
|
||||
|
||||
messageTo (self, "expireAndCleanup", null, EXPIRATION_TIME, true);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "mount_vendor.create");
|
||||
|
||||
if(getGameTime() > expirationTime)
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler expireAndCleanup()
|
||||
{
|
||||
destroyObject(self);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
int mnu = mi.addRootMenu (menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data mdata = mi.getMenuItemById(mnu);
|
||||
mdata.setServerNotify(false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
trigger OnStartNpcConversation (obj_id speaker)
|
||||
{
|
||||
chat.setGoodMood(self);
|
||||
|
||||
faceToBehavior(self, speaker);
|
||||
string_id greeting = new string_id (MOUNT_VENDOR_CONVO, "start");//Wanna buy a mount?
|
||||
string_id response[] = new string_id [2];
|
||||
response[0] = new string_id (MOUNT_VENDOR_CONVO, "yes");//yes
|
||||
response[1] = new string_id (MOUNT_VENDOR_CONVO, "no");//no
|
||||
|
||||
npcStartConversation (speaker, self, MOUNT_VENDOR_CONVO, greeting, response);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnNpcConversationResponse(string convo, obj_id player, string_id response)
|
||||
{
|
||||
if(!convo.equals(MOUNT_VENDOR_CONVO))
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
npcRemoveConversationResponse(player, response);
|
||||
|
||||
if(response.getAsciiId().equals("yes"))//yes
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(MOUNT_VENDOR_CONVO, "no"));
|
||||
|
||||
string_id message = new string_id (MOUNT_VENDOR_CONVO, "choose");//pick a droid
|
||||
npcSpeak(player, message);
|
||||
string_id[] responses = new string_id[8];
|
||||
responses[0] = new string_id(MOUNT_VENDOR_CONVO, "carrion_spat");
|
||||
responses[1] = new string_id(MOUNT_VENDOR_CONVO, "kaadu");
|
||||
responses[2] = new string_id(MOUNT_VENDOR_CONVO, "dewback");
|
||||
responses[3] = new string_id(MOUNT_VENDOR_CONVO, "bol");
|
||||
responses[4] = new string_id(MOUNT_VENDOR_CONVO, "falumpaset");
|
||||
responses[5] = new string_id(MOUNT_VENDOR_CONVO, "brackaset");
|
||||
npcSetConversationResponses(player, responses);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if(response.getAsciiId().equals("no"))//no
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(MOUNT_VENDOR_CONVO, "yes"));
|
||||
|
||||
string_id message = new string_id (MOUNT_VENDOR_CONVO, "goodbye");//goodbye
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string mountType = response.getAsciiId();
|
||||
|
||||
string diction = "";
|
||||
|
||||
if(mountType.equals("carrion_spat"))
|
||||
mountType = "carrion_spat";
|
||||
else if(mountType.equals("kaadu"))
|
||||
mountType = "kaadu_motley";
|
||||
else if(mountType.equals("dewback"))
|
||||
mountType = "lesser_dewback";
|
||||
else if(mountType.equals("bol"))
|
||||
mountType = "bol_lesser_plains";
|
||||
else if(mountType.equals("falumpaset"))
|
||||
mountType = "falumpaset_plodding";
|
||||
else if(mountType.equals("brackaset"))
|
||||
mountType = "brackaset_lowlands";
|
||||
else
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
location spawnLoc = getLocation(self);
|
||||
spawnLoc.x += 2;
|
||||
spawnLoc.z += 2;
|
||||
|
||||
obj_id mount = create.object(mountType, spawnLoc);
|
||||
|
||||
if(isValidId(mount))
|
||||
{
|
||||
//attachScript(mount, "ai.pet_advance");
|
||||
if(!hasScript(player, "ai.pet_master"))
|
||||
{
|
||||
attachScript(player, "ai.pet_master");
|
||||
}
|
||||
|
||||
if(!createNewMount(player, mount))
|
||||
{
|
||||
destroyObject(mount);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(getMountsEnabled())
|
||||
{
|
||||
if(couldPetBeMadeMountable(mount) == 0)
|
||||
{
|
||||
if(makePetMountable(mount))
|
||||
{
|
||||
obj_id petControlDevice = callable.getCallableCD(mount);
|
||||
setObjVar(petControlDevice, "ai.pet.trainedMount", 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "For some reason, the creature spawned can NOT be turned into a mount. Might be out of SCALE, could be several other things.");
|
||||
sendSystemMessageTestingOnly(player, "Anyhow, try making a mount using the REAL way instead of using a fake-out shortcut method. If you've got GOD access, it shouldn't take *much* longer.");
|
||||
sendSystemMessageTestingOnly(player, "And no writing up bugs on a broken TEST script.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
string_id message = new string_id(MOUNT_VENDOR_CONVO, "ok");//here you go
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
boolean createNewMount(obj_id master, obj_id pet)
|
||||
{
|
||||
string creatureName = ai_lib.getCreatureName(pet);
|
||||
|
||||
if(creatureName == null || creatureName == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int petSpecies = ai_lib.aiGetSpecies(pet);
|
||||
|
||||
if(petSpecies == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(callable.hasCallable(master, callable.CALLABLE_TYPE_RIDEABLE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int petType = pet_lib.getPetType(pet);
|
||||
|
||||
if(!pet_lib.hasMaxStoredPetsOfType(master, petType))
|
||||
{
|
||||
if(!callable.hasCallableCD(pet))
|
||||
{
|
||||
obj_id datapad = utils.getPlayerDatapad(master);
|
||||
|
||||
if(!isIdValid(datapad))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string controlTemplate = "object/intangible/pet/" + utils.dataTableGetString(create.CREATURE_TABLE, creatureName, "template");
|
||||
|
||||
if(!controlTemplate.endsWith(".iff"))
|
||||
{
|
||||
controlTemplate = pet_lib.PET_CTRL_DEVICE_TEMPLATE;
|
||||
}
|
||||
|
||||
obj_id petControlDevice = createObject(controlTemplate, datapad, "");
|
||||
|
||||
if(!isIdValid(petControlDevice))
|
||||
{
|
||||
petControlDevice = createObject(pet_lib.PET_CTRL_DEVICE_TEMPLATE, datapad, "");
|
||||
|
||||
if(!isIdValid(petControlDevice))
|
||||
{
|
||||
sendSystemMessage(master, pet_lib.SID_SYS_TOO_MANY_STORED_PETS);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
pet_lib.setUpPetControlDevice(petControlDevice, pet);
|
||||
callable.setCallableLinks(master, petControlDevice, pet);
|
||||
|
||||
setObjVar(petControlDevice, "mount_vendor.create", (getGameTime() + MOUNT_EXPIRATION_TIME));
|
||||
messageTo(petControlDevice, "expireAndCleanup", null, MOUNT_EXPIRATION_TIME, true);
|
||||
attachScript(petControlDevice, "beta.free_mount");
|
||||
}
|
||||
else
|
||||
{
|
||||
callable.setCallableLinks(master, callable.getCallableCD(pet), pet);
|
||||
}
|
||||
|
||||
dictionary params = new dictionary();
|
||||
params.put("pet", pet);
|
||||
params.put("master", master);
|
||||
|
||||
messageTo(pet, "handleAddMaster", params, 1, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
sendSystemMessage(master, pet_lib.SID_SYS_TOO_MANY_STORED_PETS);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
|
||||
public class move_player extends script.base_script
|
||||
{
|
||||
public move_player()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
String[] elems = split(text, ' ');
|
||||
if (elems.length < 4)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (elems[0] == null)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (!elems[0].equals("move"))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id target = utils.stringToObjId(elems[1]);
|
||||
if (!isIdValid(target))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (!isPlayer(target))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
float x = utils.stringToFloat(elems[2]);
|
||||
float z = utils.stringToFloat(elems[3]);
|
||||
location destLoc = new location(getLocation(self));
|
||||
destLoc.x = x;
|
||||
destLoc.z = z;
|
||||
if (elems.length > 4)
|
||||
{
|
||||
destLoc.area = elems[4];
|
||||
}
|
||||
warpPlayer(target, destLoc.area, destLoc.x, 0.0f, destLoc.z, null, 0.0f, 0.0f, 0.0f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
include library.utils;
|
||||
|
||||
trigger OnSpeaking( string text )
|
||||
{
|
||||
string[] elems = split( text, ' ' );
|
||||
if ( elems.length < 4 )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
if (elems[0]==null )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
if ( elems[0]!="move" )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
obj_id target = utils.stringToObjId( elems[1] );
|
||||
if ( !isIdValid( target ) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
if ( !isPlayer( target ) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
float x = utils.stringToFloat( elems[2] );
|
||||
float z = utils.stringToFloat( elems[3] );
|
||||
|
||||
location destLoc = new location (getLocation( self ));
|
||||
destLoc.x = x;
|
||||
destLoc.z = z;
|
||||
|
||||
if ( elems.length > 4 )
|
||||
{
|
||||
destLoc.area = elems[4];
|
||||
}
|
||||
|
||||
warpPlayer(target, destLoc.area, destLoc.x, 0.0f, destLoc.z, null, 0.0f, 0.0f, 0.0f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.create;
|
||||
import script.library.pet_lib;
|
||||
import script.library.colors;
|
||||
import script.ai.ai_combat;
|
||||
|
||||
public class pet_test extends script.base_script
|
||||
{
|
||||
public pet_test()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
debugSpeakMsg(self, "Pet test ready.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
location playerLocation = getLocation(self);
|
||||
if (text.equals("beginpetdemo"))
|
||||
{
|
||||
petTest(self);
|
||||
}
|
||||
else if (text.equals("endpetdemo"))
|
||||
{
|
||||
endPetTest(self);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void petTest(obj_id self) throws InterruptedException
|
||||
{
|
||||
grantSkill(self, "outdoors_creaturehandler_master");
|
||||
grantSkill(self, "outdoors_creaturehandler_support_04");
|
||||
grantSkill(self, "outdoors_creaturehandler_healing_04");
|
||||
grantSkill(self, "outdoors_creaturehandler_training_04");
|
||||
grantSkill(self, "outdoors_creaturehandler_taming_04");
|
||||
grantSkill(self, "outdoors_creaturehandler_taming_03");
|
||||
grantSkill(self, "outdoors_creaturehandler_training_03");
|
||||
grantSkill(self, "outdoors_creaturehandler_healing_03");
|
||||
grantSkill(self, "outdoors_creaturehandler_support_03");
|
||||
grantSkill(self, "outdoors_creaturehandler_training_02");
|
||||
grantSkill(self, "outdoors_creaturehandler_taming_02");
|
||||
grantSkill(self, "outdoors_creaturehandler_healing_02");
|
||||
grantSkill(self, "outdoors_creaturehandler_support_02");
|
||||
grantSkill(self, "outdoors_creaturehandler_taming_01");
|
||||
grantSkill(self, "outdoors_creaturehandler_training_01");
|
||||
grantSkill(self, "outdoors_creaturehandler_healing_01");
|
||||
grantSkill(self, "outdoors_creaturehandler_support_01");
|
||||
grantSkill(self, "outdoors_creaturehandler_novice");
|
||||
obj_id pet = create.object("bantha", getLocation(self));
|
||||
attachScript(pet, "ai.pet_advance");
|
||||
pet_lib.makePet(pet, self);
|
||||
showFlyTextPrivate(pet, self, new string_id("npc_reaction/flytext", "success"), 1.5f, colors.FORESTGREEN);
|
||||
setObjVar(pet, "ai.pet.commandList" + pet_lib.COMMAND_FOLLOW, "bob follow me");
|
||||
setObjVar(pet, "ai.pet.commandList" + pet_lib.COMMAND_ATTACK, "bob attack");
|
||||
setObjVar(pet, "ai.pet.commandList" + pet_lib.COMMAND_TRICK_1, "bob do a trick");
|
||||
setObjVar(self, "pet_test.pet_id", pet);
|
||||
sendSystemMessage(self, "Ready for pet demonstration.", null);
|
||||
}
|
||||
public void endPetTest(obj_id self) throws InterruptedException
|
||||
{
|
||||
obj_id pet = getObjIdObjVar(self, "pet_test.pet_id");
|
||||
if (!isIdValid(pet))
|
||||
{
|
||||
return;
|
||||
}
|
||||
pet_lib.removeFromPetList(pet);
|
||||
messageTo(self, "destroyPet", null, 2.f, true);
|
||||
}
|
||||
public int destroyPet(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id pet = getObjIdObjVar(self, "pet_test.pet_id");
|
||||
if (!isIdValid(pet))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
destroyObject(pet);
|
||||
sendSystemMessage(self, "Pet demonstration complete.", null);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
//------------------------------------------------
|
||||
// pet_test.script
|
||||
//------------------------------------------------
|
||||
|
||||
//------------------------------------------------
|
||||
// Includes
|
||||
//------------------------------------------------
|
||||
|
||||
include library.create;
|
||||
include library.pet_lib;
|
||||
include library.colors;
|
||||
include ai.ai_combat;
|
||||
|
||||
//-----------------------------------------------
|
||||
// OnAttach
|
||||
//-----------------------------------------------
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
debugSpeakMsg( self, "Pet test ready." );
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// OnSpeaking
|
||||
//------------------------------------------------
|
||||
|
||||
trigger OnSpeaking( string text )
|
||||
{
|
||||
// Get the location of the player?
|
||||
location playerLocation = getLocation( self );
|
||||
|
||||
if ( text == "beginpetdemo" )
|
||||
{
|
||||
petTest( self );
|
||||
}
|
||||
else if ( text == "endpetdemo" )
|
||||
{
|
||||
endPetTest( self );
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// petTest
|
||||
//-----------------------------------------------
|
||||
|
||||
void petTest( obj_id self )
|
||||
{
|
||||
// Attach pet skills.
|
||||
grantSkill( self, "outdoors_creaturehandler_master" );
|
||||
grantSkill( self, "outdoors_creaturehandler_support_04" );
|
||||
grantSkill( self, "outdoors_creaturehandler_healing_04" );
|
||||
grantSkill( self, "outdoors_creaturehandler_training_04" );
|
||||
grantSkill( self, "outdoors_creaturehandler_taming_04" );
|
||||
grantSkill( self, "outdoors_creaturehandler_taming_03" );
|
||||
grantSkill( self, "outdoors_creaturehandler_training_03" );
|
||||
grantSkill( self, "outdoors_creaturehandler_healing_03" );
|
||||
grantSkill( self, "outdoors_creaturehandler_support_03" );
|
||||
grantSkill( self, "outdoors_creaturehandler_training_02" );
|
||||
grantSkill( self, "outdoors_creaturehandler_taming_02" );
|
||||
grantSkill( self, "outdoors_creaturehandler_healing_02" );
|
||||
grantSkill( self, "outdoors_creaturehandler_support_02" );
|
||||
grantSkill( self, "outdoors_creaturehandler_taming_01" );
|
||||
grantSkill( self, "outdoors_creaturehandler_training_01" );
|
||||
grantSkill( self, "outdoors_creaturehandler_healing_01" );
|
||||
grantSkill( self, "outdoors_creaturehandler_support_01" );
|
||||
grantSkill( self, "outdoors_creaturehandler_novice" );
|
||||
|
||||
// Create a pet.
|
||||
obj_id pet = create.object( "bantha", getLocation(self) );
|
||||
|
||||
// Attach pet script.
|
||||
attachScript( pet, "ai.pet_advance" );
|
||||
|
||||
// Make it our pet.
|
||||
pet_lib.makePet( pet, self );
|
||||
showFlyTextPrivate( pet, self, new string_id( "npc_reaction/flytext", "success" ), 1.5f, colors.FORESTGREEN );
|
||||
|
||||
// Teach it some commands.
|
||||
setObjVar( pet, "ai.pet.commandList"+pet_lib.COMMAND_FOLLOW, "bob follow me");
|
||||
setObjVar( pet, "ai.pet.commandList"+pet_lib.COMMAND_ATTACK, "bob attack");
|
||||
setObjVar( pet, "ai.pet.commandList"+pet_lib.COMMAND_TRICK_1, "bob do a trick");
|
||||
|
||||
// Store the pet.
|
||||
setObjVar( self, "pet_test.pet_id", pet );
|
||||
|
||||
// Send a system message.
|
||||
sendSystemMessage( self, "Ready for pet demonstration.", null );
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// endPetTest
|
||||
//-----------------------------------------------
|
||||
|
||||
void endPetTest( obj_id self )
|
||||
{
|
||||
// Get a reference to the pet.
|
||||
obj_id pet = getObjIdObjVar( self, "pet_test.pet_id" );
|
||||
if ( !isIdValid( pet ) )
|
||||
return;
|
||||
|
||||
// Untame the pet.
|
||||
pet_lib.removeFromPetList( pet );
|
||||
|
||||
// Destroy the pet.
|
||||
messageTo( self, "destroyPet", null, 2.f, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// destroyPet
|
||||
//-----------------------------------------------
|
||||
|
||||
messageHandler destroyPet()
|
||||
{
|
||||
// Get a reference to the pet.
|
||||
obj_id pet = getObjIdObjVar( self, "pet_test.pet_id" );
|
||||
if ( !isIdValid( pet ) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
// Kill it.
|
||||
destroyObject( pet );
|
||||
|
||||
// Remove CH skills.
|
||||
/*
|
||||
revokeSkill( self, "outdoors_creaturehandler_novice" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_taming_01" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_taming_02" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_taming_03" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_taming_04" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_training_01" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_training_02" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_training_03" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_training_04" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_healing_01" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_healing_02" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_healing_03" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_healing_04" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_support_01" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_support_02" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_support_03" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_support_04" );
|
||||
revokeSkill( self, "outdoors_creaturehandler_master" );
|
||||
*/
|
||||
|
||||
// Send a system message.
|
||||
sendSystemMessage( self, "Pet demonstration complete.", null );
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
|
||||
public class player_warp extends script.base_script
|
||||
{
|
||||
public player_warp()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
if (text.startsWith("warp"))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() < 5)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "format: warp <planet> <x> <y> <z>");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
String planet = st.nextToken();
|
||||
float x = (float)utils.stringToInt(st.nextToken());
|
||||
float y = (float)utils.stringToInt(st.nextToken());
|
||||
float z = (float)utils.stringToInt(st.nextToken());
|
||||
warpPlayer(self, planet, x, y, z, null, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
if (text.startsWith("create"))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() < 2)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "format: create <template>");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id inv = getObjectInSlot(self, "inventory");
|
||||
if (inv == null)
|
||||
{
|
||||
LOG("LOG_CHANNEL", "player_warp: create -- Unable to get an inventory slot for " + self);
|
||||
sendSystemMessageTestingOnly(self, "Your inventory object is null!");
|
||||
}
|
||||
String command = st.nextToken();
|
||||
String template = st.nextToken();
|
||||
if (template == null || template.length() < 1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "That is an invalid object.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
LOG("LOG_CHANNEL", "template ->" + template);
|
||||
int template_idx = dataTableSearchColumnForString(template, "Template", "datatables/beta/restricted_template.iff");
|
||||
LOG("LOG_CHANNEL", "template_idx ->" + template_idx);
|
||||
if (template_idx != -1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "You cannot create that object.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int num_rows = dataTableGetNumRows("datatables/beta/restricted_template.iff");
|
||||
for (int i = 0; i < num_rows; i++)
|
||||
{
|
||||
dictionary row = dataTableGetRow("datatables/beta/restricted_template.iff", i);
|
||||
if (row != null)
|
||||
{
|
||||
String directory = row.getString("Directory");
|
||||
if (directory.length() > 0)
|
||||
{
|
||||
if ((template.indexOf(directory)) != -1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "You cannot create that object.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (template.length() < 1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "That is an invalid object.");
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id object = createObjectOverloaded(template, inv);
|
||||
if (!isIdValid(object))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "That is an invalid object.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, object + " created.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/**********************************************************************
|
||||
* Title: player_warp
|
||||
* Description: Enables the warping to a specified location.
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.utils;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
if (text.startsWith("warp"))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() < 5)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "format: warp <planet> <x> <y> <z>");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
string planet = st.nextToken();
|
||||
|
||||
float x = (float)utils.stringToInt(st.nextToken());
|
||||
float y = (float)utils.stringToInt(st.nextToken());
|
||||
float z = (float)utils.stringToInt(st.nextToken());
|
||||
|
||||
//LOG("LOG_CHANNEL", "loc ->" + x + "/" + y + "/" + z);
|
||||
|
||||
warpPlayer(self, planet, x, y, z, null, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.startsWith("create"))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() < 2)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "format: create <template>");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id inv = getObjectInSlot(self, "inventory");
|
||||
if (inv == null)
|
||||
{
|
||||
LOG("LOG_CHANNEL", "player_warp: create -- Unable to get an inventory slot for " + self);
|
||||
sendSystemMessageTestingOnly(self, "Your inventory object is null!");
|
||||
}
|
||||
|
||||
string command = st.nextToken();
|
||||
string template = st.nextToken();
|
||||
|
||||
if (template == null || template.length() < 1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "That is an invalid object.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
// Check the template against the restricted template list.
|
||||
LOG("LOG_CHANNEL", "template ->" + template);
|
||||
int template_idx = dataTableSearchColumnForString(template, "Template", "datatables/beta/restricted_template.iff");
|
||||
LOG("LOG_CHANNEL", "template_idx ->" + template_idx);
|
||||
if (template_idx != -1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "You cannot create that object.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
// Check for restricted directories.
|
||||
int num_rows = dataTableGetNumRows ("datatables/beta/restricted_template.iff");
|
||||
for (int i = 0; i < num_rows; i++)
|
||||
{
|
||||
dictionary row = dataTableGetRow("datatables/beta/restricted_template.iff", i);
|
||||
if (row != null)
|
||||
{
|
||||
string directory = row.getString("Directory");
|
||||
if (directory.length() > 0)
|
||||
{
|
||||
if ((template.indexOf(directory)) != -1)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "You cannot create that object.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (template.length() < 1)
|
||||
sendSystemMessageTestingOnly(self, "That is an invalid object.");
|
||||
else
|
||||
{
|
||||
obj_id object = createObjectOverloaded(template, inv);
|
||||
if (!isIdValid(object))
|
||||
sendSystemMessageTestingOnly(self, "That is an invalid object.");
|
||||
else
|
||||
sendSystemMessageTestingOnly(self, object + " created.");
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.factions;
|
||||
import script.library.utils;
|
||||
|
||||
public class pvp_test extends script.base_script
|
||||
{
|
||||
public pvp_test()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "PvP debug script attached.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
if (text.startsWith("pvp "))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(toLower(text));
|
||||
String arg = st.nextToken();
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if (target == null || target == obj_id.NULL_ID)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "PVP_STATUS: no target designated. assuming target = self");
|
||||
target = self;
|
||||
}
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
do
|
||||
{
|
||||
arg = st.nextToken();
|
||||
if (arg.equals("status"))
|
||||
{
|
||||
int type = pvpGetType(target);
|
||||
int faction = pvpGetAlignedFaction(target);
|
||||
String sType = "neutral";
|
||||
String sFaction = "mercenary";
|
||||
switch (type)
|
||||
{
|
||||
case PVPTYPE_NEUTRAL:
|
||||
break;
|
||||
case PVPTYPE_COVERT:
|
||||
sType = "covert";
|
||||
break;
|
||||
case PVPTYPE_DECLARED:
|
||||
sType = "declared";
|
||||
break;
|
||||
default:
|
||||
sType = "type_other";
|
||||
break;
|
||||
}
|
||||
switch (faction)
|
||||
{
|
||||
case 0:
|
||||
sFaction = "mercenary";
|
||||
break;
|
||||
case (370444368):
|
||||
sFaction = "rebel";
|
||||
break;
|
||||
case (-615855020):
|
||||
sFaction = "imperial";
|
||||
break;
|
||||
default:
|
||||
sFaction = "faction_other";
|
||||
break;
|
||||
}
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + ") is a " + sType + " " + sFaction);
|
||||
displayEnemyFlags(self, target);
|
||||
}
|
||||
else if (arg.equals("enemyTo"))
|
||||
{
|
||||
displayEnemyFlags(self, target);
|
||||
}
|
||||
else if (arg.equals("unalign") || arg.equals("mercenary"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): faction set UNALIGNED");
|
||||
pvpSetAlignedFaction(target, 0);
|
||||
}
|
||||
else if (arg.equals("rebel"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): faction set REBEL");
|
||||
pvpSetAlignedFaction(target, (370444368));
|
||||
}
|
||||
else if (arg.equals("imperial"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): faction set IMPERIAL");
|
||||
pvpSetAlignedFaction(target, (-615855020));
|
||||
}
|
||||
else if (arg.equals("neutral"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): type set NEUTRAL");
|
||||
pvpMakeNeutral(target);
|
||||
}
|
||||
else if (arg.equals("covert"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): type set COVERT");
|
||||
pvpMakeCovert(target);
|
||||
}
|
||||
else if (arg.equals("declared"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): type set DECLARED");
|
||||
pvpMakeDeclared(target);
|
||||
}
|
||||
else if (arg.equals("clear"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): clearing temp enemy flags");
|
||||
pvpRemoveAllTempEnemyFlags(target);
|
||||
}
|
||||
else if (arg.equals("faction"))
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): " + factions.getFaction(target));
|
||||
}
|
||||
else if (arg.equals("nonaggressive"))
|
||||
{
|
||||
pvpMakeNeutral(target);
|
||||
pvpSetAlignedFaction(target, (221551254));
|
||||
pvpMakeDeclared(target);
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): " + factions.getFaction(target));
|
||||
}
|
||||
} while (st.hasMoreTokens());
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public boolean displayEnemyFlags(obj_id player, obj_id target) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String[] enemies = pvpGetEnemyFlags(target);
|
||||
if (enemies != null)
|
||||
{
|
||||
for (int i = 0; i < enemies.length; ++i)
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(enemies[i]);
|
||||
String sTarget = st.nextToken();
|
||||
String sTargetName = getPlayerName(utils.stringToObjId(sTarget));
|
||||
String sTefFac = st.nextToken();
|
||||
int iTefFac = utils.stringToInt(sTefFac);
|
||||
String sTefFacName = "<unknown>";
|
||||
if (iTefFac == (-526735576))
|
||||
{
|
||||
sTefFacName = "battlefield";
|
||||
}
|
||||
else if (iTefFac == (1183528962))
|
||||
{
|
||||
sTefFacName = "duel";
|
||||
}
|
||||
else if (iTefFac == (-429740311))
|
||||
{
|
||||
sTefFacName = "bountyduel";
|
||||
}
|
||||
else if (iTefFac == (221551254))
|
||||
{
|
||||
sTefFacName = "nonaggressive";
|
||||
}
|
||||
else if (iTefFac == (-160237431))
|
||||
{
|
||||
sTefFacName = "unattackable";
|
||||
}
|
||||
else if (iTefFac == (84709322))
|
||||
{
|
||||
sTefFacName = "bountytarget";
|
||||
}
|
||||
else if (iTefFac == (-1526926610))
|
||||
{
|
||||
sTefFacName = "guildwarcooldownperiod";
|
||||
}
|
||||
else if (iTefFac == (-615855020))
|
||||
{
|
||||
sTefFacName = "imperial";
|
||||
}
|
||||
else if (iTefFac == (370444368))
|
||||
{
|
||||
sTefFacName = "rebel";
|
||||
}
|
||||
else if (iTefFac == (-377582139))
|
||||
{
|
||||
sTefFacName = "bubblecombat";
|
||||
}
|
||||
String sExpiration = st.nextToken();
|
||||
sendSystemMessageTestingOnly(player, "(" + player + " " + getName(player) + ") Enemy Flag: [" + sTarget + " (" + sTargetName + "), " + sTefFac + " (" + sTefFacName + "), " + sExpiration + "ms" + "]");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
|
||||
include library.factions;
|
||||
include library.utils;
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "PvP debug script attached.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
if ( text.startsWith("pvp ") )
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(toLower(text));
|
||||
string arg = st.nextToken(); //skip first token
|
||||
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if ( target == null || target == obj_id.NULL_ID)
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "PVP_STATUS: no target designated. assuming target = self");
|
||||
target = self;
|
||||
}
|
||||
|
||||
/*
|
||||
if ( !isPlayer(target) )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "PVP_STATUS: target (" + target + " - " + getName(target) + ") is not a player. aborting...");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
*/
|
||||
|
||||
if ( st.hasMoreTokens() )
|
||||
{
|
||||
do
|
||||
{
|
||||
arg = st.nextToken();
|
||||
if ( arg.equals("status") )
|
||||
{
|
||||
int type = pvpGetType(target);
|
||||
int faction = pvpGetAlignedFaction(target);
|
||||
|
||||
string sType = "neutral";
|
||||
string sFaction = "mercenary";
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case PVPTYPE_NEUTRAL:
|
||||
break;
|
||||
|
||||
case PVPTYPE_COVERT:
|
||||
sType = "covert";
|
||||
break;
|
||||
|
||||
case PVPTYPE_DECLARED:
|
||||
sType = "declared";
|
||||
break;
|
||||
|
||||
default:
|
||||
sType = "type_other";
|
||||
break;
|
||||
}
|
||||
|
||||
switch (faction)
|
||||
{
|
||||
case 0:
|
||||
sFaction = "mercenary";
|
||||
break;
|
||||
|
||||
case ##"rebel":
|
||||
sFaction = "rebel";
|
||||
break;
|
||||
|
||||
case ##"imperial":
|
||||
sFaction = "imperial";
|
||||
break;
|
||||
|
||||
default:
|
||||
sFaction = "faction_other";
|
||||
break;
|
||||
}
|
||||
|
||||
/*if ( (sType.equals("hosed")) || (sFaction.equals("hosed")) )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, "pvp type/faction hosed for obj_id " + target);
|
||||
}
|
||||
else if ( type == PVPTYPE_NEUTRAL )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + ") is pvp neutral.");
|
||||
}
|
||||
else
|
||||
{*/
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + ") is a " + sType + " " + sFaction);
|
||||
/*}*/
|
||||
|
||||
displayEnemyFlags(self, target);
|
||||
}
|
||||
else if ( arg.equals("enemyTo") )
|
||||
{
|
||||
displayEnemyFlags(self, target);
|
||||
}
|
||||
else if ( arg.equals("unalign") || arg.equals("mercenary") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): faction set UNALIGNED");
|
||||
pvpSetAlignedFaction(target, 0);
|
||||
}
|
||||
else if ( arg.equals("rebel") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): faction set REBEL");
|
||||
pvpSetAlignedFaction(target, ##"rebel");
|
||||
}
|
||||
else if ( arg.equals("imperial") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): faction set IMPERIAL");
|
||||
pvpSetAlignedFaction(target, ##"imperial");
|
||||
}
|
||||
else if ( arg.equals("neutral") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): type set NEUTRAL");
|
||||
pvpMakeNeutral(target);
|
||||
}
|
||||
else if ( arg.equals("covert") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): type set COVERT");
|
||||
pvpMakeCovert(target);
|
||||
}
|
||||
else if ( arg.equals("declared") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): type set DECLARED");
|
||||
pvpMakeDeclared(target);
|
||||
}
|
||||
else if ( arg.equals("clear") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): clearing temp enemy flags");
|
||||
pvpRemoveAllTempEnemyFlags(target);
|
||||
}
|
||||
else if ( arg.equals("faction") )
|
||||
{
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): " + factions.getFaction(target));
|
||||
}
|
||||
else if ( arg.equals("nonaggressive") )
|
||||
{
|
||||
pvpMakeNeutral(target);
|
||||
pvpSetAlignedFaction(target, ##"nonaggressive");
|
||||
pvpMakeDeclared(target);
|
||||
|
||||
sendSystemMessageTestingOnly(self, getName(target) + "(" + target + "): " + factions.getFaction(target));
|
||||
}
|
||||
} while (st.hasMoreTokens());
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
boolean displayEnemyFlags(obj_id player, obj_id target)
|
||||
{
|
||||
if (!isIdValid(target))
|
||||
return false;
|
||||
|
||||
String[] enemies = pvpGetEnemyFlags(target);
|
||||
if (enemies != null)
|
||||
{
|
||||
for (int i = 0; i < enemies.length; ++i)
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(enemies[i]);
|
||||
string sTarget = st.nextToken();
|
||||
string sTargetName = getPlayerName(utils.stringToObjId(sTarget));
|
||||
|
||||
string sTefFac = st.nextToken();
|
||||
int iTefFac = utils.stringToInt(sTefFac);
|
||||
string sTefFacName = "<unknown>";
|
||||
|
||||
if (iTefFac == ##"battlefield")
|
||||
sTefFacName = "battlefield";
|
||||
else if (iTefFac == ##"duel")
|
||||
sTefFacName = "duel";
|
||||
else if (iTefFac == ##"bountyduel")
|
||||
sTefFacName = "bountyduel";
|
||||
else if (iTefFac == ##"nonaggressive")
|
||||
sTefFacName = "nonaggressive";
|
||||
else if (iTefFac == ##"unattackable")
|
||||
sTefFacName = "unattackable";
|
||||
else if (iTefFac == ##"bountytarget")
|
||||
sTefFacName = "bountytarget";
|
||||
else if (iTefFac == ##"guildwarcooldownperiod")
|
||||
sTefFacName = "guildwarcooldownperiod";
|
||||
else if (iTefFac == ##"imperial")
|
||||
sTefFacName = "imperial";
|
||||
else if (iTefFac == ##"rebel")
|
||||
sTefFacName = "rebel";
|
||||
else if (iTefFac == ##"bubblecombat")
|
||||
sTefFacName = "bubblecombat";
|
||||
|
||||
string sExpiration = st.nextToken();
|
||||
|
||||
sendSystemMessageTestingOnly(player, "(" + player + " " + getName(player) + ") Enemy Flag: [" + sTarget + " (" + sTargetName + "), " + sTefFac + " (" + sTefFacName + "), " + sExpiration + "ms" + "]");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.skill;
|
||||
|
||||
public class skills_survey_specialist extends script.base_script
|
||||
{
|
||||
public skills_survey_specialist()
|
||||
{
|
||||
}
|
||||
public static final String SKILL_NAME = "crafting_artisan_master";
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
String[] reqs = skill.getAllRequiredSkills(SKILL_NAME);
|
||||
if ((reqs == null) || (reqs.length == 0))
|
||||
{
|
||||
debugSpeakMsg(self, "Unable to assign all skills related to " + SKILL_NAME);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < reqs.length; i++)
|
||||
{
|
||||
grantSkill(self, reqs[i]);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDetach(obj_id self) throws InterruptedException
|
||||
{
|
||||
String[] reqs = skill.getAllRequiredSkills(SKILL_NAME);
|
||||
if ((reqs == null) || (reqs.length == 0))
|
||||
{
|
||||
debugSpeakMsg(self, "Unable to revoke all skills related to " + SKILL_NAME);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
for (int i = 0; i < reqs.length; i++)
|
||||
{
|
||||
revokeSkill(self, reqs[i]);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
include library.skill;
|
||||
|
||||
const string SKILL_NAME = "crafting_artisan_master";
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
string[] reqs = skill.getAllRequiredSkills(SKILL_NAME);
|
||||
if ( (reqs == null) || (reqs.length == 0) )
|
||||
{
|
||||
debugSpeakMsg(self, "Unable to assign all skills related to " + SKILL_NAME);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < reqs.length; i++ )
|
||||
{
|
||||
grantSkill(self, reqs[i]);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDetach()
|
||||
{
|
||||
string[] reqs = skill.getAllRequiredSkills(SKILL_NAME);
|
||||
if ( (reqs == null) || (reqs.length == 0) )
|
||||
{
|
||||
debugSpeakMsg(self, "Unable to revoke all skills related to " + SKILL_NAME);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < reqs.length; i++ )
|
||||
{
|
||||
revokeSkill(self, reqs[i]);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.xp;
|
||||
import script.library.skill;
|
||||
import script.library.player_version;
|
||||
|
||||
public class tc_jedi extends script.base_script
|
||||
{
|
||||
public tc_jedi()
|
||||
{
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
revokeSkills(self);
|
||||
revokeExperience(self);
|
||||
if (hasObjVar(self, "tcTester"))
|
||||
{
|
||||
setObjVar(self, "jedi.totalPoints", 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(self, "jedi.totalPoints", 250);
|
||||
}
|
||||
attachScript(self, "player.player_jedi_conversion");
|
||||
detachScript(self, "beta.tc_jedi");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void revokeSkills(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
String[] skillList = getSkillListingForPlayer(objPlayer);
|
||||
int count = 0;
|
||||
while (skillList != null && count < 15)
|
||||
{
|
||||
skillList = player_version.orderSkillListForRevoke(skillList);
|
||||
if ((skillList != null) && (skillList.length > 0))
|
||||
{
|
||||
for (int x = 0; x < skillList.length; x++)
|
||||
{
|
||||
revokeSkill(objPlayer, skillList[x]);
|
||||
}
|
||||
}
|
||||
skillList = getSkillListingForPlayer(objPlayer);
|
||||
count++;
|
||||
}
|
||||
if (hasScript(objPlayer, "player.species_innate"))
|
||||
{
|
||||
detachScript(objPlayer, "player.species_innate");
|
||||
attachScript(objPlayer, "player.species_innate");
|
||||
}
|
||||
}
|
||||
public void revokeExperience(obj_id objPlayer) throws InterruptedException
|
||||
{
|
||||
if (objPlayer == null || !isIdValid(objPlayer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
String xpList[] = xp.getXpTypes(objPlayer);
|
||||
if (xpList != null && xpList.length > 0)
|
||||
{
|
||||
for (int i = 0; i < xpList.length; i++)
|
||||
{
|
||||
int xpAmount = getExperiencePoints(objPlayer, xpList[i]);
|
||||
if (xpAmount > 0)
|
||||
{
|
||||
grantExperiencePoints(objPlayer, xpList[i], -xpAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
|
||||
|
||||
include library.xp;
|
||||
include library.skill;
|
||||
include library.player_version;
|
||||
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
revokeSkills(self);
|
||||
revokeExperience(self);
|
||||
|
||||
if (hasObjVar(self, "tcTester"))
|
||||
setObjVar (self, "jedi.totalPoints", 32);
|
||||
else
|
||||
setObjVar (self, "jedi.totalPoints", 250);
|
||||
|
||||
attachScript(self, "player.player_jedi_conversion");
|
||||
detachScript(self, "beta.tc_jedi");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
void revokeSkills(obj_id objPlayer)
|
||||
{
|
||||
string[] skillList = getSkillListingForPlayer(objPlayer);
|
||||
|
||||
int count = 0;
|
||||
while (skillList != null && count < 15)
|
||||
{
|
||||
skillList = player_version.orderSkillListForRevoke(skillList);
|
||||
|
||||
if ( (skillList != null) && (skillList.length > 0) )
|
||||
{
|
||||
for ( int x = 0; x < skillList.length; x++ )
|
||||
{
|
||||
revokeSkill(objPlayer, skillList[x]);
|
||||
}
|
||||
}
|
||||
|
||||
skillList = getSkillListingForPlayer(objPlayer);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (hasScript(objPlayer, "player.species_innate"))
|
||||
{
|
||||
detachScript(objPlayer, "player.species_innate");
|
||||
attachScript(objPlayer, "player.species_innate");
|
||||
}
|
||||
}
|
||||
|
||||
void revokeExperience(obj_id objPlayer)
|
||||
{
|
||||
if(objPlayer == null || !isIdValid(objPlayer))
|
||||
return;
|
||||
|
||||
string xpList[] = xp.getXpTypes(objPlayer);
|
||||
if (xpList != null && xpList.length > 0)
|
||||
{
|
||||
for (int i = 0; i < xpList.length; i++)
|
||||
{
|
||||
int xpAmount = getExperiencePoints(objPlayer, xpList[i]);
|
||||
if (xpAmount > 0)
|
||||
grantExperiencePoints(objPlayer, xpList[i], -xpAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class terminal_food extends script.terminal.base.terminal_add_use
|
||||
{
|
||||
public terminal_food()
|
||||
{
|
||||
}
|
||||
public static final string_id SID_ORDER_FOOD = new string_id("sui", "order_food");
|
||||
public static final String[] TEMPLATES =
|
||||
{
|
||||
"object/tangible/food/bread_loaf_full_s1.iff",
|
||||
"object/tangible/food/fruit_melon.iff",
|
||||
"object/tangible/food/meat_kabob.iff"
|
||||
};
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if (item == menu_info_types.ITEM_USE)
|
||||
{
|
||||
obj_id inv = getObjectInSlot(player, "inventory");
|
||||
int idx = rand(0, TEMPLATES.length - 1);
|
||||
obj_id food = createObject(TEMPLATES[idx], inv, "");
|
||||
if ((food == null) || (food == obj_id.NULL_ID))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Unable to create food. Make sure you have space in your inventory.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "A random foodstuff has been created in your inventory.");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Title: terminal_food.script
|
||||
* Description: BETA SCRIPT: food dispenser
|
||||
*/
|
||||
|
||||
/***** INHERITS ********************************************************/
|
||||
|
||||
inherits terminal.base.terminal_add_use;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const string_id SID_ORDER_FOOD = new string_id ("sui", "order_food");
|
||||
|
||||
const string[] TEMPLATES = {
|
||||
"object/tangible/food/bread_loaf_full_s1.iff",
|
||||
"object/tangible/food/fruit_melon.iff",
|
||||
"object/tangible/food/meat_kabob.iff"
|
||||
};
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if ( item == menu_info_types.ITEM_USE)
|
||||
{
|
||||
//grant food here
|
||||
obj_id inv = getObjectInSlot(player, "inventory");
|
||||
//debugSpeakMsg(self, "player inventory = " + inv);
|
||||
|
||||
int idx = rand(0, TEMPLATES.length -1);
|
||||
obj_id food = createObject(TEMPLATES[idx], inv, "");
|
||||
if ( (food == null) || (food == obj_id.NULL_ID) )
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Unable to create food. Make sure you have space in your inventory.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "A random foodstuff has been created in your inventory.");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class terminal_medicine extends script.base_script
|
||||
{
|
||||
public terminal_medicine()
|
||||
{
|
||||
}
|
||||
public static final string_id SID_ORDER_DAMAGE_MEDICINE = new string_id("sui", "order_damage_medicine");
|
||||
public static final string_id SID_ORDER_WOUND_MEDICINE = new string_id("sui", "order_wound_medicine");
|
||||
public static final String VAR_CAN_USE_TERMINAL = "terminal.can_use_terminal";
|
||||
public static final int VAR_TERMINAL_TIME = 1;
|
||||
public static final String[] TEMPLATES =
|
||||
{
|
||||
"object/tangible/medicine/medpack_wound_health.iff",
|
||||
"object/tangible/medicine/medpack_wound_constitution.iff",
|
||||
"object/tangible/medicine/medpack_wound_action.iff",
|
||||
"object/tangible/medicine/medpack_wound_stamina.iff"
|
||||
};
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setCanUseTerminal(self, true);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
if (canUseTerminal(self))
|
||||
{
|
||||
mi.addRootMenu(menu_info_types.SERVER_HEAL_DAMAGE, SID_ORDER_DAMAGE_MEDICINE);
|
||||
mi.addRootMenu(menu_info_types.SERVER_HEAL_WOUND, SID_ORDER_WOUND_MEDICINE);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if (item == menu_info_types.SERVER_HEAL_DAMAGE)
|
||||
{
|
||||
if (!canUseTerminal(self))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You must wait for the terminal to recharge.");
|
||||
LOG("LOG_CHANNEL", "You must wait for the terminal to recharge.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id inv = getObjectInSlot(player, "inventory");
|
||||
createObject("object/tangible/medicine/medpack_damage.iff", inv, "");
|
||||
setCanUseTerminal(self, false);
|
||||
dictionary dctMsg = new dictionary();
|
||||
messageTo(self, "msgMedicineTerminal", dctMsg, VAR_TERMINAL_TIME, false);
|
||||
}
|
||||
if (item == menu_info_types.SERVER_HEAL_WOUND)
|
||||
{
|
||||
if (!canUseTerminal(self))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You must wait for the terminal to recharge.");
|
||||
LOG("LOG_CHANNEL", "You must wait for the terminal to recharge.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id inv = getObjectInSlot(player, "inventory");
|
||||
int idx = rand(0, TEMPLATES.length - 1);
|
||||
obj_id medicine = createObject(TEMPLATES[idx], inv, "");
|
||||
setCanUseTerminal(self, false);
|
||||
dictionary dctMsg = new dictionary();
|
||||
messageTo(self, "msgMedicineTerminal", dctMsg, VAR_TERMINAL_TIME, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
public boolean setCanUseTerminal(obj_id terminal, boolean toggle) throws InterruptedException
|
||||
{
|
||||
if (terminal == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!hasObjVar(terminal, VAR_CAN_USE_TERMINAL))
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 1);
|
||||
}
|
||||
if (toggle == true)
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean canUseTerminal(obj_id terminal) throws InterruptedException
|
||||
{
|
||||
LOG("LOG_CHANNEL", "canUseTerminal called.");
|
||||
if (terminal == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!hasObjVar(terminal, VAR_CAN_USE_TERMINAL))
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 1);
|
||||
}
|
||||
if (getIntObjVar(terminal, VAR_CAN_USE_TERMINAL) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public int msgMedicineTerminal(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
setCanUseTerminal(self, true);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
/**
|
||||
* Title: terminal_food.script
|
||||
* Description: BETA SCRIPT: food dispenser
|
||||
*/
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const string_id SID_ORDER_DAMAGE_MEDICINE = new string_id ("sui", "order_damage_medicine");
|
||||
const string_id SID_ORDER_WOUND_MEDICINE = new string_id ("sui", "order_wound_medicine");
|
||||
|
||||
const string VAR_CAN_USE_TERMINAL = "terminal.can_use_terminal";
|
||||
const int VAR_TERMINAL_TIME = 1;
|
||||
|
||||
const string[] TEMPLATES = {
|
||||
"object/tangible/medicine/medpack_wound_health.iff",
|
||||
"object/tangible/medicine/medpack_wound_constitution.iff",
|
||||
"object/tangible/medicine/medpack_wound_action.iff",
|
||||
"object/tangible/medicine/medpack_wound_stamina.iff"
|
||||
};
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnAttach()
|
||||
{
|
||||
setCanUseTerminal(self, true);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
if (canUseTerminal(self))
|
||||
{
|
||||
mi.addRootMenu(menu_info_types.SERVER_HEAL_DAMAGE, SID_ORDER_DAMAGE_MEDICINE);
|
||||
mi.addRootMenu(menu_info_types.SERVER_HEAL_WOUND, SID_ORDER_WOUND_MEDICINE);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if ( item == menu_info_types.SERVER_HEAL_DAMAGE)
|
||||
{
|
||||
if (!canUseTerminal(self))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You must wait for the terminal to recharge.");
|
||||
LOG("LOG_CHANNEL", "You must wait for the terminal to recharge.");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
//grant damage medicine here
|
||||
obj_id inv = getObjectInSlot(player, "inventory");
|
||||
createObject("object/tangible/medicine/medpack_damage.iff", inv, "");
|
||||
//debugSpeakMsg(self, "player inventory = " + inv);
|
||||
|
||||
// The terminal can only be used every so often.
|
||||
setCanUseTerminal(self, false);
|
||||
dictionary dctMsg = new dictionary();
|
||||
messageTo(self, "msgMedicineTerminal", dctMsg, VAR_TERMINAL_TIME, false);
|
||||
|
||||
}
|
||||
|
||||
if (item == menu_info_types.SERVER_HEAL_WOUND)
|
||||
{
|
||||
if (!canUseTerminal(self))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You must wait for the terminal to recharge.");
|
||||
LOG("LOG_CHANNEL", "You must wait for the terminal to recharge.");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id inv = getObjectInSlot(player, "inventory");
|
||||
int idx = rand(0, TEMPLATES.length - 1);
|
||||
obj_id medicine = createObject(TEMPLATES[idx], inv, "");
|
||||
|
||||
// The terminal can only be used every so often.
|
||||
setCanUseTerminal(self, false);
|
||||
dictionary dctMsg = new dictionary();
|
||||
messageTo(self, "msgMedicineTerminal", dctMsg, VAR_TERMINAL_TIME, false);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***** FUNCTIONS *******************************************************/
|
||||
boolean setCanUseTerminal(obj_id terminal, boolean toggle)
|
||||
{
|
||||
|
||||
if (terminal == null) return false;
|
||||
|
||||
if (!hasObjVar(terminal, VAR_CAN_USE_TERMINAL))
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 1);
|
||||
}
|
||||
|
||||
if (toggle == true)
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
boolean canUseTerminal(obj_id terminal)
|
||||
{
|
||||
LOG("LOG_CHANNEL", "canUseTerminal called.");
|
||||
if (terminal == null) return false;
|
||||
|
||||
if (!hasObjVar(terminal, VAR_CAN_USE_TERMINAL))
|
||||
{
|
||||
setObjVar(terminal, VAR_CAN_USE_TERMINAL, 1);
|
||||
}
|
||||
|
||||
if (getIntObjVar(terminal, VAR_CAN_USE_TERMINAL) == 0) return false;
|
||||
else return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
|
||||
messageHandler msgMedicineTerminal()
|
||||
{
|
||||
setCanUseTerminal(self, true);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.money;
|
||||
|
||||
public class terminal_money extends script.terminal.base.terminal_add_use
|
||||
{
|
||||
public terminal_money()
|
||||
{
|
||||
}
|
||||
public static final int CASH_AMOUNT = 10000;
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if (item == menu_info_types.ITEM_USE)
|
||||
{
|
||||
if (getCashBalance(player) < 1000000)
|
||||
{
|
||||
dictionary d = new dictionary();
|
||||
d.put("payoutTarget", player);
|
||||
money.systemPayout(money.ACCT_BETA_TEST, self, CASH_AMOUNT, "handlePayoutToPlayer", d);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You already have 1,000,000+ credits. Why do you need any more money?");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
public int handlePayoutToPlayer(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = params.getObjId("payoutTarget");
|
||||
if (!isIdValid(player))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int retCode = params.getInt(money.DICT_CODE);
|
||||
if (retCode == money.RET_SUCCESS)
|
||||
{
|
||||
transferCashTo(self, player, CASH_AMOUNT, "handlePayoutSuccess", "handlePayoutFail", params);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "The system is unable to complete the transaction. Please try again later.");
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handlePayoutSuccess(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = params.getObjId("payoutTarget");
|
||||
if (!isIdValid(player))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
sendSystemMessageTestingOnly(player, "You recieve " + CASH_AMOUNT + " credits from " + getString(getNameStringId(self)));
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handlePayoutFail(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = params.getObjId("payoutTarget");
|
||||
if (!isIdValid(player))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
sendSystemMessageTestingOnly(player, "The system is unable to complete the transaction. Please try again later.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* Title: terminal_food.script
|
||||
* Description: BETA SCRIPT: food dispenser
|
||||
*/
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.money;
|
||||
|
||||
/***** INHERITS ********************************************************/
|
||||
|
||||
inherits terminal.base.terminal_add_use;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const int CASH_AMOUNT = 10000;
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if ( item == menu_info_types.ITEM_USE )
|
||||
{
|
||||
if ( getCashBalance(player) < 1000000 )
|
||||
{
|
||||
dictionary d = new dictionary();
|
||||
d.put("payoutTarget", player);
|
||||
|
||||
money.systemPayout(money.ACCT_BETA_TEST, self, CASH_AMOUNT, "handlePayoutToPlayer", d);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "You already have 1,000,000+ credits. Why do you need any more money?");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***** FUNCTIONS *******************************************************/
|
||||
messageHandler handlePayoutToPlayer()
|
||||
{
|
||||
obj_id player = params.getObjId("payoutTarget");
|
||||
if ( !isIdValid(player) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
int retCode = params.getInt(money.DICT_CODE);
|
||||
if ( retCode == money.RET_SUCCESS )
|
||||
{
|
||||
transferCashTo(self, player, CASH_AMOUNT, "handlePayoutSuccess", "handlePayoutFail", params);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "The system is unable to complete the transaction. Please try again later.");
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handlePayoutSuccess()
|
||||
{
|
||||
obj_id player = params.getObjId("payoutTarget");
|
||||
if ( !isIdValid(player) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
sendSystemMessageTestingOnly(player, "You recieve " + CASH_AMOUNT + " credits from " + getString(getNameStringId(self)));
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handlePayoutFail()
|
||||
{
|
||||
obj_id player = params.getObjId("payoutTarget");
|
||||
if ( !isIdValid(player) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
sendSystemMessageTestingOnly(player, "The system is unable to complete the transaction. Please try again later.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.resource;
|
||||
import script.library.sui;
|
||||
import script.library.utils;
|
||||
import script.library.prose;
|
||||
|
||||
public class terminal_resource extends script.terminal.base.terminal_add_use
|
||||
{
|
||||
public terminal_resource()
|
||||
{
|
||||
}
|
||||
public static final int AMT = 100000;
|
||||
public static final String[] RESOURCE_BASE_TYPES =
|
||||
{
|
||||
"creature_resources",
|
||||
"flora_resources",
|
||||
"chemical",
|
||||
"water",
|
||||
"mineral",
|
||||
"gas",
|
||||
"energy",
|
||||
"space_metal",
|
||||
"space_gas",
|
||||
"space_chemical",
|
||||
"space_gem"
|
||||
};
|
||||
public static final String[] RESOURCE_PLANETS =
|
||||
{
|
||||
"current",
|
||||
"tatooine",
|
||||
"naboo",
|
||||
"corellia",
|
||||
"rori",
|
||||
"talus",
|
||||
"endor",
|
||||
"dantooine",
|
||||
"dathomir",
|
||||
"lok",
|
||||
"yavin4"
|
||||
};
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
if (!isGod(player) && !hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int use = -1;
|
||||
menu_info_data[] root = mi.getRootMenuItems();
|
||||
for (int i = 0; i < root.length; i++)
|
||||
{
|
||||
if (root[i].getType() == menu_info_types.ITEM_USE)
|
||||
{
|
||||
use = root[i].getId();
|
||||
}
|
||||
}
|
||||
if (use != -1)
|
||||
{
|
||||
mi.addSubMenu(use, menu_info_types.SERVER_MENU1, new string_id("beta", "resource_standard"));
|
||||
mi.addSubMenu(use, menu_info_types.SERVER_MENU2, new string_id("beta", "resource_planet"));
|
||||
mi.addSubMenu(use, menu_info_types.SERVER_MENU3, new string_id("beta", "resource_set_planet"));
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if ((item == menu_info_types.ITEM_USE) || (item == menu_info_types.SERVER_MENU1))
|
||||
{
|
||||
String prompt = "Select the desired resource category";
|
||||
String title = "BETA - Resource Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_BASE_TYPES, "handleCategorySelection", true, false);
|
||||
}
|
||||
if (item == menu_info_types.SERVER_MENU2)
|
||||
{
|
||||
String prompt = "Select the desired planet";
|
||||
String title = "BETA - Resource Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_PLANETS, "handlePlanetSelection", true, false);
|
||||
}
|
||||
if (item == menu_info_types.SERVER_MENU3)
|
||||
{
|
||||
String prompt = "Select the desired planet";
|
||||
String title = "BETA - Resource Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_PLANETS, "handleSetPlanet", true, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
public int handleCategorySelection(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
if ((params == null) || (params.isEmpty()))
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
if (btn == sui.BP_CANCEL)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (idx == -1)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
location loc = getLocation(player);
|
||||
String planet = "current";
|
||||
if (utils.hasScriptVar(self, "planet"))
|
||||
{
|
||||
planet = utils.getStringScriptVar(self, "planet");
|
||||
}
|
||||
else if (hasObjVar(self, "planet"))
|
||||
{
|
||||
planet = getStringObjVar(self, "planet");
|
||||
}
|
||||
if (!planet.equals("current") && !planet.equals("all"))
|
||||
{
|
||||
loc = new location(0, 0, 0, planet);
|
||||
}
|
||||
if (loc == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Error retrieving planet data");
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String[] resourceList = null;
|
||||
if (planet.equals("all"))
|
||||
{
|
||||
resourceList = buildAllAvailableResourceTree(RESOURCE_BASE_TYPES[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceList = buildAvailableResourceTree(loc, RESOURCE_BASE_TYPES[idx]);
|
||||
}
|
||||
String prompt = "Select the desired resource category";
|
||||
String title = "BETA - Resource Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, resourceList, "handleResourceSelection", true, false);
|
||||
utils.setScriptVar(self, "resourceList", resourceList);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handlePlanetSelection(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
if ((params == null) || (params.isEmpty()))
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
if (btn == sui.BP_CANCEL)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (idx == -1)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String planet = RESOURCE_PLANETS[idx];
|
||||
utils.setScriptVar(self, "planet", planet);
|
||||
String prompt = "Select the desired resource category";
|
||||
String title = "BETA - Resource Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_BASE_TYPES, "handleCategorySelection", true, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleSetPlanet(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
if ((params == null) || (params.isEmpty()))
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
if (btn == sui.BP_CANCEL)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (idx == -1)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String planet = RESOURCE_PLANETS[idx];
|
||||
setObjVar(self, "planet", planet);
|
||||
sendSystemMessageTestingOnly(player, "Planet set to " + planet);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleResourceSelection(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
if ((params == null) || (params.isEmpty()))
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
if (btn == sui.BP_CANCEL)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (idx == -1)
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String[] resourceList = utils.getStringArrayScriptVar(self, "resourceList");
|
||||
String resourceName = resourceList[idx].trim();
|
||||
if (resourceName.startsWith("\\#"))
|
||||
{
|
||||
resourceName = resourceName.substring(13, resourceName.length() - 3);
|
||||
}
|
||||
obj_id resourceId = getResourceTypeByName(resourceName);
|
||||
if (resourceId == null)
|
||||
{
|
||||
resourceId = pickRandomNonDepeletedResource(resourceName);
|
||||
}
|
||||
obj_id inv = utils.getInventoryContainer(player);
|
||||
obj_id resourceCrate = createResourceCrate(resourceId, AMT, inv);
|
||||
if (resourceCrate == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Resource grant failed. It is likely your inventory is full.");
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceName = " \\#pcontrast1 " + getResourceName(resourceId) + "\\#. a type of " + getClassString(getResourceClass(resourceId));
|
||||
prose_package proseSuccess = prose.getPackage(resource.SID_SAMPLE_LOCATED, resourceName, AMT);
|
||||
sendSystemMessageProse(player, proseSuccess);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public String[] buildAvailableResourceTree(location loc, String topParent) throws InterruptedException
|
||||
{
|
||||
resource_density[] resources = requestResourceList(loc, 0.0f, 1.0f, topParent);
|
||||
String[] resourceTree = buildSortedResourceTree(resources, topParent, 0);
|
||||
return resourceTree;
|
||||
}
|
||||
public String[] buildAllAvailableResourceTree(String topParent) throws InterruptedException
|
||||
{
|
||||
Vector allResources = new Vector();
|
||||
allResources.setSize(0);
|
||||
for (int i = 1; i < (RESOURCE_PLANETS.length - 1); i++)
|
||||
{
|
||||
resource_density[] resources = requestResourceList(new location(0, 0, 0, RESOURCE_PLANETS[i]), 0.0f, 1.0f, topParent);
|
||||
allResources = utils.concatArrays(allResources, resources);
|
||||
}
|
||||
resource_density[] resources = new resource_density[allResources.size()];
|
||||
allResources.toArray(resources);
|
||||
String[] resourceTree = buildSortedResourceTree(resources, topParent, 0);
|
||||
return resourceTree;
|
||||
}
|
||||
public String[] buildSortedResourceTree(resource_density[] resources, String topParent, int branchLevel) throws InterruptedException
|
||||
{
|
||||
Vector resourceTree = new Vector();
|
||||
resourceTree.setSize(0);
|
||||
if (resources != null)
|
||||
{
|
||||
for (int i = 0; i < resources.length; i++)
|
||||
{
|
||||
if (!isResourceDerivedFrom(resources[i].getResourceType(), topParent))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String parent = getResourceClass(resources[i].getResourceType());
|
||||
String child = null;
|
||||
if (parent == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
while (!parent.equals(topParent))
|
||||
{
|
||||
child = parent;
|
||||
parent = getResourceParentClass(child);
|
||||
}
|
||||
if (child == null)
|
||||
{
|
||||
child = "\\#pcontrast1 " + getResourceName(resources[i].getResourceType()) + "\\#.";
|
||||
}
|
||||
for (int j = 0; j < branchLevel; j++)
|
||||
{
|
||||
child = " " + child;
|
||||
}
|
||||
if (resourceTree.indexOf(child) == -1)
|
||||
{
|
||||
resourceTree.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < resourceTree.size(); i++)
|
||||
{
|
||||
String parent = ((String)resourceTree.get(i)).trim();
|
||||
String[] childBranch = buildSortedResourceTree(resources, parent, branchLevel + 1);
|
||||
for (int j = 0; j < childBranch.length; j++)
|
||||
{
|
||||
resourceTree.add(++i, childBranch[j]);
|
||||
}
|
||||
}
|
||||
String[] _resourceTree = new String[0];
|
||||
if (resourceTree != null)
|
||||
{
|
||||
_resourceTree = new String[resourceTree.size()];
|
||||
resourceTree.toArray(_resourceTree);
|
||||
}
|
||||
return _resourceTree;
|
||||
}
|
||||
public void cleanScriptVars() throws InterruptedException
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
utils.removeScriptVar(self, "resourceList");
|
||||
utils.removeScriptVar(self, "planet");
|
||||
}
|
||||
public String getClassString(String className) throws InterruptedException
|
||||
{
|
||||
final String resourceTable = "datatables/resource/resource_tree.iff";
|
||||
String classString = "";
|
||||
int row = dataTableSearchColumnForString(className, 1, resourceTable);
|
||||
int column = 2;
|
||||
while ((classString == null || classString.length() == 0) && column <= 9)
|
||||
{
|
||||
classString = dataTableGetString(resourceTable, row, column);
|
||||
column++;
|
||||
}
|
||||
return classString;
|
||||
}
|
||||
}
|
||||
@@ -1,412 +0,0 @@
|
||||
/**
|
||||
* Title: terminal_resource.script
|
||||
* Description: BETA SCRIPT: resource dispenser
|
||||
*/
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.resource;
|
||||
include library.sui;
|
||||
include library.utils;
|
||||
include library.prose;
|
||||
|
||||
/***** INHERITS ********************************************************/
|
||||
|
||||
inherits terminal.base.terminal_add_use;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const int AMT = 100000;
|
||||
|
||||
const string[] RESOURCE_BASE_TYPES = {
|
||||
"creature_resources",
|
||||
"flora_resources",
|
||||
"chemical",
|
||||
"water",
|
||||
"mineral",
|
||||
"gas",
|
||||
"energy",
|
||||
"space_metal",
|
||||
"space_gas",
|
||||
"space_chemical",
|
||||
"space_gem"
|
||||
|
||||
};
|
||||
|
||||
const string[] RESOURCE_PLANETS = {
|
||||
"current",
|
||||
"tatooine",
|
||||
"naboo",
|
||||
"corellia",
|
||||
"rori",
|
||||
"talus",
|
||||
"endor",
|
||||
"dantooine",
|
||||
"dathomir",
|
||||
"lok",
|
||||
"yavin4"
|
||||
};
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
if (!isGod(player) && !hasObjVar(player, "beta.terminal_ok"))
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
int use = -1;
|
||||
menu_info_data[] root = mi.getRootMenuItems();
|
||||
for (int i = 0; i < root.length; i++)
|
||||
{
|
||||
if (root[i].getType() == menu_info_types.ITEM_USE)
|
||||
use = root[i].getId();
|
||||
}
|
||||
|
||||
if (use != -1)
|
||||
{
|
||||
mi.addSubMenu(use, menu_info_types.SERVER_MENU1, new string_id("beta", "resource_standard"));
|
||||
mi.addSubMenu(use, menu_info_types.SERVER_MENU2, new string_id("beta", "resource_planet"));
|
||||
mi.addSubMenu(use, menu_info_types.SERVER_MENU3, new string_id("beta", "resource_set_planet"));
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if (( item == menu_info_types.ITEM_USE ) ||
|
||||
( item == menu_info_types.SERVER_MENU1 ))
|
||||
{
|
||||
string prompt = "Select the desired resource category";
|
||||
string title = "BETA - Resource Dispenser";
|
||||
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_BASE_TYPES, "handleCategorySelection", true, false);
|
||||
}
|
||||
if ( item == menu_info_types.SERVER_MENU2 )
|
||||
{
|
||||
string prompt = "Select the desired planet";
|
||||
string title = "BETA - Resource Dispenser";
|
||||
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_PLANETS, "handlePlanetSelection", true, false);
|
||||
}
|
||||
if ( item == menu_info_types.SERVER_MENU3 )
|
||||
{
|
||||
string prompt = "Select the desired planet";
|
||||
string title = "BETA - Resource Dispenser";
|
||||
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_PLANETS, "handleSetPlanet", true, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***** FUNCTIONS *******************************************************/
|
||||
messageHandler handleCategorySelection()
|
||||
{
|
||||
if ( (params == null) || (params.isEmpty()) )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
|
||||
if ( btn == sui.BP_CANCEL )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
if ( idx == -1 )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
location loc = getLocation(player);
|
||||
string planet = "current";
|
||||
|
||||
if (utils.hasScriptVar(self, "planet"))
|
||||
planet = utils.getStringScriptVar(self, "planet");
|
||||
else if (hasObjVar(self, "planet"))
|
||||
planet = getStringObjVar(self, "planet");
|
||||
|
||||
if (!planet.equals("current") && !planet.equals("all"))
|
||||
loc = new location (0, 0, 0, planet);
|
||||
|
||||
if (loc == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Error retrieving planet data");
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string[] resourceList = null;
|
||||
|
||||
if (planet.equals("all"))
|
||||
resourceList = buildAllAvailableResourceTree(RESOURCE_BASE_TYPES[idx]);
|
||||
else
|
||||
resourceList = buildAvailableResourceTree(loc, RESOURCE_BASE_TYPES[idx]);
|
||||
|
||||
string prompt = "Select the desired resource category";
|
||||
string title = "BETA - Resource Dispenser";
|
||||
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, resourceList, "handleResourceSelection", true, false);
|
||||
|
||||
utils.setScriptVar(self, "resourceList", resourceList);
|
||||
|
||||
/*
|
||||
if (planet.equals("all"))
|
||||
planet = "tatooine";
|
||||
if (planet.equals("current"))
|
||||
planet = getLocation(player).area;
|
||||
|
||||
obj_id[] resourceIdList = getAvailablePlanetResources(planet, RESOURCE_BASE_TYPES[idx]);
|
||||
string[] resourceList = buildSortedResourceList(resourceIdList, RESOURCE_BASE_TYPES[idx], 0);
|
||||
string report = createResourcePlanetReport(resourceList, planet, RESOURCE_BASE_TYPES[idx]);
|
||||
|
||||
sui.msgbox(self, player, report, sui.OK_ONLY, "Interplanetary Survey: "+toUpper(planet, 0)+" - "+toUpper(RESOURCE_BASE_TYPES[idx], 0), "emptyHandler");
|
||||
*/
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handlePlanetSelection()
|
||||
{
|
||||
if ( (params == null) || (params.isEmpty()) )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
|
||||
if ( btn == sui.BP_CANCEL )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
if ( idx == -1 )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string planet = RESOURCE_PLANETS[idx];
|
||||
|
||||
utils.setScriptVar(self, "planet", planet);
|
||||
|
||||
string prompt = "Select the desired resource category";
|
||||
string title = "BETA - Resource Dispenser";
|
||||
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, RESOURCE_BASE_TYPES, "handleCategorySelection", true, false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handleSetPlanet()
|
||||
{
|
||||
if ( (params == null) || (params.isEmpty()) )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
|
||||
if ( btn == sui.BP_CANCEL )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
if ( idx == -1 )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string planet = RESOURCE_PLANETS[idx];
|
||||
|
||||
setObjVar(self, "planet", planet);
|
||||
|
||||
sendSystemMessageTestingOnly(player, "Planet set to "+planet);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handleResourceSelection()
|
||||
{
|
||||
if ( (params == null) || (params.isEmpty()) )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
|
||||
if ( btn == sui.BP_CANCEL )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
if ( idx == -1 )
|
||||
{
|
||||
cleanScriptVars();
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string[] resourceList = utils.getStringArrayScriptVar(self, "resourceList");
|
||||
|
||||
string resourceName = resourceList[idx].trim();
|
||||
if (resourceName.startsWith("\\#"))
|
||||
resourceName = resourceName.substring(13, resourceName.length()-3);
|
||||
|
||||
obj_id resourceId = getResourceTypeByName(resourceName);
|
||||
|
||||
if (resourceId == null)
|
||||
{
|
||||
resourceId = pickRandomNonDepeletedResource(resourceName);
|
||||
}
|
||||
|
||||
obj_id inv = utils.getInventoryContainer(player);
|
||||
obj_id resourceCrate = createResourceCrate(resourceId, AMT, inv);
|
||||
|
||||
if (resourceCrate == null)
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Resource grant failed. It is likely your inventory is full.");
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceName = " \\#pcontrast1 "+getResourceName(resourceId)+"\\#. a type of " + getClassString(getResourceClass(resourceId));
|
||||
prose_package proseSuccess = prose.getPackage(resource.SID_SAMPLE_LOCATED, resourceName, AMT);
|
||||
sendSystemMessageProse(player, proseSuccess);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string[] buildAvailableResourceTree(location loc, string topParent)
|
||||
{
|
||||
resource_density[] resources = requestResourceList(loc, 0.0f, 1.0f, topParent);
|
||||
|
||||
string[] resourceTree = buildSortedResourceTree(resources, topParent, 0);
|
||||
|
||||
return resourceTree;
|
||||
}
|
||||
|
||||
string[] buildAllAvailableResourceTree(string topParent)
|
||||
{
|
||||
resizeable resource_density[] allResources = new resource_density[0];
|
||||
|
||||
for (int i = 1; i < (RESOURCE_PLANETS.length-1); i++)
|
||||
{
|
||||
resource_density[] resources = requestResourceList(new location(0, 0, 0, RESOURCE_PLANETS[i]), 0.0f, 1.0f, topParent);
|
||||
|
||||
allResources = utils.concatArrays(allResources, resources);
|
||||
}
|
||||
|
||||
resource_density[] resources = new resource_density[allResources.size()];
|
||||
allResources.toArray(resources);
|
||||
|
||||
string[] resourceTree = buildSortedResourceTree(resources, topParent, 0);
|
||||
|
||||
return resourceTree;
|
||||
}
|
||||
|
||||
string[] buildSortedResourceTree(resource_density[] resources, string topParent, int branchLevel)
|
||||
{
|
||||
resizeable string[] resourceTree = new string[0];
|
||||
|
||||
if(resources != null)
|
||||
{
|
||||
for (int i = 0; i < resources.length; i++)
|
||||
{
|
||||
if (!isResourceDerivedFrom(resources[i].getResourceType(), topParent))
|
||||
continue;
|
||||
|
||||
string parent = getResourceClass(resources[i].getResourceType());
|
||||
string child = null;
|
||||
|
||||
if (parent == null)
|
||||
continue;
|
||||
|
||||
while (parent != topParent)
|
||||
{
|
||||
child = parent;
|
||||
parent = getResourceParentClass(child);
|
||||
}
|
||||
|
||||
if (child == null)
|
||||
child = "\\#pcontrast1 "+getResourceName(resources[i].getResourceType())+"\\#.";
|
||||
|
||||
for (int j = 0; j < branchLevel; j++)
|
||||
{
|
||||
child = " " + child;
|
||||
}
|
||||
|
||||
|
||||
if (resourceTree.indexOf(child) == -1)
|
||||
{
|
||||
resourceTree.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < resourceTree.size(); i++)
|
||||
{
|
||||
string parent = resourceTree[i].trim();
|
||||
string[] childBranch = buildSortedResourceTree(resources, parent, branchLevel+1);
|
||||
|
||||
for (int j = 0; j < childBranch.length; j++)
|
||||
{
|
||||
resourceTree.add(++i, childBranch[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return resourceTree;
|
||||
}
|
||||
|
||||
void cleanScriptVars()
|
||||
{
|
||||
obj_id self = getSelf();
|
||||
utils.removeScriptVar(self, "resourceList");
|
||||
utils.removeScriptVar(self, "planet");
|
||||
}
|
||||
|
||||
string getClassString(string className)
|
||||
{
|
||||
const string resourceTable = "datatables/resource/resource_tree.iff";
|
||||
|
||||
string classString = "";
|
||||
|
||||
int row = dataTableSearchColumnForString(className, 1, resourceTable);
|
||||
int column = 2;
|
||||
while ((classString == null || classString.length() == 0) && column <= 9)
|
||||
{
|
||||
classString = dataTableGetString(resourceTable, row, column);
|
||||
column++;
|
||||
}
|
||||
|
||||
return classString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class terminal_warp extends script.base_script
|
||||
{
|
||||
public terminal_warp()
|
||||
{
|
||||
}
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if (!hasScript(player, "beta.player_warp"))
|
||||
{
|
||||
attachScript(player, "beta.player_warp");
|
||||
}
|
||||
sendSystemMessageTestingOnly(player, "Warp script attached.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/**********************************************************************
|
||||
* Title: terminal_warp
|
||||
* Description: Grants the warp script to whomever accesses the terminal.
|
||||
**********************************************************************/
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if (!hasScript(player, "beta.player_warp"))
|
||||
attachScript(player, "beta.player_warp");
|
||||
|
||||
sendSystemMessageTestingOnly(player, "Warp script attached.");
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class terminal_wound extends script.base_script
|
||||
{
|
||||
public terminal_wound()
|
||||
{
|
||||
}
|
||||
public static final string_id SID_INFLICT_DAMAGE = new string_id("wound_terminal", "inflict_damage");
|
||||
public static final string_id SID_INFLICT_WOUND = new string_id("wound_terminal", "inflict_wound");
|
||||
public static final string_id SID_INFLICT_WOUND_HEALTH = new string_id("wound_terminal", "heal_wound_health");
|
||||
public static final string_id SID_HEAL_BATTLE = new string_id("wound_terminal", "heal_battle_fatigue");
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_INFLICT_DAMAGE);
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU2, SID_INFLICT_WOUND);
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU3, SID_INFLICT_WOUND_HEALTH);
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU4, SID_HEAL_BATTLE);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if (item == menu_info_types.SERVER_MENU1)
|
||||
{
|
||||
addAttribModifier(player, HEALTH, -500, 0.0f, 0.0f, MOD_POOL);
|
||||
}
|
||||
if (item == menu_info_types.SERVER_MENU4)
|
||||
{
|
||||
healShockWound(player, 1000);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**********************************************************************
|
||||
* Title: terminal_wound.script
|
||||
* Description: script for the beta wound terminal. Ow!
|
||||
**********************************************************************/
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
const string_id SID_INFLICT_DAMAGE = new string_id("wound_terminal", "inflict_damage");
|
||||
const string_id SID_INFLICT_WOUND = new string_id("wound_terminal", "inflict_wound");
|
||||
const string_id SID_INFLICT_WOUND_HEALTH = new string_id("wound_terminal", "heal_wound_health");
|
||||
const string_id SID_HEAL_BATTLE = new string_id("wound_terminal", "heal_battle_fatigue");
|
||||
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_INFLICT_DAMAGE);
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU2, SID_INFLICT_WOUND);
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU3, SID_INFLICT_WOUND_HEALTH);
|
||||
mi.addRootMenu(menu_info_types.SERVER_MENU4, SID_HEAL_BATTLE);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if (item == menu_info_types.SERVER_MENU1)
|
||||
{
|
||||
addAttribModifier(player, HEALTH, -500, 0.0f, 0.0f, MOD_POOL);
|
||||
}
|
||||
|
||||
if (item == menu_info_types.SERVER_MENU4)
|
||||
{
|
||||
healShockWound(player, 1000);
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.sui;
|
||||
import script.library.xp;
|
||||
import script.library.prose;
|
||||
import script.library.pclib;
|
||||
|
||||
public class terminal_xp extends script.terminal.base.terminal_add_use
|
||||
{
|
||||
public terminal_xp()
|
||||
{
|
||||
}
|
||||
public static final int XP_AMOUNT = 100000;
|
||||
public static final String TBL = "datatables/skill/skills.iff";
|
||||
public static final String VAR_XP_TYPES = "xp_types";
|
||||
public static final String VAR_XP_TYPES_LIST = "xp_types.list";
|
||||
public static final String VAR_XP_TYPES_NAMES = "xp_types.names";
|
||||
public static final String HANDLER_XP_SELECT = "handleXpSelect";
|
||||
public static final String HANDLER_XP_AMOUNT_SELECT = "handleXpAmountSelect";
|
||||
public static final string_id PROSE_GRANT_XP = new string_id("base_player", "prose_grant_xp");
|
||||
public static final String VAR_DESIRED_XP_TYPE = "desired_xpType";
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
removeObjVar(self, VAR_XP_TYPES_LIST);
|
||||
initializeXpTerminal(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
if (item == menu_info_types.ITEM_USE)
|
||||
{
|
||||
String[] xpTypes = utils.getStringBatchScriptVar(self, VAR_XP_TYPES_NAMES);
|
||||
if ((xpTypes != null) && (xpTypes.length > 0))
|
||||
{
|
||||
String prompt = "Select the xp type you would like more xp in...";
|
||||
String title = "Beta XP Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, xpTypes, HANDLER_XP_SELECT);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
public void initializeXpTerminal(obj_id self) throws InterruptedException
|
||||
{
|
||||
String[] xpTypes = xp.getXpTypes(self);
|
||||
if ((xpTypes != null) && (xpTypes.length > 0))
|
||||
{
|
||||
setXpTypesScriptVar(self, xpTypes);
|
||||
}
|
||||
}
|
||||
public void setXpTypesScriptVar(obj_id self, String[] varData) throws InterruptedException
|
||||
{
|
||||
if ((varData == null) || (varData.length == 0))
|
||||
{
|
||||
debugSpeakMsg(self, "setXpTypesVar: passed bad string array!");
|
||||
return;
|
||||
}
|
||||
utils.setBatchScriptVar(self, VAR_XP_TYPES_LIST, varData);
|
||||
String[] xpNames = new String[varData.length];
|
||||
for (int i = 0; i < varData.length; i++)
|
||||
{
|
||||
xpNames[i] = "@exp_n:" + varData[i];
|
||||
}
|
||||
utils.setBatchScriptVar(self, VAR_XP_TYPES_NAMES, xpNames);
|
||||
}
|
||||
public int handleXpSelect(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
if (!isIdValid(player))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
if (btn == sui.BP_CANCEL)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
if (idx < 0)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String[] xpTypes = utils.getStringBatchScriptVar(self, VAR_XP_TYPES_LIST);
|
||||
if (xpTypes == null || xpTypes.length == 0 || idx >= xpTypes.length)
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "There has been an error in determining the xp type selected.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String xpType = xpTypes[idx];
|
||||
int xp = getExperiencePoints(player, xpType);
|
||||
setObjVar(player, VAR_DESIRED_XP_TYPE, xpType);
|
||||
String prompt = "Select the amount of XP you desire in the right box";
|
||||
String title = "Select your desired XP amount";
|
||||
sui.transfer(self, player, prompt, title, "Available", XP_AMOUNT, "Amount", 0, HANDLER_XP_AMOUNT_SELECT);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleXpAmountSelect(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int amt = sui.getTransferInputTo(params);
|
||||
if (btn == sui.BP_CANCEL)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String xpType = getStringObjVar(player, VAR_DESIRED_XP_TYPE);
|
||||
if (xpType.equals(""))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
removeObjVar(player, VAR_DESIRED_XP_TYPE);
|
||||
xp.grant(player, xpType, amt);
|
||||
dictionary d = new dictionary();
|
||||
d.put("xpType", xpType);
|
||||
d.put("playerId", player);
|
||||
messageTo(self, "handleDisplayXp", d, 1, false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleDisplayXp(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = params.getObjId("playerId");
|
||||
String xpType = params.getString("xpType");
|
||||
string_id PROSE_HAVE_XP = new string_id("base_player", "prose_have_xp");
|
||||
int xp = getExperiencePoints(player, xpType);
|
||||
prose_package pp = prose.getPackage(PROSE_HAVE_XP, "@exp_n:" + xpType, xp);
|
||||
sendSystemMessageProse(player, pp);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
/**
|
||||
* Title: terminal_food.script
|
||||
* Description: BETA SCRIPT: food dispenser
|
||||
*/
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.utils;
|
||||
include library.sui;
|
||||
include library.xp;
|
||||
include library.prose;
|
||||
include library.pclib;
|
||||
|
||||
/***** INHERITS ********************************************************/
|
||||
|
||||
inherits terminal.base.terminal_add_use;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const int XP_AMOUNT = 100000;
|
||||
|
||||
const string TBL = "datatables/skill/skills.iff";
|
||||
|
||||
const string VAR_XP_TYPES = "xp_types";
|
||||
const string VAR_XP_TYPES_LIST = "xp_types.list";
|
||||
const string VAR_XP_TYPES_NAMES = "xp_types.names";
|
||||
|
||||
const string HANDLER_XP_SELECT = "handleXpSelect";
|
||||
const string HANDLER_XP_AMOUNT_SELECT = "handleXpAmountSelect";
|
||||
|
||||
const string_id PROSE_GRANT_XP = new string_id("base_player","prose_grant_xp");
|
||||
|
||||
const string VAR_DESIRED_XP_TYPE = "desired_xpType";
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnAttach()
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
removeObjVar(self, VAR_XP_TYPES_LIST);
|
||||
initializeXpTerminal(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
|
||||
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
||||
{
|
||||
|
||||
if ( item == menu_info_types.ITEM_USE )
|
||||
{
|
||||
string[] xpTypes = utils.getStringBatchScriptVar(self, VAR_XP_TYPES_NAMES);
|
||||
if ( (xpTypes != null) && (xpTypes.length > 0) )
|
||||
{
|
||||
string prompt = "Select the xp type you would like more xp in...";
|
||||
string title = "Beta XP Dispenser";
|
||||
sui.listbox(self, player, prompt, sui.OK_CANCEL, title, xpTypes, HANDLER_XP_SELECT);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
/***** FUNCTIONS *******************************************************/
|
||||
void initializeXpTerminal(obj_id self)
|
||||
{
|
||||
string[] xpTypes = xp.getXpTypes(self);
|
||||
if ( (xpTypes != null) && (xpTypes.length > 0) )
|
||||
{
|
||||
setXpTypesScriptVar(self, xpTypes);
|
||||
}
|
||||
}
|
||||
|
||||
void setXpTypesScriptVar(obj_id self, string[] varData)
|
||||
{
|
||||
if ( (varData == null) || (varData.length == 0) )
|
||||
{
|
||||
debugSpeakMsg(self, "setXpTypesVar: passed bad string array!");
|
||||
return;
|
||||
}
|
||||
|
||||
utils.setBatchScriptVar(self, VAR_XP_TYPES_LIST, varData);
|
||||
|
||||
string[] xpNames = new string[varData.length];
|
||||
for ( int i = 0; i < varData.length; i++ )
|
||||
xpNames[i] = "@exp_n:" + varData[i];
|
||||
|
||||
utils.setBatchScriptVar(self, VAR_XP_TYPES_NAMES, xpNames);
|
||||
}
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
messageHandler handleXpSelect()
|
||||
{
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
if ( !isIdValid(player) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
if ( btn == sui.BP_CANCEL )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
int idx = sui.getListboxSelectedRow(params);
|
||||
if ( idx < 0 )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
string[] xpTypes = utils.getStringBatchScriptVar(self, VAR_XP_TYPES_LIST);
|
||||
if ( xpTypes == null || xpTypes.length == 0 || idx >= xpTypes.length )
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "There has been an error in determining the xp type selected.");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/*string[] typeSplit = split(xpTypes[idx], ':');
|
||||
string xpType = typeSplit[1];*/
|
||||
|
||||
string xpType = xpTypes[idx];
|
||||
|
||||
int xp = getExperiencePoints(player, xpType);
|
||||
|
||||
setObjVar(player, VAR_DESIRED_XP_TYPE, xpType);
|
||||
|
||||
string prompt = "Select the amount of XP you desire in the right box";
|
||||
string title = "Select your desired XP amount";
|
||||
sui.transfer(self, player, prompt, title, "Available", XP_AMOUNT, "Amount", 0, HANDLER_XP_AMOUNT_SELECT);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handleXpAmountSelect()
|
||||
{
|
||||
obj_id player = sui.getPlayerId(params);
|
||||
int btn = sui.getIntButtonPressed(params);
|
||||
int amt = sui.getTransferInputTo(params);
|
||||
|
||||
if ( btn == sui.BP_CANCEL )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string xpType = getStringObjVar(player, VAR_DESIRED_XP_TYPE);
|
||||
if ( xpType.equals("") )
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
removeObjVar(player, VAR_DESIRED_XP_TYPE);
|
||||
|
||||
/*
|
||||
prose_package pp = prose.getPackage(PROSE_GRANT_XP, "@exp_n:" + xpType, amt);
|
||||
sendSystemMessageProse(player, pp);
|
||||
|
||||
pclib.msgGrantXP(player, xpType, amt);
|
||||
*/
|
||||
|
||||
xp.grant(player, xpType, amt);
|
||||
|
||||
dictionary d = new dictionary();
|
||||
d.put("xpType", xpType);
|
||||
d.put("playerId", player);
|
||||
|
||||
messageTo(self, "handleDisplayXp", d, 1, false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler handleDisplayXp()
|
||||
{
|
||||
obj_id player = params.getObjId("playerId");
|
||||
string xpType = params.getString("xpType");
|
||||
|
||||
string_id PROSE_HAVE_XP = new string_id("base_player", "prose_have_xp");
|
||||
|
||||
int xp = getExperiencePoints(player, xpType);
|
||||
|
||||
prose_package pp = prose.getPackage(PROSE_HAVE_XP, "@exp_n:" + xpType, xp);
|
||||
sendSystemMessageProse(player, pp);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.create;
|
||||
import script.library.ai_lib;
|
||||
import script.library.utils;
|
||||
|
||||
public class test_create extends script.base_script
|
||||
{
|
||||
public test_create()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
int stringCheck = text.indexOf("create ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
String toCreate = text.substring(text.indexOf(" ") + 1);
|
||||
String[] createParms = split(toCreate, ' ');
|
||||
location here = getLocation(self);
|
||||
location heading = getHeading(self);
|
||||
int numToMake = 1;
|
||||
float distance = 1.25f;
|
||||
float spacing = 1.25f;
|
||||
boolean spaceUsingCollisionRadius = true;
|
||||
if (createParms.length > 1)
|
||||
{
|
||||
numToMake = utils.stringToInt(createParms[1]);
|
||||
if (createParms.length > 2)
|
||||
{
|
||||
distance = utils.stringToFloat(createParms[2]);
|
||||
if (createParms.length > 3)
|
||||
{
|
||||
spacing = utils.stringToFloat(createParms[3]);
|
||||
spaceUsingCollisionRadius = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numToMake; ++i)
|
||||
{
|
||||
final float offset = i == 0 ? distance : spacing;
|
||||
here.x += heading.x * offset;
|
||||
here.z += heading.z * offset;
|
||||
final obj_id creature = create.object(createParms[0], here);
|
||||
if (spaceUsingCollisionRadius && isValidId(creature))
|
||||
{
|
||||
spacing = getObjectCollisionRadius(creature) * 2.5f;
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
stringCheck = text.indexOf("lookat ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
String toCreate = text.substring(text.indexOf(" ") + 1, text.length());
|
||||
location here = getLocation(self);
|
||||
here.x = here.x + 1.25f;
|
||||
obj_id guy = create.object(toCreate, here);
|
||||
if (!isIdValid(guy))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (hasScript(guy, "ai.ai"))
|
||||
{
|
||||
stop(guy);
|
||||
ai_lib.setDefaultCalmBehavior(guy, ai_lib.BEHAVIOR_SENTINEL);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
stringCheck = text.indexOf("baby ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
String toCreate = text.substring(text.indexOf(" ") + 1, text.length());
|
||||
location here = getLocation(self);
|
||||
here.x = here.x + 1.25f;
|
||||
obj_id guy = create.object(toCreate, here);
|
||||
if (isIdValid(guy))
|
||||
{
|
||||
attachScript(guy, "ai.pet_advance");
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
stringCheck = text.indexOf("persist ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
String toCreate = text.substring(text.indexOf(" ") + 1, text.length());
|
||||
location here = getLocation(self);
|
||||
here.x = here.x + 2;
|
||||
String[] createParms = split(toCreate, ' ');
|
||||
if (createParms.length > 1)
|
||||
{
|
||||
int numToMake = utils.stringToInt(createParms[1]);
|
||||
for (int i = 0; i < numToMake; i++)
|
||||
{
|
||||
obj_id newNpc = create.object(createParms[0], here);
|
||||
if (isIdValid(newNpc))
|
||||
{
|
||||
persistObject(newNpc);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id newNpc = create.object(toCreate, here);
|
||||
if (isIdValid(newNpc))
|
||||
{
|
||||
persistObject(newNpc);
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
include library.create;
|
||||
include library.ai_lib;
|
||||
include library.utils;
|
||||
|
||||
trigger OnSpeaking (string text)
|
||||
{
|
||||
int stringCheck = text.indexOf("create ");
|
||||
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
string toCreate = text.substring(text.indexOf(" ") + 1);
|
||||
string[] createParms = split(toCreate, ' ');
|
||||
|
||||
location here = getLocation(self);
|
||||
location heading = getHeading(self);
|
||||
|
||||
// defaults
|
||||
int numToMake = 1;
|
||||
float distance = 1.25f;
|
||||
float spacing = 1.25f;
|
||||
boolean spaceUsingCollisionRadius = true;
|
||||
|
||||
// parse optional parameters
|
||||
if (createParms.length > 1)
|
||||
{
|
||||
numToMake = utils.stringToInt(createParms[1]);
|
||||
|
||||
if (createParms.length > 2)
|
||||
{
|
||||
distance = utils.stringToFloat(createParms[2]);
|
||||
|
||||
if (createParms.length > 3)
|
||||
{
|
||||
spacing = utils.stringToFloat(createParms[3]);
|
||||
spaceUsingCollisionRadius = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < numToMake; ++i)
|
||||
{
|
||||
const float offset = i == 0 ? distance : spacing;
|
||||
|
||||
here.x += heading.x * offset;
|
||||
here.z += heading.z * offset;
|
||||
|
||||
const obj_id creature = create.object(createParms[0], here);
|
||||
|
||||
if (spaceUsingCollisionRadius && isValidId(creature))
|
||||
{
|
||||
spacing = getObjectCollisionRadius(creature) * 2.5f;
|
||||
}
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
stringCheck = text.indexOf("lookat ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
string toCreate = text.substring( text.indexOf(" ")+1, text.length() );
|
||||
location here = getLocation (self);
|
||||
here.x = here.x + 1.25f;
|
||||
obj_id guy = create.object (toCreate, here);
|
||||
if ( !isIdValid(guy) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
if ( hasScript( guy, "ai.ai" ) )
|
||||
{
|
||||
stop( guy );
|
||||
ai_lib.setDefaultCalmBehavior( guy, ai_lib.BEHAVIOR_SENTINEL );
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
stringCheck = text.indexOf("baby ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
string toCreate = text.substring( text.indexOf(" ")+1, text.length() );
|
||||
location here = getLocation (self);
|
||||
here.x = here.x + 1.25f;
|
||||
obj_id guy = create.object (toCreate, here);
|
||||
if ( isIdValid( guy ) )
|
||||
attachScript( guy, "ai.pet_advance" );
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
stringCheck = text.indexOf("persist ");
|
||||
if (stringCheck > -1)
|
||||
{
|
||||
string toCreate = text.substring( text.indexOf(" ")+1, text.length() );
|
||||
location here = getLocation (self);
|
||||
here.x = here.x + 2;
|
||||
string[] createParms = split( toCreate, ' ' );
|
||||
if ( createParms.length > 1 )
|
||||
{
|
||||
int numToMake = utils.stringToInt(createParms[1]);
|
||||
for ( int i = 0; i < numToMake; i++ )
|
||||
{
|
||||
obj_id newNpc = create.object (createParms[0], here);
|
||||
if ( isIdValid( newNpc ) )
|
||||
persistObject( newNpc );
|
||||
else
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_id newNpc = create.object (toCreate, here);
|
||||
if ( isIdValid( newNpc ) )
|
||||
persistObject( newNpc );
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.resource;
|
||||
import script.library.sui;
|
||||
|
||||
public class uber_survey_tool extends script.base_script
|
||||
{
|
||||
public uber_survey_tool()
|
||||
{
|
||||
}
|
||||
public static final String HANDLER_SET_TOOL_CLASS = "handleSetToolClass";
|
||||
public static final string_id SID_TOOL_OPTIONS = new string_id("sui", "tool_options");
|
||||
public static final string_id SID_TOOL_CLASS = new string_id("sui", "survey_class");
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
setName(self, "Uber Survey Tool");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
int mnuOptions = -1;
|
||||
menu_info_data mid = mi.getMenuItemByType(menu_info_types.SERVER_ITEM_OPTIONS);
|
||||
if (mid == null)
|
||||
{
|
||||
mnuOptions = mi.addRootMenu(menu_info_types.SERVER_ITEM_OPTIONS, SID_TOOL_OPTIONS);
|
||||
}
|
||||
else
|
||||
{
|
||||
mnuOptions = mid.getId();
|
||||
}
|
||||
if (mnuOptions > 0)
|
||||
{
|
||||
int subClass = mi.addSubMenu(mnuOptions, menu_info_types.SERVER_SURVEY_TOOL_CLASS, SID_TOOL_CLASS);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
|
||||
{
|
||||
if (item == menu_info_types.SERVER_SURVEY_TOOL_CLASS)
|
||||
{
|
||||
sui.listbox(self, player, "Select a class to set your survey tool to...", resource.CLASS_NAME, HANDLER_SET_TOOL_CLASS);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnRequestCoreSample(obj_id self, obj_id player, String resource_type) throws InterruptedException
|
||||
{
|
||||
removeObjVar(player, resource.VAR_SAMPLE_STAMP);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int handleSetToolClass(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id player = params.getObjId("player");
|
||||
int selRow = sui.getListboxSelectedRow(params);
|
||||
switch (selRow)
|
||||
{
|
||||
case -1:
|
||||
return SCRIPT_CONTINUE;
|
||||
default:
|
||||
if ((player != null) && (player != obj_id.NULL_ID))
|
||||
{
|
||||
if (!resource.setToolClass(self, selRow))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Uber Survey Tool: class set FAILED");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Uber Survey Tool: class set -> " + resource.CLASS_NAME[selRow]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/**
|
||||
* Title: uber_survey_tool.script
|
||||
* Description: script for GM survey tool testing
|
||||
*/
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
|
||||
include library.resource;
|
||||
include library.sui;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const string HANDLER_SET_TOOL_CLASS = "handleSetToolClass";
|
||||
|
||||
const string_id SID_TOOL_OPTIONS = new string_id("sui", "tool_options");
|
||||
const string_id SID_TOOL_CLASS = new string_id("sui", "survey_class");
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
setName(self,"Uber Survey Tool");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
int mnuOptions = -1;
|
||||
menu_info_data mid = mi.getMenuItemByType(menu_info_types.SERVER_ITEM_OPTIONS);
|
||||
if ( mid == null )
|
||||
{
|
||||
mnuOptions = mi.addRootMenu(menu_info_types.SERVER_ITEM_OPTIONS, SID_TOOL_OPTIONS);
|
||||
}
|
||||
else
|
||||
{
|
||||
mnuOptions = mid.getId();
|
||||
}
|
||||
|
||||
if ( mnuOptions > 0 )
|
||||
{
|
||||
int subClass = mi.addSubMenu(mnuOptions, menu_info_types.SERVER_SURVEY_TOOL_CLASS, SID_TOOL_CLASS);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuSelect(obj_id player, int item)
|
||||
{
|
||||
if ( item == menu_info_types.SERVER_SURVEY_TOOL_CLASS )
|
||||
{
|
||||
sui.listbox(self, player, "Select a class to set your survey tool to...", resource.CLASS_NAME, HANDLER_SET_TOOL_CLASS);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnRequestCoreSample(obj_id player, string resource_type)
|
||||
{
|
||||
removeObjVar(player, resource.VAR_SAMPLE_STAMP);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/***** MESSAGEHANDLERS **************************************************/
|
||||
messageHandler handleSetToolClass()
|
||||
{
|
||||
obj_id player = params.getObjId("player");
|
||||
int selRow = sui.getListboxSelectedRow(params);
|
||||
switch (selRow)
|
||||
{
|
||||
case -1:
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
default:
|
||||
if ( (player != null) && (player != obj_id.NULL_ID) )
|
||||
{
|
||||
if ( !resource.setToolClass(self, selRow) )
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Uber Survey Tool: class set FAILED");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Uber Survey Tool: class set -> " + resource.CLASS_NAME[selRow]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.ai_lib;
|
||||
import script.library.callable;
|
||||
import script.library.pet_lib;
|
||||
import script.library.utils;
|
||||
import script.library.chat;
|
||||
import script.library.create;
|
||||
|
||||
public class vehicle_vendor extends script.base_script
|
||||
{
|
||||
public vehicle_vendor()
|
||||
{
|
||||
}
|
||||
public static final String VEHICLE_VENDOR_CONVO = "beta/vehicle_vendor";
|
||||
public static final int EXPIRATION_TIME = 60 * 60 * 24 * 16;
|
||||
public static final int VEHICLE_EXPIRATION_TIME = 60 * 60 * 24 * 16;
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
setInvulnerable(self, true);
|
||||
persistObject(self);
|
||||
setCondition(self, CONDITION_CONVERSABLE);
|
||||
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
setObjVar(self, "ai.diction", "townperson");
|
||||
setObjVar(self, "vehicle_vendor.create", (getGameTime() + EXPIRATION_TIME));
|
||||
setName(self, "Travelling Vehicle Merchant");
|
||||
messageTo(self, "expireAndCleanup", null, EXPIRATION_TIME, true);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "vehicle_vendor.create");
|
||||
if (getGameTime() > expirationTime)
|
||||
{
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int expireAndCleanup(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
destroyObject(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
|
||||
{
|
||||
int mnu = mi.addRootMenu(menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data mdata = mi.getMenuItemById(mnu);
|
||||
mdata.setServerNotify(false);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnStartNpcConversation(obj_id self, obj_id speaker) throws InterruptedException
|
||||
{
|
||||
chat.setGoodMood(self);
|
||||
faceToBehavior(self, speaker);
|
||||
string_id greeting = new string_id(VEHICLE_VENDOR_CONVO, "start");
|
||||
string_id response[] = new string_id[2];
|
||||
response[0] = new string_id(VEHICLE_VENDOR_CONVO, "yes");
|
||||
response[1] = new string_id(VEHICLE_VENDOR_CONVO, "no");
|
||||
npcStartConversation(speaker, self, VEHICLE_VENDOR_CONVO, greeting, response);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnNpcConversationResponse(obj_id self, String convo, obj_id player, string_id response) throws InterruptedException
|
||||
{
|
||||
if (!convo.equals(VEHICLE_VENDOR_CONVO))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
npcRemoveConversationResponse(player, response);
|
||||
if ((response.getAsciiId()).equals("yes"))
|
||||
{
|
||||
if (getBooleanObjVar(player, "hasTestVehicle") == true)
|
||||
{
|
||||
string_id message = new string_id(VEHICLE_VENDOR_CONVO, "toomany");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
npcRemoveConversationResponse(player, new string_id(VEHICLE_VENDOR_CONVO, "no"));
|
||||
string_id message = new string_id(VEHICLE_VENDOR_CONVO, "choose");
|
||||
npcSpeak(player, message);
|
||||
string_id[] responses = new string_id[3];
|
||||
responses[0] = new string_id(VEHICLE_VENDOR_CONVO, "x34");
|
||||
responses[1] = new string_id(VEHICLE_VENDOR_CONVO, "bike");
|
||||
responses[2] = new string_id(VEHICLE_VENDOR_CONVO, "swoop");
|
||||
npcSetConversationResponses(player, responses);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if ((response.getAsciiId()).equals("no"))
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(VEHICLE_VENDOR_CONVO, "yes"));
|
||||
string_id message = new string_id(VEHICLE_VENDOR_CONVO, "goodbye");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
String mountType = response.getAsciiId();
|
||||
String diction = "";
|
||||
if (mountType.equals("x34"))
|
||||
{
|
||||
mountType = "landspeeder_x34";
|
||||
}
|
||||
else if (mountType.equals("bike"))
|
||||
{
|
||||
mountType = "speederbike";
|
||||
}
|
||||
else if (mountType.equals("swoop"))
|
||||
{
|
||||
mountType = "speederbike_swoop";
|
||||
}
|
||||
else
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id mount = createCraftedCreatureDevice(player, mountType);
|
||||
if (isIdValid(mount))
|
||||
{
|
||||
setObjVar(player, "hasTestVehicle", true);
|
||||
}
|
||||
string_id message = new string_id(VEHICLE_VENDOR_CONVO, "goodbye2");
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public obj_id createCraftedCreatureDevice(obj_id player, String vehicle) throws InterruptedException
|
||||
{
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ Entered PCD/Pet creation function.");
|
||||
obj_id datapad = utils.getPlayerDatapad(player);
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ player datapad objide detected as: #" + datapad);
|
||||
if (!isIdValid(datapad))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String controlTemplate = "object/intangible/vehicle/" + vehicle + "_pcd.iff";
|
||||
obj_id petControlDevice = createObject(controlTemplate, datapad, "");
|
||||
attachScript(petControlDevice, "beta.free_vehicle");
|
||||
setObjVar(petControlDevice, "hasOwner", player);
|
||||
if (vehicle.equals("landspeeder_x34"))
|
||||
{
|
||||
setObjVar(petControlDevice, "vehicle_attribs.object_ref", "x34");
|
||||
}
|
||||
if (vehicle.equals("speederbike"))
|
||||
{
|
||||
setObjVar(petControlDevice, "vehicle_attribs.object_ref", "spdrbike");
|
||||
}
|
||||
if (vehicle.equals("speederbike_swoop"))
|
||||
{
|
||||
setObjVar(petControlDevice, "vehicle_attribs.object_ref", "swoop");
|
||||
}
|
||||
if (!isIdValid(petControlDevice))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Failed to create pet control device for vehicle");
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(petControlDevice, "pet.crafted", true);
|
||||
setObjVar(petControlDevice, "vehicle.template", vehicle);
|
||||
setObjVar(petControlDevice, "vehicle_vendor.create", (getGameTime() + VEHICLE_EXPIRATION_TIME));
|
||||
messageTo(petControlDevice, "expireAndCleanup", null, VEHICLE_EXPIRATION_TIME, true);
|
||||
attachScript(petControlDevice, "systems.vehicle_system.vehicle_control_device");
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ successfully created PCD object for vehicular prototype. Obj_id is #" + petControlDevice);
|
||||
}
|
||||
obj_id pet = create.object("object/mobile/vehicle/" + vehicle + ".iff", getLocation(player));
|
||||
if (!isIdValid(pet))
|
||||
{
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ OBJ_ID Validity check on Vehicular_Prototype pet object came back as NOT VALID");
|
||||
return petControlDevice;
|
||||
}
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ SUCCESSFULLY created the vehicular_prototype pet object. Prepping to attach objvars to it");
|
||||
setObjVar(pet, "vehicularTestBed", 1);
|
||||
callable.setCallableLinks(player, petControlDevice, pet);
|
||||
if (couldPetBeMadeMountable(pet) != 0)
|
||||
{
|
||||
debugServerConsoleMsg(null, "+++ VEHICLE . onAttach +++ couldPetBeMadeMountable(pet) returned FALSE.");
|
||||
return pet;
|
||||
}
|
||||
if (!makePetMountable(pet))
|
||||
{
|
||||
debugServerConsoleMsg(null, "+++ VEHICLE . onAttach +++ makePetMountable(pet) returned FALSE.");
|
||||
return pet;
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(petControlDevice, "ai.pet.trainedMount", 1);
|
||||
}
|
||||
return petControlDevice;
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
include library.ai_lib;
|
||||
include library.callable;
|
||||
include library.pet_lib;
|
||||
include library.utils;
|
||||
include library.chat;
|
||||
include library.create;
|
||||
|
||||
const string VEHICLE_VENDOR_CONVO = "beta/vehicle_vendor";
|
||||
|
||||
const int EXPIRATION_TIME = 60 * 60 * 24 * 16; // 16 days
|
||||
const int VEHICLE_EXPIRATION_TIME = 60 * 60 * 24 * 16; // 16 days
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
setInvulnerable(self, true);
|
||||
persistObject(self);
|
||||
setCondition(self, CONDITION_CONVERSABLE);
|
||||
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
|
||||
setObjVar(self, "ai.diction", "townperson");
|
||||
setObjVar(self, "vehicle_vendor.create", (getGameTime() + EXPIRATION_TIME));
|
||||
setName(self, "Travelling Vehicle Merchant");
|
||||
messageTo (self, "expireAndCleanup", null, EXPIRATION_TIME, true);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
int expirationTime = getIntObjVar(self, "vehicle_vendor.create");
|
||||
|
||||
if(getGameTime() > expirationTime)
|
||||
messageTo(self, "expireAndCleanup", null, 0, false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
messageHandler expireAndCleanup()
|
||||
{
|
||||
destroyObject(self);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
||||
{
|
||||
int mnu = mi.addRootMenu (menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data mdata = mi.getMenuItemById(mnu);
|
||||
mdata.setServerNotify(false);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
trigger OnStartNpcConversation (obj_id speaker)
|
||||
{
|
||||
chat.setGoodMood(self);
|
||||
|
||||
faceToBehavior(self, speaker);
|
||||
string_id greeting = new string_id (VEHICLE_VENDOR_CONVO, "start");//Wanna buy a mount?
|
||||
string_id response[] = new string_id [2];
|
||||
response[0] = new string_id (VEHICLE_VENDOR_CONVO, "yes");//yes
|
||||
response[1] = new string_id (VEHICLE_VENDOR_CONVO, "no");//no
|
||||
|
||||
npcStartConversation (speaker, self, VEHICLE_VENDOR_CONVO, greeting, response);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnNpcConversationResponse(string convo, obj_id player, string_id response)
|
||||
{
|
||||
if(!convo.equals(VEHICLE_VENDOR_CONVO))
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
npcRemoveConversationResponse(player, response);
|
||||
|
||||
if(response.getAsciiId().equals("yes"))//yes
|
||||
{
|
||||
if(getBooleanObjVar(player, "hasTestVehicle") == true)
|
||||
{
|
||||
string_id message = new string_id (VEHICLE_VENDOR_CONVO, "toomany");//you have too many
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
|
||||
|
||||
npcRemoveConversationResponse(player, new string_id(VEHICLE_VENDOR_CONVO, "no"));
|
||||
|
||||
string_id message = new string_id (VEHICLE_VENDOR_CONVO, "choose");//pick a vehicle
|
||||
npcSpeak(player, message);
|
||||
string_id[] responses = new string_id[3];
|
||||
responses[0] = new string_id(VEHICLE_VENDOR_CONVO, "x34");
|
||||
responses[1] = new string_id(VEHICLE_VENDOR_CONVO, "bike");
|
||||
responses[2] = new string_id(VEHICLE_VENDOR_CONVO, "swoop");
|
||||
npcSetConversationResponses(player, responses);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
else if(response.getAsciiId().equals("no"))//no
|
||||
{
|
||||
npcRemoveConversationResponse(player, new string_id(VEHICLE_VENDOR_CONVO, "yes"));
|
||||
|
||||
string_id message = new string_id (VEHICLE_VENDOR_CONVO, "goodbye");//goodbye
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
string mountType = response.getAsciiId();
|
||||
|
||||
string diction = "";
|
||||
|
||||
if(mountType.equals("x34"))
|
||||
mountType = "landspeeder_x34";
|
||||
else if(mountType.equals("bike"))
|
||||
mountType = "speederbike";
|
||||
else if(mountType.equals("swoop"))
|
||||
mountType = "speederbike_swoop";
|
||||
else
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
obj_id mount = createCraftedCreatureDevice(player, mountType);
|
||||
|
||||
if(isIdValid(mount))
|
||||
{
|
||||
setObjVar(player, "hasTestVehicle", true);
|
||||
}
|
||||
|
||||
string_id message = new string_id (VEHICLE_VENDOR_CONVO, "goodbye2");//goodbye
|
||||
npcSpeak(player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
obj_id createCraftedCreatureDevice(obj_id player, string vehicle)
|
||||
{
|
||||
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ Entered PCD/Pet creation function.");
|
||||
|
||||
// Create a new control device
|
||||
obj_id datapad = utils.getPlayerDatapad(player);
|
||||
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ player datapad objide detected as: #" + datapad);
|
||||
|
||||
if(!isIdValid(datapad))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string controlTemplate = "object/intangible/vehicle/" + vehicle + "_pcd.iff";
|
||||
obj_id petControlDevice = createObject(controlTemplate, datapad, "");
|
||||
attachScript(petControlDevice, "beta.free_vehicle");
|
||||
setObjVar(petControlDevice, "hasOwner", player);
|
||||
|
||||
if(vehicle == "landspeeder_x34")
|
||||
{
|
||||
setObjVar(petControlDevice, "vehicle_attribs.object_ref", "x34");
|
||||
}
|
||||
|
||||
if(vehicle == "speederbike")
|
||||
{
|
||||
setObjVar(petControlDevice, "vehicle_attribs.object_ref", "spdrbike");
|
||||
}
|
||||
|
||||
if(vehicle == "speederbike_swoop")
|
||||
{
|
||||
setObjVar(petControlDevice, "vehicle_attribs.object_ref", "swoop");
|
||||
}
|
||||
|
||||
if(!isIdValid(petControlDevice))
|
||||
{
|
||||
sendSystemMessageTestingOnly(player, "Failed to create pet control device for vehicle");
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(petControlDevice, "pet.crafted", true);
|
||||
setObjVar(petControlDevice, "vehicle.template", vehicle);
|
||||
setObjVar(petControlDevice, "vehicle_vendor.create", (getGameTime() + VEHICLE_EXPIRATION_TIME));
|
||||
messageTo (petControlDevice, "expireAndCleanup", null, VEHICLE_EXPIRATION_TIME, true);
|
||||
attachScript(petControlDevice, "systems.vehicle_system.vehicle_control_device");
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ successfully created PCD object for vehicular prototype. Obj_id is #" + petControlDevice);
|
||||
}
|
||||
|
||||
// Create the new pet
|
||||
obj_id pet = create.object("object/mobile/vehicle/" + vehicle + ".iff", getLocation(player));
|
||||
|
||||
if(!isIdValid(pet))
|
||||
{
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ OBJ_ID Validity check on Vehicular_Prototype pet object came back as NOT VALID");
|
||||
return petControlDevice;
|
||||
}
|
||||
|
||||
debugServerConsoleMsg(player, "+++ VEHICLE_DEED . createCraftedCreatureDevice +++ SUCCESSFULLY created the vehicular_prototype pet object. Prepping to attach objvars to it");
|
||||
|
||||
// Attach it to the control device
|
||||
setObjVar(pet, "vehicularTestBed", 1);
|
||||
|
||||
callable.setCallableLinks(player, petControlDevice, pet);
|
||||
|
||||
//make vehicle mountable
|
||||
if(couldPetBeMadeMountable(pet) != 0)
|
||||
{
|
||||
debugServerConsoleMsg(null, "+++ VEHICLE . onAttach +++ couldPetBeMadeMountable(pet) returned FALSE.");
|
||||
return pet;
|
||||
}
|
||||
|
||||
if(!makePetMountable(pet))
|
||||
{
|
||||
debugServerConsoleMsg(null, "+++ VEHICLE . onAttach +++ makePetMountable(pet) returned FALSE.");
|
||||
return pet;
|
||||
}
|
||||
else
|
||||
{
|
||||
setObjVar(petControlDevice, "ai.pet.trainedMount", 1);
|
||||
}
|
||||
|
||||
return petControlDevice;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
public class weather_test extends script.base_script
|
||||
{
|
||||
public weather_test()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
debugSpeakMsg(self, "Weather Test Script Attached");
|
||||
debugSpeakMsg(self, "Commands: clear, mild, heavy, severe");
|
||||
setObjVar(self, "weatherIndex", 0);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnHearSpeech(obj_id self, obj_id speaker, String text) throws InterruptedException
|
||||
{
|
||||
if (text.equals("0") || text.equals("clear"))
|
||||
{
|
||||
debugSpeakMsg(self, "Clear Weather");
|
||||
setWeatherData(0, 0.01f, 0.01f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text.equals("1") || text.equals("mild"))
|
||||
{
|
||||
debugSpeakMsg(self, "Mild Weather");
|
||||
setWeatherData(1, 0.02f, 0.02f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text.equals("2") || text.equals("heavy"))
|
||||
{
|
||||
debugSpeakMsg(self, "Heavy Weather");
|
||||
setWeatherData(2, 0.52f, 0.52f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text.equals("3") || text.equals("severe"))
|
||||
{
|
||||
debugSpeakMsg(self, "Severe Weather");
|
||||
setWeatherData(3, 0.95f, 0.95f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDetach(obj_id self) throws InterruptedException
|
||||
{
|
||||
debugSpeakMsg(self, "Detaching weather script. Resetting weather.");
|
||||
setWeatherData(0, 0.0f, 0.0f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
// Weather Control script
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
debugSpeakMsg(self, "Weather Test Script Attached");
|
||||
debugSpeakMsg(self, "Commands: clear, mild, heavy, severe");
|
||||
setObjVar(self, "weatherIndex", 0);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnHearSpeech(obj_id speaker, string text)
|
||||
{
|
||||
if (text == "0" || text == "clear")
|
||||
{
|
||||
debugSpeakMsg(self, "Clear Weather");
|
||||
setWeatherData(0, 0.01f, 0.01f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text == "1" || text == "mild")
|
||||
{
|
||||
debugSpeakMsg(self, "Mild Weather");
|
||||
setWeatherData(1, 0.02f, 0.02f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text == "2" || text == "heavy")
|
||||
{
|
||||
debugSpeakMsg(self, "Heavy Weather");
|
||||
setWeatherData(2, 0.52f, 0.52f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (text == "3" || text == "severe")
|
||||
{
|
||||
debugSpeakMsg(self, "Severe Weather");
|
||||
setWeatherData(3, 0.95f, 0.95f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDetach()
|
||||
{
|
||||
// Reset to clear weather regardless of state
|
||||
debugSpeakMsg(self, "Detaching weather script. Resetting weather.");
|
||||
setWeatherData (0, 0.0f, 0.0f);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
|
||||
public class world_delta extends script.base_script
|
||||
{
|
||||
public world_delta()
|
||||
{
|
||||
}
|
||||
public static final String VAR_DELTA_TARGET = "delta_target";
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
debugSpeakMsg(self, "world delta script attached!");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
if (text.startsWith("delta"))
|
||||
{
|
||||
obj_id target = getLookAtTarget(self);
|
||||
boolean badTarget = true;
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() == 1)
|
||||
{
|
||||
if ((target == null) || (target == obj_id.NULL_ID))
|
||||
{
|
||||
if (hasObjVar(self, VAR_DELTA_TARGET))
|
||||
{
|
||||
target = getObjIdObjVar(self, VAR_DELTA_TARGET);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugSpeakMsg(self, "using my lookAtTarget: " + target);
|
||||
}
|
||||
if (target != null)
|
||||
{
|
||||
badTarget = false;
|
||||
location pLoc = getLocation(self);
|
||||
location oLoc = getLocation(target);
|
||||
float dx = pLoc.x - oLoc.x;
|
||||
float dy = pLoc.y - oLoc.y;
|
||||
float dz = pLoc.z - oLoc.z;
|
||||
debugSpeakMsg(self, "(" + target + ") world delta = " + dx + " " + dy + " " + dz);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
st.nextToken();
|
||||
String param = st.nextToken();
|
||||
if (param.equals("target"))
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
param = st.nextToken();
|
||||
target = utils.stringToObjId(param);
|
||||
if (target != null)
|
||||
{
|
||||
setObjVar(self, VAR_DELTA_TARGET, target);
|
||||
debugSpeakMsg(self, "world delta target set to object " + target);
|
||||
badTarget = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (badTarget)
|
||||
{
|
||||
debugSpeakMsg(self, "I need to set a delta target using 'delta target <obj_id>'");
|
||||
}
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
|
||||
include library.utils;
|
||||
|
||||
const string VAR_DELTA_TARGET = "delta_target";
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
debugSpeakMsg(self, "world delta script attached!");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
if ( text.startsWith("delta") )
|
||||
{
|
||||
obj_id target = getLookAtTarget(self);
|
||||
boolean badTarget = true;
|
||||
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if ( st.countTokens() == 1 )
|
||||
{
|
||||
if ( (target == null) || (target == obj_id.NULL_ID) )
|
||||
{
|
||||
if ( hasObjVar(self, VAR_DELTA_TARGET) )
|
||||
{
|
||||
target = getObjIdObjVar(self, VAR_DELTA_TARGET);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
debugSpeakMsg(self, "using my lookAtTarget: " + target);
|
||||
}
|
||||
|
||||
if ( target != null )
|
||||
{
|
||||
badTarget = false;
|
||||
//perform delta calcs here
|
||||
|
||||
location pLoc = getLocation(self);
|
||||
location oLoc = getLocation(target);
|
||||
|
||||
float dx = pLoc.x - oLoc.x;
|
||||
float dy = pLoc.y - oLoc.y;
|
||||
float dz = pLoc.z - oLoc.z;
|
||||
|
||||
debugSpeakMsg(self, "(" + target + ") world delta = " + dx + " " + dy + " " + dz);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
st.nextToken(); //skip "delta" token
|
||||
|
||||
string param = st.nextToken();
|
||||
|
||||
if ( param.equals("target") )
|
||||
{
|
||||
if ( st.hasMoreTokens() )
|
||||
{
|
||||
param = st.nextToken();
|
||||
target = utils.stringToObjId(param);
|
||||
if ( target != null )
|
||||
{
|
||||
setObjVar(self, VAR_DELTA_TARGET, target);
|
||||
debugSpeakMsg(self, "world delta target set to object " + target);
|
||||
badTarget = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( badTarget )
|
||||
{
|
||||
debugSpeakMsg(self, "I need to set a delta target using 'delta target <obj_id>'");
|
||||
}
|
||||
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package script.beta;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
|
||||
public class xp_test extends script.base_script
|
||||
{
|
||||
public xp_test()
|
||||
{
|
||||
}
|
||||
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
||||
{
|
||||
if ((text.startsWith("grantXP")) || (text.startsWith("revokeXP")))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() != 3)
|
||||
{
|
||||
debugSpeakMsg(self, "PARAM ERROR - syntax: <grantXP/revokeXP> <xpType> <amt>");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
String cmd = st.nextToken();
|
||||
String xpType = st.nextToken();
|
||||
int amt = utils.stringToInt(st.nextToken());
|
||||
if (amt == -1)
|
||||
{
|
||||
debugSpeakMsg(self, "PARSE ERROR - syntax: <grantXP/revokeXP> <xpType> <amt>");
|
||||
}
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if ((target == null) || (target == obj_id.NULL_ID))
|
||||
{
|
||||
target = self;
|
||||
}
|
||||
if (!isPlayer(target))
|
||||
{
|
||||
debugSpeakMsg(self, "test_xp: invalid target for action!");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
if (cmd.equals("grantXP"))
|
||||
{
|
||||
if (grantExperiencePoints(target, xpType, amt) != XP_ERROR)
|
||||
{
|
||||
debugSpeakMsg(target, "test_xp(grantXP): " + xpType + " + " + amt + " = " + getExperiencePoints(target, xpType));
|
||||
}
|
||||
}
|
||||
else if (cmd.equals("revokeXP"))
|
||||
{
|
||||
if (grantExperiencePoints(target, xpType, -amt) != XP_ERROR)
|
||||
{
|
||||
debugSpeakMsg(target, "test_xp(revokeXP): " + xpType + " - " + amt + " = " + getExperiencePoints(target, xpType));
|
||||
}
|
||||
}
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
else if (text.startsWith("getXP"))
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if (st.countTokens() != 2)
|
||||
{
|
||||
debugSpeakMsg(self, "PARAM ERROR - syntax: getXP <xpType>");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
String cmd = st.nextToken();
|
||||
String xpType = st.nextToken();
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if ((target == null) || (target == obj_id.NULL_ID))
|
||||
{
|
||||
target = self;
|
||||
}
|
||||
if (!isPlayer(target))
|
||||
{
|
||||
debugSpeakMsg(self, "test_xp: invalid target for action!");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
int xp = getExperiencePoints(target, xpType);
|
||||
debugSpeakMsg(target, "XP: " + xpType + " = " + xp);
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
include library.utils;
|
||||
|
||||
trigger OnSpeaking(string text)
|
||||
{
|
||||
if ( (text.startsWith("grantXP")) || (text.startsWith("revokeXP")) )
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if ( st.countTokens() != 3 )
|
||||
{
|
||||
debugSpeakMsg(self, "PARAM ERROR - syntax: <grantXP/revokeXP> <xpType> <amt>");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
|
||||
string cmd = st.nextToken();
|
||||
string xpType = st.nextToken();
|
||||
int amt = utils.stringToInt(st.nextToken());
|
||||
if ( amt == -1 )
|
||||
{
|
||||
debugSpeakMsg(self, "PARSE ERROR - syntax: <grantXP/revokeXP> <xpType> <amt>");
|
||||
}
|
||||
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if ( (target == null) || (target == obj_id.NULL_ID) )
|
||||
{
|
||||
target = self;
|
||||
}
|
||||
|
||||
if ( !isPlayer(target) )
|
||||
{
|
||||
debugSpeakMsg(self, "test_xp: invalid target for action!");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
|
||||
if ( cmd == "grantXP" )
|
||||
{
|
||||
if ( grantExperiencePoints(target, xpType, amt) != XP_ERROR)
|
||||
{
|
||||
debugSpeakMsg(target, "test_xp(grantXP): " + xpType + " + " + amt + " = " + getExperiencePoints(target, xpType));
|
||||
}
|
||||
}
|
||||
else if ( cmd == "revokeXP" )
|
||||
{
|
||||
if ( grantExperiencePoints(target, xpType, -amt) != XP_ERROR)
|
||||
{
|
||||
debugSpeakMsg(target, "test_xp(revokeXP): " + xpType + " - " + amt + " = " + getExperiencePoints(target, xpType));
|
||||
}
|
||||
|
||||
}
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
else if ( text.startsWith("getXP") )
|
||||
{
|
||||
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
||||
if ( st.countTokens() != 2 )
|
||||
{
|
||||
debugSpeakMsg(self, "PARAM ERROR - syntax: getXP <xpType>");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
|
||||
string cmd = st.nextToken();
|
||||
string xpType = st.nextToken();
|
||||
|
||||
obj_id target = getLookAtTarget(self);
|
||||
if ( (target == null) || (target == obj_id.NULL_ID) )
|
||||
{
|
||||
target = self;
|
||||
}
|
||||
|
||||
if ( !isPlayer(target) )
|
||||
{
|
||||
debugSpeakMsg(self, "test_xp: invalid target for action!");
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
|
||||
int xp = getExperiencePoints(target, xpType);
|
||||
debugSpeakMsg(target, "XP: " + xpType + " = " + xp);
|
||||
return SCRIPT_OVERRIDE;
|
||||
}
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
Reference in New Issue
Block a user