Commit 91d232d6 authored by KingRainbow44's avatar KingRainbow44
Browse files

Fix `Player` on this branch

parent eed59e0d
...@@ -120,7 +120,7 @@ public class Player { ...@@ -120,7 +120,7 @@ public class Player {
@Transient private MessageHandler messageHandler; @Transient private MessageHandler messageHandler;
@Transient private AbilityManager abilityManager; @Transient private AbilityManager abilityManager;
@Transient private QuestManager questManager; @Transient private QuestManager questManager;
@Transient private SotSManager sotsManager; @Transient private SotSManager sotsManager;
@Transient private InsectCaptureManager insectCaptureManager; @Transient private InsectCaptureManager insectCaptureManager;
...@@ -409,7 +409,7 @@ public class Player { ...@@ -409,7 +409,7 @@ public class Player {
public int getWorldLevel() { public int getWorldLevel() {
return this.getProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL); return this.getProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL);
} }
public void setWorldLevel(int level) { public void setWorldLevel(int level) {
this.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level); this.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level);
this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_WORLD_LEVEL)); this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_WORLD_LEVEL));
...@@ -432,7 +432,7 @@ public class Player { ...@@ -432,7 +432,7 @@ public class Player {
this.setProperty(PlayerProperty.PROP_PLAYER_SCOIN, mora); this.setProperty(PlayerProperty.PROP_PLAYER_SCOIN, mora);
this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_SCOIN)); this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_SCOIN));
} }
public int getCrystals() { public int getCrystals() {
return this.getProperty(PlayerProperty.PROP_PLAYER_MCOIN); return this.getProperty(PlayerProperty.PROP_PLAYER_MCOIN);
} }
...@@ -507,11 +507,11 @@ public class Player { ...@@ -507,11 +507,11 @@ public class Player {
public TeamManager getTeamManager() { public TeamManager getTeamManager() {
return this.teamManager; return this.teamManager;
} }
public TowerManager getTowerManager() { public TowerManager getTowerManager() {
return towerManager; return towerManager;
} }
public TowerData getTowerData() { public TowerData getTowerData() {
if(towerData==null){ if(towerData==null){
// because of mistake, null may be saved as storage at some machine, this if can be removed in future // because of mistake, null may be saved as storage at some machine, this if can be removed in future
...@@ -519,7 +519,7 @@ public class Player { ...@@ -519,7 +519,7 @@ public class Player {
} }
return towerData; return towerData;
} }
public QuestManager getQuestManager() { public QuestManager getQuestManager() {
return questManager; return questManager;
} }
...@@ -588,7 +588,7 @@ public class Player { ...@@ -588,7 +588,7 @@ public class Player {
public MpSettingType getMpSetting() { public MpSettingType getMpSetting() {
return MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; // TEMP return MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; // TEMP
} }
public Queue<AttackResult> getAttackResults() { public Queue<AttackResult> getAttackResults() {
return this.attackResults; return this.attackResults;
} }
...@@ -783,7 +783,7 @@ public class Player { ...@@ -783,7 +783,7 @@ public class Player {
remainCalendar.add(Calendar.DATE, moonCardDuration); remainCalendar.add(Calendar.DATE, moonCardDuration);
Date theLastDay = remainCalendar.getTime(); Date theLastDay = remainCalendar.getTime();
Date now = DateHelper.onlyYearMonthDay(new Date()); Date now = DateHelper.onlyYearMonthDay(new Date());
return (int) ((theLastDay.getTime() - now.getTime()) / (24 * 60 * 60 * 1000)); // By copilot return (int) ((theLastDay.getTime() - now.getTime()) / (24 * 60 * 60 * 1000)); // By copilot
} }
public void rechargeMoonCard() { public void rechargeMoonCard() {
...@@ -980,7 +980,7 @@ public class Player { ...@@ -980,7 +980,7 @@ public class Player {
} }
public Mail getMail(int index) { return this.getMailHandler().getMailById(index); } public Mail getMail(int index) { return this.getMailHandler().getMailById(index); }
public int getMailId(Mail message) { public int getMailId(Mail message) {
return this.getMailHandler().getMailIndex(message); return this.getMailHandler().getMailIndex(message);
} }
...@@ -988,9 +988,9 @@ public class Player { ...@@ -988,9 +988,9 @@ public class Player {
public boolean replaceMailByIndex(int index, Mail message) { public boolean replaceMailByIndex(int index, Mail message) {
return this.getMailHandler().replaceMailByIndex(index, message); return this.getMailHandler().replaceMailByIndex(index, message);
} }
public void interactWith(int gadgetEntityId, GadgetInteractReq req) {
public void interactWith(int gadgetEntityId, GadgetInteractReq opType) {
GameEntity entity = getScene().getEntityById(gadgetEntityId); GameEntity entity = getScene().getEntityById(gadgetEntityId);
if (entity == null) { if (entity == null) {
return; return;
...@@ -1018,13 +1018,13 @@ public class Player { ...@@ -1018,13 +1018,13 @@ public class Player {
} }
} }
} else if (entity instanceof EntityGadget gadget) { } else if (entity instanceof EntityGadget gadget) {
if (gadget.getContent() == null) { if (gadget.getContent() == null) {
return; return;
} }
boolean shouldDelete = gadget.getContent().onInteract(this, req); boolean shouldDelete = gadget.getContent().onInteract(this, opType);
if (shouldDelete) { if (shouldDelete) {
entity.getScene().removeEntity(entity); entity.getScene().removeEntity(entity);
} }
...@@ -1168,7 +1168,7 @@ public class Player { ...@@ -1168,7 +1168,7 @@ public class Player {
} }
return showAvatarInfoList; return showAvatarInfoList;
} }
public PlayerWorldLocationInfoOuterClass.PlayerWorldLocationInfo getWorldPlayerLocationInfo() { public PlayerWorldLocationInfoOuterClass.PlayerWorldLocationInfo getWorldPlayerLocationInfo() {
return PlayerWorldLocationInfoOuterClass.PlayerWorldLocationInfo.newBuilder() return PlayerWorldLocationInfoOuterClass.PlayerWorldLocationInfo.newBuilder()
.setSceneId(this.getSceneId()) .setSceneId(this.getSceneId())
...@@ -1211,7 +1211,7 @@ public class Player { ...@@ -1211,7 +1211,7 @@ public class Player {
public BattlePassManager getBattlePassManager(){ public BattlePassManager getBattlePassManager(){
return battlePassManager; return battlePassManager;
} }
public void loadBattlePassManager() { public void loadBattlePassManager() {
if (this.battlePassManager != null) return; if (this.battlePassManager != null) return;
this.battlePassManager = DatabaseHelper.loadBattlePass(this); this.battlePassManager = DatabaseHelper.loadBattlePass(this);
...@@ -1301,7 +1301,7 @@ public class Player { ...@@ -1301,7 +1301,7 @@ public class Player {
public void save() { public void save() {
DatabaseHelper.savePlayer(this); DatabaseHelper.savePlayer(this);
} }
// Called from tokenrsp // Called from tokenrsp
public void loadFromDatabase() { public void loadFromDatabase() {
// Make sure these exist // Make sure these exist
...@@ -1319,7 +1319,7 @@ public class Player { ...@@ -1319,7 +1319,7 @@ public class Player {
} }
//Make sure towerManager's player is online player //Make sure towerManager's player is online player
this.getTowerManager().setPlayer(this); this.getTowerManager().setPlayer(this);
// Load from db // Load from db
this.getAvatars().loadFromDatabase(); this.getAvatars().loadFromDatabase();
this.getInventory().loadFromDatabase(); this.getInventory().loadFromDatabase();
...@@ -1328,7 +1328,7 @@ public class Player { ...@@ -1328,7 +1328,7 @@ public class Player {
this.getFriendsList().loadFromDatabase(); this.getFriendsList().loadFromDatabase();
this.getMailHandler().loadFromDatabase(); this.getMailHandler().loadFromDatabase();
this.getQuestManager().loadFromDatabase(); this.getQuestManager().loadFromDatabase();
this.loadBattlePassManager(); this.loadBattlePassManager();
} }
...@@ -1341,12 +1341,12 @@ public class Player { ...@@ -1341,12 +1341,12 @@ public class Player {
quest.finish(); quest.finish();
} }
getQuestManager().addQuest(35101); getQuestManager().addQuest(35101);
this.setSceneId(3); this.setSceneId(3);
this.getPos().set(GameConstants.START_POSITION); this.getPos().set(GameConstants.START_POSITION);
} }
*/ */
// Create world // Create world
World world = new World(this); World world = new World(this);
world.addPlayer(this); world.addPlayer(this);
...@@ -1383,7 +1383,7 @@ public class Player { ...@@ -1383,7 +1383,7 @@ public class Player {
// First notify packets sent // First notify packets sent
this.setHasSentAvatarDataNotify(true); this.setHasSentAvatarDataNotify(true);
// Set session state // Set session state
session.setState(SessionState.ACTIVE); session.setState(SessionState.ACTIVE);
...@@ -1393,7 +1393,7 @@ public class Player { ...@@ -1393,7 +1393,7 @@ public class Player {
session.close(); session.close();
return; return;
} }
// register // register
getServer().registerPlayer(this); getServer().registerPlayer(this);
getProfile().setPlayer(this); // Set online getProfile().setPlayer(this); // Set online
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment