mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-27 16:56:48 -04:00
60 lines
1.3 KiB
Plaintext
60 lines
1.3 KiB
Plaintext
include library.static_item;
|
|
include library.utils;
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
menu_info_data mid = mi.getMenuItemByType(menu_info_types.ITEM_USE);
|
|
if(mid != null)
|
|
{
|
|
mid.setLabel(new string_id("spam", "unroll"));
|
|
mid.setServerNotify(true);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
obj_id containingPlayer = utils.getContainingPlayer(self);
|
|
|
|
if(!isIdValid(containingPlayer))
|
|
{
|
|
sendSystemMessage(player, new string_id("spam", "cannot_use_not_in_inv"));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(containingPlayer != player)
|
|
{
|
|
sendSystemMessage(player, new string_id("spam", "cannot_use_not_in_inv"));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(item == menu_info_types.ITEM_USE)
|
|
unrollMe(self, player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
void unrollMe(obj_id self, obj_id player)
|
|
{
|
|
int which_one = rand(1, 3);
|
|
string poster = "";
|
|
|
|
switch(which_one)
|
|
{
|
|
case 1: poster = "item_publish_gift_29_corellia_04_01";
|
|
break;
|
|
case 2: poster = "item_publish_gift_29_ryatt_04_01";
|
|
break;
|
|
case 3: poster = "item_publish_gift_29_mustafar_04_01";
|
|
break;
|
|
}
|
|
|
|
obj_id item = static_item.createNewItemFunction(poster, player);
|
|
|
|
if(isIdValid(item))
|
|
{
|
|
sendSystemMessage(player, new string_id("spam", "unroll_poster"));
|
|
destroyObject(self);
|
|
}
|
|
} |