/******************************************************************************* * Copyright (c) 2013 * * This File is part of NGECore2. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. ******************************************************************************/ package resources.objects.player; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import resources.objects.waypoint.WaypointObject; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; import engine.clients.Client; import engine.resources.objects.DraftSchematic; import engine.resources.objects.Quest; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @Persistent public class PlayerObject extends SWGObject { // PLAY 3 private String title; private String profession; private List flagsList = new ArrayList(); private List profileList = new ArrayList(); private int bornDate = 0; private int totalPlayTime = 0; // PLAY 6 private String home; // Player City Name // PLAY 8 private Map xpList = new HashMap(); @NotPersistent private int xpListUpdateCounter = 0; private List waypoints = new ArrayList(); @NotPersistent private int waypointListUpdateCounter = 0; private int currentForcePower = 0; // unused in NGE private int maxForcePower = 0; // unused in NGE private List currentFSQuestList = new ArrayList(); // unused in NGE private List completedFSQuestList = new ArrayList(); // unused in NGE private List questJournal = new ArrayList(); @NotPersistent private int questJournalUpdateCounter = 0; private String professionWheelPosition; // PLAY 9 private int experimentationFlag = 0; private int craftingStage = 0; private long nearestCraftingStation = 0; private List draftSchematicList = new ArrayList(); @NotPersistent private int draftSchematicListUpdateCounter = 0; private int experimentationPoints = 0; private int accomplishmentCounter = 0; private List friendList = new ArrayList(); @NotPersistent private int friendListUpdateCounter = 0; private List ignoreList = new ArrayList(); @NotPersistent private int ignoreListUpdateCounter = 0; private int languageId = 0; // unused in NGE private int currentStomach = 0; // unused in NGE private int maxStomach = 0; // unused in NGE private int currentDrink = 0; // unused in NGE private int maxDrink = 0; // unused in NGE private int currentConsumable = 0; // unused private int maxConsumable = 0; // unused // TODO: research new NGE vars between maxConsumable and jediState private int jediState = 0; // unused in NGE @NotPersistent private PlayerMessageBuilder messageBuilder; public PlayerObject() { super(); messageBuilder = new PlayerMessageBuilder(this); } public PlayerObject(long objectID, Planet planet) { super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), "object/player/shared_player.iff"); messageBuilder = new PlayerMessageBuilder(this); } public String getTitle() { synchronized(objectMutex) { return title; } } public void setTitle(String title) { synchronized(objectMutex) { this.title = title; } } public String getProfession() { synchronized(objectMutex) { return profession; } } public void setProfession(String profession) { synchronized(objectMutex) { this.profession = profession; } } public List getFlagsList() { return flagsList; } public List getProfileList() { return profileList; } public int getBornDate() { synchronized(objectMutex) { return bornDate; } } public void setBornDate(int bornDate) { synchronized(objectMutex) { this.bornDate = bornDate; } } public int getTotalPlayTime() { synchronized(objectMutex) { return totalPlayTime; } } public void setTotalPlayTime(int totalPlayTime) { synchronized(objectMutex) { this.totalPlayTime = totalPlayTime; } } public String getHome() { synchronized(objectMutex) { return home; } } public void setHome(String home) { synchronized(objectMutex) { this.home = home; } } public Map getXpList() { return xpList; } public List getWaypoints() { return waypoints; } public int getCurrentForcePower() { synchronized(objectMutex) { return currentForcePower; } } public void setCurrentForcePower(int currentForcePower) { synchronized(objectMutex) { this.currentForcePower = currentForcePower; } } public int getMaxForcePower() { synchronized(objectMutex) { return maxForcePower; } } public void setMaxForcePower(int maxForcePower) { synchronized(objectMutex) { this.maxForcePower = maxForcePower; } } public List getCurrentFSQuestList() { return currentFSQuestList; } public List getCompletedFSQuestList() { return completedFSQuestList; } public List getQuestJournal() { return questJournal; } public String getProfessionWheelPosition() { synchronized(objectMutex) { return professionWheelPosition; } } public void setProfessionWheelPosition(String professionWheelPosition) { synchronized(objectMutex) { this.professionWheelPosition = professionWheelPosition; } } public int getExperimentationFlag() { synchronized(objectMutex) { return experimentationFlag; } } public void setExperimentationFlag(int experimentationFlag) { synchronized(objectMutex) { this.experimentationFlag = experimentationFlag; } } public int getCraftingStage() { synchronized(objectMutex) { return craftingStage; } } public void setCraftingStage(int craftingStage) { synchronized(objectMutex) { this.craftingStage = craftingStage; } } public long getNearestCraftingStation() { synchronized(objectMutex) { return nearestCraftingStation; } } public void setNearestCraftingStation(long nearestCraftingStation) { synchronized(objectMutex) { this.nearestCraftingStation = nearestCraftingStation; } } public List getDraftSchematicList() { return draftSchematicList; } public int getExperimentationPoints() { synchronized(objectMutex) { return experimentationPoints; } } public void setExperimentationPoints(int experimentationPoints) { synchronized(objectMutex) { this.experimentationPoints = experimentationPoints; } } public int getAccomplishmentCounter() { synchronized(objectMutex) { return accomplishmentCounter; } } public void setAccomplishmentCounter(int accomplishmentCounter) { synchronized(objectMutex) { this.accomplishmentCounter = accomplishmentCounter; } } public List getFriendList() { return friendList; } public int getFriendListUpdateCounter() { synchronized(objectMutex) { return friendListUpdateCounter; } } public void setFriendListUpdateCounter(int friendListUpdateCounter) { synchronized(objectMutex) { this.friendListUpdateCounter = friendListUpdateCounter; } } public List getIgnoreList() { return ignoreList; } public int getIgnoreListUpdateCounter() { synchronized(objectMutex) { return ignoreListUpdateCounter; } } public void setIgnoreListUpdateCounter(int ignoreListUpdateCounter) { synchronized(objectMutex) { this.ignoreListUpdateCounter = ignoreListUpdateCounter; } } public int getLanguageId() { synchronized(objectMutex) { return languageId; } } public void setLanguageId(int languageId) { synchronized(objectMutex) { this.languageId = languageId; } } public int getCurrentStomach() { synchronized(objectMutex) { return currentStomach; } } public void setCurrentStomach(int currentStomach) { synchronized(objectMutex) { this.currentStomach = currentStomach; } } public int getMaxStomach() { synchronized(objectMutex) { return maxStomach; } } public void setMaxStomach(int maxStomach) { synchronized(objectMutex) { this.maxStomach = maxStomach; } } public int getCurrentDrink() { synchronized(objectMutex) { return currentDrink; } } public void setCurrentDrink(int currentDrink) { synchronized(objectMutex) { this.currentDrink = currentDrink; } } public int getMaxDrink() { synchronized(objectMutex) { return maxDrink; } } public void setMaxDrink(int maxDrink) { synchronized(objectMutex) { this.maxDrink = maxDrink; } } public int getCurrentConsumable() { synchronized(objectMutex) { return currentConsumable; } } public void setCurrentConsumable(int currentConsumable) { synchronized(objectMutex) { this.currentConsumable = currentConsumable; } } public int getMaxConsumable() { synchronized(objectMutex) { return maxConsumable; } } public void setMaxConsumable(int maxConsumable) { synchronized(objectMutex) { this.maxConsumable = maxConsumable; } } public int getJediState() { synchronized(objectMutex) { return jediState; } } public void setJediState(int jediState) { synchronized(objectMutex) { this.jediState = jediState; } } @Override public void sendBaselines(Client destination) { if(destination == null || destination.getSession() == null) return; if(destination.getParent().getObjectID() == getParentId()) { // only send to self destination.getSession().write(messageBuilder.buildBaseline3()); destination.getSession().write(messageBuilder.buildBaseline6()); destination.getSession().write(messageBuilder.buildBaseline8()); destination.getSession().write(messageBuilder.buildBaseline9()); } } }