Big World Resources Collection Implement (#1368)

* init

* init

* init

* revoke

* fix error

* mining support

* mining support

* Roks endurance support

* Roks endurance support

* Timed refresh

* upgrade resource data

* Timed refresh support

* remove null gadget

* Coordination

* full synchronized

* oh no, my math teacher will hit me!

* synchronized onInteract

* remove break;

* supply re-spawn time , thanks to @wl23333

* Clean up and integrate collection spawns into SpawnDataEntries

Co-authored-by: Melledy <52122272+Melledy@users.noreply.github.com>
This commit is contained in:
zhaodice
2022-06-29 19:53:50 +08:00
committed by GitHub
parent 17fb19ebc9
commit 2462da2ede
19 changed files with 507 additions and 72 deletions

View File

@@ -32,6 +32,8 @@ import emu.grasscutter.game.mail.MailHandler;
import emu.grasscutter.game.managers.FurnitureManager;
import emu.grasscutter.game.managers.InsectCaptureManager;
import emu.grasscutter.game.managers.ResinManager;
import emu.grasscutter.game.managers.collection.CollectionManager;
import emu.grasscutter.game.managers.collection.CollectionRecordStore;
import emu.grasscutter.game.managers.deforestation.DeforestationManager;
import emu.grasscutter.game.managers.energy.EnergyManager;
import emu.grasscutter.game.managers.forging.ActiveForgeData;
@@ -42,7 +44,6 @@ import emu.grasscutter.game.managers.SotSManager;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.game.props.ClimateType;
import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.game.props.WatcherTriggerType;
import emu.grasscutter.game.quest.QuestManager;
import emu.grasscutter.game.shop.ShopLimit;
@@ -62,7 +63,7 @@ import emu.grasscutter.net.proto.OnlinePlayerInfoOuterClass.OnlinePlayerInfo;
import emu.grasscutter.net.proto.PlayerLocationInfoOuterClass.PlayerLocationInfo;
import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture;
import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail;
import emu.grasscutter.net.proto.VisionTypeOuterClass.VisionType;
import emu.grasscutter.server.event.player.PlayerJoinEvent;
import emu.grasscutter.server.event.player.PlayerQuitEvent;
import emu.grasscutter.server.game.GameServer;
@@ -183,6 +184,9 @@ public class Player {
@Transient private FurnitureManager furnitureManager;
@Transient private BattlePassManager battlePassManager;
@Transient private CollectionManager collectionManager;
private CollectionRecordStore collectionRecordStore;
private long springLastUsed;
private HashMap<String, MapMark> mapMarks;
private int nextResinRefresh;
@@ -216,6 +220,7 @@ public class Player {
this.flyCloakList = new HashSet<>();
this.costumeList = new HashSet<>();
this.towerData = new TowerData();
this.collectionRecordStore = new CollectionRecordStore();
this.unlockedForgingBlueprints = new HashSet<>();
this.unlockedCombines = new HashSet<>();
this.unlockedFurniture = new HashSet<>();
@@ -1098,7 +1103,6 @@ public class Player {
}
}
} else if (entity instanceof EntityGadget gadget) {
if (gadget.getContent() == null) {
return;
}
@@ -1106,7 +1110,7 @@ public class Player {
boolean shouldDelete = gadget.getContent().onInteract(this, opType);
if (shouldDelete) {
entity.getScene().removeEntity(entity);
entity.getScene().removeEntity(entity, VisionType.VISION_TYPE_REMOVE);
}
} else if (entity instanceof EntityMonster monster) {
insectCaptureManager.arrestSmallCreature(monster);
@@ -1306,6 +1310,20 @@ public class Player {
return deforestationManager;
}
public CollectionManager getCollectionManager() {
if(this.collectionManager==null){
this.collectionManager = new CollectionManager();
}
return this.collectionManager;
}
public CollectionRecordStore getCollectionRecordStore() {
if(this.collectionRecordStore==null){
this.collectionRecordStore = new CollectionRecordStore();
}
return collectionRecordStore;
}
public HashMap<String, MapMark> getMapMarks() { return mapMarks; }
public void setMapMarks(HashMap<String, MapMark> newMarks) { mapMarks = newMarks; }
@@ -1432,6 +1450,7 @@ public class Player {
}
//Make sure towerManager's player is online player
this.getTowerManager().setPlayer(this);
this.getCollectionManager().setPlayer(this);
// Load from db
this.getAvatars().loadFromDatabase();
@@ -1485,7 +1504,6 @@ public class Player {
session.send(new PacketCombineDataNotify(this.unlockedCombines));
this.forgingManager.sendForgeDataNotify();
this.resinManager.onPlayerLogin();
getTodayMoonCard(); // The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward.
// Battle Pass trigger