Files
dsrc/sku.0/sys.server/compiled/game/script/event/halloween/song_book.script
T

55 lines
1.5 KiB
Plaintext

/***** INCLUDES ********************************************************/
include library.sui;
include library.utils;
/***** CONSTS **********************************************************/
const string HALLOWEEN = new string("event/halloween");
const string_id SID_USE = new string_id(HALLOWEEN, "learn_song");
const string_id CANT_USE = new string_id(HALLOWEEN, "not_entertainer");
const string_id LEARNED_SONG = new string_id(HALLOWEEN, "learned_song");
const string_id CANT_USE_LOW_LEVEL = new string_id(HALLOWEEN, "not_entertainer_enough");
/***** FUNCTIONS ********************************************************/
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
{
menu_info_data data = mi.getMenuItemByType (menu_info_types.SERVER_MENU1);
if (utils.isNestedWithin(self, player))
{
if (utils.isProfession(player, utils.ENTERTAINER))
{
if (!hasCommand(player, "startMusic+dirge"))
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_USE);
}
}
return SCRIPT_CONTINUE;
}
trigger OnObjectMenuSelect(obj_id player, int item)
{
if (utils.isNestedWithin(self, player))
{
if (item == menu_info_types.SERVER_MENU1)
{
if (utils.isProfession(player, utils.ENTERTAINER))
{
if (getLevel(player) > 81)
{
grantCommand(player, "startMusic+dirge");
sendSystemMessage(player, LEARNED_SONG);
destroyObject(self);
}
else
sendSystemMessage(player, CANT_USE_LOW_LEVEL);
}
else
sendSystemMessage(player, CANT_USE);
}
}
return SCRIPT_CONTINUE;
}