Skip to content

Commit 97ea94a

Browse files
committed
DigToGround: removed obsolete inventory checks, dredge to boat
Dredging to boat works if the boat has enough free volume. Otherwise the dreged items will flow to the ground.
1 parent 36674cb commit 97ea94a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/demo/digtoground/org/gotti/wurmunlimited/mods/digtoground/DigToGround.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,26 @@ public void preInit() {
3636
@Override
3737
public void edit(MethodCall m) throws CannotCompileException {
3838
if ("com.wurmonline.server.items.Item".equals(m.getClassName()) && m.getMethodName().equals("insertItem")) {
39-
m.replace("{ created.putItemInfrontof(performer); $_ = true; }");
39+
StringBuffer buffer = new StringBuffer();
40+
buffer.append("{");
41+
buffer.append(" com.wurmonline.server.items.Item v = dredging && performer.getVehicle() != -10 ? com.wurmonline.server.Items.getItem(performer.getVehicle()) : null;");
42+
buffer.append(" if (v != null && v.isHollow() && v.getNumItemsNotCoins() < 100 && v.getFreeVolume() >= created.getVolume()) {");
43+
buffer.append(" v.insertItem(created, true);");
44+
buffer.append(" } else if (v != null && v.isHollow()) {");
45+
buffer.append(" created.putItemInfrontof(performer);");
46+
buffer.append(" performer.getCommunicator().sendNormalServerMessage(\"The \" + v.getName() + \" is full and the \" + created.getName() + \" flows to the ground.\");");
47+
buffer.append(" } else {");
48+
buffer.append(" created.putItemInfrontof(performer);");
49+
buffer.append(" }");
50+
buffer.append(" $_ = true;");
51+
buffer.append("}");
52+
m.replace(buffer.toString());
53+
} else if ("com.wurmonline.server.items.Item".equals(m.getClassName()) && m.getMethodName().equals("getNumItemsNotCoins")) {
54+
m.replace("$_ = 0;");
55+
} else if ("com.wurmonline.server.creatures.Creature".equals(m.getClassName()) && m.getMethodName().equals("canCarry")) {
56+
m.replace("$_ = true;");
57+
} else if ("com.wurmonline.server.items.Item".equals(m.getClassName()) && m.getMethodName().equals("getFreeVolume")) {
58+
m.replace("$_ = 1000;");
4059
}
4160
}
4261
});

0 commit comments

Comments
 (0)