woodcutting: create maple timer for miscellania region

This commit is contained in:
Alexsuperfly
2019-12-29 14:06:51 -05:00
committed by Adam
parent 9508934074
commit 9f86c9f128
2 changed files with 17 additions and 2 deletions

View File

@@ -60,7 +60,14 @@ enum Tree
REGULAR_TREE(null, TREE, TREE_1277, TREE_1278, TREE_1279, TREE_1280),
OAK_TREE(Duration.ofMillis(8500), ObjectID.OAK_TREE, OAK_TREE_4540, OAK_10820),
WILLOW_TREE(Duration.ofMillis(8500), WILLOW, WILLOW_10829, WILLOW_10831, WILLOW_10833),
MAPLE_TREE(Duration.ofSeconds(35), ObjectID.MAPLE_TREE, MAPLE_TREE_10832, MAPLE_TREE_36681),
MAPLE_TREE(Duration.ofSeconds(35), ObjectID.MAPLE_TREE, MAPLE_TREE_10832, MAPLE_TREE_36681)
{
@Override
Duration getRespawnTime(int region)
{
return region == MISCELLANIA_REGION ? Duration.ofMillis(8500) : super.respawnTime;
}
},
TEAK_TREE(Duration.ofMillis(8500), TEAK, TEAK_36686),
MAHOGANY_TREE(Duration.ofMillis(8500), MAHOGANY, MAHOGANY_36688),
YEW_TREE(Duration.ofMinutes(1), YEW, NULL_10823, YEW_36683),
@@ -77,6 +84,7 @@ enum Tree
this.treeIds = treeIds;
}
private static final int MISCELLANIA_REGION = 10044;
private static final Map<Integer, Tree> TREES;
static
@@ -94,6 +102,11 @@ enum Tree
TREES = builder.build();
}
Duration getRespawnTime(int region)
{
return respawnTime;
}
static Tree findTree(int objectId)
{
return TREES.get(objectId);

View File

@@ -213,7 +213,9 @@ public class WoodcuttingPlugin extends Plugin
int lenX = max.getX() - min.getX();
int lenY = max.getY() - min.getY();
log.debug("Adding respawn timer for {} tree at {}", tree, object.getLocalLocation());
TreeRespawn treeRespawn = new TreeRespawn(tree, lenX, lenY, WorldPoint.fromScene(client, min.getX(), min.getY(), client.getPlane()), Instant.now(), (int) tree.getRespawnTime().toMillis());
final int region = client.getLocalPlayer().getWorldLocation().getRegionID();
TreeRespawn treeRespawn = new TreeRespawn(tree, lenX, lenY, WorldPoint.fromScene(client, min.getX(), min.getY(), client.getPlane()), Instant.now(), (int) tree.getRespawnTime(region).toMillis());
respawns.add(treeRespawn);
}