mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
1027 lines
36 KiB
Plaintext
1027 lines
36 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: vendor.scriptlib
|
|
* Description:
|
|
* @author $Author:breinhart$
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
|
|
include java.util.Vector;
|
|
include library.create;
|
|
include library.player_structure;
|
|
include library.static_item;
|
|
|
|
//------------------------------------------------
|
|
// Constants
|
|
//------------------------------------------------
|
|
|
|
const string VAR_MAINTENANCE_RATE = "vendor.maintanence.rate";
|
|
const string VAR_DECAY_RATE = "vendor.maintanence.decay";
|
|
const string VAR_LAST_MAINTANENCE = "vendor.last_maintanence";
|
|
const string VAR_CONDITION = "vendor.condition";
|
|
const string VAR_MAX_CONDITION = "vendor.max_condition";
|
|
const string VAR_PACKUP_VERSION = "vendor.packup_version";
|
|
const string SPECIAL_VENDOR_IDENTIFIER = "vendor.special_vendor";
|
|
|
|
const int MAINTENANCE_HEARTBEAT = 3600; // 57.6 minutes
|
|
|
|
const int BASE_MAINT_RATE = 1;
|
|
const int BASE_DECAY_RATE = 2;
|
|
|
|
//LOGGING
|
|
const boolean LOGGING_ON = true;
|
|
const string LOGGING_CATEGORY = "greeter";
|
|
const string STATIC_ITEM_DEED_NAME = "static_item_deed_name";
|
|
|
|
const string OWNER_OBJVAR = "object.owner";
|
|
const string CHILD_GREETER_NONVENDOR_ID_OBJVAR = "object.child_greeter_nonvendor_objid";
|
|
const string CNTRLR_GREETER_NONVENDOR_ID_OBJVAR = "object.terminal_greeter_nonvendor_objid";
|
|
const string LASTKNOWN_GREETER_TERMINAL_LOC = "object.terminal_last_location";
|
|
//-----------------NONVENDOR VENDOR CONST
|
|
const string NONVENDOR_VENDOR_SCRIPT = "terminal.nonvendor";
|
|
const string NONVENDOR_VAR_PREFIX = "nonvendor";
|
|
const string NONVENDOR_TYPE_PREFIX = "nonvendor_";
|
|
const string NONTRADER_NONVENDOR_TYPE = NONVENDOR_VAR_PREFIX + ".give_nontrader";
|
|
const string NONVENDOR_CREATURE_TYPE_SCRVAR = NONVENDOR_VAR_PREFIX + ".creature_type";
|
|
const string NONVENDOR_NAMES_SCRVAR = NONVENDOR_VAR_PREFIX + ".unsplit_nonvendor_names";
|
|
const string NONVENDOR_STRING_ID_SCRVAR = NONVENDOR_VAR_PREFIX + ".unsplit_nonvendor_string_ids";
|
|
const string NONVENDOR_CREATURE_NAME_SCRVAR = NONVENDOR_VAR_PREFIX + ".selection_creature_name";
|
|
const string NONVENDOR_CREATURE_TEMPLATE_SCRVAR = NONVENDOR_VAR_PREFIX + ".selection_nonvendor_template";
|
|
const string NONVENDOR_CREATURE_TEMPLATE_LIST = NONVENDOR_VAR_PREFIX + ".selection_nonvendor_template_list";
|
|
const string NONVENDOR_CREATURENAME_LIST_SCRVAR = NONVENDOR_VAR_PREFIX + ".selection_creature_name_list";
|
|
const string NONVENDOR_SELECTION_SCRVAR = NONVENDOR_VAR_PREFIX + ".selection_string_id";
|
|
const string NONVENDOR_CUSTOM_NAME_SCRVAR = NONVENDOR_VAR_PREFIX + ".creature_custom_name";
|
|
const string NONVENDOR_APPEARANCE_LIST = NONVENDOR_VAR_PREFIX + ".appearance_list";
|
|
//-----------------GREETER CONST
|
|
const string TCG_OBJVAR_PREFIX = "tcg";
|
|
const string GREETER_OBJVAR_TREE = TCG_OBJVAR_PREFIX + ".greeter";
|
|
const string GREETER_TYPE_PREFIX = "greeter_";
|
|
const string GREETER_VAR_PREFIX = "greeter_prefix";
|
|
const string CREATING_GREETER = GREETER_VAR_PREFIX+".creatingGreeter";
|
|
const string GREETER_NOT_INIT_OBJVAR = GREETER_VAR_PREFIX+".greeter_not_initialized";
|
|
const string GREETER_INIT_OBJVAR = GREETER_VAR_PREFIX+".greeter_initialized";
|
|
const string GREETER_OWNER_OBJVAR = GREETER_VAR_PREFIX+".greeter_owner";
|
|
const string GREETER_TYPE_OBJVAR = GREETER_VAR_PREFIX+".greeter_type";
|
|
|
|
//greeter specific abilities
|
|
const string GREETER_ACTIVE_OBJVAR = GREETER_VAR_PREFIX+".greeter_active"; //depricated
|
|
const string GREETER_IS_ACTIVATED_OBJVAR = GREETER_VAR_PREFIX+".greeter_currently_activated";
|
|
const string GREETER_ANIMATES_OBJVAR = GREETER_VAR_PREFIX+".greeter_animates";
|
|
const string GREETER_ANIMATING_OBJVAR = GREETER_VAR_PREFIX+".greeter_currently_animating";
|
|
const string GREETER_VOICES_OBJVAR = GREETER_VAR_PREFIX+".greeter_voices";
|
|
const string GREETER_VOICING_OBJVAR = GREETER_VAR_PREFIX+".greeter_currently_voicing";
|
|
const string GREETER_SOUNDING_OBJVAR = GREETER_VAR_PREFIX+".greeter_currently_sounding";
|
|
const string GREETER_SOUNDS_OBJVAR = GREETER_VAR_PREFIX+".greeter_sounds";
|
|
const string GREETER_MOODS_OBJVAR = GREETER_VAR_PREFIX+".greeter_moods";
|
|
const string GREETER_EFFECT_OBJVAR = GREETER_VAR_PREFIX+".greeter_effects";
|
|
const string GREETER_HAS_EFFECT_OBJVAR = GREETER_VAR_PREFIX+".greeter_has_effect";
|
|
const string GREETER_STATEMENT_OBJVAR = GREETER_VAR_PREFIX+".greeter_statement";
|
|
const string GREETER_HAS_STATEMENT_OBJVAR = GREETER_VAR_PREFIX+".greeter_has_statement";
|
|
const string GREETER_HAS_COLOR_OBJVAR = GREETER_VAR_PREFIX+".greeter_has_color";
|
|
const string GREETER_SOUNDS_VO_MENU_OBJVAR = GREETER_VAR_PREFIX+".greeter_sound_vo_menu_selection";
|
|
|
|
const string CREATURE_TYPE = GREETER_VAR_PREFIX+".creature_type";
|
|
const string CREATURE_LAST_CREATED = GREETER_VAR_PREFIX+".creature_last_created";
|
|
|
|
const string GREETER_DATA_OBTAINED = GREETER_VAR_PREFIX+".greeter_data_obtained";
|
|
const string GREETER_TYPE = GREETER_VAR_PREFIX+".greeter_type";
|
|
const string GREETER_CAN_DRESS_OBJVAR = GREETER_VAR_PREFIX+".greeter_can_be_dressed";
|
|
const string GREETER_TYPE_NICHE = GREETER_VAR_PREFIX+".greeter_niche";
|
|
const string GREETER_TYPE_HAS_FEMALE_OBJVAR = GREETER_VAR_PREFIX+".greeter_has_female";
|
|
const string GREETER_TYPE_SPEAKBASIC_OBJVAR = GREETER_VAR_PREFIX+".greeter_speaks_basic";
|
|
const string GREETER_LOCATION_OBJVAR = GREETER_VAR_PREFIX+".greeter_location";
|
|
|
|
const string GREETER_ACTUAL_ANIMATION = GREETER_VAR_PREFIX+".greeter_actual_animation";
|
|
const string GREETER_ACTUAL_VOICE = GREETER_VAR_PREFIX+".greeter_actual_voice";
|
|
const string GREETER_ACTUAL_MOOD = GREETER_VAR_PREFIX+".greeter_actual_mood";
|
|
const string GREETER_ACTUAL_SOUND = GREETER_VAR_PREFIX+".greeter_actual_sound";
|
|
const string GREETER_ACTUAL_EFFECT = GREETER_VAR_PREFIX+".greeter_actual_effect";
|
|
const string GREETER_ACTUAL_STATEMENT = GREETER_VAR_PREFIX+".greeter_actual_statement";
|
|
|
|
const string GREETER_ACTUAL_MOOD_STRING = GREETER_VAR_PREFIX+".greeter_mood_string";
|
|
const string GREETER_ACTUAL_ANIMATION_STRING = GREETER_VAR_PREFIX+".greeter_anim_string";
|
|
|
|
const string GREETER_CURRENTLY_RANDOMIZED_GREET = GREETER_VAR_PREFIX +".greeter_is_randomized_greeting";
|
|
const string GREETER_RANDOM_TEST_FIRE = GREETER_VAR_PREFIX +".greeter_random_test_greeting";
|
|
|
|
const string GREETER_CREATURE_TYPE_OBJVAR = GREETER_VAR_PREFIX + ".greeter_verified_creature_type";
|
|
const string GREETER_CREATURE_NAME_OBJVAR = GREETER_VAR_PREFIX + ".selection_creature_name";
|
|
const string GREETER_NAMES_OBJVAR = GREETER_VAR_PREFIX + ".unsplit_greeter_names";
|
|
const string GREETER_STRING_ID_OBJVAR = GREETER_VAR_PREFIX + ".unsplit_greeter_string_ids";
|
|
const string GREETER_CREATURENAME_LIST_OBJVAR = GREETER_VAR_PREFIX + ".selection_creature_name_list";
|
|
const string GREETER_SELECTION_OBJVAR = GREETER_VAR_PREFIX + ".selection_string_id";
|
|
const string GREETER_CUSTOM_NAME_OBJVAR = GREETER_VAR_PREFIX + ".creature_custom_name";
|
|
const string GREETER_APPEARANCE_LIST = GREETER_VAR_PREFIX + ".appearance_list";
|
|
const string GREETER_COLOR_OBJVAR = GREETER_VAR_PREFIX + ".color_setting";
|
|
const string GREETER_ALREADY_BARKED_SCRVAR = GREETER_VAR_PREFIX + ".greeter_already_barked";
|
|
const string GREETER_PLAYTERCOLOR_SCRVAR = GREETER_VAR_PREFIX + ".greeter_color_setting";
|
|
const string GREETER_COLOR = GREETER_VAR_PREFIX + ".greeter_color_str_array";
|
|
const string GREETER_CONVERSE = GREETER_VAR_PREFIX + ".greeter_conversable";
|
|
|
|
const string GREETER_HAS_NICHE_OBJVAR = GREETER_VAR_PREFIX + ".greeter_niche";
|
|
const string GREETER_IS_DRESSABLE = GREETER_VAR_PREFIX + ".greeter_is_dressable";
|
|
const string GREETER_SPEAKS_BASIC = GREETER_VAR_PREFIX + ".greeter_speaks_basic";
|
|
const string GREETER_HAS_ANIMS_OBJVAR = GREETER_VAR_PREFIX + ".greeter_has_anims";
|
|
const string GREETER_HAS_VO_OBJVAR = GREETER_VAR_PREFIX + ".greeter_has_vo";
|
|
const string GREETER_HAS_SOUND_OBJVAR = GREETER_VAR_PREFIX + ".greeter_has_sound";
|
|
const string GREETER_HAS_MOOD_OBJVAR = GREETER_VAR_PREFIX + ".greeter_has_mood";
|
|
const string GREETER_HAS_CHAT_OBJVAR = GREETER_VAR_PREFIX + ".greeter_has_chat";
|
|
|
|
const string GREETER_SCRIPT = "terminal.greeter";
|
|
const string GREETER_DEED_OBJVAR = "greeter.give_greeter"; //this is the objvar on the static item...don't change it here unless you change it there and update the version
|
|
const string GREETER_OWNER_OID_OBJVAR = GREETER_VAR_PREFIX + ".greeter_owner";
|
|
|
|
const string TBL_VENDOR_ROOT_TBL_DIR = "datatables/vendor/";
|
|
const string TBL_GREETER_ANIMS = "datatables/vendor/vendor_areabark_anims.iff";
|
|
const string TBL_GREETER_MOODS = "datatables/vendor/vendor_areabark_moods.iff";
|
|
const string TBL_GREETER_SAY_CHAT = "datatables/vendor/greeter_say_chat.iff";
|
|
const string TBL_GREETER_SOUND_VOICE_EFFECT = "datatables/vendor/greeter_sound_voice_effect.iff";
|
|
const string TBL_GREETER_NONVENDOR_TABLE = "datatables/vendor/greeter_nonvendor_data.iff";
|
|
const string COL_CREATURE_TYPE = "creature_type";
|
|
const string COL_GREETER_CREATURE_NAME = "greeter_creature_name";
|
|
const string COL_NONVENDOR_CREATURE_NAME = "nonvendor_creature_name";
|
|
const string COL_NONVENDOR_CREATURE_TEMPLATE = "nonvendor_template_name";
|
|
const string COL_NICHE = "greeter_niche";
|
|
const string COL_GRTR_STRING_ID = "greeter_appearance_string_id";
|
|
const string COL_NONVNDR_STRING_ID = "nonvendor_appearance_string_id";
|
|
const string COL_DRESSED = "greeter_can_be_dressed";
|
|
const string COL_SPEAK_BASIC = "greeter_speaks_basic";
|
|
const string COL_SAY_CHAT = "greeter_say_chat";
|
|
const string COL_ANIMATES = "greeter_animates";
|
|
const string COL_VO = "greeter_voice_over";
|
|
const string COL_SOUNDS = "greeter_sounds";
|
|
const string COL_MOODS = "greeter_has_moods";
|
|
const string COL_COLOR = "greeter_can_color";
|
|
|
|
const int VAR_TRUE = 1;
|
|
const int VAR_FALSE = 0;
|
|
|
|
//STRING IDS
|
|
const string_id SID_OBSCENE = new string_id("player_structure", "obscene");
|
|
const string_id SID_INVALID_GREETER_TABLE_DATA = new string_id("player_vendor", "greeter_data_table_corrupt");
|
|
const string_id SID_SYS_CREATE_GREETER_SUCCESS = new string_id("player_structure", "create_greeter_success");
|
|
const string_id SID_INVENTORY_FULL_GENERIC = new string_id("player_structure", "inventory_full_generic");
|
|
const string_id SID_GREETER_PACK_UP_SUCCESS = new string_id("player_structure", "greeter_packup_success");
|
|
const string_id SID_GREETER_PACK_UP_FAILURE = new string_id("player_structure", "greeter_packup_failure");
|
|
const string_id SID_MUST_BE_IN_VALID_LOCATION = new string_id("player_structure", "must_be_valid_location");
|
|
//------------------------------------------------
|
|
// payMaintenance
|
|
//------------------------------------------------
|
|
|
|
boolean payMaintenance( obj_id player, obj_id vendor, int amt )
|
|
{
|
|
if ( player == null || player == obj_id.NULL_ID )
|
|
return false;
|
|
|
|
if ( vendor == null || vendor == obj_id.NULL_ID )
|
|
return false;
|
|
|
|
if ( amt < 1 || amt > 100000 )
|
|
return false;
|
|
|
|
dictionary params = new dictionary();
|
|
params.put( money.DICT_MSG_PAYER, "1" );
|
|
return money.requestPayment( player, vendor, amt, "handleVendorPayment", params, true );
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// withdrawMaintenance
|
|
//------------------------------------------------
|
|
|
|
boolean withdrawMaintenance( obj_id player, obj_id vendor, int amt )
|
|
{
|
|
if ( player == null || player == obj_id.NULL_ID )
|
|
return false;
|
|
|
|
if ( vendor == null || vendor == obj_id.NULL_ID )
|
|
return false;
|
|
|
|
if ( amt < 1 || amt > 100000 )
|
|
return false;
|
|
|
|
dictionary d = new dictionary();
|
|
d.put("player", player);
|
|
d.put("amount", amt);
|
|
return transferBankCreditsTo( vendor, player, amt, "msgVendorWithdrawSuccess", "msgVendorWithdrawFail", d );
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// decrementMaintenancePool
|
|
//------------------------------------------------
|
|
|
|
int decrementMaintenancePool( obj_id vendor, int amt )
|
|
{
|
|
if ( vendor == null || vendor == obj_id.NULL_ID )
|
|
return -1;
|
|
|
|
if ( amt < 1 )
|
|
return -1;
|
|
|
|
int pool = getBankBalance( vendor );
|
|
if ( amt > pool )
|
|
return -2;
|
|
|
|
if ( money.bankTo( vendor, money.ACCT_VENDOR, amt ) )
|
|
{
|
|
CustomerServiceLog( "vendor", "Vendor decrement maintenance pool. Vendor " + vendor + " Amount: " + amt );
|
|
return pool - amt;
|
|
}
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// damageVendor
|
|
//------------------------------------------------
|
|
|
|
int damageVendor( obj_id vendor, int amt )
|
|
{
|
|
if ( vendor == null || vendor == obj_id.NULL_ID )
|
|
return -1;
|
|
|
|
if ( amt < 1 )
|
|
return -1;
|
|
|
|
int condition = getVendorCondition( vendor );
|
|
|
|
condition = condition - amt;
|
|
|
|
CustomerServiceLog( "vendor", "VENDOR DAMAGE DUE TO NO EMPTY MAINTENANCE POOL! Vendor " + vendor + " Damage: " + amt );
|
|
if ( condition < 1 )
|
|
{
|
|
CustomerServiceLog( "vendor", "VENDOR CONDITION ZERO! Disabling vendor due to nonpayment of maintenance. Vendor " + vendor );
|
|
CustomerServiceLog( "vendor", "Note: Vendor disable code is not finished. Vendor will continue to operate normally. Vendor " + vendor );
|
|
condition = 0;
|
|
|
|
// Need to disable the vendor here.
|
|
obj_id inv = utils.getInventoryContainer( vendor );
|
|
if ( inv == null )
|
|
inv = vendor;
|
|
setObjVar( inv, "vendor_deactivated", 1 );
|
|
}
|
|
else
|
|
{
|
|
setObjVar( vendor, VAR_CONDITION, condition );
|
|
}
|
|
|
|
return condition;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// repairVendor
|
|
//------------------------------------------------
|
|
|
|
int repairVendor( obj_id vendor, int amt )
|
|
{
|
|
if ( vendor == null || vendor == obj_id.NULL_ID )
|
|
return -1;
|
|
|
|
if ( amt < 1 )
|
|
return -1;
|
|
|
|
int condition = getVendorCondition( vendor );
|
|
int max_condition = getMaxCondition( vendor );
|
|
|
|
condition = condition + amt;
|
|
|
|
if ( condition > max_condition )
|
|
condition = max_condition;
|
|
|
|
setObjVar( vendor, VAR_CONDITION, condition );
|
|
CustomerServiceLog( "vendor", "Vendor repair damage. Vendor " + vendor + " Amount: " + amt );
|
|
|
|
// Enable vendor.
|
|
if ( condition == max_condition )
|
|
{
|
|
obj_id inv = utils.getInventoryContainer( vendor );
|
|
if ( inv == null )
|
|
inv = vendor;
|
|
removeObjVar( inv, "vendor_deactivated" );
|
|
}
|
|
|
|
return condition;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// getMaintenanceRate
|
|
//------------------------------------------------
|
|
|
|
int getMaintenanceRate( obj_id vendor )
|
|
{
|
|
return getIntObjVar( vendor, VAR_MAINTENANCE_RATE );
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// getMaintenancePool
|
|
//------------------------------------------------
|
|
|
|
int getMaintenancePool( obj_id vendor )
|
|
{
|
|
return getBankBalance( vendor );
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// getDecayRate
|
|
//------------------------------------------------
|
|
|
|
int getDecayRate( obj_id vendor )
|
|
{
|
|
return getIntObjVar( vendor, VAR_DECAY_RATE );
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// getVendorCondition
|
|
//------------------------------------------------
|
|
|
|
int getVendorCondition( obj_id vendor )
|
|
{
|
|
return getIntObjVar( vendor, VAR_CONDITION );
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// getMaxCondition
|
|
//------------------------------------------------
|
|
|
|
int getMaxCondition( obj_id vendor )
|
|
{
|
|
return getIntObjVar( vendor, VAR_MAX_CONDITION );
|
|
}
|
|
|
|
|
|
void finalizePackUp(obj_id player, obj_id vendor, obj_id packer, boolean isAbandoned)
|
|
{
|
|
// Create a new structure control device in the datapad
|
|
obj_id vcd = null;
|
|
obj_id datapad = null;
|
|
|
|
const boolean isLoadedAndAuthoritative = player.isLoaded() && player.isAuthoritative();
|
|
|
|
CustomerServiceLog("vendorpackup", "Player " + getPlayerName(packer) +
|
|
" (" + packer + ") is attempting to pack vendor (" + vendor + ",abandoned="+ isAbandoned + ") owned by player " +
|
|
getPlayerName(player) + " (" + player + ")");
|
|
|
|
if ( isLoadedAndAuthoritative )
|
|
{
|
|
datapad = utils.getPlayerDatapad(player);
|
|
}
|
|
else
|
|
{
|
|
datapad = utils.getPlayerDatapad(packer);
|
|
}
|
|
|
|
if(!isIdValid(datapad))
|
|
{
|
|
return;
|
|
}
|
|
vcd = createObjectOverloaded("object/intangible/vendor/generic_vendor_control_device.iff", datapad);
|
|
if(!isIdValid(vcd))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (isAbandoned)
|
|
{
|
|
setObjVar(vcd, "abandoned.packer", packer);
|
|
setObjVar(vcd, "abandoned.owner", player);
|
|
setObjVar(vcd, "abandoned.vendor", vendor);
|
|
}
|
|
|
|
attachScript(vcd, "vendor.vendor_control_device");
|
|
string vendorName = getName( vendor );
|
|
|
|
// set the version on packup
|
|
setObjVar(vendor, VAR_PACKUP_VERSION, 1);
|
|
|
|
// Tell the commodities system the vendor is packed
|
|
updateVendorStatus(vendor, VENDOR_STATUS_FLAG_PACKED);
|
|
|
|
// Unregister the vendor if it's registered
|
|
if (hasObjVar(vendor, "vendor.map_registered"))
|
|
{
|
|
removeObjVar(vendor, "vendor.map_registered");
|
|
removePlanetaryMapLocation(vendor);
|
|
}
|
|
|
|
setName(vcd, vendorName);
|
|
|
|
putIn(vendor, vcd, player);
|
|
if ( !isLoadedAndAuthoritative )
|
|
{
|
|
// maxDepth 1 handles non-creature and creature vendors including broken ones as both have demand loaded inventories
|
|
// however fix_load_with does not set the load with_value correctly for containers on non-npc vendors so use maxDepth of 0 for them
|
|
const int maxDepth = isNpcVendor(vendor) ? 1 : 0;
|
|
|
|
moveToOfflinePlayerDatapadAndUnload(vcd, player, maxDepth + 1); // add one for the vcd
|
|
fixLoadWith(vendor, player, maxDepth);
|
|
}
|
|
|
|
CustomerServiceLog("vendorpackup", "Player " + getPlayerName(packer) +
|
|
" (" + packer + ") packed vendor (" + vendor + ",abandoned=" + isAbandoned + ") owned by player " +
|
|
getPlayerName(player) + " (" + player + ") into device (" + vcd +")");
|
|
|
|
return;
|
|
}
|
|
|
|
boolean isVendorPackUpEnabled()
|
|
{
|
|
return utils.checkConfigFlag("GameServer", "allowPlayersToPackVendors");
|
|
}
|
|
|
|
obj_id getAuctionContainer(obj_id vendor)
|
|
{
|
|
obj_id container = utils.getInventoryContainer(vendor);
|
|
if (container == null)
|
|
container = vendor;
|
|
|
|
return container;
|
|
}
|
|
|
|
boolean isNpcVendor(obj_id vendor)
|
|
{
|
|
// if the auction container is not the vendor then the vendor is a droid or terminal (a non-npc) vendor
|
|
// i.e. the vendor itself is the auction container
|
|
return getAuctionContainer(vendor) != vendor;
|
|
}
|
|
|
|
//Called in Greeter Script
|
|
string[] getAllGreeterDatatableColumnNames(obj_id object, string datatablePath)
|
|
{
|
|
blog("vendor_lib.getAllGreeterDatatableColumnNames:init");
|
|
|
|
if(!isValidId(object) || !exists(object)) //can return to greeter npc or whomever
|
|
return null;
|
|
else if(datatablePath == null || datatablePath.equals(""))
|
|
return null;
|
|
else if(!datatablePath.startsWith(TBL_VENDOR_ROOT_TBL_DIR))
|
|
return null;
|
|
|
|
string[] preParsedColList = dataTableGetColumnNames(datatablePath);
|
|
if(preParsedColList == null)
|
|
return null;
|
|
|
|
int preParsedColListLength = preParsedColList.length;
|
|
if(preParsedColListLength < 0)
|
|
return null;
|
|
|
|
blog("vendor_lib.getAllGreeterDatatableColumnNames: prevalidation completed");
|
|
|
|
resizeable string[] greeterColNames = new string[0];
|
|
|
|
for(int i = 0; i < preParsedColListLength; i++)
|
|
{
|
|
if(preParsedColList[i].startsWith("greeter"))
|
|
{
|
|
greeterColNames = utils.addElement(greeterColNames, preParsedColList[i]);
|
|
}
|
|
}
|
|
|
|
if(greeterColNames.length <= 0)// null
|
|
{
|
|
return null;
|
|
}
|
|
blog("vendor_lib.getAllGreeterDatatableColumnNames: greeter col name list being returned.");
|
|
return greeterColNames;
|
|
}
|
|
|
|
//Overloading the buildNpcInPlayerStructure
|
|
boolean buildNpcInPlayerStructure(obj_id controller, obj_id player, string npcType, boolean newGreeter)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: deed invalid.");
|
|
return false;
|
|
}
|
|
if(!isValidId(player) || !exists(player))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: player invalid.");
|
|
return false;
|
|
}
|
|
if(npcType == null || npcType.equals(""))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to get NPC TYPE to create.");
|
|
return false;
|
|
}
|
|
|
|
return buildNpcInPlayerStructure(controller, player, npcType, null, newGreeter);
|
|
}
|
|
|
|
//Overloading the buildNpcInPlayerStructure. Adding location that can be null
|
|
boolean buildNpcInPlayerStructure(obj_id controller, obj_id owner, string npcType, location where, boolean newGreeter)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: deed invalid.");
|
|
CustomerServiceLog("vendor", "vendor_lib.buildNpcInPlayerStructure: Greeter/Non-Vendor could not be created. Reason: Greeter Controller Invalid.");
|
|
return false;
|
|
}
|
|
if(!isValidId(owner)) //do not do !exists
|
|
{
|
|
CustomerServiceLog("vendor", "vendor_lib.buildNpcInPlayerStructure: Greeter/Non-Vendor could not be created. Reason: Greeter Controller Owner OID: "+owner+" is invalid.");
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: player invalid.");
|
|
return false;
|
|
}
|
|
if(npcType == null || npcType.length() <= 0)
|
|
{
|
|
CustomerServiceLog("vendor", "vendor_lib.buildNpcInPlayerStructure: Greeter/Non-Vendor could not be created. Reason: Greeter/Non-Vendor type not found. Owner OID: "+owner+" Controller OID: "+controller);
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: npcType invalid.");
|
|
return false;
|
|
}
|
|
if(!npcType.startsWith(NONVENDOR_VAR_PREFIX) && !npcType.startsWith(GREETER_VAR_PREFIX))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: npcType could not be found.");
|
|
blog("vendor_lib.buildNpcInPlayerStructure: npcType received: "+npcType+" npcType needed:"+NONVENDOR_TYPE_PREFIX);
|
|
|
|
return false;
|
|
}
|
|
if(newGreeter && !validateNpcPlacementInStructure(owner))
|
|
{
|
|
sendSystemMessage(owner, SID_MUST_BE_IN_VALID_LOCATION);
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Unable to create a nonvendor: validateNpcPlacementInStructure said NO.");
|
|
return false;
|
|
}
|
|
|
|
//check to see if location passed is null, if so, get location of player.
|
|
location loc = null;
|
|
if(where == null)
|
|
loc = getLocation(owner);
|
|
else
|
|
loc = where;
|
|
|
|
if(loc == null)
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Location could not be found");
|
|
return false;
|
|
}
|
|
|
|
string itemName = getStaticItemName(controller);
|
|
if(itemName == null || itemName.equals(""))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Static Item Name not found");
|
|
return false;
|
|
}
|
|
|
|
if(npcType.startsWith(NONVENDOR_VAR_PREFIX))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: I am a nonvendor vendor");
|
|
|
|
string nonVendorSpawn = utils.getStringScriptVar(owner, NONVENDOR_CREATURE_TEMPLATE_SCRVAR);
|
|
if(nonVendorSpawn == null || nonVendorSpawn.equals(""))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Creature Name not found");
|
|
return false;
|
|
}
|
|
obj_id nonVendorCreature = createObject(nonVendorSpawn, loc);
|
|
//obj_id nonVendorCreature = create.staticObject(nonVendorSpawn, loc);
|
|
blog("vendor_lib.buildNpcInPlayerStructure: created mob staticObject: "+nonVendorCreature);
|
|
string nonVendorName = utils.getStringScriptVar(owner, NONVENDOR_CUSTOM_NAME_SCRVAR);
|
|
blog("vendor_lib.buildNpcInPlayerStructure: nonVendorName: "+nonVendorName);
|
|
if(nonVendorName != null && !nonVendorName.equals(""))
|
|
setName(nonVendorCreature, nonVendorName);
|
|
|
|
setObjVar(nonVendorCreature, STATIC_ITEM_DEED_NAME, itemName); //set the static item name of the deed on the mob
|
|
setObjVar(nonVendorCreature, GREETER_OWNER_OBJVAR, owner); //set owner on mob
|
|
persistObject(nonVendorCreature);
|
|
setOwner(nonVendorCreature, owner);
|
|
attachScript(nonVendorCreature, NONVENDOR_VENDOR_SCRIPT);
|
|
CustomerServiceLog("tcg", "TCG NonVendor: "+nonVendorCreature+" of type: "+nonVendorSpawn+" was placed at location: " +loc+ " by owner: " + owner + ".");
|
|
|
|
return true;
|
|
}
|
|
//greeter creation here
|
|
blog("vendor_lib.buildNpcInPlayerStructure: I am a GREETER");
|
|
|
|
string greeterSelection = utils.getStringObjVar(controller, vendor_lib.GREETER_CREATURE_NAME_OBJVAR);//Acual Spawn String
|
|
if(greeterSelection == null || greeterSelection.equals(""))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Greeter Spawn String Not Found");
|
|
return false;
|
|
}
|
|
string customName = utils.getStringObjVar(controller, vendor_lib.GREETER_CUSTOM_NAME_OBJVAR);
|
|
if(customName == null || customName.equals(""))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Greeter Custom Name Not Found");
|
|
return false;
|
|
}
|
|
|
|
string creatureType = utils.getStringObjVar(controller, vendor_lib.GREETER_CREATURE_TYPE_OBJVAR);
|
|
if(creatureType == null || creatureType.equals(""))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Creature Type Not Found");
|
|
return false;
|
|
}
|
|
|
|
blog("vendor_lib.buildNpcInPlayerStructure: primary greeter build validation complete. About to spawn: "+greeterSelection);
|
|
|
|
obj_id greeterObj = create.staticObject(greeterSelection, loc);
|
|
if(!isValidId(greeterObj) || !exists(greeterObj))
|
|
{
|
|
blog("vendor_lib.buildNpcInPlayerStructure: Greeter Creature Could NOT BE CREATED");
|
|
return false;
|
|
}
|
|
|
|
string greeterName = "Greeter: " + customName;
|
|
setName(greeterObj, greeterName);
|
|
//give the controller the greeter oid
|
|
setObjVar(controller, vendor_lib.CHILD_GREETER_NONVENDOR_ID_OBJVAR, greeterObj);
|
|
//give the greeter the controller oid
|
|
setObjVar(greeterObj, vendor_lib.CNTRLR_GREETER_NONVENDOR_ID_OBJVAR, controller);
|
|
//give location
|
|
setObjVar(controller, vendor_lib.GREETER_LOCATION_OBJVAR, getLocation(greeterObj));
|
|
|
|
// Set flags.
|
|
setInvulnerable(greeterObj, true);
|
|
|
|
attachScript(greeterObj, GREETER_SCRIPT);
|
|
setObjVar(greeterObj, STATIC_ITEM_DEED_NAME, itemName); //set the static item name of the deed on the mob
|
|
|
|
ai_lib.setDefaultCalmBehavior(greeterObj, ai_lib.BEHAVIOR_SENTINEL);
|
|
setOwner(greeterObj, owner);
|
|
setObjVar(greeterObj, vendor_lib.GREETER_OWNER_OBJVAR, owner); //keeps mob from being manipulated by non-owner
|
|
//----removed
|
|
//persistObject(greeterObj);
|
|
//
|
|
setObjVar(greeterObj, vendor_lib.CREATURE_LAST_CREATED, getCalendarTimeStringLocal(getCalendarTime()));
|
|
setObjVar(controller, vendor_lib.CREATURE_TYPE, creatureType);
|
|
blog("vendor_lib.buildGreeter: Done setting up Greeter");
|
|
|
|
setObjVar(controller, "unmoveable", 1);
|
|
//sendSystemMessage(player, SID_SYS_CREATE_GREETER_SUCCESS);
|
|
CustomerServiceLog("tcg", "TCG Greeter: "+greeterObj+" of type: "+greeterSelection+" was placed at location: " +loc+ " by owner: " + owner + ".");
|
|
|
|
return true;
|
|
}
|
|
|
|
boolean validateNpcPlacementInStructure(obj_id player)
|
|
{
|
|
if(!isValidId(player) || !exists(player))
|
|
return false;
|
|
|
|
obj_id structure = getTopMostContainer(player);
|
|
if(!isValidId(structure) || !exists(structure))
|
|
return false;
|
|
|
|
if(!player_structure.isPlayerStructure(structure) || player_structure.isCivic(structure))
|
|
return false;
|
|
|
|
if(player_structure.isOwner(structure, player))
|
|
return true;
|
|
|
|
if(player_structure.isAdmin(structure, player))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
boolean validateNonVendorInStructure(obj_id nonVendor)
|
|
{
|
|
if(!isValidId(nonVendor) || !exists(nonVendor))
|
|
return false;
|
|
|
|
|
|
obj_id structure = getTopMostContainer(nonVendor);
|
|
if(!isValidId(structure) || !exists(structure))
|
|
return false;
|
|
|
|
|
|
if(!player_structure.isPlayerStructure(structure) || player_structure.isCivic(structure))
|
|
return false;
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
string getGreeterNonVendorCreatureType(obj_id object, string greeterOrNonVendorType)
|
|
{
|
|
blog("vendor_lib.getGreeterNonVendorCreatureType init");
|
|
|
|
if(!isValidId(object) || !exists(object))
|
|
return null;
|
|
else if(greeterOrNonVendorType == null || greeterOrNonVendorType.equals(""))
|
|
return null;
|
|
|
|
blog("vendor_lib.getGreeterNonVendorCreatureType validation complete");
|
|
string[] creatureTypes = dataTableGetStringColumnNoDefaults(TBL_GREETER_NONVENDOR_TABLE, COL_CREATURE_TYPE);
|
|
if(creatureTypes == null)
|
|
{
|
|
if(isPlayer(object))
|
|
sendSystemMessage(object, SID_INVALID_GREETER_TABLE_DATA);
|
|
return null;
|
|
}
|
|
blog("vendor_lib.getGreeterNonVendorCreatureType creatureTypes received");
|
|
|
|
for(int i = 0; i < creatureTypes.length; i++)
|
|
{
|
|
if(greeterOrNonVendorType.indexOf(creatureTypes[i]) == -1)
|
|
{
|
|
blog("vendor_lib.getGreeterNonVendorCreatureType greeterOrNonVendorType: " + greeterOrNonVendorType + " "+creatureTypes[i]);
|
|
continue;
|
|
}
|
|
|
|
blog("vendor_lib.getGreeterNonVendorCreatureType greeterOrNonVendorType FOUND: "+creatureTypes[i]+ "row: "+i);
|
|
return creatureTypes[i];
|
|
}
|
|
blog("vendor_lib.getGreeterNonVendorCreatureType greeterOrNonVendorType NOT found");
|
|
return null;
|
|
}
|
|
|
|
boolean isSpecialVendor(obj_id object)
|
|
{
|
|
if(!isValidId(object) || !exists(object))
|
|
return false;
|
|
|
|
if(!hasObjVar(object, vendor_lib.SPECIAL_VENDOR_IDENTIFIER))
|
|
return false;
|
|
|
|
if(getBooleanObjVar(object, vendor_lib.SPECIAL_VENDOR_IDENTIFIER) != true)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
//used by the greeter/non-vendor deed to set the owner of the deed/controller object
|
|
obj_id setObjectOwner(obj_id controller)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return null;
|
|
|
|
obj_id owner = getOwner(controller);
|
|
if(!isValidId(owner))
|
|
{
|
|
owner = utils.getContainingPlayer(controller);
|
|
if(!isValidId(owner) && !exists(owner))
|
|
return null;
|
|
|
|
setOwner(controller, owner);
|
|
}
|
|
|
|
//is this really needed?
|
|
if(!hasObjVar(controller, vendor_lib.OWNER_OBJVAR))
|
|
setObjVar(controller, vendor_lib.OWNER_OBJVAR, owner);
|
|
|
|
return owner;
|
|
}
|
|
|
|
//used by the greeter/non-vendor deed to get the owner of the deed/controller object
|
|
obj_id getObjectOwner(obj_id controller)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return null;
|
|
|
|
obj_id owner = getOwner(controller);
|
|
if(!isValidId(owner))
|
|
{
|
|
owner = setObjectOwner(controller);
|
|
if(!isValidId(owner))
|
|
return null;
|
|
}
|
|
return owner;
|
|
}
|
|
|
|
//check the location of Controller and Child to see if something
|
|
//wrong is going on
|
|
boolean isControllerOrChildInValidLocation(obj_id controller)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
|
|
obj_id structure = getTopMostContainer(controller);
|
|
if(!isValidId(structure) || !exists(structure))
|
|
return false;
|
|
|
|
if(!player_structure.isPlayerStructure(structure))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
//check the location of Controller and another object to see if they are
|
|
//both in same cell
|
|
boolean isObjectInSameCellAsController(obj_id controller, obj_id object)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
if(!isValidId(object) || !exists(object))
|
|
return false;
|
|
|
|
obj_id controllerStructure = getTopMostContainer(controller);
|
|
if(!isValidId(controllerStructure) || !exists(controllerStructure))
|
|
return false;
|
|
|
|
if(!controllerContainmentCheck(controller))
|
|
return false;
|
|
|
|
location controllerLoc = getLocation(controller);
|
|
if(controllerLoc == null)
|
|
return false;
|
|
|
|
location objLocation = getLocation(object);
|
|
if(objLocation == null)
|
|
return false;
|
|
|
|
if(controllerLoc.cell != objLocation.cell)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
// Called from OnInitialize trigger in the tcg_greeter_contract.script/tcg_vendor_contract.script.
|
|
// The Location should be legal based on check when player originally placed the controller.
|
|
boolean recreateObject(obj_id controller, obj_id player)
|
|
{
|
|
blog("vendor_lib.recreateObject init");
|
|
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
if(!isValidId(player) || !exists(player))
|
|
return false;
|
|
|
|
blog("vendor_lib.recreateObject validation completed. Getting Controller Location");
|
|
|
|
//TODO, save the player's specified greeter location on the controller
|
|
//over write where with that location is it exists.
|
|
location where = getLocation(controller);
|
|
if(where == null)
|
|
return false;
|
|
|
|
string npcType = "";
|
|
if(hasObjVar(controller, NONVENDOR_VAR_PREFIX))
|
|
npcType = NONVENDOR_VAR_PREFIX;
|
|
else if(hasObjVar(controller, GREETER_VAR_PREFIX))
|
|
npcType = GREETER_VAR_PREFIX;
|
|
|
|
if(npcType == null || npcType.equals(""))
|
|
return false;
|
|
|
|
//TODO - Add Cust. Svc Log
|
|
blog("vendor_lib.recreateObjectAtLocation placing greeter via buildNpcInPlayerStructure at CONTROLLER location");
|
|
return buildNpcInPlayerStructure(controller, player, npcType, where, false);
|
|
}
|
|
|
|
boolean recreateObjectAtLocation(obj_id controller, obj_id owner, location loc)
|
|
{
|
|
blog("vendor_lib.recreateObjectAtLocation init");
|
|
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
if(!isValidId(owner))
|
|
return false;
|
|
if(loc == null)
|
|
return false;
|
|
blog("vendor_lib.recreateObjectAtLocation Greeter Location Validated");
|
|
|
|
blog("vendor_lib.recreateObjectAtLocation getting controller location for testing");
|
|
|
|
location where = getLocation(controller);
|
|
if(where == null)
|
|
{
|
|
CustomerServiceLog("vendor", "vendor_lib.recreateObjectAtLocation: GREETER CONTROLLER LOCATION INVALID: Controller: "+ controller+") Owner: " + getName(owner) + " (" +owner+ ")");
|
|
return false;
|
|
}
|
|
|
|
string npcType = "";
|
|
if(hasObjVar(controller, NONVENDOR_VAR_PREFIX))
|
|
npcType = NONVENDOR_VAR_PREFIX;
|
|
else if(hasObjVar(controller, GREETER_VAR_PREFIX))
|
|
npcType = GREETER_VAR_PREFIX;
|
|
|
|
if(npcType == null || npcType.equals(""))
|
|
return false;
|
|
|
|
blog("vendor_lib.recreateObjectAtLocation placing greeter via buildNpcInPlayerStructure at greeter location");
|
|
|
|
return buildNpcInPlayerStructure(controller, owner, npcType, loc, false);
|
|
}
|
|
|
|
boolean controllerContainmentCheck(obj_id controller)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
if (utils.isNestedWithinAPlayer(controller))
|
|
return false;
|
|
|
|
obj_id building = getTopMostContainer(controller);
|
|
if(!isGameObjectTypeOf(building, GOT_building_player) && (!isGameObjectTypeOf(building, GOT_ship_fighter) && !space_utils.isShipWithInterior(building)))
|
|
return false;
|
|
|
|
if(player_structure.isCivic(building))
|
|
return false;
|
|
|
|
location here = getLocation(controller);
|
|
if(getContainedBy(controller) == here.cell)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
boolean removeObjectFromController(obj_id controller, obj_id greeter)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
|
|
removeObjVar(controller, vendor_lib.CHILD_GREETER_NONVENDOR_ID_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_IS_ACTIVATED_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_ANIMATING_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_VOICING_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_SOUNDING_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_HAS_MOOD_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_HAS_STATEMENT_OBJVAR);
|
|
removeObjVar(controller, vendor_lib.GREETER_CURRENTLY_RANDOMIZED_GREET);
|
|
|
|
if(isValidId(greeter) && exists(greeter))
|
|
destroyObject(greeter);
|
|
|
|
removeObjVar(controller, "unmoveable");
|
|
|
|
return true;
|
|
}
|
|
|
|
boolean updateGreeterFunctionality(obj_id greeter)
|
|
{
|
|
blog("vendor_lib.updateGreeterFunctionality init");
|
|
|
|
if(!isValidId(greeter) || !exists(greeter))
|
|
return false;
|
|
|
|
obj_id controller = getObjIdObjVar(greeter, CNTRLR_GREETER_NONVENDOR_ID_OBJVAR);
|
|
if(!isValidId(controller) || !exists(controller))
|
|
{
|
|
CustomerServiceLog("vendor", "vendor_lib.updateGreeterFunctionality: GREETER CONTROLLER INVALID: Greeter: "+getName(greeter)+" ("+ greeter+") GREETER UPDATE FAILED - NOTIFY DESIGN");
|
|
//We don't want to destroy in case the controller isn't loaded yet for whatever reason
|
|
return false;
|
|
}
|
|
|
|
//destroy the greeter
|
|
if(!removeObjectFromController(controller, greeter))
|
|
{
|
|
CustomerServiceLog("vendor", "vendor_lib.updateGreeterFunctionality: GREETER NOT DESTROYED PROPERLY FOR UPDATE: Greeter: "+getName(greeter)+" ("+ greeter+") Owner: " + getOwner(controller));
|
|
CustomerServiceLog("vendor", "vendor_lib.updateGreeterFunctionality: GREETER BEING MANUALLY DESTROYED: Greeter: "+getName(greeter)+" ("+ greeter);
|
|
destroyObject(greeter);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
boolean colorizeGreeterFromWidget(obj_id player, obj_id greeter, string params)
|
|
{
|
|
|
|
if(!isValidId(player) || !exists(player))
|
|
return false;
|
|
if(!isValidId(greeter) || !exists(greeter))
|
|
return false;
|
|
if(params == null || params.equals(""))
|
|
return false;
|
|
|
|
|
|
obj_id controller = getObjIdObjVar(greeter, vendor_lib.CNTRLR_GREETER_NONVENDOR_ID_OBJVAR);
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
|
|
|
|
string[] colorArray = split(params, ' ');
|
|
if(colorArray == null || colorArray.length <= 0)
|
|
return false;
|
|
|
|
|
|
setObjVar(controller, vendor_lib.GREETER_COLOR, colorArray);
|
|
|
|
for(int i = 0; i < colorArray.length; i+=2)
|
|
{
|
|
if(colorArray[i] == null || colorArray[i].equals(""))
|
|
break;//if a blank entry is found bail out.
|
|
hue.setColor(greeter, colorArray[i], utils.stringToInt(colorArray[i+1]));
|
|
}
|
|
utils.removeScriptVar(player, vendor_lib.GREETER_PLAYTERCOLOR_SCRVAR);
|
|
return true;
|
|
}
|
|
|
|
boolean colorizeGreeterFromController(obj_id controller, obj_id greeter)
|
|
{
|
|
if(!isValidId(controller) || !exists(controller))
|
|
return false;
|
|
if(!isValidId(greeter) || !exists(greeter))
|
|
return false;
|
|
|
|
string[] colorArray = getStringArrayObjVar(controller, vendor_lib.GREETER_COLOR);
|
|
if(colorArray == null || colorArray.length <= 0)
|
|
return false;
|
|
|
|
for(int i = 0; i < colorArray.length; i+=2)
|
|
{
|
|
if(colorArray[i] == null || colorArray[i].equals(""))
|
|
break;//if a blank entry is found bail out.
|
|
hue.setColor(greeter, colorArray[i], utils.stringToInt(colorArray[i+1]));
|
|
}
|
|
return true;
|
|
}
|
|
|
|
boolean blog(string msg)
|
|
{
|
|
if(LOGGING_ON && msg != null && !msg.equals(""))
|
|
LOG(LOGGING_CATEGORY, msg);
|
|
return true;
|
|
}
|