Hunting and deforestation support. (#1083)

* add drops for animals wild pig,fishes,foxes,birds

* append fox

* Deforestation Support

implement drop woods when attacking tree

* Deforestation support (remove prints)

implement drop woods when attacking tree

* Deforestation support (remove prints)

implement drop woods when attacking tree

* add AutoRecycleHashMap

Map's KEY is automatic expire if key long time no use (query or modify from HashMap)

* use AutoRecycleHashMap in case of memory leak

* fix bug

* remove prints

* static AutoRecycleHashMap

* fix problems

* Delete AutoRecycleHashMap.java

* remove log

* fix build

* improve

* remove unnecessary information

Co-authored-by: Albedo <105265570+arub3do@users.noreply.github.com>

Co-authored-by: Albedo <105265570+arub3do@users.noreply.github.com>
This commit is contained in:
zhaodice
2022-05-29 21:16:49 +08:00
committed by GitHub
parent 830ac793fe
commit a95002fd40
5 changed files with 221 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ import emu.grasscutter.game.ability.AbilityManager;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.avatar.AvatarProfileData;
import emu.grasscutter.game.avatar.AvatarStorage;
import emu.grasscutter.game.managers.DeforestationManager.DeforestationManager;
import emu.grasscutter.game.entity.EntityGadget;
import emu.grasscutter.game.entity.EntityItem;
import emu.grasscutter.game.entity.GameEntity;
@@ -145,11 +146,11 @@ public class Player {
@Transient private MapMarksManager mapMarksManager;
@Transient private StaminaManager staminaManager;
@Transient private EnergyManager energyManager;
@Transient private DeforestationManager deforestationManager;
private long springLastUsed;
private HashMap<String, MapMark> mapMarks;
@Deprecated
@SuppressWarnings({"rawtypes", "unchecked"}) // Morphia only!
public Player() {
@@ -159,6 +160,8 @@ public class Player {
this.mailHandler = new MailHandler(this);
this.towerManager = new TowerManager(this);
this.abilityManager = new AbilityManager(this);
this.deforestationManager = new DeforestationManager(this);
this.setQuestManager(new QuestManager(this));
this.pos = new Position();
this.rotation = new Position();
@@ -227,6 +230,7 @@ public class Player {
this.staminaManager = new StaminaManager(this);
this.sotsManager = new SotSManager(this);
this.energyManager = new EnergyManager(this);
this.deforestationManager = new DeforestationManager(this);
}
public int getUid() {
@@ -923,7 +927,6 @@ public class Player {
// Add to inventory
boolean success = getInventory().addItem(item, ActionReason.SubfieldDrop);
if (success) {
if (!drop.isShare()) // not shared drop
this.sendPacket(new PacketGadgetInteractRsp(drop, InteractType.INTERACT_PICK_ITEM));
else
@@ -1109,6 +1112,10 @@ public class Player {
return abilityManager;
}
public DeforestationManager getDeforestationManager() {
return deforestationManager;
}
public HashMap<String, MapMark> getMapMarks() { return mapMarks; }
public void setMapMarks(HashMap<String, MapMark> newMarks) { mapMarks = newMarks; }
@@ -1294,6 +1301,9 @@ public class Player {
// Call quit event.
PlayerQuitEvent event = new PlayerQuitEvent(this); event.call();
//reset wood
getDeforestationManager().resetWood();
}
public enum SceneLoadState {