Files
dsrc/sku.0/sys.server/compiled/game/script/systems/jedi/jedi_holocron.script
T

142 lines
3.3 KiB
Plaintext

include library.pclib;
include library.prose;
include library.utils;
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
{
//debugServerConsoleMsg(self, "creating grenade menu");
if(hasObjVar(self, "intUsed"))
{
return SCRIPT_CONTINUE;
}
menu_info_data mid = mi.getMenuItemByType(menu_info_types.EXAMINE);
if ( mid != null )
{
mid.setServerNotify(true);
}
mid = mi.getMenuItemByType (menu_info_types.ITEM_USE);
if (mid != null)
{
mid.setServerNotify (true);
}
return SCRIPT_CONTINUE;
}
trigger OnObjectMenuSelect(obj_id player, int item)
{
if (item == menu_info_types.ITEM_USE)
{
if(hasObjVar(self, "intUsed"))
return SCRIPT_CONTINUE;
if (utils.hasScriptVar(player, "jedi.holcron_used"))
{
sendSystemMessage(player, new string_id("jedi_spam", "holocron_no_effect"));
return SCRIPT_CONTINUE;
}
int max_force = getMaxForcePower(player);
int current_force = getForcePower(player);
if (max_force < 1)
{
sendSystemMessage(player, new string_id("jedi_spam", "holocron_no_effect"));
return SCRIPT_CONTINUE;
}
if (current_force >= max_force)
{
sendSystemMessage(player, new string_id("jedi_spam", "holocron_force_max"));
return SCRIPT_CONTINUE;
}
sendSystemMessage(player, new string_id("jedi_spam", "holocron_force_replenish"));
location loc = getLocation(player);
playClientEffectLoc(player, "clienteffect/pl_force_heal_self.cef" , loc, 0);
utils.setScriptVar(player, "jedi.holcron_used", 1);
setForcePower(player, max_force);
setObjVar(self, "intUsed", 1);
destroyObject(self);
}
//string_id strSpam = new string_id("jedi_spam", "holocron_quiet");
//sendSystemMessage(player, strSpam);
/*
//debugServerConsoleMsg(self, "selecting the item");
if ( item == menu_info_types.ITEM_USE)
{
if(hasObjVar(self, "intUsed"))
{
return SCRIPT_CONTINUE;
}
if(isJedi(player))
{
string_id strSpam = new string_id("jedi_spam", "holocron_already_jedi");
sendSystemMessage(player, strSpam);
setObjVar(self, "intUsed", 1);
destroyObject(self);
return SCRIPT_CONTINUE;
}
string[] strSkills = getStringArrayObjVar(player, pclib.OBJVAR_JEDI_SKILL_REQUIREMENTS);
if(strSkills == null || strSkills.length == 0) {
CustomerServiceLog("jedi", getFirstName(player) + " (" + player + ") needs 0 more skills to activate their FS slot.");
} else {
CustomerServiceLog("jedi", getFirstName(player) + " (" + player + ") needs " + strSkills.length + " more skills to activate their FS slot.");
}
if((strSkills==null)||(strSkills.length<5))
{
string_id strSpam = new string_id("jedi_spam", "holocron_quiet");
sendSystemMessage(player, strSpam);
return SCRIPT_CONTINUE;
}
string strAscii = "holocron_"; // light/dark differentiaton below.
string strTemplate = getTemplateName(self);
int intIndex = strTemplate.indexOf("dark");
if(intIndex>0)
{
// SITH!
strAscii = strAscii+"dark_information";
}
else
{
strAscii = strAscii+"light_information";
}
string_id strSpam = new string_id("jedi_spam", strAscii);
string_id strSkillName = new string_id("skl_n", strSkills[0]);
prose_package proseTest = prose.getPackage(strSpam, strSkillName);
if(proseTest==null)
{
}
sendSystemMessageProse(player, proseTest);
setObjVar(self, "intUsed", 1);
destroyObject(self);
}
*/
return SCRIPT_CONTINUE;
}