Java overhaul continued...

This commit is contained in:
Cekis
2016-04-03 19:09:23 +01:00
parent c75d0f05b0
commit 2188b04099
2 changed files with 17 additions and 45 deletions
+12 -33
View File
@@ -1,14 +1,8 @@
package script.data_item;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.loot;
import script.obj_id;
import script.string_id;
public class dropoff extends script.item.container.add_only
{
@@ -18,44 +12,29 @@ public class dropoff extends script.item.container.add_only
public static final string_id SID_DATA_ONLY = new string_id("error_message", "data_only");
public int OnAboutToReceiveItem(obj_id self, obj_id srcContainer, obj_id transferer, obj_id item) throws InterruptedException
{
if (isPlayer(transferer))
{
if (!loot.isFactionalDataItem(item))
{
sendSystemMessage(transferer, SID_DATA_ONLY);
return SCRIPT_OVERRIDE;
}
if (isPlayer(transferer) && !loot.isFactionalDataItem(item)){
sendSystemMessage(transferer, SID_DATA_ONLY);
return SCRIPT_OVERRIDE;
}
return SCRIPT_CONTINUE;
}
public int OnReceivedItem(obj_id self, obj_id srcContainer, obj_id transferer, obj_id item) throws InterruptedException
{
if (isPlayer(transferer))
{
if (loot.isFactionalDataItem(item))
if (isPlayer(transferer) && loot.isFactionalDataItem(item)){
if (!loot.redeemFactionCoupon(getContainedBy(self), transferer, item))
{
if (!loot.redeemFactionCoupon(getContainedBy(self), transferer, item))
{
debugSpeakMsg(transferer, "redeem failed: returning coupon to source container!");
putIn(item, srcContainer);
}
return SCRIPT_CONTINUE;
debugSpeakMsg(transferer, "redeem failed: returning coupon to source container!");
putIn(item, srcContainer);
}
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
public int OnClosedContainer(obj_id self, obj_id who) throws InterruptedException
{
obj_id[] contents = getContents(self);
if ((contents == null) || (contents.length == 0))
{
}
else
{
for (int i = 0; i < contents.length; i++)
{
destroyObject(contents[i]);
}
for (obj_id content : contents) {
destroyObject(content);
}
return SCRIPT_CONTINUE;
}