Files
dsrc/sku.0/sys.server/compiled/game/script/poi/wounded/leader_inv.java
T
Tekaoh 5c2e112349 Java 11.0.2 migration (#32)
* Code compiles - execution NOT tested

* updating gitignore

* Removed intellij settings files

* Removed more intellij files

* Added exclusion for JDK classes.

* Fixed purchasing script for vendors that have listed coin types.

* Updated script to not kick off until the entire preload is complete.

* adds static name entry for Solo movie poster and tcg9 vendor entry

* clean up empty and orphaned object templates

* adds placeholder black market (static) spawns

* corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors

* Updated gitignore and removed intellij project files

* Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src

* Fixed appearance and template for terminal (#2)

* Fixed appearance and template for terminal (#3)

* Fixed appearance and template for terminal (#4)

* Deleted another faulty/orphaned object template

* Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges.

* Fixed some unneeded java 11 changes
2019-04-18 18:31:52 -05:00

151 lines
5.5 KiB
Java
Executable File

package script.poi.wounded;
import script.attrib_mod;
import script.attribute;
import script.dictionary;
import script.library.consumable;
import script.library.healing;
import script.library.poi;
import script.library.scenario;
import script.obj_id;
public class leader_inv extends script.item.container.add_only
{
public leader_inv()
{
}
public static final int PROVIDED_MEDICINE = 4;
public int OnAttach(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnInitialize(obj_id self) throws InterruptedException
{
return SCRIPT_CONTINUE;
}
public int OnAboutToReceiveItem(obj_id self, obj_id srcContainer, obj_id transferer, obj_id item) throws InterruptedException
{
obj_id actor = getContainedBy(self);
if ((actor == null) || (actor == obj_id.NULL_ID))
{
return SCRIPT_OVERRIDE;
}
obj_id poiMaster = poi.getBaseObject(actor);
if ((poiMaster == null) || (poiMaster == obj_id.NULL_ID))
{
LOG("poiWounded", "OnStartNpcConversation: unable to locate base object");
return SCRIPT_CONTINUE;
}
String convo = getStringObjVar(poiMaster, scenario.VAR_SCENARIO_CONVO);
if (convo.equals(""))
{
LOG("poiWounded", "OnStartNpcConversation: unable to determine conversation file");
return SCRIPT_CONTINUE;
}
if (isPlayer(transferer))
{
if (!healing.isMedicine(item))
{
scenario.say(actor, convo, "item_not_medicine");
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int OnReceivedItem(obj_id self, obj_id srcContainer, obj_id transferer, obj_id item) throws InterruptedException
{
obj_id actor = getContainedBy(self);
if ((actor == null) || (actor == obj_id.NULL_ID))
{
return SCRIPT_OVERRIDE;
}
obj_id poiMaster = poi.getBaseObject(actor);
if ((poiMaster == null) || (poiMaster == obj_id.NULL_ID))
{
LOG("poiWounded", "OnStartNpcConversation: unable to locate base object");
return SCRIPT_CONTINUE;
}
String convo = getStringObjVar(poiMaster, scenario.VAR_SCENARIO_CONVO);
if (convo.equals(""))
{
LOG("poiWounded", "OnStartNpcConversation: unable to determine conversation file");
return SCRIPT_CONTINUE;
}
if (isPlayer(transferer))
{
if (healing.isMedicine(item))
{
int cnt = getIntObjVar(item, consumable.VAR_CONSUMABLE_CHARGES);
obj_id[] actors = scenario.getActorsWithNamePrefix(poiMaster, scenario.MEDIATOR);
if ((actors == null) || (actors.length == 0))
{
}
else
{
boolean assisted = false;
for (int i = 0; i < cnt; i++)
{
obj_id wounded = getFirstWoundedActor(actors);
if (wounded == null)
{
i = cnt;
}
}
if (assisted)
{
scenario.setPlayerProgress(transferer, PROVIDED_MEDICINE);
scenario.say(actor, convo, "m_reward");
int amt = 0;
attrib_mod[] mods = getAttribModArrayObjVar(item, consumable.VAR_CONSUMABLE_MODS);
if ((mods == null) || (mods.length == 0))
{
}
else
{
for (attrib_mod mod : mods) {
amt += mod.getValue();
}
}
amt *= cnt;
obj_id wounded = getFirstWoundedActor(actors);
if (wounded == null)
{
scenario.say(actor, convo, "m_all_healed");
poi.complete(poiMaster);
amt *= 1.25f;
}
amt /= 10;
dictionary d = new dictionary();
d.put("target", transferer);
d.put("amt", amt);
messageTo(actor, "giveReward", d, 0, false);
}
destroyObject(item);
}
}
}
return SCRIPT_CONTINUE;
}
public boolean healActorWounds(obj_id actor, int[] wounds) throws InterruptedException
{
if ((actor == null) || (wounds == null) || (wounds.length == 0))
{
return false;
}
attribute[] maxAttribs = getUnmodifiedMaxAttribs(actor);
for (int i = 0; i < maxAttribs.length; ++i)
{
int woundVal = wounds[i];
if (woundVal > 0)
{
addAttribModifier(actor, maxAttribs[i].getType(), maxAttribs[i].getValue(), 0, 0, MOD_POOL);
}
}
return true;
}
public obj_id getFirstWoundedActor(obj_id[] actors) throws InterruptedException
{
return null;
}
}