Files
dsrc/sku.0/sys.server/compiled/game/script/item/hoth_sharpshooter_buff.script
T
2013-09-10 23:17:15 -07:00

53 lines
1.6 KiB
Plaintext

include library.utils;
include library.prose;
include library.trial;
include library.buff;
const string_id SID_MUST_BIO_LINK_FROM_INVENTORY = new string_id("base_player", "must_biolink_to_use_from_inventory");
const string_id SID_NOT_YET = new string_id("base_player", "not_yet");
const float REUSE_TIME = 1800;
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
{
menu_info_data mid = mi.getMenuItemByType(menu_info_types.ITEM_USE);
mi.addRootMenu(menu_info_types.ITEM_USE, new string_id("spam", "item_use"));
return SCRIPT_CONTINUE;
}
trigger OnObjectMenuSelect(obj_id player, int item)
{
if(isDead(player) || isIncapacitated(player) || !utils.isNestedWithin(self, player))
{
return SCRIPT_CONTINUE;
}
if(item == menu_info_types.ITEM_USE)
{
float buffTime = getFloatObjVar(player, "clickItem.hoth_sharpshooter");
if(getGameTime() > buffTime || isGod(player))
{
setObjVar(player, "clickItem.hoth_sharpshooter", (getGameTime() + REUSE_TIME));
sendCooldownGroupTimingOnly(player, getStringCrc("epic_items"), REUSE_TIME);
playClientEffectObj(player, "clienteffect/medic_reckless_stimulation.cef", player, "");
activateSharpshooterBuff(self, player);
}
else
{
//send them a message on how long before they can use again
int timeDiff = (int)buffTime - getGameTime();
prose_package pp = prose.getPackage(SID_NOT_YET, timeDiff);
sendSystemMessageProse(player, pp);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
void activateSharpshooterBuff(obj_id self, obj_id player)
{
buff.applyBuff(player, "hoth_sharpshooter_buff");
}