mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
135 lines
3.2 KiB
Plaintext
135 lines
3.2 KiB
Plaintext
|
|
include library.utils;
|
|
include library.minigame;
|
|
include library.resource;
|
|
|
|
const string_id SID_FILET = new string_id(minigame.STF_FISH, "mnu_filet");
|
|
const string_id SID_TROPHY = new string_id(minigame.STF_FISH, "mnu_trophy");
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
obj_id inv = utils.getInventoryContainer(player);
|
|
if ( !isIdValid(inv) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( utils.isNestedWithin(self, inv) )
|
|
{
|
|
obj_id[] contents = getContents(self);
|
|
if ( contents != null && contents.length > 0 )
|
|
int mnuFilet = mi.addRootMenu(menu_info_types.SERVER_MENU1, SID_FILET);
|
|
//int mnuTrophy = mi.addRootMenu(menu_info_types.SERVER_MENU2, SID_TROPHY);
|
|
}
|
|
|
|
//int dbgOpen = mi.addRootMenu(menu_info_types.ITEM_OPEN, new string_id("",""));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
obj_id inv = utils.getInventoryContainer(player);
|
|
if ( !isIdValid(inv) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( utils.isNestedWithin(self, inv) )
|
|
{
|
|
if ( item == menu_info_types.SERVER_MENU1 ) //FILET FISH
|
|
{
|
|
minigame.filetFish(player, self);
|
|
}
|
|
/*else if ( item == menu_info_types.SERVER_MENU2 ) //MAKE TROPHY
|
|
{
|
|
minigame.trophyFish(player, self);
|
|
}*/
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnOpenedContainer(obj_id who)
|
|
{
|
|
if ( isPlayer(who) && !isGod(who) )
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAboutToLoseItem(obj_id destContainer, obj_id transferer, obj_id item)
|
|
{
|
|
if ( isPlayer(transferer) && !isGod(transferer) )
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAboutToReceiveItem(obj_id srcContainer, obj_id transferer, obj_id item)
|
|
{
|
|
if ( isPlayer(transferer) && !isGod(transferer) )
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
|
|
{
|
|
if ( hasObjVar(self, minigame.VAR_FISH_BASE) )
|
|
{
|
|
int line = utils.getValidAttributeIndex(names);
|
|
if (line == -1)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
string type = getStringObjVar(self, minigame.VAR_FISH_NAME);
|
|
if ( type != null && !type.equals("") )
|
|
{
|
|
names[line] = "type";
|
|
attribs[line] = "@fish_n:" + type;
|
|
line++;
|
|
if (line > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
float length = getFloatObjVar(self, minigame.VAR_FISH_LENGTH);
|
|
if ( length > 0f )
|
|
{
|
|
names[line] = "length";
|
|
attribs[line] = "" + length + "m";
|
|
line++;
|
|
if (line > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
location loc = getLocationObjVar(self, minigame.VAR_FISH_LOCATION);
|
|
if ( loc != null )
|
|
{
|
|
names[line] = "planet";
|
|
attribs[line] = "@planet_n:" + loc.area;
|
|
line++;
|
|
if (line > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(hasObjVar(self, minigame.VAR_FISH_TIME_STAMP))
|
|
{
|
|
int timeCaught = getIntObjVar(self, minigame.VAR_FISH_TIME_STAMP);
|
|
string stTimeCaught = getCalendarTimeStringLocal(timeCaught);
|
|
names[line] = "fish_time_caught";
|
|
attribs[line] = stTimeCaught;
|
|
line++;
|
|
if (line > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(hasObjVar(self, minigame.VAR_FISH_CATCHER))
|
|
{
|
|
string playerName = getStringObjVar(self, minigame.VAR_FISH_CATCHER);
|
|
names[line] = "caught_by";
|
|
attribs[line] = playerName;
|
|
line++;
|
|
if (line > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|