mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
67 lines
1.4 KiB
Plaintext
67 lines
1.4 KiB
Plaintext
include library.utils;
|
|
include library.consumable;
|
|
include library.player_stomach;
|
|
include library.healing;
|
|
|
|
inherits item.comestible.comestible;
|
|
|
|
// Foraged stats datatable.
|
|
const string FORAGED_DATA = "datatables/foraging/forage_global.iff";
|
|
|
|
trigger OnGetAttributes( obj_id player, string[] names, string[] attribs )
|
|
{
|
|
// Get our foraged food mod.
|
|
attrib_mod[] am = consumable.getForagedFoodMods( self );
|
|
|
|
// Print out our attributes.
|
|
int n = utils.getValidAttributeIndex( names );
|
|
if ( n == -1 )
|
|
return SCRIPT_CONTINUE;
|
|
names[n] = EXAM_ATTRIB_MOD;
|
|
if ( (am == null) || (am.length == 0) )
|
|
{
|
|
attribs[n] = EXAM_NONE;
|
|
n++;
|
|
if (n > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
int numMods = am.length;
|
|
|
|
attribs[n] = "" + numMods;
|
|
n++;
|
|
if (n > names.length)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
for ( int i = 0; i < numMods; i++ )
|
|
{
|
|
int attrib = am[i].getAttribute();
|
|
int val = am[i].getValue();
|
|
// int newVal = healing.getBuffPercentage(val);
|
|
int newVal = Integer.MIN_VALUE;
|
|
int duration = (int)(am[i].getDuration());
|
|
|
|
string sVal = "";
|
|
|
|
if ( newVal > 0 )
|
|
{
|
|
sVal = "+" + newVal;
|
|
}
|
|
else if ( newVal < 0 )
|
|
{
|
|
sVal = "" + newVal;
|
|
}
|
|
|
|
names[n] = toLower(consumable.STAT_NAME[attrib]);
|
|
attribs[n] = sVal + "%, " + duration + "s";
|
|
|
|
n++;
|
|
if ( n > names.length )
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|