mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-02 02:15:48 -04:00
86 lines
2.1 KiB
Plaintext
86 lines
2.1 KiB
Plaintext
// guild.script - guild terminal menu handling
|
|
|
|
//Includes
|
|
|
|
include library.guild;
|
|
include library.player_structure;
|
|
include library.sui;
|
|
include library.utils;
|
|
|
|
//inherits terminal.base.base_terminal;
|
|
|
|
// Constants
|
|
|
|
const string_id SID_GUILD_LOAD_CARTRIDGE = new string_id ("guild", "load_cartridge");
|
|
const string_id SID_LOAD_CARTRIDGE_PROMPT = new string_id ("guild", "load_cartridge_prompt");
|
|
const string_id SID_LOAD_CARTRIDGE_TITLE = new string_id ("guild", "load_cartridge_title");
|
|
|
|
const string STR_GUILD_CREATE_NAME_PROMPT = "@guild:create_name_prompt";
|
|
const string STR_GUILD_CREATE_NAME_TITLE = "@guild:create_name_title";
|
|
const string STR_GUILD_CREATE_ABBREV_PROMPT = "@guild:create_abbrev_prompt";
|
|
const string STR_GUILD_CREATE_ABBREV_TITLE = "@guild:create_abbrev_title";
|
|
|
|
|
|
// Triggers
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
int playerGuildId = getGuildId(player);
|
|
|
|
if (playerGuildId != 0 && utils.isNestedWithinAPlayer(self))
|
|
{
|
|
if(player == guildGetLeader(playerGuildId))
|
|
mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_GUILD_LOAD_CARTRIDGE);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
sendDirtyObjectMenuNotification(self);
|
|
|
|
int playerGuildId = getGuildId(player);
|
|
|
|
if (playerGuildId != 0 && utils.isNestedWithinAPlayer(self))
|
|
{
|
|
if(player == guildGetLeader(playerGuildId))
|
|
int pid = sui.msgbox(self, player, "@" + SID_LOAD_CARTRIDGE_PROMPT, sui.YES_NO, "@" + SID_LOAD_CARTRIDGE_TITLE, "handleLoadCartridge");
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// MessageHandlers
|
|
|
|
messageHandler handleLoadCartridge()
|
|
{
|
|
if(params == null || params.isEmpty())
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int bp = sui.getIntButtonPressed(params);
|
|
if ( bp == sui.BP_CANCEL )
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id player = sui.getPlayerId(params);
|
|
int guildId = getGuildId(player);
|
|
|
|
if(player != guildGetLeader(guildId))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(guild.loadCartridge(player, self))
|
|
destroyObject(self);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|