mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
129 lines
2.4 KiB
Plaintext
129 lines
2.4 KiB
Plaintext
include library.buff;
|
|
include library.player_structure;
|
|
include library.skill;
|
|
include library.space_utils;
|
|
include library.space_transition;
|
|
include library.sui;
|
|
include library.utils;
|
|
|
|
const string_id SID_GRANT_BUFF = new string_id("spam", "assembly_terminal_grant_buff");
|
|
const string_id SID_NOT_IN_HOUSE = new string_id("spam", "assembly_terminal_not_in_huse");
|
|
const string_id SID_WRONG_CLASS = new string_id("spam", "assembly_terminal_wrong_class");
|
|
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
|
|
if(!isIdValid(player))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(checkLocation(self))
|
|
{
|
|
int startDisplay = mi.addRootMenu(menu_info_types.ITEM_USE, SID_GRANT_BUFF);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
|
|
//player_structure.isNameOnEntryList(structure, getPlayerName(player))
|
|
if(item == menu_info_types.ITEM_USE && isIdValid(player))
|
|
{
|
|
if(checkLocation(self))
|
|
{
|
|
grantBuff(player);
|
|
}
|
|
|
|
else
|
|
{
|
|
sendSystemMessage(player, SID_NOT_IN_HOUSE);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
return SCRIPT_CONTINUE;
|
|
|
|
}
|
|
|
|
boolean checkLocation(obj_id item)
|
|
{
|
|
|
|
if(!isIdValid(item))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(!utils.isInHouseCellSpace(item))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (!utils.isNestedWithinAPlayer (item))
|
|
{
|
|
obj_id house = getTopMostContainer(item);
|
|
obj_id ship = space_transition.getContainingShip(item);
|
|
|
|
string templateName ="";
|
|
|
|
if(isIdValid(ship))
|
|
{
|
|
templateName = getTemplateName(ship);
|
|
}
|
|
|
|
|
|
if(isIdValid(house) && (player_structure.isBuilding(house) || space_utils.isPobType(templateName)))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void grantBuff(obj_id player)
|
|
{
|
|
|
|
|
|
if(hasSkill(player, "class_domestics_phase1_novice"))
|
|
{
|
|
|
|
buff.applyBuff(player, "crafting_display_domestic_buff");
|
|
}
|
|
|
|
else if(hasSkill(player, "class_engineering_phase1_novice"))
|
|
{
|
|
|
|
buff.applyBuff(player, "crafting_display_engineering_buff");
|
|
}
|
|
|
|
else if(hasSkill(player, "class_munitions_phase1_novice"))
|
|
{
|
|
|
|
buff.applyBuff(player, "crafting_display_munitions_buff");
|
|
}
|
|
|
|
else if(hasSkill(player, "class_structures_phase1_novice"))
|
|
{
|
|
|
|
buff.applyBuff(player, "crafting_display_structure_buff");
|
|
buff.applyBuff(player, "crafting_display_shipwright_buff");
|
|
}
|
|
|
|
else if(hasSkill(player, "class_forcesensitive_phase1_novice"))
|
|
{
|
|
|
|
buff.applyBuff(player, "crafting_display_jedi_buff");
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
sendSystemMessage(player, SID_WRONG_CLASS);
|
|
}
|
|
|
|
}
|