RuneHive-Game
Loading...
Searching...
No Matches
PlaceBirdhouse.java
Go to the documentation of this file.
1package com.runehive.content.skill.impl.hunter.birdhouse.action;
2
3import com.runehive.content.skill.impl.hunter.birdhouse.BirdhouseData;
4import com.runehive.content.skill.impl.hunter.birdhouse.PlayerBirdHouseData;
5import com.runehive.game.action.Action;
6import com.runehive.game.action.policy.WalkablePolicy;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.game.world.entity.mob.player.persist.PlayerSerializer;
9import com.runehive.game.world.items.Item;
10import com.runehive.game.world.object.CustomGameObject;
11import com.runehive.game.world.object.GameObject;
12import com.runehive.net.packet.out.SendAddObject;
13
14public class PlaceBirdhouse extends Action<Player> {
15
19 super(player, 1);
20 this.birdhouseData = birdhouseData;
21 this.gameObject = gameObject;
22 }
23
24 @Override
28
29 @Override
30 public String getName() {
31 return "Place birdhouse";
32 }
33
34 @Override
35 protected void execute() {
36 getMob().inventory.remove(new Item(birdhouseData.birdHouseId));
37 getMob().inventory.refresh();
38 getMob().birdHouseData.add(new PlayerBirdHouseData(birdhouseData, gameObject.getId(), gameObject.getPosition(), gameObject.getDirection().getId(), gameObject.getObjectType().getId()));
39 getMob().send(new SendAddObject(new CustomGameObject(birdhouseData.objectData[0], gameObject.getPosition(), gameObject.getDirection(), gameObject.getObjectType())));
41 getMob().action.getCurrentAction().cancel();
42 }
43
44}
void execute()
A function representing the unit of work that will be carried out.
PlaceBirdhouse(Player player, BirdhouseData birdhouseData, GameObject gameObject)
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
T getMob()
Gets the player.
Definition Action.java:44
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21
Represents a static game object loaded from the map fs.
A queue policy determines whether the action can occur while walking.
WALKABLE
This indicates actions may occur while walking.